[FFmpeg-devel] [PATCH 3/4] avformat/mxfenc: write reel_name if metadata key is present

Tomas Härdin tjoppen at acc.umu.se
Mon Nov 27 12:40:08 EET 2017


On Sun, 2017-11-26 at 21:42 -0800, Mark Reid wrote:
> @@ -1396,13 +1410,17 @@ static int mxf_write_package(AVFormatContext
> *s, MXFPackage *package)
>      }
>  
>      // write multiple descriptor reference
> -    if (package->type == SourcePackage) {
> +    if (package->instance == 1) {

Would only ever SourcePackage have instance != 0? What if we have
multiple MaterialPackage?
Saying (package->type == SourcePackage && package->instance == 1) might
be appropriate

>          mxf_write_local_tag(pb, 16, 0x4701);
>          if (s->nb_streams > 1) {
>              mxf_write_uuid(pb, MultipleDescriptor, 0);
>              mxf_write_multi_descriptor(s);
>          } else
>              mxf_write_uuid(pb, SubDescriptor, 0);
> +    } else if (package->instance == 2) {

Same here

> +        mxf_write_local_tag(pb, 16, 0x4701);
> +        mxf_write_uuid(pb, TapeDescriptor, 0);
> +        mxf_write_tape_descriptor(s);
>      }
>  
>      // write timecode track
> @@ -1416,7 +1434,7 @@ static int mxf_write_package(AVFormatContext
> *s, MXFPackage *package)
>          mxf_write_sequence(s, st, package);
>          mxf_write_structural_component(s, st, package);
>  
> -        if (package->type == SourcePackage) {
> +        if (package->instance == 1) {

And here

> @@ -1474,6 +1494,26 @@ static int
> mxf_write_header_metadata_sets(AVFormatContext *s)
>          }
>      }
>  
> +    if (entry = av_dict_get(s->metadata, "reel_name", NULL, 0)) {

Parenthesis around this and maybe an equality check. Or move the
assignment outside the if.

> +        packages[2].name = entry->value;
> +    } else {
> +        /* check if any of the streams contain a reel_name */
> +        for (i = 0; i < s->nb_streams; i++) {
> +            st = s->streams[i];
> +            if (entry = av_dict_get(st->metadata, "reel_name", NULL,
> 0)) {
> +                packages[2].name = entry->value;
> +                break;

Is it possible to set more than one reel_name? Conflicting values
should probably result in an error (both s->metadata and st->metadata).

/Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171127/e78e7c44/attachment.sig>


More information about the ffmpeg-devel mailing list