Re: [FFmpeg-devel] [PATCH v2 1/3] avformat/mxfenc: use track count to generate component instance uuid
On Thu, Nov 30, 2017 at 9:01 AM, Tomas Härdin wrote: > On Wed, 2017-11-29 at 20:18 -0800, Mark Reid wrote: > > On Wed, Nov 29, 2017 at 1:36 AM, Tomas Härdin > > wrote: > > > > > On 2017-11-29 05:11, Mark Reid wrote: > > > > > > > @@ -980,7 +980,7 @@ static void > > > > mxf_write_structural_component(AVFormatContext > > > > *s, AVStream *st, MXF > > > > // write uid > > > > mxf_write_local_tag(pb, 16, 0x3C0A); > > > > -mxf_write_uuid(pb, package->type == MaterialPackage ? > > > > SourceClip: > > > > SourceClip + TypeBottom, st->index); > > > > +mxf_write_uuid(pb, SourceClip, mxf->track_uuid_offset); > > > > PRINT_KEY(s, "structural component uid", pb->buf_ptr - > > > > 16); > > > > mxf_write_common_fields(s, st); > > > > @@ -1357,7 +1357,7 @@ static void > > > > mxf_write_package(AVFormatContext *s, > > > > MXFPackage *package) > > > > // write package umid > > > > mxf_write_local_tag(pb, 32, 0x4401); > > > > -mxf_write_umid(s, package->type == SourcePackage); > > > > +mxf_write_umid(s, package->instance); > > > > PRINT_KEY(s, "package umid second part", pb->buf_ptr - 16); > > > > // package name > > > > @@ -1375,10 +1375,9 @@ static void > > > > mxf_write_package(AVFormatContext *s, > > > > MXFPackage *package) > > > > // write track refs > > > > mxf_write_local_tag(pb, track_count*16 + 8, 0x4403); > > > > mxf_write_refs_count(pb, track_count); > > > > -mxf_write_uuid(pb, package->type == MaterialPackage ? Track > > > > : > > > > - Track + TypeBottom, -1); // timecode track > > > > +mxf_write_uuid(pb, Track, mxf->track_uuid_offset); // > > > > timecode track > > > > for (i = 0; i < s->nb_streams; i++) > > > > -mxf_write_uuid(pb, package->type == MaterialPackage ? > > > > Track : > > > > Track + TypeBottom, i); > > > > +mxf_write_uuid(pb, Track, mxf->track_uuid_offset + i + > > > > 1); > > > > > > > > > > Do these refer to tracks that are about to be written? Seems so as > > > best I > > > can tell, so I guess it works. I'd be happier if the referencing > > > was done > > > more explicitly rather than implicitly > > > > > > yes they refer to the tracks about to be written. Those uuids need to > > match > > the uuid instance tag (0x3C0A) on a track written in mxf_write_track. > > then > > the uuid ref on the track needs to match the one on the sequence, and > > then > > the one the sequence needs to match the one on the component. > > > > would you rather the instance id be a argument to each of the write > > functions? for example: > > mxf_write_package(AVFormatContext *s, MXFPackage *package, int > > track_uuid_offset) > > mxf_write_track(AVFormatContext *s, AVStream *st, MXFPackage > > *package, int > > instance_id) > > would that be more explicit? > > I'm not quite sure tbh. It's been a few years since I worked with MXF, > so it's harder to say. Maybe a comment would be enough > > okay I'll submit a new version with some more comments > /Tomas > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/3] avformat/mxfenc: use track count to generate component instance uuid
On Wed, 2017-11-29 at 20:18 -0800, Mark Reid wrote: > On Wed, Nov 29, 2017 at 1:36 AM, Tomas Härdin > wrote: > > > On 2017-11-29 05:11, Mark Reid wrote: > > > > > @@ -980,7 +980,7 @@ static void > > > mxf_write_structural_component(AVFormatContext > > > *s, AVStream *st, MXF > > > // write uid > > > mxf_write_local_tag(pb, 16, 0x3C0A); > > > -mxf_write_uuid(pb, package->type == MaterialPackage ? > > > SourceClip: > > > SourceClip + TypeBottom, st->index); > > > +mxf_write_uuid(pb, SourceClip, mxf->track_uuid_offset); > > > PRINT_KEY(s, "structural component uid", pb->buf_ptr - > > > 16); > > > mxf_write_common_fields(s, st); > > > @@ -1357,7 +1357,7 @@ static void > > > mxf_write_package(AVFormatContext *s, > > > MXFPackage *package) > > > // write package umid > > > mxf_write_local_tag(pb, 32, 0x4401); > > > -mxf_write_umid(s, package->type == SourcePackage); > > > +mxf_write_umid(s, package->instance); > > > PRINT_KEY(s, "package umid second part", pb->buf_ptr - 16); > > > // package name > > > @@ -1375,10 +1375,9 @@ static void > > > mxf_write_package(AVFormatContext *s, > > > MXFPackage *package) > > > // write track refs > > > mxf_write_local_tag(pb, track_count*16 + 8, 0x4403); > > > mxf_write_refs_count(pb, track_count); > > > -mxf_write_uuid(pb, package->type == MaterialPackage ? Track > > > : > > > - Track + TypeBottom, -1); // timecode track > > > +mxf_write_uuid(pb, Track, mxf->track_uuid_offset); // > > > timecode track > > > for (i = 0; i < s->nb_streams; i++) > > > -mxf_write_uuid(pb, package->type == MaterialPackage ? > > > Track : > > > Track + TypeBottom, i); > > > +mxf_write_uuid(pb, Track, mxf->track_uuid_offset + i + > > > 1); > > > > > > > Do these refer to tracks that are about to be written? Seems so as > > best I > > can tell, so I guess it works. I'd be happier if the referencing > > was done > > more explicitly rather than implicitly > > > yes they refer to the tracks about to be written. Those uuids need to > match > the uuid instance tag (0x3C0A) on a track written in mxf_write_track. > then > the uuid ref on the track needs to match the one on the sequence, and > then > the one the sequence needs to match the one on the component. > > would you rather the instance id be a argument to each of the write > functions? for example: > mxf_write_package(AVFormatContext *s, MXFPackage *package, int > track_uuid_offset) > mxf_write_track(AVFormatContext *s, AVStream *st, MXFPackage > *package, int > instance_id) > would that be more explicit? I'm not quite sure tbh. It's been a few years since I worked with MXF, so it's harder to say. Maybe a comment would be enough /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
Re: [FFmpeg-devel] [PATCH v2 1/3] avformat/mxfenc: use track count to generate component instance uuid
On Wed, Nov 29, 2017 at 1:36 AM, Tomas Härdin wrote: > On 2017-11-29 05:11, Mark Reid wrote: > >> @@ -980,7 +980,7 @@ static void >> mxf_write_structural_component(AVFormatContext >> *s, AVStream *st, MXF >> // write uid >> mxf_write_local_tag(pb, 16, 0x3C0A); >> -mxf_write_uuid(pb, package->type == MaterialPackage ? SourceClip: >> SourceClip + TypeBottom, st->index); >> +mxf_write_uuid(pb, SourceClip, mxf->track_uuid_offset); >> PRINT_KEY(s, "structural component uid", pb->buf_ptr - 16); >> mxf_write_common_fields(s, st); >> @@ -1357,7 +1357,7 @@ static void mxf_write_package(AVFormatContext *s, >> MXFPackage *package) >> // write package umid >> mxf_write_local_tag(pb, 32, 0x4401); >> -mxf_write_umid(s, package->type == SourcePackage); >> +mxf_write_umid(s, package->instance); >> PRINT_KEY(s, "package umid second part", pb->buf_ptr - 16); >> // package name >> @@ -1375,10 +1375,9 @@ static void mxf_write_package(AVFormatContext *s, >> MXFPackage *package) >> // write track refs >> mxf_write_local_tag(pb, track_count*16 + 8, 0x4403); >> mxf_write_refs_count(pb, track_count); >> -mxf_write_uuid(pb, package->type == MaterialPackage ? Track : >> - Track + TypeBottom, -1); // timecode track >> +mxf_write_uuid(pb, Track, mxf->track_uuid_offset); // timecode track >> for (i = 0; i < s->nb_streams; i++) >> -mxf_write_uuid(pb, package->type == MaterialPackage ? Track : >> Track + TypeBottom, i); >> +mxf_write_uuid(pb, Track, mxf->track_uuid_offset + i + 1); >> > > Do these refer to tracks that are about to be written? Seems so as best I > can tell, so I guess it works. I'd be happier if the referencing was done > more explicitly rather than implicitly yes they refer to the tracks about to be written. Those uuids need to match the uuid instance tag (0x3C0A) on a track written in mxf_write_track. then the uuid ref on the track needs to match the one on the sequence, and then the one the sequence needs to match the one on the component. would you rather the instance id be a argument to each of the write functions? for example: mxf_write_package(AVFormatContext *s, MXFPackage *package, int track_uuid_offset) mxf_write_track(AVFormatContext *s, AVStream *st, MXFPackage *package, int instance_id) would that be more explicit? > > // write user comment refs >> if (mxf->store_user_comments) { >> @@ -1402,12 +1401,14 @@ static void mxf_write_package(AVFormatContext >> *s, MXFPackage *package) >> mxf_write_track(s, mxf->timecode_track, package); >> mxf_write_sequence(s, mxf->timecode_track, package); >> mxf_write_timecode_component(s, mxf->timecode_track, package); >> +mxf->track_uuid_offset++; >> for (i = 0; i < s->nb_streams; i++) { >> AVStream *st = s->streams[i]; >> mxf_write_track(s, st, package); >> mxf_write_sequence(s, st, package); >> mxf_write_structural_component(s, st, package); >> +mxf->track_uuid_offset++; >> >> > > /Tomas > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/3] avformat/mxfenc: use track count to generate component instance uuid
On 2017-11-29 05:11, Mark Reid wrote: @@ -980,7 +980,7 @@ static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, MXF // write uid mxf_write_local_tag(pb, 16, 0x3C0A); -mxf_write_uuid(pb, package->type == MaterialPackage ? SourceClip: SourceClip + TypeBottom, st->index); +mxf_write_uuid(pb, SourceClip, mxf->track_uuid_offset); PRINT_KEY(s, "structural component uid", pb->buf_ptr - 16); mxf_write_common_fields(s, st); @@ -1357,7 +1357,7 @@ static void mxf_write_package(AVFormatContext *s, MXFPackage *package) // write package umid mxf_write_local_tag(pb, 32, 0x4401); -mxf_write_umid(s, package->type == SourcePackage); +mxf_write_umid(s, package->instance); PRINT_KEY(s, "package umid second part", pb->buf_ptr - 16); // package name @@ -1375,10 +1375,9 @@ static void mxf_write_package(AVFormatContext *s, MXFPackage *package) // write track refs mxf_write_local_tag(pb, track_count*16 + 8, 0x4403); mxf_write_refs_count(pb, track_count); -mxf_write_uuid(pb, package->type == MaterialPackage ? Track : - Track + TypeBottom, -1); // timecode track +mxf_write_uuid(pb, Track, mxf->track_uuid_offset); // timecode track for (i = 0; i < s->nb_streams; i++) -mxf_write_uuid(pb, package->type == MaterialPackage ? Track : Track + TypeBottom, i); +mxf_write_uuid(pb, Track, mxf->track_uuid_offset + i + 1); Do these refer to tracks that are about to be written? Seems so as best I can tell, so I guess it works. I'd be happier if the referencing was done more explicitly rather than implicitly // write user comment refs if (mxf->store_user_comments) { @@ -1402,12 +1401,14 @@ static void mxf_write_package(AVFormatContext *s, MXFPackage *package) mxf_write_track(s, mxf->timecode_track, package); mxf_write_sequence(s, mxf->timecode_track, package); mxf_write_timecode_component(s, mxf->timecode_track, package); +mxf->track_uuid_offset++; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; mxf_write_track(s, st, package); mxf_write_sequence(s, st, package); mxf_write_structural_component(s, st, package); +mxf->track_uuid_offset++; /Tomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel