[FFmpeg-devel] [PATCH 1/2] avformat: add callback for opening further files
Michael Niedermayer
michaelni at gmx.at
Mon May 11 21:56:12 CEST 2015
On Mon, May 11, 2015 at 06:12:25PM +0200, wm4 wrote:
> On Mon, 11 May 2015 17:55:57 +0200
> Michael Niedermayer <michaelni at gmx.at> wrote:
>
> > Signed-off-by: Michael Niedermayer <michaelni at 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.
changed
> 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.
theres AVFormatContext.opaque, which i belive can be used
bumped version, added APIChanges entry
applied
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150511/42878dfa/attachment.asc>
More information about the ffmpeg-devel
mailing list