I need to change to 1 for the mxf_data_essence_descriptor. It test some others kings but actually I don't have. And I add the check of the size of the mxf_data_essence_descriptor.
I update and re-submit the patch. thx 2014-07-22 15:26 GMT+02:00 Luca Barbato <[email protected]>: > On 22/07/14 15:12, Marc-Antoine Arnaud wrote: >> --- >> libavformat/mxfdec.c | 15 +++++++++++++++ >> 1 file changed, 15 insertions(+) >> >> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c >> index 58d9027..2d7ac48 100644 >> --- a/libavformat/mxfdec.c >> +++ b/libavformat/mxfdec.c >> @@ -971,6 +971,15 @@ static const MXFCodecUL >> mxf_sound_essence_container_uls[] = { >> { { >> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 >> }, 0, AV_CODEC_ID_NONE }, >> }; >> >> +static const MXFCodecUL mxf_data_essence_container_uls[] = { >> + { { >> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x09,0x0d,0x01,0x03,0x01,0x02,0x0e,0x00,0x00 >> }, 16, 0 }, >> + { { >> 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x09,0x0d,0x01,0x03,0x01,0x02,0x0e,0x00,0x00 >> }, 16, AV_CODEC_ID_NONE }, >> +}; >> + >> +static const char* mxf_data_essence_descriptor[3] = { >> + "vbi_vanc_smpte_436M", >> +}; > > I guess you have other 2 coming, right? =) > >> + >> static int mxf_get_sorted_table_segments(MXFContext *mxf, int >> *nb_sorted_segments, MXFIndexTableSegment ***sorted_segments) >> { >> int i, j, nb_segments = 0; >> @@ -1618,6 +1627,11 @@ static int mxf_parse_structural_metadata(MXFContext >> *mxf) >> } else if (st->codec->codec_id == AV_CODEC_ID_MP2) { >> st->need_parsing = AVSTREAM_PARSE_FULL; >> } >> + } else if (st->codec->codec_type == AVMEDIA_TYPE_DATA) { >> + int data_codec_id; >> + data_codec_id = >> mxf_get_codec_ul(mxf_data_essence_container_uls, essence_container_ul)->id; >> + if(data_codec_id >= 0) > > You should validate if it fits the mxf_data_essence_descriptor to avoid > to go outside the buffer. (while at it "if (") > >> + av_dict_set(&st->metadata, "data_type", >> mxf_data_essence_descriptor[data_codec_id], 0); >> } >> if (descriptor->extradata) { >> st->codec->extradata = av_mallocz(descriptor->extradata_size + >> FF_INPUT_BUFFER_PADDING_SIZE); >> @@ -1790,6 +1804,7 @@ static const MXFMetadataReadTableEntry >> mxf_metadata_read_table[] = { >> { { >> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x51,0x00 >> }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* >> MPEG 2 Video */ >> { { >> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x48,0x00 >> }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* >> Wave */ >> { { >> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x47,0x00 >> }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* >> AES3 */ >> + { { >> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x5c,0x00 >> }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* >> VANC/VBI - SMPTE 436M */ >> { { >> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x3A,0x00 >> }, mxf_read_track, sizeof(MXFTrack), Track }, /* Static Track */ >> { { >> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x3B,0x00 >> }, mxf_read_track, sizeof(MXFTrack), Track }, /* Generic Track */ >> { { >> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x04,0x01,0x02,0x02,0x00,0x00 >> }, mxf_read_cryptographic_context, sizeof(MXFCryptoContext), CryptoContext >> }, >> > > Beside that looks fine. > > lu > > _______________________________________________ > libav-devel mailing list > [email protected] > https://lists.libav.org/mailman/listinfo/libav-devel -- Marc-Antoine | e: [email protected] | tel: 06-84-71-84-45 | ohloh: http://bit.ly/1iwtlsU _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
