[FFmpeg-devel] [PATCH 07/10] lavf: document that AVStream::codecpar may be modified by lavf after avformat_write_header(). This is assumed not to break API because it's already true (see e.g. matroskaenc handling of new AAC extradata)

James Almer jamrial at gmail.com
Fri Mar 16 00:46:21 EET 2018


On 3/14/2018 3:24 AM, Rodger Combs wrote:
> This is assumed not to break API because it's already true (see e.g.
> matroskaenc handling of new AAC extradata)

That's an API violation from the muxer's part instead. The correct
approach is to fix the violation, not adapt the API around it.

> ---
>  libavformat/avformat.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 9e87d6cdac..5f0ebfc114 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1006,7 +1006,8 @@ typedef struct AVStream {
>       *
>       * - demuxing: filled by libavformat on stream creation or in
>       *             avformat_find_stream_info()
> -     * - muxing: filled by the caller before avformat_write_header()
> +     * - muxing: filled by the caller before avformat_write_header();
> +     * -         may be modified by libavformat afterwards

Personally I'd rather fix the current muxer-level violations and if
needed store any such changes in a separate struct in AVStreamInternal
instead when dealing with generic code (Namely patch 9/10 from this set).
But if others are fine with introducing this definition change then i
wont block it.

>       */
>      AVCodecParameters *codecpar;
>  
> 



More information about the ffmpeg-devel mailing list