diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-11-12 14:50:00 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2021-11-16 10:51:32 +0100 |
commit | ed75a08d36c011db152d89e2c23b2dab55331d93 (patch) | |
tree | b0bbebd307b88e4d7db7f4c7f5f8111c2fe2fe29 /libavformat/utils.c | |
parent | 85433fb937f8ef69077a05a03c347ada46281282 (diff) | |
download | ffmpeg-ed75a08d36c011db152d89e2c23b2dab55331d93.tar.gz |
lavf: add an AVClass to AVStream on next major bump
Also add a function to retrieve that class, analogously to
avformat_get_class().
This will be useful for adding an AVOption for dispositions.
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index bbc61dccbb..dcfbae7d7e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -721,6 +721,17 @@ void avformat_free_context(AVFormatContext *s) av_free(s); } +static const AVClass stream_class = { + .class_name = "AVStream", + .item_name = av_default_item_name, + .version = LIBAVUTIL_VERSION_INT, +}; + +const AVClass *av_stream_get_class(void) +{ + return &stream_class; +} + AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) { FFFormatContext *const si = ffformatcontext(s); @@ -745,6 +756,10 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) return NULL; st = &sti->pub; +#if FF_API_AVSTREAM_CLASS + st->av_class = &stream_class; +#endif + st->codecpar = avcodec_parameters_alloc(); if (!st->codecpar) goto fail; |