* qatar/master: lavf: bump minor and add an APIChanges entry for avformat cleanup lavf: get rid of ffm-specific stuff in avformat.h Not pulled: avio: deprecate av_protocol_next(). avio: add a function for iterating though protocol names. lavf: rename a parameter of av_sdp_create from buff->buf lavf: rename avf_sdp_create to av_sdp_create. lavf: make av_guess_image2_codec internal avio: make URLProtocol internal. avio: make URLContext internal. lavf: mark av_pkt_dump(_log) for remove on $next+1 bump. lavf: use designated initializers for all protocols applehttp: don't use deprecated url_ functions. avio: move two ff_udp_* functions from avio_internal to url.h asfdec: remove a forgotten declaration of nonexistent function avio: deprecate the typedef for URLInterruptCB
Unified · Split
| @@ -12,6 +12,11 @@ libavutil: 2009-03-08 · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | API changes, most recent first: | 13 | API changes, most recent first: |
| 14 | 14 | ||
| 15 | 2011-04-08 - lavf 52.106.0 - avformat.h | ||
| 16 | Minor avformat.h cleanup: | ||
| 17 | a9bf9d8 deprecate av_guess_image2_codec | ||
| 18 | c3675df rename avf_sdp_create->av_sdp_create | ||
| 19 | |||
| 15 | 2011-04-03 - lavf 52.105.0 - avio.h | 20 | 2011-04-03 - lavf 52.105.0 - avio.h |
| 16 | Large-scale renaming/deprecating of AVIOContext-related functions: | 21 | Large-scale renaming/deprecating of AVIOContext-related functions: |
| 17 | 724f6a0 deprecate url_fdopen | 22 | 724f6a0 deprecate url_fdopen |
| @@ -47,6 +47,8 @@ · 46 unmodified lines | |||
| 47 | #include "libavutil/libm.h" | 47 | #include "libavutil/libm.h" |
| 48 | #include "libavformat/os_support.h" | 48 | #include "libavformat/os_support.h" |
| 49 | 49 | ||
| 50 | #include "libavformat/ffm.h" // not public API | ||
| 51 | |||
| 50 | #if CONFIG_AVFILTER | 52 | #if CONFIG_AVFILTER |
| 51 | # include "libavfilter/avfilter.h" | 53 | # include "libavfilter/avfilter.h" |
| 52 | # include "libavfilter/avfiltergraph.h" | 54 | # include "libavfilter/avfiltergraph.h" |
| @@ -1881,7 +1883,7 @@ static void print_sdp(AVFormatContext **avc, int n) · 1828 unmodified lines | |||
| 1881 | { | 1883 | { |
| 1882 | char sdp[2048]; | 1884 | char sdp[2048]; |
| 1883 | 1885 | ||
| 1884 | avf_sdp_create(avc, n, sdp, sizeof(sdp)); | 1886 | av_sdp_create(avc, n, sdp, sizeof(sdp)); |
| 1885 | printf("SDP:\n%s\n", sdp); | 1887 | printf("SDP:\n%s\n", sdp); |
| 1886 | fflush(stdout); | 1888 | fflush(stdout); |
| 1887 | } | 1889 | } |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include <strings.h> | 29 | #include <strings.h> |
| 30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
| 31 | #include "libavformat/avformat.h" | 31 | #include "libavformat/avformat.h" |
| 32 | #include "libavformat/ffm.h" | ||
| 32 | #include "libavformat/network.h" | 33 | #include "libavformat/network.h" |
| 33 | #include "libavformat/os_support.h" | 34 | #include "libavformat/os_support.h" |
| 34 | #include "libavformat/rtpdec.h" | 35 | #include "libavformat/rtpdec.h" |
| @@ -2957,7 +2958,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, · 2922 unmodified lines | |||
| 2957 | avc->streams[i]->codec = stream->streams[i]->codec; | 2958 | avc->streams[i]->codec = stream->streams[i]->codec; |
| 2958 | } | 2959 | } |
| 2959 | *pbuffer = av_mallocz(2048); | 2960 | *pbuffer = av_mallocz(2048); |
| 2960 | avf_sdp_create(&avc, 1, *pbuffer, 2048); | 2961 | av_sdp_create(&avc, 1, *pbuffer, 2048); |
| 2961 | 2962 | ||
| 2962 | sdp_done: | 2963 | sdp_done: |
| 2963 | #if !FF_API_MAX_STREAMS | 2964 | #if !FF_API_MAX_STREAMS |
| @@ -113,7 +113,7 @@ static void free_variant_list(AppleHTTPContext *c) · 112 unmodified lines | |||
| 113 | av_free_packet(&var->pkt); | 113 | av_free_packet(&var->pkt); |
| 114 | av_free(var->pb.buffer); | 114 | av_free(var->pb.buffer); |
| 115 | if (var->input) | 115 | if (var->input) |
| 116 | url_close(var->input); | 116 | ffurl_close(var->input); |
| 117 | if (var->ctx) { | 117 | if (var->ctx) { |
| 118 | var->ctx->pb = NULL; | 118 | var->ctx->pb = NULL; |
| 119 | av_close_input_file(var->ctx); | 119 | av_close_input_file(var->ctx); |
| @@ -291,18 +291,18 @@ reload: · 171 unmodified lines | |||
| 291 | goto reload; | 291 | goto reload; |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | ret = url_open(&v->input, | 294 | ret = ffurl_open(&v->input, |
| 295 | v->segments[v->cur_seq_no - v->start_seq_no]->url, | 295 | v->segments[v->cur_seq_no - v->start_seq_no]->url, |
| 296 | AVIO_RDONLY); | 296 | AVIO_RDONLY); |
| 297 | if (ret < 0) | 297 | if (ret < 0) |
| 298 | return ret; | 298 | return ret; |
| 299 | } | 299 | } |
| 300 | ret = url_read(v->input, buf, buf_size); | 300 | ret = ffurl_read(v->input, buf, buf_size); |
| 301 | if (ret > 0) | 301 | if (ret > 0) |
| 302 | return ret; | 302 | return ret; |
| 303 | if (ret < 0 && ret != AVERROR_EOF) | 303 | if (ret < 0 && ret != AVERROR_EOF) |
| 304 | return ret; | 304 | return ret; |
| 305 | url_close(v->input); | 305 | ffurl_close(v->input); |
| 306 | v->input = NULL; | 306 | v->input = NULL; |
| 307 | v->cur_seq_no++; | 307 | v->cur_seq_no++; |
| 308 | 308 | ||
| @@ -435,7 +435,7 @@ static int recheck_discard_flags(AVFormatContext *s, int first) · 126 unmodified lines | |||
| 435 | av_log(s, AV_LOG_INFO, "Now receiving variant %d\n", i); | 435 | av_log(s, AV_LOG_INFO, "Now receiving variant %d\n", i); |
| 436 | } else if (first && !v->cur_needed && v->needed) { | 436 | } else if (first && !v->cur_needed && v->needed) { |
| 437 | if (v->input) | 437 | if (v->input) |
| 438 | url_close(v->input); | 438 | ffurl_close(v->input); |
| 439 | v->input = NULL; | 439 | v->input = NULL; |
| 440 | v->needed = 0; | 440 | v->needed = 0; |
| 441 | changed = 1; | 441 | changed = 1; |
| @@ -517,7 +517,7 @@ static int applehttp_read_seek(AVFormatContext *s, int stream_index, · 75 unmodified lines | |||
| 517 | struct variant *var = c->variants[i]; | 517 | struct variant *var = c->variants[i]; |
| 518 | int64_t pos = 0; | 518 | int64_t pos = 0; |
| 519 | if (var->input) { | 519 | if (var->input) { |
| 520 | url_close(var->input); | 520 | ffurl_close(var->input); |
| 521 | var->input = NULL; | 521 | var->input = NULL; |
| 522 | } | 522 | } |
| 523 | av_free_packet(&var->pkt); | 523 | av_free_packet(&var->pkt); |
| @@ -298,11 +298,9 @@ static int applehttp_close(URLContext *h) · 297 unmodified lines | |||
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | URLProtocol ff_applehttp_protocol = { | 300 | URLProtocol ff_applehttp_protocol = { |
| 301 | "applehttp", | 301 | .name = "applehttp", |
| 302 | applehttp_open, | 302 | .url_open = applehttp_open, |
| 303 | applehttp_read, | 303 | .url_read = applehttp_read, |
| 304 | NULL, /* write */ | 304 | .url_close = applehttp_close, |
| 305 | NULL, /* seek */ | 305 | .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, |
| 306 | applehttp_close, | ||
| 307 | .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, | ||
| 308 | }; | 306 | }; |
| @@ -31,8 +31,6 @@ · 30 unmodified lines | |||
| 31 | #include "asfcrypt.h" | 31 | #include "asfcrypt.h" |
| 32 | #include "avlanguage.h" | 32 | #include "avlanguage.h" |
| 33 | 33 | ||
| 34 | void ff_mms_set_stream_selection(URLContext *h, AVFormatContext *format); | ||
| 35 | |||
| 36 | typedef struct { | 34 | typedef struct { |
| 37 | int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID | 35 | int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID |
| 38 | ASFStream streams[128]; ///< it's max number and it's not that big | 36 | ASFStream streams[128]; ///< it's max number and it's not that big |
| @@ -907,7 +907,9 @@ AVInputFormat *av_iformat_next(AVInputFormat *f); · 906 unmodified lines | |||
| 907 | */ | 907 | */ |
| 908 | AVOutputFormat *av_oformat_next(AVOutputFormat *f); | 908 | AVOutputFormat *av_oformat_next(AVOutputFormat *f); |
| 909 | 909 | ||
| 910 | enum CodecID av_guess_image2_codec(const char *filename); | 910 | #if FF_API_GUESS_IMG2_CODEC |
| 911 | attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename); | ||
| 912 | #endif | ||
| 911 | 913 | ||
| 912 | /* XXX: Use automatic init with either ELF sections or C file parser */ | 914 | /* XXX: Use automatic init with either ELF sections or C file parser */ |
| 913 | /* modules. */ | 915 | /* modules. */ |
| @@ -986,7 +988,6 @@ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); · 72 unmodified lines | |||
| 986 | */ | 988 | */ |
| 987 | void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); | 989 | void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); |
| 988 | 990 | ||
| 989 | attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); | ||
| 990 | 991 | ||
| 991 | /** | 992 | /** |
| 992 | * Send a nice dump of a packet to the log. | 993 | * Send a nice dump of a packet to the log. |
| @@ -1002,7 +1003,10 @@ attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); · 9 unmodified lines | |||
| 1002 | void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, | 1003 | void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, |
| 1003 | AVStream *st); | 1004 | AVStream *st); |
| 1004 | 1005 | ||
| 1006 | #if FF_API_PKT_DUMP | ||
| 1007 | attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); | ||
| 1005 | attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, | 1008 | attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, |
| 1009 | #endif | ||
| 1006 | int dump_payload); | 1010 | int dump_payload); |
| 1007 | 1011 | ||
| 1008 | /** | 1012 | /** |
| @@ -1521,12 +1525,6 @@ int64_t parse_date(const char *datestr, int duration); · 512 unmodified lines | |||
| 1521 | */ | 1525 | */ |
| 1522 | int64_t av_gettime(void); | 1526 | int64_t av_gettime(void); |
| 1523 | 1527 | ||
| 1524 | /* ffm-specific for ffserver */ | ||
| 1525 | #define FFM_PACKET_SIZE 4096 | ||
| 1526 | int64_t ffm_read_write_index(int fd); | ||
| 1527 | int ffm_write_write_index(int fd, int64_t pos); | ||
| 1528 | void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size); | ||
| 1529 | |||
| 1530 | #if FF_API_FIND_INFO_TAG | 1528 | #if FF_API_FIND_INFO_TAG |
| 1531 | /** | 1529 | /** |
| 1532 | * @deprecated use av_find_info_tag in libavutil instead. | 1530 | * @deprecated use av_find_info_tag in libavutil instead. |
| @@ -1566,12 +1564,16 @@ int av_filename_number_test(const char *filename); · 33 unmodified lines | |||
| 1566 | * all the contexts in the array (an AVCodecContext per RTP stream) | 1564 | * all the contexts in the array (an AVCodecContext per RTP stream) |
| 1567 | * must contain only one AVStream. | 1565 | * must contain only one AVStream. |
| 1568 | * @param n_files number of AVCodecContexts contained in ac | 1566 | * @param n_files number of AVCodecContexts contained in ac |
| 1569 | * @param buff buffer where the SDP will be stored (must be allocated by | 1567 | * @param buf buffer where the SDP will be stored (must be allocated by |
| 1570 | * the caller) | 1568 | * the caller) |
| 1571 | * @param size the size of the buffer | 1569 | * @param size the size of the buffer |
| 1572 | * @return 0 if OK, AVERROR_xxx on error | 1570 | * @return 0 if OK, AVERROR_xxx on error |
| 1573 | */ | 1571 | */ |
| 1574 | int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); | 1572 | int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size); |
| 1573 | |||
| 1574 | #if FF_API_SDP_CREATE | ||
| 1575 | attribute_deprecated int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); | ||
| 1576 | #endif | ||
| 1575 | 1577 | ||
| 1576 | /** | 1578 | /** |
| 1577 | * Return a positive value if the given filename has one of the given | 1579 | * Return a positive value if the given filename has one of the given |
| @@ -49,7 +49,7 @@ static const AVClass urlcontext_class = · 48 unmodified lines | |||
| 49 | static int default_interrupt_cb(void); | 49 | static int default_interrupt_cb(void); |
| 50 | 50 | ||
| 51 | URLProtocol *first_protocol = NULL; | 51 | URLProtocol *first_protocol = NULL; |
| 52 | URLInterruptCB *url_interrupt_cb = default_interrupt_cb; | 52 | int (*url_interrupt_cb)(void) = default_interrupt_cb; |
| 53 | 53 | ||
| 54 | URLProtocol *av_protocol_next(URLProtocol *p) | 54 | URLProtocol *av_protocol_next(URLProtocol *p) |
| 55 | { | 55 | { |
| @@ -57,6 +57,16 @@ URLProtocol *av_protocol_next(URLProtocol *p) · 1 unmodified line | |||
| 57 | else return first_protocol; | 57 | else return first_protocol; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | const char *avio_enum_protocols(void **opaque, int output) | ||
| 61 | { | ||
| 62 | URLProtocol **p = opaque; | ||
| 63 | *p = *p ? (*p)->next : first_protocol; | ||
| 64 | if (!*p) return NULL; | ||
| 65 | if ((output && (*p)->url_write) || (!output && (*p)->url_read)) | ||
| 66 | return (*p)->name; | ||
| 67 | return avio_enum_protocols(opaque, output); | ||
| 68 | } | ||
| 69 | |||
| 60 | int ffurl_register_protocol(URLProtocol *protocol, int size) | 70 | int ffurl_register_protocol(URLProtocol *protocol, int size) |
| 61 | { | 71 | { |
| 62 | URLProtocol **p; | 72 | URLProtocol **p; |
| @@ -389,7 +399,7 @@ static int default_interrupt_cb(void) · 326 unmodified lines | |||
| 389 | return 0; | 399 | return 0; |
| 390 | } | 400 | } |
| 391 | 401 | ||
| 392 | void avio_set_interrupt_cb(URLInterruptCB *interrupt_cb) | 402 | void avio_set_interrupt_cb(int (*interrupt_cb)(void)) |
| 393 | { | 403 | { |
| 394 | if (!interrupt_cb) | 404 | if (!interrupt_cb) |
| 395 | interrupt_cb = default_interrupt_cb; | 405 | interrupt_cb = default_interrupt_cb; |
| @@ -37,12 +37,14 @@ · 36 unmodified lines | |||
| 37 | 37 | ||
| 38 | /* unbuffered I/O */ | 38 | /* unbuffered I/O */ |
| 39 | 39 | ||
| 40 | #if FF_API_OLD_AVIO | ||
| 40 | /** | 41 | /** |
| 41 | * URL Context. | 42 | * URL Context. |
| 42 | * New fields can be added to the end with minor version bumps. | 43 | * New fields can be added to the end with minor version bumps. |
| 43 | * Removal, reordering and changes to existing fields require a major | 44 | * Removal, reordering and changes to existing fields require a major |
| 44 | * version bump. | 45 | * version bump. |
| 45 | * sizeof(URLContext) must not be used outside libav*. | 46 | * sizeof(URLContext) must not be used outside libav*. |
| 47 | * @deprecated This struct will be made private | ||
| 46 | */ | 48 | */ |
| 47 | typedef struct URLContext { | 49 | typedef struct URLContext { |
| 48 | #if FF_API_URL_CLASS | 50 | #if FF_API_URL_CLASS |
| @@ -57,7 +59,6 @@ typedef struct URLContext { · 8 unmodified lines | |||
| 57 | int is_connected; | 59 | int is_connected; |
| 58 | } URLContext; | 60 | } URLContext; |
| 59 | 61 | ||
| 60 | #if FF_API_OLD_AVIO | ||
| 61 | typedef struct URLPollEntry { | 62 | typedef struct URLPollEntry { |
| 62 | URLContext *handle; | 63 | URLContext *handle; |
| 63 | int events; | 64 | int events; |
| @@ -90,11 +91,9 @@ typedef struct URLPollEntry { · 26 unmodified lines | |||
| 90 | * silently ignored. | 91 | * silently ignored. |
| 91 | */ | 92 | */ |
| 92 | #define URL_FLAG_NONBLOCK 4 | 93 | #define URL_FLAG_NONBLOCK 4 |
| 93 | #endif | ||
| 94 | 94 | ||
| 95 | typedef int URLInterruptCB(void); | 95 | typedef int URLInterruptCB(void); |
| 96 | 96 | ||
| 97 | #if FF_API_OLD_AVIO | ||
| 98 | /** | 97 | /** |
| 99 | * @defgroup old_url_funcs Old url_* functions | 98 | * @defgroup old_url_funcs Old url_* functions |
| 100 | * @deprecated use the buffered API based on AVIOContext instead | 99 | * @deprecated use the buffered API based on AVIOContext instead |
| @@ -117,7 +116,7 @@ attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_siz · 16 unmodified lines | |||
| 117 | attribute_deprecated int av_url_read_pause(URLContext *h, int pause); | 116 | attribute_deprecated int av_url_read_pause(URLContext *h, int pause); |
| 118 | attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index, | 117 | attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index, |
| 119 | int64_t timestamp, int flags); | 118 | int64_t timestamp, int flags); |
| 120 | attribute_deprecated void url_set_interrupt_cb(URLInterruptCB *interrupt_cb); | 119 | attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void)); |
| 121 | #endif | 120 | #endif |
| 122 | 121 | ||
| 123 | /** | 122 | /** |
| @@ -132,7 +131,7 @@ int url_exist(const char *url); · 8 unmodified lines | |||
| 132 | * in this case by the interrupted function. 'NULL' means no interrupt | 131 | * in this case by the interrupted function. 'NULL' means no interrupt |
| 133 | * callback is given. | 132 | * callback is given. |
| 134 | */ | 133 | */ |
| 135 | void avio_set_interrupt_cb(URLInterruptCB *interrupt_cb); | 134 | void avio_set_interrupt_cb(int (*interrupt_cb)(void)); |
| 136 | 135 | ||
| 137 | #if FF_API_OLD_AVIO | 136 | #if FF_API_OLD_AVIO |
| 138 | /* not implemented */ | 137 | /* not implemented */ |
| @@ -140,8 +139,11 @@ attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout); · 1 unmodified line | |||
| 140 | 139 | ||
| 141 | 140 | ||
| 142 | #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ | 141 | #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ |
| 143 | #endif | ||
| 144 | 142 | ||
| 143 | /** | ||
| 144 | * @deprecated This struct is to be made private. Use the higher-level | ||
| 145 | * AVIOContext-based API instead. | ||
| 146 | */ | ||
| 145 | typedef struct URLProtocol { | 147 | typedef struct URLProtocol { |
| 146 | const char *name; | 148 | const char *name; |
| 147 | int (*url_open)(URLContext *h, const char *url, int flags); | 149 | int (*url_open)(URLContext *h, const char *url, int flags); |
| @@ -158,6 +160,7 @@ typedef struct URLProtocol { · 10 unmodified lines | |||
| 158 | const AVClass *priv_data_class; | 160 | const AVClass *priv_data_class; |
| 159 | int flags; | 161 | int flags; |
| 160 | } URLProtocol; | 162 | } URLProtocol; |
| 163 | #endif | ||
| 161 | 164 | ||
| 162 | #if FF_API_REGISTER_PROTOCOL | 165 | #if FF_API_REGISTER_PROTOCOL |
| 163 | extern URLProtocol *first_protocol; | 166 | extern URLProtocol *first_protocol; |
| @@ -596,4 +599,18 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); · 432 unmodified lines | |||
| 596 | int udp_get_file_handle(URLContext *h); | 599 | int udp_get_file_handle(URLContext *h); |
| 597 | #endif | 600 | #endif |
| 598 | 601 | ||
| 602 | /** | ||
| 603 | * Iterate through names of available protocols. | ||
| 604 | * @note it is recommanded to use av_protocol_next() instead of this | ||
| 605 | * | ||
| 606 | * @param opaque A private pointer representing current protocol. | ||
| 607 | * It must be a pointer to NULL on first iteration and will | ||
| 608 | * be updated by successive calls to avio_enum_protocols. | ||
| 609 | * @param output If set to 1, iterate over output protocols, | ||
| 610 | * otherwise over input protocols. | ||
| 611 | * | ||
| 612 | * @return A static string containing the name of current protocol or NULL | ||
| 613 | */ | ||
| 614 | const char *avio_enum_protocols(void **opaque, int output); | ||
| 615 | |||
| 599 | #endif /* AVFORMAT_AVIO_H */ | 616 | #endif /* AVFORMAT_AVIO_H */ |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | #define AVFORMAT_AVIO_INTERNAL_H | 21 | #define AVFORMAT_AVIO_INTERNAL_H |
| 22 | 22 | ||
| 23 | #include "avio.h" | 23 | #include "avio.h" |
| 24 | #include "url.h" | ||
| 24 | 25 | ||
| 25 | int ffio_init_context(AVIOContext *s, | 26 | int ffio_init_context(AVIOContext *s, |
| 26 | unsigned char *buffer, | 27 | unsigned char *buffer, |
| @@ -92,10 +93,6 @@ int ffio_read_pause(AVIOContext *h, int pause); · 65 unmodified lines | |||
| 92 | int64_t ffio_read_seek (AVIOContext *h, int stream_index, | 93 | int64_t ffio_read_seek (AVIOContext *h, int stream_index, |
| 93 | int64_t timestamp, int flags); | 94 | int64_t timestamp, int flags); |
| 94 | 95 | ||
| 95 | /* udp.c */ | ||
| 96 | int ff_udp_set_remote_url(URLContext *h, const char *uri); | ||
| 97 | int ff_udp_get_local_port(URLContext *h); | ||
| 98 | |||
| 99 | void ffio_init_checksum(AVIOContext *s, | 96 | void ffio_init_checksum(AVIOContext *s, |
| 100 | unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), | 97 | unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), |
| 101 | unsigned long checksum); | 98 | unsigned long checksum); |
| @@ -190,10 +190,9 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence) · 189 unmodified lines | |||
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | URLProtocol ff_concat_protocol = { | 192 | URLProtocol ff_concat_protocol = { |
| 193 | "concat", | 193 | .name = "concat", |
| 194 | concat_open, | 194 | .url_open = concat_open, |
| 195 | concat_read, | 195 | .url_read = concat_read, |
| 196 | NULL, | 196 | .url_seek = concat_seek, |
| 197 | concat_seek, | 197 | .url_close = concat_close, |
| 198 | concat_close, | ||
| 199 | }; | 198 | }; |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | /* The FFM file is made of blocks of fixed size */ | 29 | /* The FFM file is made of blocks of fixed size */ |
| 30 | #define FFM_HEADER_SIZE 14 | 30 | #define FFM_HEADER_SIZE 14 |
| 31 | #define FFM_PACKET_SIZE 4096 | ||
| 31 | #define PACKET_ID 0x666d | 32 | #define PACKET_ID 0x666d |
| 32 | 33 | ||
| 33 | /* each packet contains frames (which can span several packets */ | 34 | /* each packet contains frames (which can span several packets */ |
| @@ -55,4 +56,8 @@ typedef struct FFMContext { · 21 unmodified lines | |||
| 55 | uint8_t packet[FFM_PACKET_SIZE]; | 56 | uint8_t packet[FFM_PACKET_SIZE]; |
| 56 | } FFMContext; | 57 | } FFMContext; |
| 57 | 58 | ||
| 59 | int64_t ffm_read_write_index(int fd); | ||
| 60 | int ffm_write_write_index(int fd, int64_t pos); | ||
| 61 | void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size); | ||
| 62 | |||
| 58 | #endif /* AVFORMAT_FFM_H */ | 63 | #endif /* AVFORMAT_FFM_H */ |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
| 30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
| 31 | #include "os_support.h" | 31 | #include "os_support.h" |
| 32 | #include "url.h" | ||
| 32 | 33 | ||
| 33 | 34 | ||
| 34 | /* standard file protocol */ | 35 | /* standard file protocol */ |
| @@ -95,12 +96,12 @@ static int file_close(URLContext *h) · 60 unmodified lines | |||
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | URLProtocol ff_file_protocol = { | 98 | URLProtocol ff_file_protocol = { |
| 98 | "file", | 99 | .name = "file", |
| 99 | file_open, | 100 | .url_open = file_open, |
| 100 | file_read, | 101 | .url_read = file_read, |
| 101 | file_write, | 102 | .url_write = file_write, |
| 102 | file_seek, | 103 | .url_seek = file_seek, |
| 103 | file_close, | 104 | .url_close = file_close, |
| 104 | .url_get_file_handle = file_get_handle, | 105 | .url_get_file_handle = file_get_handle, |
| 105 | }; | 106 | }; |
| 106 | 107 | ||
| @@ -131,10 +132,10 @@ static int pipe_open(URLContext *h, const char *filename, int flags) · 24 unmodified lines | |||
| 131 | } | 132 | } |
| 132 | 133 | ||
| 133 | URLProtocol ff_pipe_protocol = { | 134 | URLProtocol ff_pipe_protocol = { |
| 134 | "pipe", | 135 | .name = "pipe", |
| 135 | pipe_open, | 136 | .url_open = pipe_open, |
| 136 | file_read, | 137 | .url_read = file_read, |
| 137 | file_write, | 138 | .url_write = file_write, |
| 138 | .url_get_file_handle = file_get_handle, | 139 | .url_get_file_handle = file_get_handle, |
| 139 | }; | 140 | }; |
| 140 | 141 | ||
| @@ -121,10 +121,9 @@ static int gopher_read(URLContext *h, uint8_t *buf, int size) · 120 unmodified lines | |||
| 121 | 121 | ||
| 122 | 122 | ||
| 123 | URLProtocol ff_gopher_protocol = { | 123 | URLProtocol ff_gopher_protocol = { |
| 124 | "gopher", | 124 | .name = "gopher", |
| 125 | gopher_open, | 125 | .url_open = gopher_open, |
| 126 | gopher_read, | 126 | .url_read = gopher_read, |
| 127 | gopher_write, | 127 | .url_write = gopher_write, |
| 128 | NULL, /*seek*/ | 128 | .url_close = gopher_close, |
| 129 | gopher_close, | ||
| 130 | }; | 129 | }; |
| @@ -505,13 +505,13 @@ http_get_file_handle(URLContext *h) · 504 unmodified lines | |||
| 505 | } | 505 | } |
| 506 | 506 | ||
| 507 | URLProtocol ff_http_protocol = { | 507 | URLProtocol ff_http_protocol = { |
| 508 | "http", | 508 | .name = "http", |
| 509 | http_open, | 509 | .url_open = http_open, |
| 510 | http_read, | 510 | .url_read = http_read, |
| 511 | http_write, | 511 | .url_write = http_write, |
| 512 | http_seek, | 512 | .url_seek = http_seek, |
| 513 | http_close, | 513 | .url_close = http_close, |
| 514 | .url_get_file_handle = http_get_file_handle, | 514 | .url_get_file_handle = http_get_file_handle, |
| 515 | .priv_data_size = sizeof(HTTPContext), | 515 | .priv_data_size = sizeof(HTTPContext), |
| 516 | .priv_data_class = &httpcontext_class, | 516 | .priv_data_class = &httpcontext_class, |
| 517 | }; | 517 | }; |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | #ifndef AVFORMAT_HTTP_H | 22 | #ifndef AVFORMAT_HTTP_H |
| 23 | #define AVFORMAT_HTTP_H | 23 | #define AVFORMAT_HTTP_H |
| 24 | 24 | ||
| 25 | #include "avio.h" | 25 | #include "url.h" |
| 26 | 26 | ||
| 27 | /** | 27 | /** |
| 28 | * Set custom HTTP headers. | 28 | * Set custom HTTP headers. |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | |||
| 24 | #include "libavutil/avstring.h" | 24 | #include "libavutil/avstring.h" |
| 25 | #include "avformat.h" | 25 | #include "avformat.h" |
| 26 | #include "avio_internal.h" | 26 | #include "avio_internal.h" |
| 27 | #include "internal.h" | ||
| 27 | #include <strings.h> | 28 | #include <strings.h> |
| 28 | 29 | ||
| 29 | typedef struct { | 30 | typedef struct { |
| @@ -185,9 +186,16 @@ static int read_probe(AVProbeData *p) · 155 unmodified lines | |||
| 185 | return 0; | 186 | return 0; |
| 186 | } | 187 | } |
| 187 | 188 | ||
| 189 | enum CodecID ff_guess_image2_codec(const char *filename) | ||
| 190 | { | ||
| 191 | return av_str2id(img_tags, filename); | ||
| 192 | } | ||
| 193 | |||
| 194 | #if FF_API_GUESS_IMG2_CODEC | ||
| 188 | enum CodecID av_guess_image2_codec(const char *filename){ | 195 | enum CodecID av_guess_image2_codec(const char *filename){ |
| 189 | return av_str2id(img_tags, filename); | 196 | return av_str2id(img_tags, filename); |
| 190 | } | 197 | } |
| 198 | #endif | ||
| 191 | 199 | ||
| 192 | static int read_header(AVFormatContext *s1, AVFormatParameters *ap) | 200 | static int read_header(AVFormatContext *s1, AVFormatParameters *ap) |
| 193 | { | 201 | { |
| @@ -250,4 +250,6 @@ void ff_reduce_index(AVFormatContext *s, int stream_index); · 249 unmodified lines | |||
| 250 | void ff_make_absolute_url(char *buf, int size, const char *base, | 250 | void ff_make_absolute_url(char *buf, int size, const char *base, |
| 251 | const char *rel); | 251 | const char *rel); |
| 252 | 252 | ||
| 253 | enum CodecID ff_guess_image2_codec(const char *filename); | ||
| 254 | |||
| 253 | #endif /* AVFORMAT_INTERNAL_H */ | 255 | #endif /* AVFORMAT_INTERNAL_H */ |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | |||
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #include "avformat.h" | 27 | #include "avformat.h" |
| 28 | #include "url.h" | ||
| 28 | 29 | ||
| 29 | #include <librtmp/rtmp.h> | 30 | #include <librtmp/rtmp.h> |
| 30 | #include <librtmp/log.h> | 31 | #include <librtmp/log.h> |
| @@ -158,66 +159,56 @@ static int rtmp_get_file_handle(URLContext *s) · 127 unmodified lines | |||
| 158 | } | 159 | } |
| 159 | 160 | ||
| 160 | URLProtocol ff_rtmp_protocol = { | 161 | URLProtocol ff_rtmp_protocol = { |
| 161 | "rtmp", | 162 | .name = "rtmp", |
| 162 | rtmp_open, | 163 | .url_open = rtmp_open, |
| 163 | rtmp_read, | 164 | .url_read = rtmp_read, |
| 164 | rtmp_write, | 165 | .url_write = rtmp_write, |
| 165 | NULL, /* seek */ | 166 | .url_close = rtmp_close, |
| 166 | rtmp_close, | 167 | .url_read_pause = rtmp_read_pause, |
| 167 | NULL, /* next */ | 168 | .url_read_seek = rtmp_read_seek, |
| 168 | rtmp_read_pause, | 169 | .url_get_file_handle = rtmp_get_file_handle |
| 169 | rtmp_read_seek, | ||
| 170 | rtmp_get_file_handle | ||
| 171 | }; | 170 | }; |
| 172 | 171 | ||
| 173 | URLProtocol ff_rtmpt_protocol = { | 172 | URLProtocol ff_rtmpt_protocol = { |
| 174 | "rtmpt", | 173 | .name = "rtmpt", |
| 175 | rtmp_open, | 174 | .url_open = rtmp_open, |
| 176 | rtmp_read, | 175 | .url_read = rtmp_read, |
| 177 | rtmp_write, | 176 | .url_write = rtmp_write, |
| 178 | NULL, /* seek */ | 177 | .url_close = rtmp_close, |
| 179 | rtmp_close, | 178 | .url_read_pause = rtmp_read_pause, |
| 180 | NULL, /* next */ | 179 | .url_read_seek = rtmp_read_seek, |
| 181 | rtmp_read_pause, | 180 | .url_get_file_handle = rtmp_get_file_handle |
| 182 | rtmp_read_seek, | ||
| 183 | rtmp_get_file_handle | ||
| 184 | }; | 181 | }; |
| 185 | 182 | ||
| 186 | URLProtocol ff_rtmpe_protocol = { | 183 | URLProtocol ff_rtmpe_protocol = { |
| 187 | "rtmpe", | 184 | .name = "rtmpe", |
| 188 | rtmp_open, | 185 | .url_open = rtmp_open, |
| 189 | rtmp_read, | 186 | .url_read = rtmp_read, |
| 190 | rtmp_write, | 187 | .url_write = rtmp_write, |
| 191 | NULL, /* seek */ | 188 | .url_close = rtmp_close, |
| 192 | rtmp_close, | 189 | .url_read_pause = rtmp_read_pause, |
| 193 | NULL, /* next */ | 190 | .url_read_seek = rtmp_read_seek, |
| 194 | rtmp_read_pause, | 191 | .url_get_file_handle = rtmp_get_file_handle |
| 195 | rtmp_read_seek, | ||
| 196 | rtmp_get_file_handle | ||
| 197 | }; | 192 | }; |
| 198 | 193 | ||
| 199 | URLProtocol ff_rtmpte_protocol = { | 194 | URLProtocol ff_rtmpte_protocol = { |
| 200 | "rtmpte", | 195 | .name = "rtmpte", |
| 201 | rtmp_open, | 196 | .url_open = rtmp_open, |
| 202 | rtmp_read, | 197 | .url_read = rtmp_read, |
| 203 | rtmp_write, | 198 | .url_write = rtmp_write, |
| 204 | NULL, /* seek */ | 199 | .url_close = rtmp_close, |
| 205 | rtmp_close, | 200 | .url_read_pause = rtmp_read_pause, |
| 206 | NULL, /* next */ | 201 | .url_read_seek = rtmp_read_seek, |
| 207 | rtmp_read_pause, | 202 | .url_get_file_handle = rtmp_get_file_handle |
| 208 | rtmp_read_seek, | ||
| 209 | rtmp_get_file_handle | ||
| 210 | }; | 203 | }; |
| 211 | 204 | ||
| 212 | URLProtocol ff_rtmps_protocol = { | 205 | URLProtocol ff_rtmps_protocol = { |
| 213 | "rtmps", | 206 | .name = "rtmps", |
| 214 | rtmp_open, | 207 | .url_open = rtmp_open, |
| 215 | rtmp_read, | 208 | .url_read = rtmp_read, |
| 216 | rtmp_write, | 209 | .url_write = rtmp_write, |
| 217 | NULL, /* seek */ | 210 | .url_close = rtmp_close, |
| 218 | rtmp_close, | 211 | .url_read_pause = rtmp_read_pause, |
| 219 | NULL, /* next */ | 212 | .url_read_seek = rtmp_read_seek, |
| 220 | rtmp_read_pause, | 213 | .url_get_file_handle = rtmp_get_file_handle |
| 221 | rtmp_read_seek, | ||
| 222 | rtmp_get_file_handle | ||
| 223 | }; | 214 | }; |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | |||
| 21 | #ifndef AVFORMAT_MMS_H | 21 | #ifndef AVFORMAT_MMS_H |
| 22 | #define AVFORMAT_MMS_H | 22 | #define AVFORMAT_MMS_H |
| 23 | 23 | ||
| 24 | #include "avformat.h" | 24 | #include "url.h" |
| 25 | 25 | ||
| 26 | typedef struct { | 26 | typedef struct { |
| 27 | int id; | 27 | int id; |
| @@ -623,10 +623,8 @@ static int mms_read(URLContext *h, uint8_t *buf, int size) · 622 unmodified lines | |||
| 623 | } | 623 | } |
| 624 | 624 | ||
| 625 | URLProtocol ff_mmst_protocol = { | 625 | URLProtocol ff_mmst_protocol = { |
| 626 | "mmst", | 626 | .name = "mmst", |
| 627 | mms_open, | 627 | .url_open = mms_open, |
| 628 | mms_read, | 628 | .url_read = mms_read, |
| 629 | NULL, // write | 629 | .url_close = mms_close, |
| 630 | NULL, // seek | ||
| 631 | mms_close, | ||
| 632 | }; | 630 | }; |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | |||
| 23 | #define AVFORMAT_RTMPPKT_H | 23 | #define AVFORMAT_RTMPPKT_H |
| 24 | 24 | ||
| 25 | #include "avformat.h" | 25 | #include "avformat.h" |
| 26 | #include "url.h" | ||
| 26 | 27 | ||
| 27 | /** maximum possible number of different RTMP channels */ | 28 | /** maximum possible number of different RTMP channels */ |
| 28 | #define RTMP_CHANNELS 65599 | 29 | #define RTMP_CHANNELS 65599 |
| @@ -991,10 +991,9 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) · 990 unmodified lines | |||
| 991 | } | 991 | } |
| 992 | 992 | ||
| 993 | URLProtocol ff_rtmp_protocol = { | 993 | URLProtocol ff_rtmp_protocol = { |
| 994 | "rtmp", | 994 | .name = "rtmp", |
| 995 | rtmp_open, | 995 | .url_open = rtmp_open, |
| 996 | rtmp_read, | 996 | .url_read = rtmp_read, |
| 997 | rtmp_write, | 997 | .url_write = rtmp_write, |
| 998 | NULL, /* seek */ | 998 | .url_close = rtmp_close, |
| 999 | rtmp_close, | ||
| 1000 | }; | 999 | }; |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | |||
| 25 | #include "libavcodec/avcodec.h" | 25 | #include "libavcodec/avcodec.h" |
| 26 | #include "avformat.h" | 26 | #include "avformat.h" |
| 27 | #include "rtp.h" | 27 | #include "rtp.h" |
| 28 | #include "url.h" | ||
| 28 | 29 | ||
| 29 | typedef struct PayloadContext PayloadContext; | 30 | typedef struct PayloadContext PayloadContext; |
| 30 | typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler; | 31 | typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler; |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | |||
| 23 | #define AVFORMAT_RTPENC_CHAIN_H | 23 | #define AVFORMAT_RTPENC_CHAIN_H |
| 24 | 24 | ||
| 25 | #include "avformat.h" | 25 | #include "avformat.h" |
| 26 | #include "url.h" | ||
| 26 | 27 | ||
| 27 | AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, | 28 | AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, |
| 28 | URLContext *handle, int packet_size); | 29 | URLContext *handle, int packet_size); |
| @@ -355,11 +355,10 @@ int rtp_get_rtcp_file_handle(URLContext *h) { · 354 unmodified lines | |||
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | URLProtocol ff_rtp_protocol = { | 357 | URLProtocol ff_rtp_protocol = { |
| 358 | "rtp", | 358 | .name = "rtp", |
| 359 | rtp_open, | 359 | .url_open = rtp_open, |
| 360 | rtp_read, | 360 | .url_read = rtp_read, |
| 361 | rtp_write, | 361 | .url_write = rtp_write, |
| 362 | NULL, /* seek */ | 362 | .url_close = rtp_close, |
| 363 | rtp_close, | ||
| 364 | .url_get_file_handle = rtp_get_file_handle, | 363 | .url_get_file_handle = rtp_get_file_handle, |
| 365 | }; | 364 | }; |
| @@ -66,7 +66,7 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr) · 65 unmodified lines | |||
| 66 | ff_url_join(sdp_ctx.filename, sizeof(sdp_ctx.filename), | 66 | ff_url_join(sdp_ctx.filename, sizeof(sdp_ctx.filename), |
| 67 | "rtsp", NULL, addr, -1, NULL); | 67 | "rtsp", NULL, addr, -1, NULL); |
| 68 | ctx_array[0] = &sdp_ctx; | 68 | ctx_array[0] = &sdp_ctx; |
| 69 | if (avf_sdp_create(ctx_array, 1, sdp, SDP_MAX_SIZE)) { | 69 | if (av_sdp_create(ctx_array, 1, sdp, SDP_MAX_SIZE)) { |
| 70 | av_free(sdp); | 70 | av_free(sdp); |
| 71 | return AVERROR_INVALIDDATA; | 71 | return AVERROR_INVALIDDATA; |
| 72 | } | 72 | } |
| @@ -208,7 +208,7 @@ static int sap_write_header(AVFormatContext *s) · 207 unmodified lines | |||
| 208 | av_strlcpy(&sap->ann[pos], "application/sdp", sap->ann_size - pos); | 208 | av_strlcpy(&sap->ann[pos], "application/sdp", sap->ann_size - pos); |
| 209 | pos += strlen(&sap->ann[pos]) + 1; | 209 | pos += strlen(&sap->ann[pos]) + 1; |
| 210 | 210 | ||
| 211 | if (avf_sdp_create(contexts, s->nb_streams, &sap->ann[pos], | 211 | if (av_sdp_create(contexts, s->nb_streams, &sap->ann[pos], |
| 212 | sap->ann_size - pos)) { | 212 | sap->ann_size - pos)) { |
| 213 | ret = AVERROR_INVALIDDATA; | 213 | ret = AVERROR_INVALIDDATA; |
| 214 | goto fail; | 214 | goto fail; |
| @@ -474,14 +474,14 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des · 473 unmodified lines | |||
| 474 | sdp_write_media_attributes(buff, size, c, payload_type); | 474 | sdp_write_media_attributes(buff, size, c, payload_type); |
| 475 | } | 475 | } |
| 476 | 476 | ||
| 477 | int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) | 477 | int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size) |
| 478 | { | 478 | { |
| 479 | AVMetadataTag *title = av_metadata_get(ac[0]->metadata, "title", NULL, 0); | 479 | AVMetadataTag *title = av_metadata_get(ac[0]->metadata, "title", NULL, 0); |
| 480 | struct sdp_session_level s; | 480 | struct sdp_session_level s; |
| 481 | int i, j, port, ttl, is_multicast; | 481 | int i, j, port, ttl, is_multicast; |
| 482 | char dst[32], dst_type[5]; | 482 | char dst[32], dst_type[5]; |
| 483 | 483 | ||
| 484 | memset(buff, 0, size); | 484 | memset(buf, 0, size); |
| 485 | memset(&s, 0, sizeof(struct sdp_session_level)); | 485 | memset(&s, 0, sizeof(struct sdp_session_level)); |
| 486 | s.user = "-"; | 486 | s.user = "-"; |
| 487 | s.src_addr = "127.0.0.1"; /* FIXME: Properly set this */ | 487 | s.src_addr = "127.0.0.1"; /* FIXME: Properly set this */ |
| @@ -506,7 +506,7 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) · 18 unmodified lines | |||
| 506 | } | 506 | } |
| 507 | } | 507 | } |
| 508 | } | 508 | } |
| 509 | sdp_write_header(buff, size, &s); | 509 | sdp_write_header(buf, size, &s); |
| 510 | 510 | ||
| 511 | dst[0] = 0; | 511 | dst[0] = 0; |
| 512 | for (i = 0; i < n_files; i++) { | 512 | for (i = 0; i < n_files; i++) { |
| @@ -518,11 +518,11 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) · 5 unmodified lines | |||
| 518 | ttl = 0; | 518 | ttl = 0; |
| 519 | } | 519 | } |
| 520 | for (j = 0; j < ac[i]->nb_streams; j++) { | 520 | for (j = 0; j < ac[i]->nb_streams; j++) { |
| 521 | ff_sdp_write_media(buff, size, | 521 | ff_sdp_write_media(buf, size, |
| 522 | ac[i]->streams[j]->codec, dst[0] ? dst : NULL, | 522 | ac[i]->streams[j]->codec, dst[0] ? dst : NULL, |
| 523 | dst_type, (port > 0) ? port + j * 2 : 0, ttl); | 523 | dst_type, (port > 0) ? port + j * 2 : 0, ttl); |
| 524 | if (port <= 0) { | 524 | if (port <= 0) { |
| 525 | av_strlcatf(buff, size, | 525 | av_strlcatf(buf, size, |
| 526 | "a=control:streamid=%d\r\n", i + j); | 526 | "a=control:streamid=%d\r\n", i + j); |
| 527 | } | 527 | } |
| 528 | } | 528 | } |
| @@ -531,7 +531,7 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) · 2 unmodified lines | |||
| 531 | return 0; | 531 | return 0; |
| 532 | } | 532 | } |
| 533 | #else | 533 | #else |
| 534 | int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) | 534 | int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size) |
| 535 | { | 535 | { |
| 536 | return AVERROR(ENOSYS); | 536 | return AVERROR(ENOSYS); |
| 537 | } | 537 | } |
| @@ -540,3 +540,10 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des · 2 unmodified lines | |||
| 540 | { | 540 | { |
| 541 | } | 541 | } |
| 542 | #endif | 542 | #endif |
| 543 | |||
| 544 | #if FF_API_SDP_CREATE | ||
| 545 | int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) | ||
| 546 | { | ||
| 547 | return av_sdp_create(ac, n_files, buff, size); | ||
| 548 | } | ||
| 549 | #endif | ||
| @@ -202,11 +202,10 @@ static int tcp_get_file_handle(URLContext *h) · 201 unmodified lines | |||
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | URLProtocol ff_tcp_protocol = { | 204 | URLProtocol ff_tcp_protocol = { |
| 205 | "tcp", | 205 | .name = "tcp", |
| 206 | tcp_open, | 206 | .url_open = tcp_open, |
| 207 | tcp_read, | 207 | .url_read = tcp_read, |
| 208 | tcp_write, | 208 | .url_write = tcp_write, |
| 209 | NULL, /* seek */ | 209 | .url_close = tcp_close, |
| 210 | tcp_close, | ||
| 211 | .url_get_file_handle = tcp_get_file_handle, | 210 | .url_get_file_handle = tcp_get_file_handle, |
| 212 | }; | 211 | }; |
| @@ -489,11 +489,10 @@ static int udp_close(URLContext *h) · 488 unmodified lines | |||
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | URLProtocol ff_udp_protocol = { | 491 | URLProtocol ff_udp_protocol = { |
| 492 | "udp", | 492 | .name = "udp", |
| 493 | udp_open, | 493 | .url_open = udp_open, |
| 494 | udp_read, | 494 | .url_read = udp_read, |
| 495 | udp_write, | 495 | .url_write = udp_write, |
| 496 | NULL, /* seek */ | 496 | .url_close = udp_close, |
| 497 | udp_close, | ||
| 498 | .url_get_file_handle = udp_get_file_handle, | 497 | .url_get_file_handle = udp_get_file_handle, |
| 499 | }; | 498 | }; |
| @@ -31,7 +31,35 @@ · 30 unmodified lines | |||
| 31 | #if !FF_API_OLD_AVIO | 31 | #if !FF_API_OLD_AVIO |
| 32 | #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ | 32 | #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ |
| 33 | 33 | ||
| 34 | extern URLInterruptCB *url_interrupt_cb; | 34 | extern int (*url_interrupt_cb)(void); |
| 35 | |||
| 36 | typedef struct URLContext { | ||
| 37 | const AVClass *av_class; /**< information for av_log(). Set by url_open(). */ | ||
| 38 | struct URLProtocol *prot; | ||
| 39 | void *priv_data; | ||
| 40 | char *filename; /**< specified URL */ | ||
| 41 | int flags; | ||
| 42 | int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */ | ||
| 43 | int is_streamed; /**< true if streamed (no seek possible), default = false */ | ||
| 44 | int is_connected; | ||
| 45 | } URLContext; | ||
| 46 | |||
| 47 | typedef struct URLProtocol { | ||
| 48 | const char *name; | ||
| 49 | int (*url_open)( URLContext *h, const char *url, int flags); | ||
| 50 | int (*url_read)( URLContext *h, unsigned char *buf, int size); | ||
| 51 | int (*url_write)(URLContext *h, const unsigned char *buf, int size); | ||
| 52 | int64_t (*url_seek)( URLContext *h, int64_t pos, int whence); | ||
| 53 | int (*url_close)(URLContext *h); | ||
| 54 | struct URLProtocol *next; | ||
| 55 | int (*url_read_pause)(URLContext *h, int pause); | ||
| 56 | int64_t (*url_read_seek)(URLContext *h, int stream_index, | ||
| 57 | int64_t timestamp, int flags); | ||
| 58 | int (*url_get_file_handle)(URLContext *h); | ||
| 59 | int priv_data_size; | ||
| 60 | const AVClass *priv_data_class; | ||
| 61 | int flags; | ||
| 62 | } URLProtocol; | ||
| 35 | #endif | 63 | #endif |
| 36 | 64 | ||
| 37 | /** | 65 | /** |
| @@ -140,4 +168,8 @@ int ffurl_get_file_handle(URLContext *h); · 102 unmodified lines | |||
| 140 | */ | 168 | */ |
| 141 | int ffurl_register_protocol(URLProtocol *protocol, int size); | 169 | int ffurl_register_protocol(URLProtocol *protocol, int size); |
| 142 | 170 | ||
| 171 | /* udp.c */ | ||
| 172 | int ff_udp_set_remote_url(URLContext *h, const char *uri); | ||
| 173 | int ff_udp_get_local_port(URLContext *h); | ||
| 174 | |||
| 143 | #endif //AVFORMAT_URL_H | 175 | #endif //AVFORMAT_URL_H |
| @@ -219,7 +219,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename, · 218 unmodified lines | |||
| 219 | #if CONFIG_IMAGE2_MUXER | 219 | #if CONFIG_IMAGE2_MUXER |
| 220 | if (!short_name && filename && | 220 | if (!short_name && filename && |
| 221 | av_filename_number_test(filename) && | 221 | av_filename_number_test(filename) && |
| 222 | av_guess_image2_codec(filename) != CODEC_ID_NONE) { | 222 | ff_guess_image2_codec(filename) != CODEC_ID_NONE) { |
| 223 | return av_guess_format("image2", NULL, NULL); | 223 | return av_guess_format("image2", NULL, NULL); |
| 224 | } | 224 | } |
| 225 | #endif | 225 | #endif |
| @@ -272,7 +272,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, · 46 unmodified lines | |||
| 272 | 272 | ||
| 273 | #if CONFIG_IMAGE2_MUXER | 273 | #if CONFIG_IMAGE2_MUXER |
| 274 | if(!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")){ | 274 | if(!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")){ |
| 275 | codec_id= av_guess_image2_codec(filename); | 275 | codec_id= ff_guess_image2_codec(filename); |
| 276 | } | 276 | } |
| 277 | #endif | 277 | #endif |
| 278 | if(codec_id == CODEC_ID_NONE) | 278 | if(codec_id == CODEC_ID_NONE) |
| @@ -3574,22 +3574,26 @@ static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int · 3295 unmodified lines | |||
| 3574 | av_hex_dump(f, pkt->data, pkt->size); | 3574 | av_hex_dump(f, pkt->data, pkt->size); |
| 3575 | } | 3575 | } |
| 3576 | 3576 | ||
| 3577 | #if FF_API_PKT_DUMP | ||
| 3577 | void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload) | 3578 | void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload) |
| 3578 | { | 3579 | { |
| 3579 | AVRational tb = { 1, AV_TIME_BASE }; | 3580 | AVRational tb = { 1, AV_TIME_BASE }; |
| 3580 | pkt_dump_internal(NULL, f, 0, pkt, dump_payload, tb); | 3581 | pkt_dump_internal(NULL, f, 0, pkt, dump_payload, tb); |
| 3581 | } | 3582 | } |
| 3583 | #endif | ||
| 3582 | 3584 | ||
| 3583 | void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st) | 3585 | void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st) |
| 3584 | { | 3586 | { |
| 3585 | pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base); | 3587 | pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base); |
| 3586 | } | 3588 | } |
| 3587 | 3589 | ||
| 3590 | #if FF_API_PKT_DUMP | ||
| 3588 | void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload) | 3591 | void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload) |
| 3589 | { | 3592 | { |
| 3590 | AVRational tb = { 1, AV_TIME_BASE }; | 3593 | AVRational tb = { 1, AV_TIME_BASE }; |
| 3591 | pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, tb); | 3594 | pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, tb); |
| 3592 | } | 3595 | } |
| 3596 | #endif | ||
| 3593 | 3597 | ||
| 3594 | void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, | 3598 | void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, |
| 3595 | AVStream *st) | 3599 | AVStream *st) |
| @@ -104,5 +104,14 @@ · 103 unmodified lines | |||
| 104 | #ifndef FF_API_FIND_INFO_TAG | 104 | #ifndef FF_API_FIND_INFO_TAG |
| 105 | #define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54) | 105 | #define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54) |
| 106 | #endif | 106 | #endif |
| 107 | #ifndef FF_API_PKT_DUMP | ||
| 108 | #define FF_API_PKT_DUMP (LIBAVFORMAT_VERSION_MAJOR < 54) | ||
| 109 | #endif | ||
| 110 | #ifndef FF_API_GUESS_IMG2_CODEC | ||
| 111 | #define FF_API_GUESS_IMG2_CODEC (LIBAVFORMAT_VERSION_MAJOR < 54) | ||
| 112 | #endif | ||
| 113 | #ifndef FF_API_SDP_CREATE | ||
| 114 | #define FF_API_SDP_CREATE (LIBAVFORMAT_VERSION_MAJOR < 54) | ||
| 115 | #endif | ||
| 107 | 116 | ||
| 108 | #endif //AVFORMAT_VERSION_H | 117 | #endif //AVFORMAT_VERSION_H |