On Mon, 11 May 2015 17:55:57 +0200 Michael Niedermayer <michae...@gmx.at> wrote:
> Signed-off-by: Michael Niedermayer <michae...@gmx.at> > --- > libavformat/avformat.h | 6 ++++++ > libavformat/utils.c | 1 + > 2 files changed, 7 insertions(+) > > diff --git a/libavformat/avformat.h b/libavformat/avformat.h > index 339ff52..2e840a7 100644 > --- a/libavformat/avformat.h > +++ b/libavformat/avformat.h > @@ -1237,6 +1237,8 @@ typedef struct AVChapter { > typedef int (*av_format_control_message)(struct AVFormatContext *s, int type, > void *data, size_t data_size); > > +typedef int (*AVOpenCallback)(AVIOContext **s, const char *url, int flags, > + const AVIOInterruptCB *int_cb, AVDictionary > **options); > > /** > * The duration of a video can be estimated through various ways, and this > enum can be used > @@ -1780,6 +1782,8 @@ typedef struct AVFormatContext { > * Demuxing: Set by user. > */ > enum AVCodecID data_codec_id; > + > + int (*open_cb)(AVIOContext **s, const char *url, int flags, const > AVIOInterruptCB *int_cb, AVDictionary **options); > } AVFormatContext; > > int av_format_get_probe_score(const AVFormatContext *s); > @@ -1797,6 +1801,8 @@ void * av_format_get_opaque(const AVFormatContext > *s); > void av_format_set_opaque(AVFormatContext *s, void *opaque); > av_format_control_message av_format_get_control_message_cb(const > AVFormatContext *s); > void av_format_set_control_message_cb(AVFormatContext *s, > av_format_control_message callback); > +AVOpenCallback av_format_get_open_cb(const AVFormatContext *s); > +void av_format_set_open_cb(AVFormatContext *s, AVOpenCallback callback); > > /** > * This function will cause global side data to be injected in the next > packet > diff --git a/libavformat/utils.c b/libavformat/utils.c > index d1f1d09..db2b4f6 100644 > --- a/libavformat/utils.c > +++ b/libavformat/utils.c > @@ -112,6 +112,7 @@ MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, > data_codec) > MAKE_ACCESSORS(AVFormatContext, format, int, metadata_header_padding) > MAKE_ACCESSORS(AVFormatContext, format, void *, opaque) > MAKE_ACCESSORS(AVFormatContext, format, av_format_control_message, > control_message_cb) > +MAKE_ACCESSORS(AVFormatContext, format, AVOpenCallback, open_cb) > > int64_t av_stream_get_end_pts(const AVStream *st) > { Looks almost good. I think the callback should have the AVFormatContext as a parameter. Is there a context field in AVFormatContext for free use by the API user? If not, an opaque context parameter for the callback set by av_format_set_open_cb() is also good. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel