static int gxf_write_umf_material_description(AVFormatContext *s) { GXFContext *gxf = s->priv_data; AVIOContext *pb = s->pb; int timecode_base = gxf->time_base.den == 60000 ? 60 : 50; int64_t timestamp = 0; AVDictionaryEntry *t; uint64_t nb_fields; uint32_t timecode_in; // timecode at mark in uint32_t timecode_out; // timecode at mark out #if FF_API_TIMESTAMP if (s->timestamp) timestamp = s->timestamp; else #endif if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) timestamp = ff_iso8601_to_unix_time(t->value); timecode_in = GXF_TIMECODE(gxf->tc.color, gxf->tc.drop, gxf->tc.hh, gxf->tc.mm, gxf->tc.ss, gxf->tc.ff); nb_fields = gxf->nb_fields + gxf->tc.hh * (timecode_base * 3600) + gxf->tc.mm * (timecode_base * 60) + gxf->tc.ss * timecode_base + gxf->tc.ff; timecode_out = GXF_TIMECODE(gxf->tc.color, gxf->tc.drop, nb_fields / (timecode_base * 3600) % 24, nb_fields / (timecode_base * 60) % 60, nb_fields / timecode_base % 60, nb_fields % timecode_base); avio_wl32(pb, gxf->flags); avio_wl32(pb, gxf->nb_fields); /* length of the longest track */ avio_wl32(pb, gxf->nb_fields); /* length of the shortest track */ avio_wl32(pb, 0); /* mark in */ avio_wl32(pb, gxf->nb_fields); /* mark out */ avio_wl32(pb, timecode_in); /* timecode mark in */ avio_wl32(pb, timecode_out); /* timecode mark out */ avio_wl64(pb, timestamp); /* modification time */ avio_wl64(pb, timestamp); /* creation time */ avio_wl16(pb, 0); /* reserved */ avio_wl16(pb, 0); /* reserved */ avio_wl16(pb, gxf->audio_tracks); avio_wl16(pb, 1); /* timecode track count */ avio_wl16(pb, 0); /* reserved */ avio_wl16(pb, gxf->mpeg_tracks); return 48; }
static int gxf_write_timecode_auxiliary(AVIOContext *pb, GXFContext *gxf) { uint32_t timecode = GXF_TIMECODE(gxf->tc.color, gxf->tc.drop, gxf->tc.hh, gxf->tc.mm, gxf->tc.ss, gxf->tc.ff); avio_wl32(pb, timecode); /* reserved */ avio_wl32(pb, 0); return 8; }