diff options
Diffstat (limited to 'libavformat/avformat.h')
-rw-r--r-- | libavformat/avformat.h | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 273a6ae..34bad43 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1780,7 +1780,6 @@ typedef struct AVFormatContext { /** * User data. * This is a place for some private data of the user. - * Mostly usable with control_message_cb or any future callbacks in device's context. */ void *opaque; @@ -1811,6 +1810,7 @@ typedef struct AVFormatContext { */ enum AVCodecID data_codec_id; +#if FF_API_OLD_OPEN_CALLBACKS /** * Called to open further IO contexts when needed for demuxing. * @@ -1825,8 +1825,12 @@ typedef struct AVFormatContext { * @See av_format_set_open_cb() * * Demuxing: Set by user. + * + * @deprecated Use io_open and io_close. */ + attribute_deprecated int (*open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options); +#endif /** * ',' separated list of allowed protocols. @@ -1834,6 +1838,34 @@ typedef struct AVFormatContext { * - decoding: set by user through AVOptions (NO direct access) */ char *protocol_whitelist; + + /* + * A callback for opening new IO streams. + * + * Certain muxers or demuxers (e.g. for various playlist-based formats) need + * to open additional files during muxing or demuxing. This callback allows + * the caller to provide custom IO in such cases. + * + * @param s the format context + * @param pb on success, the newly opened IO context should be returned here + * @param url the url to open + * @param flags a combination of AVIO_FLAG_* + * @param options a dictionary of additional options, with the same + * semantics as in avio_open2() + * @return 0 on success, a negative AVERROR code on failure + * + * @note Certain muxers and demuxers do nesting, i.e. they open one or more + * additional internal format contexts. Thus the AVFormatContext pointer + * passed to this callback may be different from the one facing the caller. + * It will, however, have the same 'opaque' field. + */ + int (*io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, + int flags, AVDictionary **options); + + /** + * A callback for closing the streams opened with AVFormatContext.io_open(). + */ + void (*io_close)(struct AVFormatContext *s, AVIOContext *pb); } AVFormatContext; int av_format_get_probe_score(const AVFormatContext *s); @@ -1851,8 +1883,10 @@ 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); +#if FF_API_OLD_OPEN_CALLBACKS +attribute_deprecated AVOpenCallback av_format_get_open_cb(const AVFormatContext *s); +attribute_deprecated void av_format_set_open_cb(AVFormatContext *s, AVOpenCallback callback); +#endif /** * This function will cause global side data to be injected in the next packet |