History

Merge remote branch 'qatar/master'

* 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

Michael Niedermayer committed 15 years ago

Commit d4d09322 parents a61bc91 0c68c8034 files · +249 −165Browse files

Unified · Split

34 files
  1. doc/APIchanges +5 −0
  2. ffmpeg.c +3 −1
  3. ffserver.c +2 −1
  4. libavformat/applehttp.c +8 −8
  5. libavformat/applehttpproto.c +5 −7
  6. libavformat/asfdec.c +0 −2
  7. libavformat/avformat.h +13 −11
  8. libavformat/avio.c +12 −2
  9. libavformat/avio.h +23 −6
  10. libavformat/avio_internal.h +1 −4
  11. libavformat/concat.c +5 −6
  12. libavformat/ffm.h +5 −0
  13. libavformat/file.c +11 −10
  14. libavformat/gopher.c +5 −6
  15. libavformat/http.c +8 −8
  16. libavformat/http.h +1 −1
  17. libavformat/img2.c +8 −0
  18. libavformat/internal.h +2 −0
  19. libavformat/librtmp.c +41 −50
  20. libavformat/mms.h +1 −1
  21. libavformat/mmst.c +4 −6
  22. libavformat/rtmppkt.h +1 −0
  23. libavformat/rtmpproto.c +5 −6
  24. libavformat/rtpdec.h +1 −0
  25. libavformat/rtpenc_chain.h +1 −0
  26. libavformat/rtpproto.c +5 −6
  27. libavformat/rtspenc.c +1 −1
  28. libavformat/sapenc.c +1 −1
  29. libavformat/sdp.c +13 −6
  30. libavformat/tcp.c +5 −6
  31. libavformat/udp.c +5 −6
  32. libavformat/url.h +33 −1
  33. libavformat/utils.c +6 −2
  34. libavformat/version.h +9 −0
doc/APIchanges+5−0
@@ -12,6 +12,11 @@ libavutil: 2009-03-08 · 11 unmodified lines
1212
1313 API changes, most recent first:
1414
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+
1520 2011-04-03 - lavf 52.105.0 - avio.h
1621 Large-scale renaming/deprecating of AVIOContext-related functions:
1722 724f6a0 deprecate url_fdopen
ffmpeg.c+3−1
@@ -47,6 +47,8 @@ · 46 unmodified lines
4747 #include "libavutil/libm.h"
4848 #include "libavformat/os_support.h"
4949
50+#include "libavformat/ffm.h" // not public API
51+
5052 #if CONFIG_AVFILTER
5153 # include "libavfilter/avfilter.h"
5254 # include "libavfilter/avfiltergraph.h"
@@ -1881,7 +1883,7 @@ static void print_sdp(AVFormatContext **avc, int n) · 1828 unmodified lines
18811883 {
18821884 char sdp[2048];
18831885
1884− avf_sdp_create(avc, n, sdp, sizeof(sdp));
1886+ av_sdp_create(avc, n, sdp, sizeof(sdp));
18851887 printf("SDP:\n%s\n", sdp);
18861888 fflush(stdout);
18871889 }
ffserver.c+2−1
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include <strings.h>
3030 #include <stdlib.h>
3131 #include "libavformat/avformat.h"
32+#include "libavformat/ffm.h"
3233 #include "libavformat/network.h"
3334 #include "libavformat/os_support.h"
3435 #include "libavformat/rtpdec.h"
@@ -2957,7 +2958,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, · 2922 unmodified lines
29572958 avc->streams[i]->codec = stream->streams[i]->codec;
29582959 }
29592960 *pbuffer = av_mallocz(2048);
2960− avf_sdp_create(&avc, 1, *pbuffer, 2048);
2961+ av_sdp_create(&avc, 1, *pbuffer, 2048);
29612962
29622963 sdp_done:
29632964 #if !FF_API_MAX_STREAMS
libavformat/applehttp.c+8−8
@@ -113,7 +113,7 @@ static void free_variant_list(AppleHTTPContext *c) · 112 unmodified lines
113113 av_free_packet(&var->pkt);
114114 av_free(var->pb.buffer);
115115 if (var->input)
116− url_close(var->input);
116+ ffurl_close(var->input);
117117 if (var->ctx) {
118118 var->ctx->pb = NULL;
119119 av_close_input_file(var->ctx);
@@ -291,18 +291,18 @@ reload: · 171 unmodified lines
291291 goto reload;
292292 }
293293
294− ret = url_open(&v->input,
295− v->segments[v->cur_seq_no - v->start_seq_no]->url,
296− AVIO_RDONLY);
294+ ret = ffurl_open(&v->input,
295+ v->segments[v->cur_seq_no - v->start_seq_no]->url,
296+ AVIO_RDONLY);
297297 if (ret < 0)
298298 return ret;
299299 }
300− ret = url_read(v->input, buf, buf_size);
300+ ret = ffurl_read(v->input, buf, buf_size);
301301 if (ret > 0)
302302 return ret;
303303 if (ret < 0 && ret != AVERROR_EOF)
304304 return ret;
305− url_close(v->input);
305+ ffurl_close(v->input);
306306 v->input = NULL;
307307 v->cur_seq_no++;
308308
@@ -435,7 +435,7 @@ static int recheck_discard_flags(AVFormatContext *s, int first) · 126 unmodified lines
435435 av_log(s, AV_LOG_INFO, "Now receiving variant %d\n", i);
436436 } else if (first && !v->cur_needed && v->needed) {
437437 if (v->input)
438− url_close(v->input);
438+ ffurl_close(v->input);
439439 v->input = NULL;
440440 v->needed = 0;
441441 changed = 1;
@@ -517,7 +517,7 @@ static int applehttp_read_seek(AVFormatContext *s, int stream_index, · 75 unmodified lines
517517 struct variant *var = c->variants[i];
518518 int64_t pos = 0;
519519 if (var->input) {
520− url_close(var->input);
520+ ffurl_close(var->input);
521521 var->input = NULL;
522522 }
523523 av_free_packet(&var->pkt);
libavformat/applehttpproto.c+5−7
@@ -298,11 +298,9 @@ static int applehttp_close(URLContext *h) · 297 unmodified lines
298298 }
299299
300300 URLProtocol ff_applehttp_protocol = {
301− "applehttp",
302− applehttp_open,
303− applehttp_read,
304− NULL, /* write */
305− NULL, /* seek */
306− applehttp_close,
307− .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
301+ .name = "applehttp",
302+ .url_open = applehttp_open,
303+ .url_read = applehttp_read,
304+ .url_close = applehttp_close,
305+ .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
308306 };
libavformat/asfdec.c+0−2
@@ -31,8 +31,6 @@ · 30 unmodified lines
3131 #include "asfcrypt.h"
3232 #include "avlanguage.h"
3333
34−void ff_mms_set_stream_selection(URLContext *h, AVFormatContext *format);
35−
3634 typedef struct {
3735 int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID
3836 ASFStream streams[128]; ///< it's max number and it's not that big
libavformat/avformat.h+13−11
@@ -907,7 +907,9 @@ AVInputFormat *av_iformat_next(AVInputFormat *f); · 906 unmodified lines
907907 */
908908 AVOutputFormat *av_oformat_next(AVOutputFormat *f);
909909
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
911913
912914 /* XXX: Use automatic init with either ELF sections or C file parser */
913915 /* modules. */
@@ -986,7 +988,6 @@ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); · 72 unmodified lines
986988 */
987989 void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st);
988990
989−attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
990991
991992 /**
992993 * 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
10021003 void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
10031004 AVStream *st);
10041005
1006+#if FF_API_PKT_DUMP
1007+attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
10051008 attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt,
1009+#endif
10061010 int dump_payload);
10071011
10081012 /**
@@ -1521,12 +1525,6 @@ int64_t parse_date(const char *datestr, int duration); · 512 unmodified lines
15211525 */
15221526 int64_t av_gettime(void);
15231527
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−
15301528 #if FF_API_FIND_INFO_TAG
15311529 /**
15321530 * @deprecated use av_find_info_tag in libavutil instead.
@@ -1566,12 +1564,16 @@ int av_filename_number_test(const char *filename); · 33 unmodified lines
15661564 * all the contexts in the array (an AVCodecContext per RTP stream)
15671565 * must contain only one AVStream.
15681566 * @param n_files number of AVCodecContexts contained in ac
1569− * @param buff buffer where the SDP will be stored (must be allocated by
1570− * the caller)
1567+ * @param buf buffer where the SDP will be stored (must be allocated by
1568+ * the caller)
15711569 * @param size the size of the buffer
15721570 * @return 0 if OK, AVERROR_xxx on error
15731571 */
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
15751577
15761578 /**
15771579 * Return a positive value if the given filename has one of the given
libavformat/avio.c+12−2
@@ -49,7 +49,7 @@ static const AVClass urlcontext_class = · 48 unmodified lines
4949 static int default_interrupt_cb(void);
5050
5151 URLProtocol *first_protocol = NULL;
52−URLInterruptCB *url_interrupt_cb = default_interrupt_cb;
52+int (*url_interrupt_cb)(void) = default_interrupt_cb;
5353
5454 URLProtocol *av_protocol_next(URLProtocol *p)
5555 {
@@ -57,6 +57,16 @@ URLProtocol *av_protocol_next(URLProtocol *p) · 1 unmodified line
5757 else return first_protocol;
5858 }
5959
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+
6070 int ffurl_register_protocol(URLProtocol *protocol, int size)
6171 {
6272 URLProtocol **p;
@@ -389,7 +399,7 @@ static int default_interrupt_cb(void) · 326 unmodified lines
389399 return 0;
390400 }
391401
392−void avio_set_interrupt_cb(URLInterruptCB *interrupt_cb)
402+void avio_set_interrupt_cb(int (*interrupt_cb)(void))
393403 {
394404 if (!interrupt_cb)
395405 interrupt_cb = default_interrupt_cb;
libavformat/avio.h+23−6
@@ -37,12 +37,14 @@ · 36 unmodified lines
3737
3838 /* unbuffered I/O */
3939
40+#if FF_API_OLD_AVIO
4041 /**
4142 * URL Context.
4243 * New fields can be added to the end with minor version bumps.
4344 * Removal, reordering and changes to existing fields require a major
4445 * version bump.
4546 * sizeof(URLContext) must not be used outside libav*.
47+ * @deprecated This struct will be made private
4648 */
4749 typedef struct URLContext {
4850 #if FF_API_URL_CLASS
@@ -57,7 +59,6 @@ typedef struct URLContext { · 8 unmodified lines
5759 int is_connected;
5860 } URLContext;
5961
60−#if FF_API_OLD_AVIO
6162 typedef struct URLPollEntry {
6263 URLContext *handle;
6364 int events;
@@ -90,11 +91,9 @@ typedef struct URLPollEntry { · 26 unmodified lines
9091 * silently ignored.
9192 */
9293 #define URL_FLAG_NONBLOCK 4
93−#endif
9494
9595 typedef int URLInterruptCB(void);
9696
97−#if FF_API_OLD_AVIO
9897 /**
9998 * @defgroup old_url_funcs Old url_* functions
10099 * @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
117116 attribute_deprecated int av_url_read_pause(URLContext *h, int pause);
118117 attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index,
119118 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));
121120 #endif
122121
123122 /**
@@ -132,7 +131,7 @@ int url_exist(const char *url); · 8 unmodified lines
132131 * in this case by the interrupted function. 'NULL' means no interrupt
133132 * callback is given.
134133 */
135−void avio_set_interrupt_cb(URLInterruptCB *interrupt_cb);
134+void avio_set_interrupt_cb(int (*interrupt_cb)(void));
136135
137136 #if FF_API_OLD_AVIO
138137 /* not implemented */
@@ -140,8 +139,11 @@ attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout); · 1 unmodified line
140139
141140
142141 #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
143−#endif
144142
143+/**
144+ * @deprecated This struct is to be made private. Use the higher-level
145+ * AVIOContext-based API instead.
146+ */
145147 typedef struct URLProtocol {
146148 const char *name;
147149 int (*url_open)(URLContext *h, const char *url, int flags);
@@ -158,6 +160,7 @@ typedef struct URLProtocol { · 10 unmodified lines
158160 const AVClass *priv_data_class;
159161 int flags;
160162 } URLProtocol;
163+#endif
161164
162165 #if FF_API_REGISTER_PROTOCOL
163166 extern URLProtocol *first_protocol;
@@ -596,4 +599,18 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); · 432 unmodified lines
596599 int udp_get_file_handle(URLContext *h);
597600 #endif
598601
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+
599616 #endif /* AVFORMAT_AVIO_H */
libavformat/avio_internal.h+1−4
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #define AVFORMAT_AVIO_INTERNAL_H
2222
2323 #include "avio.h"
24+#include "url.h"
2425
2526 int ffio_init_context(AVIOContext *s,
2627 unsigned char *buffer,
@@ -92,10 +93,6 @@ int ffio_read_pause(AVIOContext *h, int pause); · 65 unmodified lines
9293 int64_t ffio_read_seek (AVIOContext *h, int stream_index,
9394 int64_t timestamp, int flags);
9495
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−
9996 void ffio_init_checksum(AVIOContext *s,
10097 unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
10198 unsigned long checksum);
libavformat/concat.c+5−6
@@ -190,10 +190,9 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence) · 189 unmodified lines
190190 }
191191
192192 URLProtocol ff_concat_protocol = {
193− "concat",
194− concat_open,
195− concat_read,
196− NULL,
197− concat_seek,
198− concat_close,
193+ .name = "concat",
194+ .url_open = concat_open,
195+ .url_read = concat_read,
196+ .url_seek = concat_seek,
197+ .url_close = concat_close,
199198 };
libavformat/ffm.h+5−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828
2929 /* The FFM file is made of blocks of fixed size */
3030 #define FFM_HEADER_SIZE 14
31+#define FFM_PACKET_SIZE 4096
3132 #define PACKET_ID 0x666d
3233
3334 /* each packet contains frames (which can span several packets */
@@ -55,4 +56,8 @@ typedef struct FFMContext { · 21 unmodified lines
5556 uint8_t packet[FFM_PACKET_SIZE];
5657 } FFMContext;
5758
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+
5863 #endif /* AVFORMAT_FFM_H */
libavformat/file.c+11−10
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include <sys/stat.h>
3030 #include <stdlib.h>
3131 #include "os_support.h"
32+#include "url.h"
3233
3334
3435 /* standard file protocol */
@@ -95,12 +96,12 @@ static int file_close(URLContext *h) · 60 unmodified lines
9596 }
9697
9798 URLProtocol ff_file_protocol = {
98− "file",
99− file_open,
100− file_read,
101− file_write,
102− file_seek,
103− file_close,
99+ .name = "file",
100+ .url_open = file_open,
101+ .url_read = file_read,
102+ .url_write = file_write,
103+ .url_seek = file_seek,
104+ .url_close = file_close,
104105 .url_get_file_handle = file_get_handle,
105106 };
106107
@@ -131,10 +132,10 @@ static int pipe_open(URLContext *h, const char *filename, int flags) · 24 unmodified lines
131132 }
132133
133134 URLProtocol ff_pipe_protocol = {
134− "pipe",
135− pipe_open,
136− file_read,
137− file_write,
135+ .name = "pipe",
136+ .url_open = pipe_open,
137+ .url_read = file_read,
138+ .url_write = file_write,
138139 .url_get_file_handle = file_get_handle,
139140 };
140141
libavformat/gopher.c+5−6
@@ -121,10 +121,9 @@ static int gopher_read(URLContext *h, uint8_t *buf, int size) · 120 unmodified lines
121121
122122
123123 URLProtocol ff_gopher_protocol = {
124− "gopher",
125− gopher_open,
126− gopher_read,
127− gopher_write,
128− NULL, /*seek*/
129− gopher_close,
124+ .name = "gopher",
125+ .url_open = gopher_open,
126+ .url_read = gopher_read,
127+ .url_write = gopher_write,
128+ .url_close = gopher_close,
130129 };
libavformat/http.c+8−8
@@ -505,13 +505,13 @@ http_get_file_handle(URLContext *h) · 504 unmodified lines
505505 }
506506
507507 URLProtocol ff_http_protocol = {
508− "http",
509− http_open,
510− http_read,
511− http_write,
512− http_seek,
513− http_close,
508+ .name = "http",
509+ .url_open = http_open,
510+ .url_read = http_read,
511+ .url_write = http_write,
512+ .url_seek = http_seek,
513+ .url_close = http_close,
514514 .url_get_file_handle = http_get_file_handle,
515− .priv_data_size = sizeof(HTTPContext),
516− .priv_data_class = &httpcontext_class,
515+ .priv_data_size = sizeof(HTTPContext),
516+ .priv_data_class = &httpcontext_class,
517517 };
libavformat/http.h+1−1
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 #ifndef AVFORMAT_HTTP_H
2323 #define AVFORMAT_HTTP_H
2424
25−#include "avio.h"
25+#include "url.h"
2626
2727 /**
2828 * Set custom HTTP headers.
libavformat/img2.c+8−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include "libavutil/avstring.h"
2525 #include "avformat.h"
2626 #include "avio_internal.h"
27+#include "internal.h"
2728 #include <strings.h>
2829
2930 typedef struct {
@@ -185,9 +186,16 @@ static int read_probe(AVProbeData *p) · 155 unmodified lines
185186 return 0;
186187 }
187188
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
188195 enum CodecID av_guess_image2_codec(const char *filename){
189196 return av_str2id(img_tags, filename);
190197 }
198+#endif
191199
192200 static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
193201 {
libavformat/internal.h+2−0
@@ -250,4 +250,6 @@ void ff_reduce_index(AVFormatContext *s, int stream_index); · 249 unmodified lines
250250 void ff_make_absolute_url(char *buf, int size, const char *base,
251251 const char *rel);
252252
253+enum CodecID ff_guess_image2_codec(const char *filename);
254+
253255 #endif /* AVFORMAT_INTERNAL_H */
libavformat/librtmp.c+41−50
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 */
2626
2727 #include "avformat.h"
28+#include "url.h"
2829
2930 #include <librtmp/rtmp.h>
3031 #include <librtmp/log.h>
@@ -158,66 +159,56 @@ static int rtmp_get_file_handle(URLContext *s) · 127 unmodified lines
158159 }
159160
160161 URLProtocol ff_rtmp_protocol = {
161− "rtmp",
162− rtmp_open,
163− rtmp_read,
164− rtmp_write,
165− NULL, /* seek */
166− rtmp_close,
167− NULL, /* next */
168− rtmp_read_pause,
169− rtmp_read_seek,
170− rtmp_get_file_handle
162+ .name = "rtmp",
163+ .url_open = rtmp_open,
164+ .url_read = rtmp_read,
165+ .url_write = rtmp_write,
166+ .url_close = rtmp_close,
167+ .url_read_pause = rtmp_read_pause,
168+ .url_read_seek = rtmp_read_seek,
169+ .url_get_file_handle = rtmp_get_file_handle
171170 };
172171
173172 URLProtocol ff_rtmpt_protocol = {
174− "rtmpt",
175− rtmp_open,
176− rtmp_read,
177− rtmp_write,
178− NULL, /* seek */
179− rtmp_close,
180− NULL, /* next */
181− rtmp_read_pause,
182− rtmp_read_seek,
183− rtmp_get_file_handle
173+ .name = "rtmpt",
174+ .url_open = rtmp_open,
175+ .url_read = rtmp_read,
176+ .url_write = rtmp_write,
177+ .url_close = rtmp_close,
178+ .url_read_pause = rtmp_read_pause,
179+ .url_read_seek = rtmp_read_seek,
180+ .url_get_file_handle = rtmp_get_file_handle
184181 };
185182
186183 URLProtocol ff_rtmpe_protocol = {
187− "rtmpe",
188− rtmp_open,
189− rtmp_read,
190− rtmp_write,
191− NULL, /* seek */
192− rtmp_close,
193− NULL, /* next */
194− rtmp_read_pause,
195− rtmp_read_seek,
196− rtmp_get_file_handle
184+ .name = "rtmpe",
185+ .url_open = rtmp_open,
186+ .url_read = rtmp_read,
187+ .url_write = rtmp_write,
188+ .url_close = rtmp_close,
189+ .url_read_pause = rtmp_read_pause,
190+ .url_read_seek = rtmp_read_seek,
191+ .url_get_file_handle = rtmp_get_file_handle
197192 };
198193
199194 URLProtocol ff_rtmpte_protocol = {
200− "rtmpte",
201− rtmp_open,
202− rtmp_read,
203− rtmp_write,
204− NULL, /* seek */
205− rtmp_close,
206− NULL, /* next */
207− rtmp_read_pause,
208− rtmp_read_seek,
209− rtmp_get_file_handle
195+ .name = "rtmpte",
196+ .url_open = rtmp_open,
197+ .url_read = rtmp_read,
198+ .url_write = rtmp_write,
199+ .url_close = rtmp_close,
200+ .url_read_pause = rtmp_read_pause,
201+ .url_read_seek = rtmp_read_seek,
202+ .url_get_file_handle = rtmp_get_file_handle
210203 };
211204
212205 URLProtocol ff_rtmps_protocol = {
213− "rtmps",
214− rtmp_open,
215− rtmp_read,
216− rtmp_write,
217− NULL, /* seek */
218− rtmp_close,
219− NULL, /* next */
220− rtmp_read_pause,
221− rtmp_read_seek,
222− rtmp_get_file_handle
206+ .name = "rtmps",
207+ .url_open = rtmp_open,
208+ .url_read = rtmp_read,
209+ .url_write = rtmp_write,
210+ .url_close = rtmp_close,
211+ .url_read_pause = rtmp_read_pause,
212+ .url_read_seek = rtmp_read_seek,
213+ .url_get_file_handle = rtmp_get_file_handle
223214 };
libavformat/mms.h+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #ifndef AVFORMAT_MMS_H
2222 #define AVFORMAT_MMS_H
2323
24−#include "avformat.h"
24+#include "url.h"
2525
2626 typedef struct {
2727 int id;
libavformat/mmst.c+4−6
@@ -623,10 +623,8 @@ static int mms_read(URLContext *h, uint8_t *buf, int size) · 622 unmodified lines
623623 }
624624
625625 URLProtocol ff_mmst_protocol = {
626− "mmst",
627− mms_open,
628− mms_read,
629− NULL, // write
630− NULL, // seek
631− mms_close,
626+ .name = "mmst",
627+ .url_open = mms_open,
628+ .url_read = mms_read,
629+ .url_close = mms_close,
632630 };
libavformat/rtmppkt.h+1−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #define AVFORMAT_RTMPPKT_H
2424
2525 #include "avformat.h"
26+#include "url.h"
2627
2728 /** maximum possible number of different RTMP channels */
2829 #define RTMP_CHANNELS 65599
libavformat/rtmpproto.c+5−6
@@ -991,10 +991,9 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) · 990 unmodified lines
991991 }
992992
993993 URLProtocol ff_rtmp_protocol = {
994− "rtmp",
995− rtmp_open,
996− rtmp_read,
997− rtmp_write,
998− NULL, /* seek */
999− rtmp_close,
994+ .name = "rtmp",
995+ .url_open = rtmp_open,
996+ .url_read = rtmp_read,
997+ .url_write = rtmp_write,
998+ .url_close = rtmp_close,
1000999 };
libavformat/rtpdec.h+1−0
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include "libavcodec/avcodec.h"
2626 #include "avformat.h"
2727 #include "rtp.h"
28+#include "url.h"
2829
2930 typedef struct PayloadContext PayloadContext;
3031 typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
libavformat/rtpenc_chain.h+1−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #define AVFORMAT_RTPENC_CHAIN_H
2424
2525 #include "avformat.h"
26+#include "url.h"
2627
2728 AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
2829 URLContext *handle, int packet_size);
libavformat/rtpproto.c+5−6
@@ -355,11 +355,10 @@ int rtp_get_rtcp_file_handle(URLContext *h) { · 354 unmodified lines
355355 }
356356
357357 URLProtocol ff_rtp_protocol = {
358− "rtp",
359− rtp_open,
360− rtp_read,
361− rtp_write,
362− NULL, /* seek */
363− rtp_close,
358+ .name = "rtp",
359+ .url_open = rtp_open,
360+ .url_read = rtp_read,
361+ .url_write = rtp_write,
362+ .url_close = rtp_close,
364363 .url_get_file_handle = rtp_get_file_handle,
365364 };
libavformat/rtspenc.c+1−1
@@ -66,7 +66,7 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr) · 65 unmodified lines
6666 ff_url_join(sdp_ctx.filename, sizeof(sdp_ctx.filename),
6767 "rtsp", NULL, addr, -1, NULL);
6868 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)) {
7070 av_free(sdp);
7171 return AVERROR_INVALIDDATA;
7272 }
libavformat/sapenc.c+1−1
@@ -208,7 +208,7 @@ static int sap_write_header(AVFormatContext *s) · 207 unmodified lines
208208 av_strlcpy(&sap->ann[pos], "application/sdp", sap->ann_size - pos);
209209 pos += strlen(&sap->ann[pos]) + 1;
210210
211− if (avf_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
211+ if (av_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
212212 sap->ann_size - pos)) {
213213 ret = AVERROR_INVALIDDATA;
214214 goto fail;
libavformat/sdp.c+13−6
@@ -474,14 +474,14 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des · 473 unmodified lines
474474 sdp_write_media_attributes(buff, size, c, payload_type);
475475 }
476476
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)
478478 {
479479 AVMetadataTag *title = av_metadata_get(ac[0]->metadata, "title", NULL, 0);
480480 struct sdp_session_level s;
481481 int i, j, port, ttl, is_multicast;
482482 char dst[32], dst_type[5];
483483
484− memset(buff, 0, size);
484+ memset(buf, 0, size);
485485 memset(&s, 0, sizeof(struct sdp_session_level));
486486 s.user = "-";
487487 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
506506 }
507507 }
508508 }
509− sdp_write_header(buff, size, &s);
509+ sdp_write_header(buf, size, &s);
510510
511511 dst[0] = 0;
512512 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
518518 ttl = 0;
519519 }
520520 for (j = 0; j < ac[i]->nb_streams; j++) {
521− ff_sdp_write_media(buff, size,
521+ ff_sdp_write_media(buf, size,
522522 ac[i]->streams[j]->codec, dst[0] ? dst : NULL,
523523 dst_type, (port > 0) ? port + j * 2 : 0, ttl);
524524 if (port <= 0) {
525− av_strlcatf(buff, size,
525+ av_strlcatf(buf, size,
526526 "a=control:streamid=%d\r\n", i + j);
527527 }
528528 }
@@ -531,7 +531,7 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) · 2 unmodified lines
531531 return 0;
532532 }
533533 #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)
535535 {
536536 return AVERROR(ENOSYS);
537537 }
@@ -540,3 +540,10 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des · 2 unmodified lines
540540 {
541541 }
542542 #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
libavformat/tcp.c+5−6
@@ -202,11 +202,10 @@ static int tcp_get_file_handle(URLContext *h) · 201 unmodified lines
202202 }
203203
204204 URLProtocol ff_tcp_protocol = {
205− "tcp",
206− tcp_open,
207− tcp_read,
208− tcp_write,
209− NULL, /* seek */
210− tcp_close,
205+ .name = "tcp",
206+ .url_open = tcp_open,
207+ .url_read = tcp_read,
208+ .url_write = tcp_write,
209+ .url_close = tcp_close,
211210 .url_get_file_handle = tcp_get_file_handle,
212211 };
libavformat/udp.c+5−6
@@ -489,11 +489,10 @@ static int udp_close(URLContext *h) · 488 unmodified lines
489489 }
490490
491491 URLProtocol ff_udp_protocol = {
492− "udp",
493− udp_open,
494− udp_read,
495− udp_write,
496− NULL, /* seek */
497− udp_close,
492+ .name = "udp",
493+ .url_open = udp_open,
494+ .url_read = udp_read,
495+ .url_write = udp_write,
496+ .url_close = udp_close,
498497 .url_get_file_handle = udp_get_file_handle,
499498 };
libavformat/url.h+33−1
@@ -31,7 +31,35 @@ · 30 unmodified lines
3131 #if !FF_API_OLD_AVIO
3232 #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
3333
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;
3563 #endif
3664
3765 /**
@@ -140,4 +168,8 @@ int ffurl_get_file_handle(URLContext *h); · 102 unmodified lines
140168 */
141169 int ffurl_register_protocol(URLProtocol *protocol, int size);
142170
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+
143175 #endif //AVFORMAT_URL_H
libavformat/utils.c+6−2
@@ -219,7 +219,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename, · 218 unmodified lines
219219 #if CONFIG_IMAGE2_MUXER
220220 if (!short_name && filename &&
221221 av_filename_number_test(filename) &&
222− av_guess_image2_codec(filename) != CODEC_ID_NONE) {
222+ ff_guess_image2_codec(filename) != CODEC_ID_NONE) {
223223 return av_guess_format("image2", NULL, NULL);
224224 }
225225 #endif
@@ -272,7 +272,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, · 46 unmodified lines
272272
273273 #if CONFIG_IMAGE2_MUXER
274274 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);
276276 }
277277 #endif
278278 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
35743574 av_hex_dump(f, pkt->data, pkt->size);
35753575 }
35763576
3577+#if FF_API_PKT_DUMP
35773578 void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload)
35783579 {
35793580 AVRational tb = { 1, AV_TIME_BASE };
35803581 pkt_dump_internal(NULL, f, 0, pkt, dump_payload, tb);
35813582 }
3583+#endif
35823584
35833585 void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st)
35843586 {
35853587 pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
35863588 }
35873589
3590+#if FF_API_PKT_DUMP
35883591 void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload)
35893592 {
35903593 AVRational tb = { 1, AV_TIME_BASE };
35913594 pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, tb);
35923595 }
3596+#endif
35933597
35943598 void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
35953599 AVStream *st)
libavformat/version.h+9−0
@@ -104,5 +104,14 @@ · 103 unmodified lines
104104 #ifndef FF_API_FIND_INFO_TAG
105105 #define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54)
106106 #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
107116
108117 #endif //AVFORMAT_VERSION_H

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t