From 026e175775cd9355067e9ff93fb6df3f64b365c2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 7 Apr 2011 19:17:55 +0200 Subject: [PATCH 01/15] avio: deprecate the typedef for URLInterruptCB There's no particular reason to pollute the namespace with a typedef for it. --- libavformat/avio.c | 4 ++-- libavformat/avio.h | 6 ++---- libavformat/url.h | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index 1d40da67ee..e043058974 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -49,7 +49,7 @@ static const AVClass urlcontext_class = static int default_interrupt_cb(void); URLProtocol *first_protocol = NULL; -URLInterruptCB *url_interrupt_cb = default_interrupt_cb; +int (*url_interrupt_cb)(void) = default_interrupt_cb; URLProtocol *av_protocol_next(URLProtocol *p) { @@ -389,7 +389,7 @@ static int default_interrupt_cb(void) return 0; } -void avio_set_interrupt_cb(URLInterruptCB *interrupt_cb) +void avio_set_interrupt_cb(int (*interrupt_cb)(void)) { if (!interrupt_cb) interrupt_cb = default_interrupt_cb; diff --git a/libavformat/avio.h b/libavformat/avio.h index e9aa49991e..701f3fe66c 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -90,11 +90,9 @@ typedef struct URLPollEntry { * silently ignored. */ #define URL_FLAG_NONBLOCK 4 -#endif typedef int URLInterruptCB(void); -#if FF_API_OLD_AVIO /** * @defgroup old_url_funcs Old url_* functions * @deprecated use the buffered API based on AVIOContext instead @@ -117,7 +115,7 @@ attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_siz attribute_deprecated int av_url_read_pause(URLContext *h, int pause); attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index, int64_t timestamp, int flags); -attribute_deprecated void url_set_interrupt_cb(URLInterruptCB *interrupt_cb); +attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void)); #endif /** @@ -132,7 +130,7 @@ int url_exist(const char *url); * in this case by the interrupted function. 'NULL' means no interrupt * callback is given. */ -void avio_set_interrupt_cb(URLInterruptCB *interrupt_cb); +void avio_set_interrupt_cb(int (*interrupt_cb)(void)); #if FF_API_OLD_AVIO /* not implemented */ diff --git a/libavformat/url.h b/libavformat/url.h index 7482611e11..941b8af1d1 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -31,7 +31,7 @@ #if !FF_API_OLD_AVIO #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ -extern URLInterruptCB *url_interrupt_cb; +extern int (*url_interrupt_cb)(void); #endif /** From acaceca2f191b30f64421f6568fd30ad561daec9 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 7 Apr 2011 20:13:36 +0200 Subject: [PATCH 02/15] asfdec: remove a forgotten declaration of nonexistent function --- libavformat/asfdec.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 14ef2a5c37..20b498758e 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -31,8 +31,6 @@ #include "asfcrypt.h" #include "avlanguage.h" -void ff_mms_set_stream_selection(URLContext *h, AVFormatContext *format); - typedef struct { int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID ASFStream streams[128]; ///< it's max number and it's not that big From d6bbe76124c5879099e03754646c4bd70ce5112f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 7 Apr 2011 20:15:43 +0200 Subject: [PATCH 03/15] avio: move two ff_udp_* functions from avio_internal to url.h --- libavformat/avio_internal.h | 4 ---- libavformat/url.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 5ef4cca7dd..2879ee1ed1 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -92,10 +92,6 @@ int ffio_read_pause(AVIOContext *h, int pause); int64_t ffio_read_seek (AVIOContext *h, int stream_index, int64_t timestamp, int flags); -/* udp.c */ -int ff_udp_set_remote_url(URLContext *h, const char *uri); -int ff_udp_get_local_port(URLContext *h); - void ffio_init_checksum(AVIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum); diff --git a/libavformat/url.h b/libavformat/url.h index 941b8af1d1..b8ea6ad2eb 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -140,4 +140,8 @@ int ffurl_get_file_handle(URLContext *h); */ int ffurl_register_protocol(URLProtocol *protocol, int size); +/* udp.c */ +int ff_udp_set_remote_url(URLContext *h, const char *uri); +int ff_udp_get_local_port(URLContext *h); + #endif //AVFORMAT_URL_H From a6aa7a1a14dc12d9d745e5d4a8a7feb38eb1c4da Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 8 Apr 2011 06:57:54 +0200 Subject: [PATCH 04/15] applehttp: don't use deprecated url_ functions. --- libavformat/applehttp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 6c697c50bc..243f4a6a03 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -113,7 +113,7 @@ static void free_variant_list(AppleHTTPContext *c) av_free_packet(&var->pkt); av_free(var->pb.buffer); if (var->input) - url_close(var->input); + ffurl_close(var->input); if (var->ctx) { var->ctx->pb = NULL; av_close_input_file(var->ctx); @@ -291,18 +291,18 @@ reload: goto reload; } - ret = url_open(&v->input, - v->segments[v->cur_seq_no - v->start_seq_no]->url, - AVIO_RDONLY); + ret = ffurl_open(&v->input, + v->segments[v->cur_seq_no - v->start_seq_no]->url, + AVIO_RDONLY); if (ret < 0) return ret; } - ret = url_read(v->input, buf, buf_size); + ret = ffurl_read(v->input, buf, buf_size); if (ret > 0) return ret; if (ret < 0 && ret != AVERROR_EOF) return ret; - url_close(v->input); + ffurl_close(v->input); v->input = NULL; v->cur_seq_no++; @@ -435,7 +435,7 @@ static int recheck_discard_flags(AVFormatContext *s, int first) av_log(s, AV_LOG_INFO, "Now receiving variant %d\n", i); } else if (first && !v->cur_needed && v->needed) { if (v->input) - url_close(v->input); + ffurl_close(v->input); v->input = NULL; v->needed = 0; changed = 1; @@ -517,7 +517,7 @@ static int applehttp_read_seek(AVFormatContext *s, int stream_index, struct variant *var = c->variants[i]; int64_t pos = 0; if (var->input) { - url_close(var->input); + ffurl_close(var->input); var->input = NULL; } av_free_packet(&var->pkt); From f35ff97f2e572a6b02180b248f929541962ffdd3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 8 Apr 2011 07:41:47 +0200 Subject: [PATCH 05/15] lavf: use designated initializers for all protocols This is more readable and makes it easier to reorder URLProtocol members. --- libavformat/applehttpproto.c | 12 ++--- libavformat/concat.c | 11 ++--- libavformat/file.c | 20 ++++---- libavformat/gopher.c | 11 ++--- libavformat/http.c | 16 +++---- libavformat/librtmp.c | 90 ++++++++++++++++-------------------- libavformat/mmst.c | 10 ++-- libavformat/rtmpproto.c | 11 ++--- libavformat/rtpproto.c | 11 ++--- libavformat/tcp.c | 11 ++--- libavformat/udp.c | 11 ++--- 11 files changed, 97 insertions(+), 117 deletions(-) diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c index 52645f7494..8842bd4dcf 100644 --- a/libavformat/applehttpproto.c +++ b/libavformat/applehttpproto.c @@ -298,11 +298,9 @@ static int applehttp_close(URLContext *h) } URLProtocol ff_applehttp_protocol = { - "applehttp", - applehttp_open, - applehttp_read, - NULL, /* write */ - NULL, /* seek */ - applehttp_close, - .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, + .name = "applehttp", + .url_open = applehttp_open, + .url_read = applehttp_read, + .url_close = applehttp_close, + .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, }; diff --git a/libavformat/concat.c b/libavformat/concat.c index dbacc6987a..da9bee2cc4 100644 --- a/libavformat/concat.c +++ b/libavformat/concat.c @@ -190,10 +190,9 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence) } URLProtocol ff_concat_protocol = { - "concat", - concat_open, - concat_read, - NULL, - concat_seek, - concat_close, + .name = "concat", + .url_open = concat_open, + .url_read = concat_read, + .url_seek = concat_seek, + .url_close = concat_close, }; diff --git a/libavformat/file.c b/libavformat/file.c index 729061a4e5..3293a5369b 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -95,12 +95,12 @@ static int file_close(URLContext *h) } URLProtocol ff_file_protocol = { - "file", - file_open, - file_read, - file_write, - file_seek, - file_close, + .name = "file", + .url_open = file_open, + .url_read = file_read, + .url_write = file_write, + .url_seek = file_seek, + .url_close = file_close, .url_get_file_handle = file_get_handle, }; @@ -131,10 +131,10 @@ static int pipe_open(URLContext *h, const char *filename, int flags) } URLProtocol ff_pipe_protocol = { - "pipe", - pipe_open, - file_read, - file_write, + .name = "pipe", + .url_open = pipe_open, + .url_read = file_read, + .url_write = file_write, .url_get_file_handle = file_get_handle, }; diff --git a/libavformat/gopher.c b/libavformat/gopher.c index cfc4424ef1..cfc07e79cf 100644 --- a/libavformat/gopher.c +++ b/libavformat/gopher.c @@ -121,10 +121,9 @@ static int gopher_read(URLContext *h, uint8_t *buf, int size) URLProtocol ff_gopher_protocol = { - "gopher", - gopher_open, - gopher_read, - gopher_write, - NULL, /*seek*/ - gopher_close, + .name = "gopher", + .url_open = gopher_open, + .url_read = gopher_read, + .url_write = gopher_write, + .url_close = gopher_close, }; diff --git a/libavformat/http.c b/libavformat/http.c index 8d20527feb..bcfce80bff 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -505,13 +505,13 @@ http_get_file_handle(URLContext *h) } URLProtocol ff_http_protocol = { - "http", - http_open, - http_read, - http_write, - http_seek, - http_close, + .name = "http", + .url_open = http_open, + .url_read = http_read, + .url_write = http_write, + .url_seek = http_seek, + .url_close = http_close, .url_get_file_handle = http_get_file_handle, - .priv_data_size = sizeof(HTTPContext), - .priv_data_class = &httpcontext_class, + .priv_data_size = sizeof(HTTPContext), + .priv_data_class = &httpcontext_class, }; diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c index f98040297c..5770e59e7a 100644 --- a/libavformat/librtmp.c +++ b/libavformat/librtmp.c @@ -158,66 +158,56 @@ static int rtmp_get_file_handle(URLContext *s) } URLProtocol ff_rtmp_protocol = { - "rtmp", - rtmp_open, - rtmp_read, - rtmp_write, - NULL, /* seek */ - rtmp_close, - NULL, /* next */ - rtmp_read_pause, - rtmp_read_seek, - rtmp_get_file_handle + .name = "rtmp", + .url_open = rtmp_open, + .url_read = rtmp_read, + .url_write = rtmp_write, + .url_close = rtmp_close, + .url_read_pause = rtmp_read_pause, + .url_read_seek = rtmp_read_seek, + .url_get_file_handle = rtmp_get_file_handle }; URLProtocol ff_rtmpt_protocol = { - "rtmpt", - rtmp_open, - rtmp_read, - rtmp_write, - NULL, /* seek */ - rtmp_close, - NULL, /* next */ - rtmp_read_pause, - rtmp_read_seek, - rtmp_get_file_handle + .name = "rtmpt", + .url_open = rtmp_open, + .url_read = rtmp_read, + .url_write = rtmp_write, + .url_close = rtmp_close, + .url_read_pause = rtmp_read_pause, + .url_read_seek = rtmp_read_seek, + .url_get_file_handle = rtmp_get_file_handle }; URLProtocol ff_rtmpe_protocol = { - "rtmpe", - rtmp_open, - rtmp_read, - rtmp_write, - NULL, /* seek */ - rtmp_close, - NULL, /* next */ - rtmp_read_pause, - rtmp_read_seek, - rtmp_get_file_handle + .name = "rtmpe", + .url_open = rtmp_open, + .url_read = rtmp_read, + .url_write = rtmp_write, + .url_close = rtmp_close, + .url_read_pause = rtmp_read_pause, + .url_read_seek = rtmp_read_seek, + .url_get_file_handle = rtmp_get_file_handle }; URLProtocol ff_rtmpte_protocol = { - "rtmpte", - rtmp_open, - rtmp_read, - rtmp_write, - NULL, /* seek */ - rtmp_close, - NULL, /* next */ - rtmp_read_pause, - rtmp_read_seek, - rtmp_get_file_handle + .name = "rtmpte", + .url_open = rtmp_open, + .url_read = rtmp_read, + .url_write = rtmp_write, + .url_close = rtmp_close, + .url_read_pause = rtmp_read_pause, + .url_read_seek = rtmp_read_seek, + .url_get_file_handle = rtmp_get_file_handle }; URLProtocol ff_rtmps_protocol = { - "rtmps", - rtmp_open, - rtmp_read, - rtmp_write, - NULL, /* seek */ - rtmp_close, - NULL, /* next */ - rtmp_read_pause, - rtmp_read_seek, - rtmp_get_file_handle + .name = "rtmps", + .url_open = rtmp_open, + .url_read = rtmp_read, + .url_write = rtmp_write, + .url_close = rtmp_close, + .url_read_pause = rtmp_read_pause, + .url_read_seek = rtmp_read_seek, + .url_get_file_handle = rtmp_get_file_handle }; diff --git a/libavformat/mmst.c b/libavformat/mmst.c index 30219dcecb..a3f260939d 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -623,10 +623,8 @@ static int mms_read(URLContext *h, uint8_t *buf, int size) } URLProtocol ff_mmst_protocol = { - "mmst", - mms_open, - mms_read, - NULL, // write - NULL, // seek - mms_close, + .name = "mmst", + .url_open = mms_open, + .url_read = mms_read, + .url_close = mms_close, }; diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index f1519845f1..9fc5196b2c 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -991,10 +991,9 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) } URLProtocol ff_rtmp_protocol = { - "rtmp", - rtmp_open, - rtmp_read, - rtmp_write, - NULL, /* seek */ - rtmp_close, + .name = "rtmp", + .url_open = rtmp_open, + .url_read = rtmp_read, + .url_write = rtmp_write, + .url_close = rtmp_close, }; diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index 5ac0e1b428..b92b2e7ace 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -355,11 +355,10 @@ int rtp_get_rtcp_file_handle(URLContext *h) { } URLProtocol ff_rtp_protocol = { - "rtp", - rtp_open, - rtp_read, - rtp_write, - NULL, /* seek */ - rtp_close, + .name = "rtp", + .url_open = rtp_open, + .url_read = rtp_read, + .url_write = rtp_write, + .url_close = rtp_close, .url_get_file_handle = rtp_get_file_handle, }; diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 8e380ac374..0cb3ae3262 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -195,11 +195,10 @@ static int tcp_get_file_handle(URLContext *h) } URLProtocol ff_tcp_protocol = { - "tcp", - tcp_open, - tcp_read, - tcp_write, - NULL, /* seek */ - tcp_close, + .name = "tcp", + .url_open = tcp_open, + .url_read = tcp_read, + .url_write = tcp_write, + .url_close = tcp_close, .url_get_file_handle = tcp_get_file_handle, }; diff --git a/libavformat/udp.c b/libavformat/udp.c index 07d1775e96..b881ff95fd 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -489,11 +489,10 @@ static int udp_close(URLContext *h) } URLProtocol ff_udp_protocol = { - "udp", - udp_open, - udp_read, - udp_write, - NULL, /* seek */ - udp_close, + .name = "udp", + .url_open = udp_open, + .url_read = udp_read, + .url_write = udp_write, + .url_close = udp_close, .url_get_file_handle = udp_get_file_handle, }; From c5704b2b9a9cb38e27d24f9962594def16870c52 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 5 Apr 2011 12:59:27 +0200 Subject: [PATCH 06/15] lavf: mark av_pkt_dump(_log) for remove on $next+1 bump. --- libavformat/avformat.h | 4 +++- libavformat/utils.c | 4 ++++ libavformat/version.h | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 61babdcb04..6b1b2b493d 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -978,7 +978,6 @@ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); */ void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); -attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); /** * Send a nice dump of a packet to the log. @@ -994,7 +993,10 @@ attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, AVStream *st); +#if FF_API_PKT_DUMP +attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, +#endif int dump_payload); /** diff --git a/libavformat/utils.c b/libavformat/utils.c index da8f3fd3bd..ca582b34df 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3545,22 +3545,26 @@ static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int av_hex_dump(f, pkt->data, pkt->size); } +#if FF_API_PKT_DUMP void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload) { AVRational tb = { 1, AV_TIME_BASE }; pkt_dump_internal(NULL, f, 0, pkt, dump_payload, tb); } +#endif void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st) { pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base); } +#if FF_API_PKT_DUMP void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload) { AVRational tb = { 1, AV_TIME_BASE }; pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, tb); } +#endif void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, AVStream *st) diff --git a/libavformat/version.h b/libavformat/version.h index 58ef4b846f..512195e82f 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -101,5 +101,8 @@ #ifndef FF_API_FIND_INFO_TAG #define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54) #endif +#ifndef FF_API_PKT_DUMP +#define FF_API_PKT_DUMP (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #endif //AVFORMAT_VERSION_H From c486dade95ba529151391a7879538c9d4787752b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 7 Apr 2011 20:25:52 +0200 Subject: [PATCH 07/15] avio: make URLContext internal. --- libavformat/avio.h | 3 ++- libavformat/avio_internal.h | 1 + libavformat/file.c | 1 + libavformat/http.h | 2 +- libavformat/librtmp.c | 1 + libavformat/mms.h | 2 +- libavformat/rtmppkt.h | 1 + libavformat/rtpdec.h | 1 + libavformat/rtpenc_chain.h | 1 + libavformat/url.h | 11 +++++++++++ 10 files changed, 21 insertions(+), 3 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 701f3fe66c..a97d6308ac 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -37,12 +37,14 @@ /* unbuffered I/O */ +#if FF_API_OLD_AVIO /** * URL Context. * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. * sizeof(URLContext) must not be used outside libav*. + * @deprecated This struct will be made private */ typedef struct URLContext { #if FF_API_URL_CLASS @@ -57,7 +59,6 @@ typedef struct URLContext { int is_connected; } URLContext; -#if FF_API_OLD_AVIO typedef struct URLPollEntry { URLContext *handle; int events; diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 2879ee1ed1..721a3c4602 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -21,6 +21,7 @@ #define AVFORMAT_AVIO_INTERNAL_H #include "avio.h" +#include "url.h" int ffio_init_context(AVIOContext *s, unsigned char *buffer, diff --git a/libavformat/file.c b/libavformat/file.c index 3293a5369b..31067ede69 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -29,6 +29,7 @@ #include #include #include "os_support.h" +#include "url.h" /* standard file protocol */ diff --git a/libavformat/http.h b/libavformat/http.h index 97f54cc71a..c5ff5e134c 100644 --- a/libavformat/http.h +++ b/libavformat/http.h @@ -22,7 +22,7 @@ #ifndef AVFORMAT_HTTP_H #define AVFORMAT_HTTP_H -#include "avio.h" +#include "url.h" /** * Set custom HTTP headers. diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c index 5770e59e7a..db5cc9858b 100644 --- a/libavformat/librtmp.c +++ b/libavformat/librtmp.c @@ -25,6 +25,7 @@ */ #include "avformat.h" +#include "url.h" #include #include diff --git a/libavformat/mms.h b/libavformat/mms.h index e85d59a24f..12e9ef0962 100644 --- a/libavformat/mms.h +++ b/libavformat/mms.h @@ -21,7 +21,7 @@ #ifndef AVFORMAT_MMS_H #define AVFORMAT_MMS_H -#include "avformat.h" +#include "url.h" typedef struct { int id; diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h index 8ad29240bc..bb3475811e 100644 --- a/libavformat/rtmppkt.h +++ b/libavformat/rtmppkt.h @@ -23,6 +23,7 @@ #define AVFORMAT_RTMPPKT_H #include "avformat.h" +#include "url.h" /** maximum possible number of different RTMP channels */ #define RTMP_CHANNELS 65599 diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h index 1d4a9b6337..da53efc1f4 100644 --- a/libavformat/rtpdec.h +++ b/libavformat/rtpdec.h @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "avformat.h" #include "rtp.h" +#include "url.h" typedef struct PayloadContext PayloadContext; typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler; diff --git a/libavformat/rtpenc_chain.h b/libavformat/rtpenc_chain.h index 678b49e27b..6bdddcfe99 100644 --- a/libavformat/rtpenc_chain.h +++ b/libavformat/rtpenc_chain.h @@ -23,6 +23,7 @@ #define AVFORMAT_RTPENC_CHAIN_H #include "avformat.h" +#include "url.h" AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, URLContext *handle, int packet_size); diff --git a/libavformat/url.h b/libavformat/url.h index b8ea6ad2eb..b6c110dfe9 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -32,6 +32,17 @@ #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ extern int (*url_interrupt_cb)(void); + +typedef struct URLContext { + const AVClass *av_class; /**< information for av_log(). Set by url_open(). */ + struct URLProtocol *prot; + void *priv_data; + char *filename; /**< specified URL */ + int flags; + int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */ + int is_streamed; /**< true if streamed (no seek possible), default = false */ + int is_connected; +} URLContext; #endif /** From 5593f031489f54ad184dd2d2744e31006c8627a5 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 7 Apr 2011 21:01:17 +0200 Subject: [PATCH 08/15] avio: make URLProtocol internal. --- libavformat/avio.h | 6 +++++- libavformat/url.h | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index a97d6308ac..c39d2a0444 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -139,8 +139,11 @@ attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout); #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ -#endif +/** + * @deprecated This struct is to be made private. Use the higher-level + * AVIOContext-based API instead. + */ typedef struct URLProtocol { const char *name; int (*url_open)(URLContext *h, const char *url, int flags); @@ -157,6 +160,7 @@ typedef struct URLProtocol { const AVClass *priv_data_class; int flags; } URLProtocol; +#endif #if FF_API_REGISTER_PROTOCOL extern URLProtocol *first_protocol; diff --git a/libavformat/url.h b/libavformat/url.h index b6c110dfe9..bde06d91da 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -43,6 +43,23 @@ typedef struct URLContext { int is_streamed; /**< true if streamed (no seek possible), default = false */ int is_connected; } URLContext; + +typedef struct URLProtocol { + const char *name; + int (*url_open)( URLContext *h, const char *url, int flags); + int (*url_read)( URLContext *h, unsigned char *buf, int size); + int (*url_write)(URLContext *h, const unsigned char *buf, int size); + int64_t (*url_seek)( URLContext *h, int64_t pos, int whence); + int (*url_close)(URLContext *h); + struct URLProtocol *next; + int (*url_read_pause)(URLContext *h, int pause); + int64_t (*url_read_seek)(URLContext *h, int stream_index, + int64_t timestamp, int flags); + int (*url_get_file_handle)(URLContext *h); + int priv_data_size; + const AVClass *priv_data_class; + int flags; +} URLProtocol; #endif /** From a9bf9d8e5349114d37cc3baf0b1e7d95197c5ef8 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 5 Apr 2011 13:13:53 +0200 Subject: [PATCH 09/15] lavf: make av_guess_image2_codec internal It doesn't look very useful as a public function. --- libavformat/avformat.h | 4 +++- libavformat/img2.c | 8 ++++++++ libavformat/internal.h | 2 ++ libavformat/utils.c | 4 ++-- libavformat/version.h | 3 +++ 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 6b1b2b493d..37ec8a9bee 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -899,7 +899,9 @@ AVInputFormat *av_iformat_next(AVInputFormat *f); */ AVOutputFormat *av_oformat_next(AVOutputFormat *f); -enum CodecID av_guess_image2_codec(const char *filename); +#if FF_API_GUESS_IMG2_CODEC +attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename); +#endif /* XXX: Use automatic init with either ELF sections or C file parser */ /* modules. */ diff --git a/libavformat/img2.c b/libavformat/img2.c index 59d9150cdf..2b5d63b0bd 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -24,6 +24,7 @@ #include "libavutil/avstring.h" #include "avformat.h" #include "avio_internal.h" +#include "internal.h" #include typedef struct { @@ -183,9 +184,16 @@ static int read_probe(AVProbeData *p) return 0; } +enum CodecID ff_guess_image2_codec(const char *filename) +{ + return av_str2id(img_tags, filename); +} + +#if FF_API_GUESS_IMG2_CODEC enum CodecID av_guess_image2_codec(const char *filename){ return av_str2id(img_tags, filename); } +#endif static int read_header(AVFormatContext *s1, AVFormatParameters *ap) { diff --git a/libavformat/internal.h b/libavformat/internal.h index 7528dae4eb..9bc23402a4 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -250,4 +250,6 @@ void ff_reduce_index(AVFormatContext *s, int stream_index); void ff_make_absolute_url(char *buf, int size, const char *base, const char *rel); +enum CodecID ff_guess_image2_codec(const char *filename); + #endif /* AVFORMAT_INTERNAL_H */ diff --git a/libavformat/utils.c b/libavformat/utils.c index ca582b34df..1d58682a66 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -218,7 +218,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename, #if CONFIG_IMAGE2_MUXER if (!short_name && filename && av_filename_number_test(filename) && - av_guess_image2_codec(filename) != CODEC_ID_NONE) { + ff_guess_image2_codec(filename) != CODEC_ID_NONE) { return av_guess_format("image2", NULL, NULL); } #endif @@ -271,7 +271,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, #if CONFIG_IMAGE2_MUXER if(!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")){ - codec_id= av_guess_image2_codec(filename); + codec_id= ff_guess_image2_codec(filename); } #endif if(codec_id == CODEC_ID_NONE) diff --git a/libavformat/version.h b/libavformat/version.h index 512195e82f..cfe1f82393 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -104,5 +104,8 @@ #ifndef FF_API_PKT_DUMP #define FF_API_PKT_DUMP (LIBAVFORMAT_VERSION_MAJOR < 54) #endif +#ifndef FF_API_GUESS_IMG2_CODEC +#define FF_API_GUESS_IMG2_CODEC (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #endif //AVFORMAT_VERSION_H From c3675dfe1e345a81d704fa0dd31151b8d54589ee Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 8 Apr 2011 11:36:12 +0200 Subject: [PATCH 10/15] lavf: rename avf_sdp_create to av_sdp_create. The new name is more consistent with the rest of the API. --- ffmpeg.c | 2 +- ffserver.c | 2 +- libavformat/avformat.h | 6 +++++- libavformat/rtspenc.c | 2 +- libavformat/sapenc.c | 2 +- libavformat/sdp.c | 11 +++++++++-- libavformat/version.h | 3 +++ 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 83e77dd51f..46adb9a98d 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1797,7 +1797,7 @@ static void print_sdp(AVFormatContext **avc, int n) { char sdp[2048]; - avf_sdp_create(avc, n, sdp, sizeof(sdp)); + av_sdp_create(avc, n, sdp, sizeof(sdp)); printf("SDP:\n%s\n", sdp); fflush(stdout); } diff --git a/ffserver.c b/ffserver.c index 259aaca05e..eab8ae25ad 100644 --- a/ffserver.c +++ b/ffserver.c @@ -2957,7 +2957,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, avc->streams[i]->codec = stream->streams[i]->codec; } *pbuffer = av_mallocz(2048); - avf_sdp_create(&avc, 1, *pbuffer, 2048); + av_sdp_create(&avc, 1, *pbuffer, 2048); sdp_done: #if !FF_API_MAX_STREAMS diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 37ec8a9bee..26fca88ca6 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1558,7 +1558,11 @@ int av_filename_number_test(const char *filename); * @param size the size of the buffer * @return 0 if OK, AVERROR_xxx on error */ -int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); + +#if FF_API_SDP_CREATE +attribute_deprecated int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); +#endif /** * Return a positive value if the given filename has one of the given diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index 684f2fe558..c1fc97ca8f 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -66,7 +66,7 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr) ff_url_join(sdp_ctx.filename, sizeof(sdp_ctx.filename), "rtsp", NULL, addr, -1, NULL); ctx_array[0] = &sdp_ctx; - if (avf_sdp_create(ctx_array, 1, sdp, SDP_MAX_SIZE)) { + if (av_sdp_create(ctx_array, 1, sdp, SDP_MAX_SIZE)) { av_free(sdp); return AVERROR_INVALIDDATA; } diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index e675986b7d..455e65341f 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -208,7 +208,7 @@ static int sap_write_header(AVFormatContext *s) av_strlcpy(&sap->ann[pos], "application/sdp", sap->ann_size - pos); pos += strlen(&sap->ann[pos]) + 1; - if (avf_sdp_create(contexts, s->nb_streams, &sap->ann[pos], + if (av_sdp_create(contexts, s->nb_streams, &sap->ann[pos], sap->ann_size - pos)) { ret = AVERROR_INVALIDDATA; goto fail; diff --git a/libavformat/sdp.c b/libavformat/sdp.c index 02af7dce1d..0e46c3365f 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -474,7 +474,7 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des sdp_write_media_attributes(buff, size, c, payload_type); } -int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) { AVMetadataTag *title = av_metadata_get(ac[0]->metadata, "title", NULL, 0); struct sdp_session_level s; @@ -531,7 +531,7 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) return 0; } #else -int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) { return AVERROR(ENOSYS); } @@ -540,3 +540,10 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des { } #endif + +#if FF_API_SDP_CREATE +int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) +{ + return av_sdp_create(ac, n_files, buff, size); +} +#endif diff --git a/libavformat/version.h b/libavformat/version.h index cfe1f82393..552a1bda60 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -107,5 +107,8 @@ #ifndef FF_API_GUESS_IMG2_CODEC #define FF_API_GUESS_IMG2_CODEC (LIBAVFORMAT_VERSION_MAJOR < 54) #endif +#ifndef FF_API_SDP_CREATE +#define FF_API_SDP_CREATE (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #endif //AVFORMAT_VERSION_H From c234d40bd9c98fc8c5540135cd5055c12e603a0f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 8 Apr 2011 12:22:39 +0200 Subject: [PATCH 11/15] lavf: rename a parameter of av_sdp_create from buff->buf This is more consistent with the rest of the API. --- libavformat/avformat.h | 6 +++--- libavformat/sdp.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 26fca88ca6..8e18a6131d 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1553,12 +1553,12 @@ int av_filename_number_test(const char *filename); * all the contexts in the array (an AVCodecContext per RTP stream) * must contain only one AVStream. * @param n_files number of AVCodecContexts contained in ac - * @param buff buffer where the SDP will be stored (must be allocated by - * the caller) + * @param buf buffer where the SDP will be stored (must be allocated by + * the caller) * @param size the size of the buffer * @return 0 if OK, AVERROR_xxx on error */ -int av_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size); #if FF_API_SDP_CREATE attribute_deprecated int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); diff --git a/libavformat/sdp.c b/libavformat/sdp.c index 0e46c3365f..005434c6c4 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -474,14 +474,14 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des sdp_write_media_attributes(buff, size, c, payload_type); } -int av_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size) { AVMetadataTag *title = av_metadata_get(ac[0]->metadata, "title", NULL, 0); struct sdp_session_level s; int i, j, port, ttl, is_multicast; char dst[32], dst_type[5]; - memset(buff, 0, size); + memset(buf, 0, size); memset(&s, 0, sizeof(struct sdp_session_level)); s.user = "-"; s.src_addr = "127.0.0.1"; /* FIXME: Properly set this */ @@ -506,7 +506,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) } } } - sdp_write_header(buff, size, &s); + sdp_write_header(buf, size, &s); dst[0] = 0; for (i = 0; i < n_files; i++) { @@ -518,11 +518,11 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) ttl = 0; } for (j = 0; j < ac[i]->nb_streams; j++) { - ff_sdp_write_media(buff, size, + ff_sdp_write_media(buf, size, ac[i]->streams[j]->codec, dst[0] ? dst : NULL, dst_type, (port > 0) ? port + j * 2 : 0, ttl); if (port <= 0) { - av_strlcatf(buff, size, + av_strlcatf(buf, size, "a=control:streamid=%d\r\n", i + j); } } @@ -531,7 +531,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) return 0; } #else -int av_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size) { return AVERROR(ENOSYS); } From f8270bbf8ce891cc614a5562c02ce18a50a89f1d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 4 Apr 2011 08:18:54 +0200 Subject: [PATCH 12/15] avio: add a function for iterating though protocol names. --- libavformat/avio.c | 10 ++++++++++ libavformat/avio.h | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/libavformat/avio.c b/libavformat/avio.c index e043058974..ab7a7f51ec 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -57,6 +57,16 @@ URLProtocol *av_protocol_next(URLProtocol *p) else return first_protocol; } +const char *avio_enum_protocols(void **opaque, int output) +{ + URLProtocol **p = opaque; + *p = *p ? (*p)->next : first_protocol; + if (!*p) return NULL; + if ((output && (*p)->url_write) || (!output && (*p)->url_read)) + return (*p)->name; + return avio_enum_protocols(opaque, output); +} + int ffurl_register_protocol(URLProtocol *protocol, int size) { URLProtocol **p; diff --git a/libavformat/avio.h b/libavformat/avio.h index c39d2a0444..9ea138e080 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -600,4 +600,17 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); int udp_get_file_handle(URLContext *h); #endif +/** + * Iterate through names of available protocols. + * + * @param opaque A private pointer representing current protocol. + * It must be a pointer to NULL on first iteration and will + * be updated by successive calls to avio_enum_protocols. + * @param output If set to 1, iterate over output protocols, + * otherwise over input protocols. + * + * @return A static string containing the name of current protocol or NULL + */ +const char *avio_enum_protocols(void **opaque, int output); + #endif /* AVFORMAT_AVIO_H */ From cdc6a87f193b1bf99a640a44374d4f2597118959 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 4 Apr 2011 20:28:58 +0200 Subject: [PATCH 13/15] avio: deprecate av_protocol_next(). --- cmdutils.c | 20 ++++++++------------ libavformat/avio.c | 2 ++ libavformat/avio.h | 4 +++- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index 6901f5656b..cc10b48e30 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -653,20 +653,16 @@ void show_bsfs(void) void show_protocols(void) { - URLProtocol *up=NULL; + void *opaque = NULL; + const char *name; printf("Supported file protocols:\n" - "I.. = Input supported\n" - ".O. = Output supported\n" - "..S = Seek supported\n" - "FLAGS NAME\n" - "----- \n"); - while((up = av_protocol_next(up))) - printf("%c%c%c %s\n", - up->url_read ? 'I' : '.', - up->url_write ? 'O' : '.', - up->url_seek ? 'S' : '.', - up->name); + "Input:\n"); + while ((name = avio_enum_protocols(&opaque, 0))) + printf("%s\n", name); + printf("Output:\n"); + while ((name = avio_enum_protocols(&opaque, 1))) + printf("%s\n", name); } void show_filters(void) diff --git a/libavformat/avio.c b/libavformat/avio.c index ab7a7f51ec..ad1f1b40c2 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -51,11 +51,13 @@ static int default_interrupt_cb(void); URLProtocol *first_protocol = NULL; int (*url_interrupt_cb)(void) = default_interrupt_cb; +#if FF_API_OLD_AVIO URLProtocol *av_protocol_next(URLProtocol *p) { if(p) return p->next; else return first_protocol; } +#endif const char *avio_enum_protocols(void **opaque, int output) { diff --git a/libavformat/avio.h b/libavformat/avio.h index 9ea138e080..7bb8d175d0 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -170,12 +170,14 @@ extern URLProtocol *first_protocol; extern URLInterruptCB *url_interrupt_cb; #endif +#if FF_API_OLD_AVIO /** * If protocol is NULL, returns the first registered protocol, * if protocol is non-NULL, returns the next registered protocol after protocol, * or NULL if protocol is the last one. */ -URLProtocol *av_protocol_next(URLProtocol *p); +attribute_deprecated URLProtocol *av_protocol_next(URLProtocol *p); +#endif #if FF_API_REGISTER_PROTOCOL /** From 3ee53dabcfd8810d01f114599617cf55e481c291 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 8 Apr 2011 11:21:13 +0200 Subject: [PATCH 14/15] lavf: get rid of ffm-specific stuff in avformat.h --- ffmpeg.c | 2 ++ ffserver.c | 1 + libavformat/avformat.h | 6 ------ libavformat/ffm.h | 5 +++++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 46adb9a98d..841c79895e 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -110,6 +110,8 @@ static const OptionDef options[]; #define MAX_STREAMS 1024 /* arbitrary sanity check value */ #endif +#define FFM_PACKET_SIZE 4096 //XXX a duplicate of the line in ffm.h + static const char *last_asked_format = NULL; static AVFormatContext *input_files[MAX_FILES]; static int64_t input_files_ts_offset[MAX_FILES]; diff --git a/ffserver.c b/ffserver.c index eab8ae25ad..36cd9cedbc 100644 --- a/ffserver.c +++ b/ffserver.c @@ -29,6 +29,7 @@ #include #include #include "libavformat/avformat.h" +#include "libavformat/ffm.h" #include "libavformat/network.h" #include "libavformat/os_support.h" #include "libavformat/rtpdec.h" diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 8e18a6131d..5c8456f337 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1508,12 +1508,6 @@ int64_t parse_date(const char *datestr, int duration); */ int64_t av_gettime(void); -/* ffm-specific for ffserver */ -#define FFM_PACKET_SIZE 4096 -int64_t ffm_read_write_index(int fd); -int ffm_write_write_index(int fd, int64_t pos); -void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size); - #if FF_API_FIND_INFO_TAG /** * @deprecated use av_find_info_tag in libavutil instead. diff --git a/libavformat/ffm.h b/libavformat/ffm.h index 4c088d6912..89a14a5a88 100644 --- a/libavformat/ffm.h +++ b/libavformat/ffm.h @@ -28,6 +28,7 @@ /* The FFM file is made of blocks of fixed size */ #define FFM_HEADER_SIZE 14 +#define FFM_PACKET_SIZE 4096 #define PACKET_ID 0x666d /* each packet contains frames (which can span several packets */ @@ -55,4 +56,8 @@ typedef struct FFMContext { uint8_t packet[FFM_PACKET_SIZE]; } FFMContext; +int64_t ffm_read_write_index(int fd); +int ffm_write_write_index(int fd, int64_t pos); +void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size); + #endif /* AVFORMAT_FFM_H */ From 0c68c804196400de3c40c8849124b292ed62b99c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 8 Apr 2011 11:46:52 +0200 Subject: [PATCH 15/15] lavf: bump minor and add an APIChanges entry for avformat cleanup --- doc/APIchanges | 5 +++++ libavformat/version.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 6f69e05264..7d12737472 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -12,6 +12,11 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-04-08 - lavf 52.106.0 - avformat.h + Minor avformat.h cleanup: + a9bf9d8 deprecate av_guess_image2_codec + c3675df rename avf_sdp_create->av_sdp_create + 2011-04-03 - lavf 52.105.0 - avio.h Large-scale renaming/deprecating of AVIOContext-related functions: 724f6a0 deprecate url_fdopen diff --git a/libavformat/version.h b/libavformat/version.h index 552a1bda60..a29c2c6b5f 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,7 +24,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 105 +#define LIBAVFORMAT_VERSION_MINOR 106 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \