[FFmpeg-devel] [PATCH 1/6] avformat/mxfdec: use MXFCodecUL struct to store essence description for data_essence_container_uls

Tomas Härdin tjoppen at acc.umu.se
Tue Jun 5 14:19:19 EEST 2018


tor 2018-05-31 klockan 02:05 +0200 skrev Marton Balint:
> > Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  libavformat/mxf.h    |  1 +
>  libavformat/mxfdec.c | 16 ++++------------
>  2 files changed, 5 insertions(+), 12 deletions(-)
> 
> diff --git a/libavformat/mxf.h b/libavformat/mxf.h
> index ffcc429a8b..19f8d8a9f5 100644
> --- a/libavformat/mxf.h
> +++ b/libavformat/mxf.h
> @@ -68,6 +68,7 @@ typedef struct MXFCodecUL {
>      UID uid;
>      unsigned matching_len;
>      int id;

Is "id" really needed now?

> +    const char *desc;
>  } MXFCodecUL;
>  
>  typedef struct {
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index bd46572e48..1099616174 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -1278,14 +1278,10 @@ static const MXFCodecUL mxf_sound_essence_container_uls[] = {
>  };
>  
>  static const MXFCodecUL mxf_data_essence_container_uls[] = {
> -    { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x09,0x0d,0x01,0x03,0x01,0x02,0x0e,0x00,0x00 }, 16, 0 },
> +    { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x09,0x0d,0x01,0x03,0x01,0x02,0x0e,0x00,0x00 }, 16, AV_CODEC_ID_NONE, "vbi_vanc_smpte_436M" },
>      { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0, AV_CODEC_ID_NONE },
>  };
>  
> -static const char * const mxf_data_essence_descriptor[] = {
> -    "vbi_vanc_smpte_436M",
> -};
> -
>  static int mxf_get_sorted_table_segments(MXFContext *mxf, int *nb_sorted_segments, MXFIndexTableSegment ***sorted_segments)
>  {
>      int i, j, nb_segments = 0;
> @@ -2354,13 +2350,9 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
>                  st->need_parsing = AVSTREAM_PARSE_FULL;
>              }
>          } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {
> -            int codec_id = mxf_get_codec_ul(mxf_data_essence_container_uls,
> -                                            essence_container_ul)->id;
> -            if (codec_id >= 0 &&
> -                codec_id < FF_ARRAY_ELEMS(mxf_data_essence_descriptor)) {
> -                av_dict_set(&st->metadata, "data_type",
> -                            mxf_data_essence_descriptor[codec_id], 0);
> -            }
> +            container_ul = mxf_get_codec_ul(mxf_data_essence_container_uls, essence_container_ul);
> +            if (container_ul->desc)
> +                av_dict_set(&st->metadata, "data_type", container_ul->desc, 0);
>          }
>          if (descriptor->extradata) {
>              if (!ff_alloc_extradata(st->codecpar, descriptor->extradata_size)) {

Else it looks good

/Tomas


More information about the ffmpeg-devel mailing list