Re: [FFmpeg-devel] [PATCH v4] libavformat/mxfdec.c: support demuxing opatom audio without index
On Sun, Jan 18, 2015 at 1:11 PM, Michael Niedermayer wrote: > On Sun, Jan 18, 2015 at 02:43:21PM +0100, Tomas Härdin wrote: > > On Wed, 2015-01-14 at 19:26 -0800, Mark Reid wrote: > > > changes since v3: > > > * return if there isn’t exactly one partition > > > * cosmetic and gcc cleanups > > > * added comment about EditUnitByteCount > > > > > > --- > > > libavformat/mxfdec.c | 59 > > > > 1 file changed, 59 insertions(+) > > > > Looks good to me :) > > applied > > > > > > Maybe there could be added a FATE test for it too, I'm no longer sure > > how that works. > > if theres a file that i should upload to the fate samples > i just need to know which and into which directory > also the file should be as small as possible without compromising > the tests usefullness > > and a patch that adds a test which uses the file would be needed > as well > > sure, I can make a test, I'll generate smaller sample for fate and send a patch. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v4] libavformat/mxfdec.c: support demuxing opatom audio without index
On Sun, Jan 18, 2015 at 02:43:21PM +0100, Tomas Härdin wrote: > On Wed, 2015-01-14 at 19:26 -0800, Mark Reid wrote: > > changes since v3: > > * return if there isn’t exactly one partition > > * cosmetic and gcc cleanups > > * added comment about EditUnitByteCount > > > > --- > > libavformat/mxfdec.c | 59 > > > > 1 file changed, 59 insertions(+) > > Looks good to me :) applied > > Maybe there could be added a FATE test for it too, I'm no longer sure > how that works. if theres a file that i should upload to the fate samples i just need to know which and into which directory also the file should be as small as possible without compromising the tests usefullness and a patch that adds a test which uses the file would be needed as well thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v4] libavformat/mxfdec.c: support demuxing opatom audio without index
On Wed, 2015-01-14 at 19:26 -0800, Mark Reid wrote: > changes since v3: > * return if there isn’t exactly one partition > * cosmetic and gcc cleanups > * added comment about EditUnitByteCount > > --- > libavformat/mxfdec.c | 59 > > 1 file changed, 59 insertions(+) Looks good to me :) Maybe there could be added a FATE test for it too, I'm no longer sure how that works. /Tomas signature.asc Description: This is a digitally signed message part ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v4] libavformat/mxfdec.c: support demuxing opatom audio without index
changes since v3: * return if there isn’t exactly one partition * cosmetic and gcc cleanups * added comment about EditUnitByteCount --- libavformat/mxfdec.c | 59 1 file changed, 59 insertions(+) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 646a3ea..b892bc2 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2461,6 +2461,64 @@ static void mxf_handle_small_eubc(AVFormatContext *s) mxf->edit_units_per_packet = 1920; } +/** + * Deal with the case where OPAtom files does not have any IndexTableSegments. + */ +static int mxf_handle_missing_index_segment(MXFContext *mxf) +{ +AVFormatContext *s = mxf->fc; +AVStream *st = NULL; +MXFIndexTableSegment *segment = NULL; +MXFPartition *p = NULL; +int essence_partition_count = 0; +int i, ret; + +if (mxf->op != OPAtom) +return 0; + +/* TODO: support raw video without a index if they exist */ +if (s->nb_streams != 1 || s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO || !is_pcm(s->streams[0]->codec->codec_id)) +return 0; + +/* check if file already has a IndexTableSegment */ +for (i = 0; i < mxf->metadata_sets_count; i++) { +if (mxf->metadata_sets[i]->type == IndexTableSegment) +return 0; +} + +/* find the essence partition */ +for (i = 0; i < mxf->partitions_count; i++) { +/* BodySID == 0 -> no essence */ +if (!mxf->partitions[i].body_sid) +continue; + +p = &mxf->partitions[i]; +essence_partition_count++; +} + +/* only handle files with a single essence partition */ +if (essence_partition_count != 1) +return 0; + +if (!(segment = av_mallocz(sizeof(*segment +return AVERROR(ENOMEM); + +if ((ret = mxf_add_metadata_set(mxf, segment))) { +mxf_free_metadataset((MXFMetadataSet**)&segment); +return ret; +} + +st = s->streams[0]; +segment->type = IndexTableSegment; +/* stream will be treated as small EditUnitByteCount */ +segment->edit_unit_byte_count = (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3; +segment->index_start_position = 0; +segment->index_duration = s->streams[0]->duration; +segment->index_sid = p->index_sid; +segment->body_sid = p->body_sid; +return 0; +} + static void mxf_read_random_index_pack(AVFormatContext *s) { MXFContext *mxf = s->priv_data; @@ -2623,6 +2681,7 @@ static int mxf_read_header(AVFormatContext *s) if ((ret = mxf_parse_structural_metadata(mxf)) < 0) goto fail; +mxf_handle_missing_index_segment(mxf); if ((ret = mxf_compute_index_tables(mxf)) < 0) goto fail; -- 2.2.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel