diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-02-08 05:12:30 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-02-08 05:12:30 +0000 |
commit | 5ac4d7689d753147f89b3322593d6998e32d27c4 (patch) | |
tree | 50b467ac3ac14896987aa760458768383c1244df | |
parent | 251bf87560c0c4d1c0a35e73eed76fa6d60a6ab3 (diff) | |
download | ffmpeg-5ac4d7689d753147f89b3322593d6998e32d27c4.tar.gz |
reuse MXFCodecUL for data def and simplify
Originally committed as revision 17042 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/mxf.c | 9 | ||||
-rw-r--r-- | libavformat/mxf.h | 9 | ||||
-rw-r--r-- | libavformat/mxfdec.c | 15 | ||||
-rw-r--r-- | libavformat/mxfenc.c | 10 |
4 files changed, 14 insertions, 29 deletions
diff --git a/libavformat/mxf.c b/libavformat/mxf.c index cd84cb5264..05cb173ac3 100644 --- a/libavformat/mxf.c +++ b/libavformat/mxf.c @@ -24,11 +24,10 @@ /** * SMPTE RP224 http://www.smpte-ra.org/mdd/index.html */ -const MXFDataDefinitionUL ff_mxf_data_definition_uls[] = { - { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x01,0x03,0x02,0x02,0x01,0x00,0x00,0x00 }, CODEC_TYPE_VIDEO }, - { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x01,0x03,0x02,0x02,0x02,0x00,0x00,0x00 }, CODEC_TYPE_AUDIO }, - { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x05,0x01,0x03,0x02,0x02,0x02,0x02,0x00,0x00 }, CODEC_TYPE_AUDIO }, - { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, CODEC_TYPE_DATA }, +const MXFCodecUL ff_mxf_data_definition_uls[] = { + { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x01,0x03,0x02,0x02,0x01,0x00,0x00,0x00 }, 13, CODEC_TYPE_VIDEO }, + { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x01,0x03,0x02,0x02,0x02,0x00,0x00,0x00 }, 13, CODEC_TYPE_AUDIO }, + { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 0, CODEC_TYPE_DATA }, }; const MXFCodecUL ff_mxf_codec_uls[] = { diff --git a/libavformat/mxf.h b/libavformat/mxf.h index ff6ad00249..99553a5378 100644 --- a/libavformat/mxf.h +++ b/libavformat/mxf.h @@ -55,15 +55,10 @@ typedef struct { typedef struct { UID uid; unsigned matching_len; - enum CodecID id; + int id; } MXFCodecUL; -typedef struct { - UID uid; - enum CodecType type; -} MXFDataDefinitionUL; - -extern const MXFDataDefinitionUL ff_mxf_data_definition_uls[]; +extern const MXFCodecUL ff_mxf_data_definition_uls[]; extern const MXFCodecUL ff_mxf_codec_uls[]; #ifdef DEBUG diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 7090e23fd1..3933d4c87e 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -618,7 +618,7 @@ static int mxf_match_uid(const UID key, const UID uid, int len) static const MXFCodecUL *mxf_get_codec_ul(const MXFCodecUL *uls, UID *uid) { - while (uls->id != CODEC_ID_NONE) { + while (uls->uid[0]) { if(mxf_match_uid(uls->uid, *uid, uls->matching_len)) break; uls++; @@ -626,16 +626,6 @@ static const MXFCodecUL *mxf_get_codec_ul(const MXFCodecUL *uls, UID *uid) return uls; } -static enum CodecType mxf_get_codec_type(const MXFDataDefinitionUL *uls, UID *uid) -{ - while (uls->type != CODEC_TYPE_DATA) { - if(mxf_match_uid(uls->uid, *uid, 16)) - break; - uls++; - } - return uls->type; -} - static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMetadataSetType type) { int i; @@ -757,7 +747,8 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) } PRINT_KEY(mxf->fc, "data definition ul", source_track->sequence->data_definition_ul); - st->codec->codec_type = mxf_get_codec_type(ff_mxf_data_definition_uls, &source_track->sequence->data_definition_ul); + codec_ul = mxf_get_codec_ul(ff_mxf_data_definition_uls, &source_track->sequence->data_definition_ul); + st->codec->codec_type = codec_ul->id; source_package->descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor_ref, AnyType); if (source_package->descriptor) { diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 6381cad603..361c52da89 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -325,11 +325,11 @@ static void mxf_free(AVFormatContext *s) } } -static const MXFDataDefinitionUL *mxf_get_data_definition_ul(enum CodecType type) +static const MXFCodecUL *mxf_get_data_definition_ul(int type) { - const MXFDataDefinitionUL *uls = ff_mxf_data_definition_uls; - while (uls->type != CODEC_TYPE_DATA) { - if (type == uls->type) + const MXFCodecUL *uls = ff_mxf_data_definition_uls; + while (uls->uid[0]) { + if (type == uls->id) break; uls++; } @@ -509,7 +509,7 @@ static void mxf_write_track(AVFormatContext *s, AVStream *st, enum MXFMetadataSe static void mxf_write_common_fields(ByteIOContext *pb, AVStream *st) { - const MXFDataDefinitionUL *data_def_ul = mxf_get_data_definition_ul(st->codec->codec_type); + const MXFCodecUL *data_def_ul = mxf_get_data_definition_ul(st->codec->codec_type); MXFStreamContext *sc = st->priv_data; // find data define uls |