|
@@ -134,6 +134,9 @@ typedef struct { |
|
|
int height; |
|
|
int height; |
|
|
int channels; |
|
|
int channels; |
|
|
int bits_per_sample; |
|
|
int bits_per_sample; |
|
|
|
|
|
unsigned int component_depth; |
|
|
|
|
|
unsigned int horiz_subsampling; |
|
|
|
|
|
unsigned int vert_subsampling; |
|
|
UID *sub_descriptors_refs; |
|
|
UID *sub_descriptors_refs; |
|
|
int sub_descriptors_count; |
|
|
int sub_descriptors_count; |
|
|
int linked_track_id; |
|
|
int linked_track_id; |
|
@@ -789,6 +792,7 @@ static void mxf_read_pixel_layout(AVIOContext *pb, MXFDescriptor *descriptor) |
|
|
static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
|
|
static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) |
|
|
{ |
|
|
{ |
|
|
MXFDescriptor *descriptor = arg; |
|
|
MXFDescriptor *descriptor = arg; |
|
|
|
|
|
descriptor->pix_fmt = PIX_FMT_NONE; |
|
|
switch(tag) { |
|
|
switch(tag) { |
|
|
case 0x3F01: |
|
|
case 0x3F01: |
|
|
descriptor->sub_descriptors_count = avio_rb32(pb); |
|
|
descriptor->sub_descriptors_count = avio_rb32(pb); |
|
@@ -819,6 +823,15 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int |
|
|
descriptor->aspect_ratio.num = avio_rb32(pb); |
|
|
descriptor->aspect_ratio.num = avio_rb32(pb); |
|
|
descriptor->aspect_ratio.den = avio_rb32(pb); |
|
|
descriptor->aspect_ratio.den = avio_rb32(pb); |
|
|
break; |
|
|
break; |
|
|
|
|
|
case 0x3301: |
|
|
|
|
|
descriptor->component_depth = avio_rb32(pb); |
|
|
|
|
|
break; |
|
|
|
|
|
case 0x3302: |
|
|
|
|
|
descriptor->horiz_subsampling = avio_rb32(pb); |
|
|
|
|
|
break; |
|
|
|
|
|
case 0x3308: |
|
|
|
|
|
descriptor->vert_subsampling = avio_rb32(pb); |
|
|
|
|
|
break; |
|
|
case 0x3D03: |
|
|
case 0x3D03: |
|
|
descriptor->sample_rate.num = avio_rb32(pb); |
|
|
descriptor->sample_rate.num = avio_rb32(pb); |
|
|
descriptor->sample_rate.den = avio_rb32(pb); |
|
|
descriptor->sample_rate.den = avio_rb32(pb); |
|
@@ -1294,6 +1307,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) |
|
|
UID *essence_container_ul = NULL; |
|
|
UID *essence_container_ul = NULL; |
|
|
const MXFCodecUL *codec_ul = NULL; |
|
|
const MXFCodecUL *codec_ul = NULL; |
|
|
const MXFCodecUL *container_ul = NULL; |
|
|
const MXFCodecUL *container_ul = NULL; |
|
|
|
|
|
const MXFCodecUL *pix_fmt_ul = NULL; |
|
|
AVStream *st; |
|
|
AVStream *st; |
|
|
|
|
|
|
|
|
if (!(material_track = mxf_resolve_strong_ref(mxf, &material_package->tracks_refs[i], Track))) { |
|
|
if (!(material_track = mxf_resolve_strong_ref(mxf, &material_package->tracks_refs[i], Track))) { |
|
@@ -1427,8 +1441,23 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) |
|
|
st->codec->codec_id = container_ul->id; |
|
|
st->codec->codec_id = container_ul->id; |
|
|
st->codec->width = descriptor->width; |
|
|
st->codec->width = descriptor->width; |
|
|
st->codec->height = descriptor->height; |
|
|
st->codec->height = descriptor->height; |
|
|
if (st->codec->codec_id == CODEC_ID_RAWVIDEO) |
|
|
|
|
|
|
|
|
if (st->codec->codec_id == CODEC_ID_RAWVIDEO) { |
|
|
st->codec->pix_fmt = descriptor->pix_fmt; |
|
|
st->codec->pix_fmt = descriptor->pix_fmt; |
|
|
|
|
|
if (st->codec->pix_fmt == PIX_FMT_NONE) { |
|
|
|
|
|
pix_fmt_ul = mxf_get_codec_ul(ff_mxf_pixel_format_uls, |
|
|
|
|
|
&descriptor->essence_codec_ul); |
|
|
|
|
|
st->codec->pix_fmt = pix_fmt_ul->id; |
|
|
|
|
|
if (st->codec->pix_fmt == PIX_FMT_NONE) { |
|
|
|
|
|
/* support files created before RP224v10 by defaulting to UYVY422 |
|
|
|
|
|
if subsampling is 4:2:2 and component depth is 8-bit */ |
|
|
|
|
|
if (descriptor->horiz_subsampling == 2 && |
|
|
|
|
|
descriptor->vert_subsampling == 1 && |
|
|
|
|
|
descriptor->component_depth == 8) { |
|
|
|
|
|
st->codec->pix_fmt = PIX_FMT_UYVY422; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
st->need_parsing = AVSTREAM_PARSE_HEADERS; |
|
|
st->need_parsing = AVSTREAM_PARSE_HEADERS; |
|
|
} else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { |
|
|
} else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { |
|
|
container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul); |
|
|
container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul); |
|
|