[FFmpeg-devel] [PATCH 2/4] avformat/mxfenc: use track count to generate component instance uuid
Tomas Härdin
tjoppen at acc.umu.se
Mon Nov 27 12:14:51 EET 2017
On Sun, 2017-11-26 at 21:42 -0800, Mark Reid wrote:
> ---
> libavformat/mxf.h | 1 -
> libavformat/mxfenc.c | 45 +++++++++++++++++++++++++----
> ------------
> tests/ref/fate/copy-trac4914 | 2 +-
> tests/ref/fate/time_base | 2 +-
> tests/ref/lavf/mxf | 6 +++---
> tests/ref/lavf/mxf_d10 | 2 +-
> tests/ref/lavf/mxf_dv25 | 2 +-
> tests/ref/lavf/mxf_dvcpro50 | 2 +-
> tests/ref/lavf/mxf_opatom | 2 +-
> tests/ref/lavf/mxf_opatom_audio | 2 +-
> 10 files changed, 38 insertions(+), 28 deletions(-)
> [...]
> @@ -846,6 +847,10 @@ static void
> mxf_write_track(AVFormatContext *s, AVStream *st, MXFPackage *packag
> MXFContext *mxf = s->priv_data;
> AVIOContext *pb = s->pb;
> MXFStreamContext *sc = st->priv_data;
> + int instance = package->uuid_offset;
> +
> + if (st != mxf->timecode_track)
> + instance += st->index + 1;
>
> mxf_write_metadata_key(pb, 0x013b00);
> PRINT_KEY(s, "track key", pb->buf_ptr - 16);
>
> static int mxf_write_essence_container_data(AVFormatContext *s)
> @@ -1443,11 +1451,12 @@ static int
> mxf_write_header_metadata_sets(AVFormatContext *s)
> AVDictionaryEntry *entry = NULL;
> AVStream *st = NULL;
> int i;
> -
> + int track_count = 0;
> MXFPackage packages[2] = {};
> int package_count = 2;
> packages[0].type = MaterialPackage;
> packages[1].type = SourcePackage;
> + packages[1].instance = 1;
>
> if (entry = av_dict_get(s->metadata, "material_package_name",
> NULL, 0))
> packages[0].name = entry->value;
> @@ -1468,8 +1477,10 @@ static int
> mxf_write_header_metadata_sets(AVFormatContext *s)
> mxf_write_preface(s);
> mxf_write_identification(s);
> mxf_write_content_storage(s, packages, package_count);
> - for (i = 0; i < package_count; i++)
> - mxf_write_package(s, &packages[i]);
> + for (i = 0; i < package_count; i++) {
> + packages[i].uuid_offset = track_count;
> + track_count += mxf_write_package(s, &packages[i]);
> + }
I see st->index + 1 when deriving instance from uuid_offset, are you
sure there isn't a potential off-by-one error here? An MP track and SP
track getting the same UUID or something. I guess type is enough to
differentiate, but then why does instance need uuid_offset?
/Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171127/f9614b9e/attachment.sig>
More information about the ffmpeg-devel
mailing list