Merge commit '259fe7280d0b63dc7a8ff017d44f26d3a84cfde8'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 28 Jul 2014 22:17:58 +0000 (00:17 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 28 Jul 2014 22:18:03 +0000 (00:18 +0200)
* commit '259fe7280d0b63dc7a8ff017d44f26d3a84cfde8':
  mxf: Extract origin information from material and source track

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/mxfdec.c

@@@ -715,9 -687,14 +716,12 @@@ static int mxf_read_sequence(void *arg
      case 0x0201:
          avio_read(pb, sequence->data_definition_ul, 16);
          break;
+         case 0x4b02:
+         sequence->origin = avio_r8(pb);
+         break;
      case 0x1001:
          sequence->structural_components_count = avio_rb32(pb);
 -        if (sequence->structural_components_count >= UINT_MAX / sizeof(UID))
 -            return AVERROR_INVALIDDATA;
 -        sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID));
 +        sequence->structural_components_refs = av_calloc(sequence->structural_components_count, sizeof(UID));
          if (!sequence->structural_components_refs)
              return AVERROR(ENOMEM);
          avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */
@@@ -1627,11 -1593,20 +1631,21 @@@ static int mxf_parse_structural_metadat
                  }
              }
              st->need_parsing = AVSTREAM_PARSE_HEADERS;
+             if (material_track->sequence->origin) {
+                 char material_origin[3];
+                 snprintf(material_origin, sizeof(material_origin), "%d", material_track->sequence->origin);
+                 av_dict_set(&st->metadata, "material_track_origin", material_origin, 0);
+             }
+             if (source_track->sequence->origin) {
+                 char source_origin[3];
+                 snprintf(source_origin, sizeof(source_origin), "%d", source_track->sequence->origin);
+                 av_dict_set(&st->metadata, "source_track_origin", source_origin, 0);
+             }
          } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
              container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul);
 -            if (st->codec->codec_id == AV_CODEC_ID_NONE)
 -                st->codec->codec_id = container_ul->id;
 +            /* Only overwrite existing codec ID if it is unset or A-law, which is the default according to SMPTE RP 224. */
 +            if (st->codec->codec_id == AV_CODEC_ID_NONE || (st->codec->codec_id == AV_CODEC_ID_PCM_ALAW && (enum AVCodecID)container_ul->id != AV_CODEC_ID_NONE))
 +                st->codec->codec_id = (enum AVCodecID)container_ul->id;
              st->codec->channels = descriptor->channels;
              st->codec->bits_per_coded_sample = descriptor->bits_per_sample;