Mercurial > libavformat.hg
comparison mxfdec.c @ 4404:7cf3b77ad6ff libavformat
reuse MXFCodecUL for data def and simplify
author | bcoudurier |
---|---|
date | Sun, 08 Feb 2009 05:12:30 +0000 |
parents | 39f6b190c772 |
children | a079bfd0192b |
comparison
equal
deleted
inserted
replaced
4403:39f6b190c772 | 4404:7cf3b77ad6ff |
---|---|
616 return 1; | 616 return 1; |
617 } | 617 } |
618 | 618 |
619 static const MXFCodecUL *mxf_get_codec_ul(const MXFCodecUL *uls, UID *uid) | 619 static const MXFCodecUL *mxf_get_codec_ul(const MXFCodecUL *uls, UID *uid) |
620 { | 620 { |
621 while (uls->id != CODEC_ID_NONE) { | 621 while (uls->uid[0]) { |
622 if(mxf_match_uid(uls->uid, *uid, uls->matching_len)) | 622 if(mxf_match_uid(uls->uid, *uid, uls->matching_len)) |
623 break; | 623 break; |
624 uls++; | 624 uls++; |
625 } | 625 } |
626 return uls; | 626 return uls; |
627 } | |
628 | |
629 static enum CodecType mxf_get_codec_type(const MXFDataDefinitionUL *uls, UID *uid) | |
630 { | |
631 while (uls->type != CODEC_TYPE_DATA) { | |
632 if(mxf_match_uid(uls->uid, *uid, 16)) | |
633 break; | |
634 uls++; | |
635 } | |
636 return uls->type; | |
637 } | 627 } |
638 | 628 |
639 static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMetadataSetType type) | 629 static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMetadataSetType type) |
640 { | 630 { |
641 int i; | 631 int i; |
755 av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n"); | 745 av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n"); |
756 return -1; | 746 return -1; |
757 } | 747 } |
758 | 748 |
759 PRINT_KEY(mxf->fc, "data definition ul", source_track->sequence->data_definition_ul); | 749 PRINT_KEY(mxf->fc, "data definition ul", source_track->sequence->data_definition_ul); |
760 st->codec->codec_type = mxf_get_codec_type(ff_mxf_data_definition_uls, &source_track->sequence->data_definition_ul); | 750 codec_ul = mxf_get_codec_ul(ff_mxf_data_definition_uls, &source_track->sequence->data_definition_ul); |
751 st->codec->codec_type = codec_ul->id; | |
761 | 752 |
762 source_package->descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor_ref, AnyType); | 753 source_package->descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor_ref, AnyType); |
763 if (source_package->descriptor) { | 754 if (source_package->descriptor) { |
764 if (source_package->descriptor->type == MultipleDescriptor) { | 755 if (source_package->descriptor->type == MultipleDescriptor) { |
765 for (j = 0; j < source_package->descriptor->sub_descriptors_count; j++) { | 756 for (j = 0; j < source_package->descriptor->sub_descriptors_count; j++) { |