[FFmpeg-devel] [PATCH v3 1/2] avcodec/codec_par: Add codec properties field to AVCodecParameters

Soft Works softworkz at hotmail.com
Wed Oct 6 11:09:29 EEST 2021



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> Soft Works
> Sent: Wednesday, October 6, 2021 8:45 AM
> To: ffmpeg-devel at ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH v3 1/2] avcodec/codec_par: Add codec
> properties field to AVCodecParameters
> 
> This fixes incorrect display of closed_captions property in ffprobe.
> 
> Repro Example:
> ffprobe -show_entries stream=closed_captions:disposition=:side_data=
> "http://streams.videolan.org/streams/ts/CC/NewsStream-608-ac3.ts"
> 
> While the codec string included "Closed Captions",
> the stream data is showed: closed_captions=0
> 
> The test ref was incorrect as the test media file actually does
> have cc, which is fixed by this commit, so the test ref needs
> to be updated.
> 
> Signed-off-by: softworkz <softworkz at hotmail.com>
> ---
> v3: Moved test update to the right (this) commit
> 
>  doc/APIchanges          | 3 +++
>  libavcodec/codec_par.c  | 2 ++
>  libavcodec/codec_par.h  | 4 ++++
>  libavcodec/version.h    | 2 +-
>  tests/ref/fate/ts-demux | 2 +-
>  5 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 7b267a79ac..2be3303efa 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -14,6 +14,9 @@ libavutil:     2021-04-27
> 
>  API changes, most recent first:
> 
> +2021-10-07 - xxxxxxxxxx - lavc 59.11.100 - codec_par.h
> +  Add codec properties field to AVCodecParameters
> +
>  2021-09-21 - xxxxxxxxxx - lavu 57.7.100 - pixfmt.h
>    Add AV_PIX_FMT_X2BGR10.
> 
> diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c
> index 1a5168a04b..f6c13f7d11 100644
> --- a/libavcodec/codec_par.c
> +++ b/libavcodec/codec_par.c
> @@ -101,6 +101,7 @@ int
> avcodec_parameters_from_context(AVCodecParameters *par,
>      par->bits_per_raw_sample   = codec->bits_per_raw_sample;
>      par->profile               = codec->profile;
>      par->level                 = codec->level;
> +    par->properties            = codec->properties;
> 
>      switch (par->codec_type) {
>      case AVMEDIA_TYPE_VIDEO:
> @@ -156,6 +157,7 @@ int avcodec_parameters_to_context(AVCodecContext
> *codec,
>      codec->bits_per_raw_sample   = par->bits_per_raw_sample;
>      codec->profile               = par->profile;
>      codec->level                 = par->level;
> +    codec->properties            = par->properties;
> 
>      switch (par->codec_type) {
>      case AVMEDIA_TYPE_VIDEO:
> diff --git a/libavcodec/codec_par.h b/libavcodec/codec_par.h
> index 10cf79dff1..42ed8deb13 100644
> --- a/libavcodec/codec_par.h
> +++ b/libavcodec/codec_par.h
> @@ -198,6 +198,10 @@ typedef struct AVCodecParameters {
>       * Audio only. Number of samples to skip after a discontinuity.
>       */
>      int seek_preroll;
> +    /**
> +     * Codec properties of the stream that gets decoded
> +     */
> +    unsigned properties;
>  } AVCodecParameters;
> 
>  /**
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 4bd22f7e93..1c28fd0be5 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -28,7 +28,7 @@
>  #include "libavutil/version.h"
> 
>  #define LIBAVCODEC_VERSION_MAJOR  59
> -#define LIBAVCODEC_VERSION_MINOR  10
> +#define LIBAVCODEC_VERSION_MINOR  11
>  #define LIBAVCODEC_VERSION_MICRO 100
> 
>  #define LIBAVCODEC_VERSION_INT
> AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
> index 8e7a81da41..1d1382cf37 100644
> --- a/tests/ref/fate/ts-demux
> +++ b/tests/ref/fate/ts-demux
> @@ -41,7 +41,7 @@
> packet|codec_type=audio|stream_index=2|pts=3912642700|pts_time=43473.
> 807778|dts=
> 
> packet|codec_type=video|stream_index=0|pts=3912686363|pts_time=43474.
> 292922|dts=3912686363|dts_time=43474.292922|duration=1501|duration_ti
> me=0.016678|size=4944|pos=506660|flags=__|data_hash=CRC32:54a86cbb
> 
> packet|codec_type=audio|stream_index=1|pts=3912644825|pts_time=43473.
> 831389|dts=3912644825|dts_time=43473.831389|duration=2880|duration_ti
> me=0.032000|size=906|pos=474888|flags=K_|data_hash=CRC32:0893d398
> 
> packet|codec_type=audio|stream_index=2|pts=3912645580|pts_time=43473.
> 839778|dts=3912645580|dts_time=43473.839778|duration=2880|duration_ti
> me=0.032000|size=354|pos=491808|flags=K_|data_hash=CRC32:f5963fa6
> -
> stream|index=0|codec_name=mpeg2video|profile=4|codec_type=video|codec
> _tag_string=[2][0][0][0]|codec_tag=0x0002|width=1280|height=720|coded
> _width=0|coded_height=0|closed_captions=0|film_grain=0|has_b_frames=1
> |sample_aspect_ratio=1:1|display_aspect_ratio=16:9|pix_fmt=yuv420p|le
> vel=4|color_range=tv|color_space=unknown|color_transfer=unknown|color
> _primaries=unknown|chroma_location=left|field_order=progressive|refs=
> 1|id=0x31|r_frame_rate=60000/1001|avg_frame_rate=60000/1001|time_base
> =1/90000|start_pts=3912669846|start_time=43474.109400|duration_ts=195
> 19|duration=0.216878|bit_rate=15000000|max_bit_rate=N/A|bits_per_raw_
> sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=15|extrad
> ata_hash=CRC32:53134fa8|disposition:default=0|disposition:dub=0|dispo
> sition:original=0|disposition:comment=0|disposition:lyrics=0|disposit
> ion:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|dis
> position:visual_impaired=0|disposition:clean_effects=0|disposition:at
> tached_pic=0|disposition:timed_

Line break was inserted here!

> thumbnails=0|disposition:captions=0|disposition:descriptions=0|dispos
> ition:metadata=0|disposition:dependent=0|disposition:still_image=0
> +stream|index=0|codec_name=mpeg2video|profile=4|codec_type=video|code
> c_tag_string=[2][0][0][0]|codec_tag=0x0002|width=1280|height=720|code
> d_width=0|coded_height=0|closed_captions=1|film_grain=0|has_b_frames=
> 1|sample_aspect_ratio=1:1|display_aspect_ratio=16:9|pix_fmt=yuv420p|l
> evel=4|color_range=tv|color_space=unknown|color_transfer=unknown|colo
> r_primaries=unknown|chroma_location=left|field_order=progressive|refs
> =1|id=0x31|r_frame_rate=60000/1001|avg_frame_rate=60000/1001|time_bas
> e=1/90000|start_pts=3912669846|start_time=43474.109400|duration_ts=19
> 519|duration=0.216878|bit_rate=15000000|max_bit_rate=N/A|bits_per_raw
> _sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=15|extra
> data_hash=CRC32:53134fa8|disposition:default=0|disposition:dub=0|disp
> osition:original=0|disposition:comment=0|disposition:lyrics=0|disposi
> tion:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|di
> sposition:visual_impaired=0|disposition:clean_effects=0|disposition:a
> ttached_pic=0|disposition:timed_

Line break was inserted here!

> thumbnails=0|disposition:captions=0|disposition:descriptions=0|dispos
> ition:metadata=0|disposition:dependent=0|disposition:still_image=0
>  side_data|side_data_type=CPB
> properties|max_bitrate=15000000|min_bitrate=0|avg_bitrate=0|buffer_si
> ze=9781248|vbv_delay=-1
> 
> stream|index=1|codec_name=ac3|profile=unknown|codec_type=audio|codec_
> tag_string=[4][0][0][0]|codec_tag=0x0004|sample_fmt=fltp|sample_rate=
> 48000|channels=6|channel_layout=5.1(side)|bits_per_sample=0|id=0x34|r
> _frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=391263
> 3305|start_time=43473.703389|duration_ts=14400|duration=0.160000|bit_
> rate=384000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb
> _read_frames=N/A|nb_read_packets=5|disposition:default=0|disposition:
> dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics
> =0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_imp
> aired=0|disposition:visual_impaired=0|disposition:clean_effects=0|dis
> position:attached_pic=0|disposition:timed_thumbnails=0|disposition:ca
> ptions=0|disposition:descriptions=0|disposition:metadata=0|dispositio
> n:dependent=0|disposition:still_image=0|tag:language=eng
> 
> stream|index=2|codec_name=ac3|profile=unknown|codec_type=audio|codec_
> tag_string=[4][0][0][0]|codec_tag=0x0004|sample_fmt=fltp|sample_rate=
> 48000|channels=2|channel_layout=stereo|bits_per_sample=0|id=0x35|r_fr
> ame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=391263406
> 0|start_time=43473.711778|duration_ts=14400|duration=0.160000|bit_rat
> e=192000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_re
> ad_frames=N/A|nb_read_packets=5|disposition:default=0|disposition:dub
> =0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|
> disposition:karaoke=0|disposition:forced=0|disposition:hearing_impair
> ed=0|disposition:visual_impaired=0|disposition:clean_effects=0|dispos
> ition:attached_pic=0|disposition:timed_thumbnails=0|disposition:capti
> ons=0|disposition:descriptions=0|disposition:metadata=0|disposition:d
> ependent=0|disposition:still_image=0|tag:language=es
> --

I used to think that it's caused by Outlook, but I had BCCed this
patch to 3 other e-mail accounts and at all of them, the message has
arrived without those erroneous line breaks added.

Is it the mailing list which adds those line breaks?

Kind regards,
softworkz





More information about the ffmpeg-devel mailing list