diff options
author | Clément Bœsch <clement.boesch@smartjog.com> | 2012-05-30 10:26:53 +0200 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2012-06-04 07:41:22 +0200 |
commit | 6b35f1a2a6432cb79f657ea3fadb86b8e12dddcb (patch) | |
tree | 372b3d3ee1664494f32d1b518caf54fb9c4dd20b /libavformat/gxfenc.c | |
parent | 0f0f3bd1e022639eb8e9c02b7b18f37071c21763 (diff) | |
download | ffmpeg-6b35f1a2a6432cb79f657ea3fadb86b8e12dddcb.tar.gz |
timecode: move timecode muxer options to metadata.
Some demuxers set a timecode in the format or streams metadata. The
muxers now make use of this metadata instead of a duplicated private
option.
This makes possible transparent copy of the timecode when transmuxing
and transcoding.
-timecode option for MPEG1/2 codec is also renamed to -gop_timecode. The
global ffmpeg -timecode option will set it anyway so no option change
visible for the user.
Diffstat (limited to 'libavformat/gxfenc.c')
-rw-r--r-- | libavformat/gxfenc.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index 089a689402..3c5078ca9f 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -41,7 +41,6 @@ typedef struct GXFTimecode{ int ff; int color; int drop; - char *str; } GXFTimecode; typedef struct GXFStreamContext { @@ -655,11 +654,11 @@ static void gxf_init_timecode_track(GXFStreamContext *sc, GXFStreamContext *vsc) sc->fields = vsc->fields; } -static int gxf_init_timecode(AVFormatContext *s, GXFTimecode *tc, int fields) +static int gxf_init_timecode(AVFormatContext *s, GXFTimecode *tc, const char *tcstr, int fields) { char c; - if (sscanf(tc->str, "%d:%d:%d%c%d", &tc->hh, &tc->mm, &tc->ss, &c, &tc->ff) != 5) { + if (sscanf(tcstr, "%d:%d:%d%c%d", &tc->hh, &tc->mm, &tc->ss, &c, &tc->ff) != 5) { av_log(s, AV_LOG_ERROR, "unable to parse timecode, " "syntax: hh:mm:ss[:;.]ff\n"); return -1; @@ -681,6 +680,7 @@ static int gxf_write_header(AVFormatContext *s) GXFStreamContext *vsc = NULL; uint8_t tracks[255] = {0}; int i, media_info = 0; + AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0); if (!pb->seekable) { av_log(s, AV_LOG_ERROR, "gxf muxer does not support streamed output, patch welcome"); @@ -741,6 +741,8 @@ static int gxf_write_header(AVFormatContext *s) "gxf muxer only accepts PAL or NTSC resolutions currently\n"); return -1; } + if (!tcr) + tcr = av_dict_get(st->metadata, "timecode", NULL, 0); avpriv_set_pts_info(st, 64, gxf->time_base.num, gxf->time_base.den); if (gxf_find_lines_index(st) < 0) sc->lines_index = -1; @@ -792,9 +794,8 @@ static int gxf_write_header(AVFormatContext *s) if (ff_audio_interleave_init(s, GXF_samples_per_frame, (AVRational){ 1, 48000 }) < 0) return -1; - if (gxf->tc.str) { - gxf_init_timecode(s, &gxf->tc, vsc->fields); - } + if (tcr) + gxf_init_timecode(s, &gxf->tc, tcr->value, vsc->fields); gxf_init_timecode_track(&gxf->timecode_track, vsc); gxf->flags |= 0x200000; // time code track is non-drop frame @@ -983,18 +984,6 @@ static int gxf_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *pk ff_interleave_packet_per_dts, gxf_compare_field_nb); } -static const AVOption options[] = { - { AV_TIMECODE_OPTION(GXFContext, tc.str, AV_OPT_FLAG_ENCODING_PARAM) }, - { NULL } -}; - -static const AVClass gxf_muxer_class = { - .class_name = "GXF muxer", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - AVOutputFormat ff_gxf_muxer = { .name = "gxf", .long_name = NULL_IF_CONFIG_SMALL("GXF format"), @@ -1006,5 +995,4 @@ AVOutputFormat ff_gxf_muxer = { .write_packet = gxf_write_packet, .write_trailer = gxf_write_trailer, .interleave_packet = gxf_interleave_packet, - .priv_class = &gxf_muxer_class, }; |