1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

get essence container ul in header and set it per track, check for unsupported codec

Originally committed as revision 15071 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Baptiste Coudurier 2008-08-30 23:54:24 +00:00
parent 179308768a
commit a2f55f22b3

View File

@ -40,6 +40,7 @@ typedef struct {
typedef struct { typedef struct {
UID track_essence_element_key; UID track_essence_element_key;
const UID *essence_container_ul;
} MXFStreamContext; } MXFStreamContext;
typedef struct MXFContext { typedef struct MXFContext {
@ -181,15 +182,15 @@ static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len)
return 0; return 0;
} }
static const MXFCodecUL *mxf_get_essence_container_ul(enum CodecID type) static const UID *mxf_get_essence_container_ul(enum CodecID type)
{ {
const MXFCodecUL *uls = ff_mxf_essence_container_uls; const MXFCodecUL *uls = ff_mxf_essence_container_uls;
while (uls->id != CODEC_ID_NONE) { while (uls->id != CODEC_ID_NONE) {
if (uls->id == type) if (uls->id == type)
break; return &uls->uid;
uls++; uls++;
} }
return uls; return NULL;
} }
static void mxf_write_primer_pack(AVFormatContext *s) static void mxf_write_primer_pack(AVFormatContext *s)
@ -601,7 +602,7 @@ static void mxf_write_multi_descriptor(AVFormatContext *s)
static void mxf_write_generic_desc(ByteIOContext *pb, const MXFDescriptorWriteTableEntry *desc_tbl, AVStream *st) static void mxf_write_generic_desc(ByteIOContext *pb, const MXFDescriptorWriteTableEntry *desc_tbl, AVStream *st)
{ {
const MXFCodecUL *codec_ul; MXFStreamContext *sc = st->priv_data;
put_buffer(pb, desc_tbl->key, 16); put_buffer(pb, desc_tbl->key, 16);
klv_encode_ber_length(pb, 108); klv_encode_ber_length(pb, 108);
@ -616,9 +617,8 @@ static void mxf_write_generic_desc(ByteIOContext *pb, const MXFDescriptorWriteTa
put_be32(pb, st->time_base.den); put_be32(pb, st->time_base.den);
put_be32(pb, st->time_base.num); put_be32(pb, st->time_base.num);
codec_ul = mxf_get_essence_container_ul(st->codec->codec_id);
mxf_write_local_tag(pb, 16, 0x3004); mxf_write_local_tag(pb, 16, 0x3004);
put_buffer(pb, codec_ul->uid, 16); put_buffer(pb, *sc->essence_container_ul, 16);
} }
static void mxf_write_mpegvideo_desc(AVFormatContext *s, const MXFDescriptorWriteTableEntry *desc_tbl, int stream_index) static void mxf_write_mpegvideo_desc(AVFormatContext *s, const MXFDescriptorWriteTableEntry *desc_tbl, int stream_index)
@ -769,6 +769,12 @@ static int mux_write_header(AVFormatContext *s)
av_set_pts_info(st, 64, 1, st->codec->time_base.den); av_set_pts_info(st, 64, 1, st->codec->time_base.den);
else if (st->codec->codec_type == CODEC_TYPE_AUDIO) else if (st->codec->codec_type == CODEC_TYPE_AUDIO)
av_set_pts_info(st, 64, 1, st->codec->sample_rate); av_set_pts_info(st, 64, 1, st->codec->sample_rate);
sc->essence_container_ul = mxf_get_essence_container_ul(st->codec->codec_id);
if (!sc->essence_container_ul) {
av_log(s, AV_LOG_ERROR, "track %d: could not find essence container ul, "
"codec not currently supported in container\n", i);
return -1;
}
} }
mxf_write_partition(s, 0, 1, header_partition_key); mxf_write_partition(s, 0, 1, header_partition_key);