From ed75a08d36c011db152d89e2c23b2dab55331d93 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 12 Nov 2021 14:50:00 +0100 Subject: 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. --- libavformat/utils.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libavformat/utils.c') 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; -- cgit v1.2.3