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/mxfenc.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/mxfenc.c')
-rw-r--r-- | libavformat/mxfenc.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index f87a50a80b..b2fe736ff2 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -189,7 +189,6 @@ typedef struct MXFContext { unsigned body_partitions_count; int last_key_index; ///< index of last key frame uint64_t duration; - char *tc_opt_str; ///< timecode option string AVTimecode tc; ///< timecode context AVStream *timecode_track; int timecode_base; ///< rounded time code base (25 or 30) @@ -1403,6 +1402,7 @@ static int mxf_write_header(AVFormatContext *s) const int *samples_per_frame = NULL; AVDictionaryEntry *t; int64_t timestamp = 0; + AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0); if (!s->nb_streams) return -1; @@ -1443,9 +1443,10 @@ static int mxf_write_header(AVFormatContext *s) } rate = (AVRational){mxf->time_base.den, mxf->time_base.num}; avpriv_set_pts_info(st, 64, mxf->time_base.num, mxf->time_base.den); - if (mxf->tc_opt_str) - ret = av_timecode_init_from_string(&mxf->tc, rate, - mxf->tc_opt_str, s); + if (!tcr) + tcr = av_dict_get(st->metadata, "timecode", NULL, 0); + if (tcr) + ret = av_timecode_init_from_string(&mxf->tc, rate, tcr->value, s); else ret = av_timecode_init(&mxf->tc, rate, 0, 0, s); if (ret < 0) @@ -1877,26 +1878,6 @@ static int mxf_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int mxf_interleave_get_packet, mxf_compare_timestamps); } -static const AVClass mxf_class = { - .class_name = "mxf", - .item_name = av_default_item_name, - .version = LIBAVUTIL_VERSION_INT, - .option = (const AVOption[]){ - {AV_TIMECODE_OPTION(MXFContext, tc_opt_str, AV_OPT_FLAG_ENCODING_PARAM)}, - {NULL} - }, -}; - -static const AVClass mxf_d10_class = { - .class_name = "mxf_d10", - .item_name = av_default_item_name, - .version = LIBAVUTIL_VERSION_INT, - .option = (const AVOption[]){ - {AV_TIMECODE_OPTION(MXFContext, tc_opt_str, AV_OPT_FLAG_ENCODING_PARAM)}, - {NULL} - }, -}; - AVOutputFormat ff_mxf_muxer = { .name = "mxf", .long_name = NULL_IF_CONFIG_SMALL("Material eXchange Format"), @@ -1910,7 +1891,6 @@ AVOutputFormat ff_mxf_muxer = { .write_trailer = mxf_write_footer, .flags = AVFMT_NOTIMESTAMPS, .interleave_packet = mxf_interleave, - .priv_class = &mxf_class, }; AVOutputFormat ff_mxf_d10_muxer = { @@ -1925,5 +1905,4 @@ AVOutputFormat ff_mxf_d10_muxer = { .write_trailer = mxf_write_footer, .flags = AVFMT_NOTIMESTAMPS, .interleave_packet = mxf_interleave, - .priv_class = &mxf_d10_class, }; |