diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-01-31 12:28:04 +0000 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-01-31 12:28:04 +0000 |
commit | 9938697c1c119a675759029ead74b91c529cdf2e (patch) | |
tree | df594b8ceda53d29763040312c6ea48c692e2781 | |
parent | b4af7d68fe14c6978a1a2f8b1bb34fd50d189160 (diff) | |
parent | d749615333084e62c9fcc480d1ae466369fdf14f (diff) | |
download | ffmpeg-9938697c1c119a675759029ead74b91c529cdf2e.tar.gz |
Merge commit 'd749615333084e62c9fcc480d1ae466369fdf14f'
* commit 'd749615333084e62c9fcc480d1ae466369fdf14f':
lavc: Move timecode_frame_start to codec private options
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r-- | libavcodec/avcodec.h | 9 | ||||
-rw-r--r-- | libavcodec/mpeg12enc.c | 20 | ||||
-rw-r--r-- | libavcodec/mpegvideo.h | 1 | ||||
-rw-r--r-- | libavcodec/options_table.h | 2 |
4 files changed, 22 insertions, 10 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 727b3a1c03..0a478e6b1c 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2633,12 +2633,11 @@ typedef struct AVCodecContext { */ int max_prediction_order; - /** - * GOP timecode frame start number - * - encoding: Set by user, in non drop frame format - * - decoding: Set by libavcodec (timecode in the 25 bits format, -1 if unset) - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int64_t timecode_frame_start; +#endif #if FF_API_RTP_CALLBACK /** diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index a9d0e3f66a..ea45c07055 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -206,16 +206,24 @@ static av_cold int encode_init(AVCodecContext *avctx) return -1; } +#if FF_API_PRIVATE_OPT +FF_DISABLE_DEPRECATION_WARNINGS + if (avctx->timecode_frame_start) + s->timecode_frame_start = avctx->timecode_frame_start; +FF_ENABLE_DEPRECATION_WARNINGS +#endif + if (s->tc_opt_str) { AVRational rate = ff_mpeg12_frame_rate_tab[s->frame_rate_index]; int ret = av_timecode_init_from_string(&s->tc, rate, s->tc_opt_str, s); if (ret < 0) return ret; s->drop_frame_timecode = !!(s->tc.flags & AV_TIMECODE_FLAG_DROPFRAME); - s->avctx->timecode_frame_start = s->tc.start; + s->timecode_frame_start = s->tc.start; } else { - s->avctx->timecode_frame_start = 0; // default is -1 + s->timecode_frame_start = 0; // default is -1 } + return 0; } @@ -363,7 +371,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) * fake MPEG frame rate in case of low frame rate */ fps = (framerate.num + framerate.den / 2) / framerate.den; time_code = s->current_picture_ptr->f->coded_picture_number + - s->avctx->timecode_frame_start; + s->timecode_frame_start; s->gop_picture_number = s->current_picture_ptr->f->coded_picture_number; @@ -1092,14 +1100,16 @@ av_cold void ff_mpeg1_encode_init(MpegEncContext *s) #define OFFSET(x) offsetof(MpegEncContext, x) #define VE AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM #define COMMON_OPTS \ - { "gop_timecode", "MPEG GOP Timecode in hh:mm:ss[:;.]ff format", \ + { "gop_timecode", "MPEG GOP Timecode in hh:mm:ss[:;.]ff format. Overrides timecode_frame_start.", \ OFFSET(tc_opt_str), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX, VE },\ { "intra_vlc", "Use MPEG-2 intra VLC table.", \ OFFSET(intra_vlc_format), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, \ { "drop_frame_timecode", "Timecode is in drop frame format.", \ OFFSET(drop_frame_timecode), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, \ { "scan_offset", "Reserve space for SVCD scan offset user data.", \ - OFFSET(scan_offset), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, + OFFSET(scan_offset), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, \ + { "timecode_frame_start", "GOP timecode frame start number, in non-drop-frame format", \ + OFFSET(timecode_frame_start), AV_OPT_TYPE_INT64, {.i64 = -1 }, -1, INT64_MAX, VE}, \ static const AVOption mpeg1_options[] = { COMMON_OPTS diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 97ec1f18b7..62cedf0c99 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -453,6 +453,7 @@ typedef struct MpegEncContext { // picture structure defines are loaded from mpegutils.h int picture_structure; + int64_t timecode_frame_start; ///< GOP timecode frame start number, in non drop frame format int intra_dc_precision; int frame_pred_frame_dct; int top_field_first; diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index ddd800036c..ecf988cc73 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -432,7 +432,9 @@ static const AVOption avcodec_options[] = { {"compression_level", NULL, OFFSET(compression_level), AV_OPT_TYPE_INT, {.i64 = FF_COMPRESSION_DEFAULT }, INT_MIN, INT_MAX, V|A|E}, {"min_prediction_order", NULL, OFFSET(min_prediction_order), AV_OPT_TYPE_INT, {.i64 = -1 }, INT_MIN, INT_MAX, A|E}, {"max_prediction_order", NULL, OFFSET(max_prediction_order), AV_OPT_TYPE_INT, {.i64 = -1 }, INT_MIN, INT_MAX, A|E}, +#if FF_API_PRIVATE_OPT {"timecode_frame_start", "GOP timecode frame start number, in non-drop-frame format", OFFSET(timecode_frame_start), AV_OPT_TYPE_INT64, {.i64 = -1 }, -1, INT64_MAX, V|E}, +#endif {"bits_per_raw_sample", NULL, OFFSET(bits_per_raw_sample), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, {"channel_layout", NULL, OFFSET(channel_layout), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, 0, INT64_MAX, A|E|D, "channel_layout"}, {"request_channel_layout", NULL, OFFSET(request_channel_layout), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, 0, INT64_MAX, A|D, "request_channel_layout"}, |