Deprecate CODEC_FLAG2_DROP_FRAME_TIMECODE
---
libavcodec/avcodec.h | 2 ++
libavcodec/mpeg12enc.c | 12 +++++++++---
libavcodec/mpegvideo.h | 1 +
libavcodec/options.c | 2 ++
4 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index fdf6349..8ab5f27 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -620,7 +620,9 @@ typedef struct RcOverride{
#define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< Use MPEG-2 intra VLC table.
#endif
#define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< Only do ME/MC (I frames ->
ref, P frame -> ME+MC).
+#if FF_API_MPEGVIDEO_GLOBAL_OPTS
#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop
frame format.
+#endif
#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual
skipping
#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be
truncated at a packet boundaries instead of only at frame boundaries.
#define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear
quantizer.
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index aa10e95..4ec669e 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -143,6 +143,11 @@ static av_cold int encode_init(AVCodecContext *avctx)
if(MPV_encode_init(avctx) < 0)
return -1;
+#if FF_API_MPEGVIDEO_GLOBAL_OPTS
+ if (avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE)
+ s->drop_frame_timecode = 1;
+#endif
+
if(find_frame_rate_index(s) < 0){
if(s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){
av_log(avctx, AV_LOG_ERROR, "MPEG1/2 does not support %d/%d
fps\n", avctx->time_base.den, avctx->time_base.num);
@@ -175,7 +180,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
}
}
- if((avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE) &&
s->frame_rate_index != 4){
+ if (s->drop_frame_timecode && s->frame_rate_index != 4) {
av_log(avctx, AV_LOG_ERROR, "Drop frame time code only allowed with
1001/30000 fps\n");
return -1;
}
@@ -286,14 +291,14 @@ static void mpeg1_encode_sequence_header(MpegEncContext
*s)
}
put_header(s, GOP_START_CODE);
- put_bits(&s->pb, 1, !!(s->avctx->flags2 &
CODEC_FLAG2_DROP_FRAME_TIMECODE)); /* drop frame flag */
+ put_bits(&s->pb, 1, s->drop_frame_timecode); /* drop frame flag */
/* time code : we must convert from the real frame rate to a
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->gop_picture_number =
s->current_picture_ptr->f.coded_picture_number;
- if (s->avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE) {
+ if (s->drop_frame_timecode) {
/* only works for NTSC 29.97 */
int d = time_code / 17982;
int m = time_code % 17982;
@@ -932,6 +937,7 @@ static void mpeg1_encode_block(MpegEncContext *s,
#define VE AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
static const AVOption options[] = {
{ "intra_vlc", "Use MPEG-2 intra VLC table.",
OFFSET(intra_vlc_format), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE },
+ { "drop_frame_timecode", "Timecode is in drop frame format.",
OFFSET(drop_frame_timecode), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE},
{ NULL },
};
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 0790b07..34069c6 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -644,6 +644,7 @@ typedef struct MpegEncContext {
int interlaced_dct;
int first_slice;
int first_field; ///< is 1 for the first field of a field picture
0 otherwise
+ int drop_frame_timecode; ///< timecode is in drop frame format.
/* RTP specific */
int rtp_mode;
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 19a4133..5231cb4 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -421,7 +421,9 @@ static const AVOption options[]={
{"max_partition_order", "deprecated, use flac-specific options",
OFFSET(max_partition_order), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX,
A|E},
#endif
{"timecode_frame_start", "GOP timecode frame start number, in non drop frame
format", OFFSET(timecode_frame_start), FF_OPT_TYPE_INT64, {.dbl = 0 }, 0,
INT64_MAX, V|E},
+#if FF_API_MPEGVIDEO_GLOBAL_OPTS
{"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, {.dbl =
CODEC_FLAG2_DROP_FRAME_TIMECODE }, INT_MIN, INT_MAX, V|E, "flags2"},
+#endif
{"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, {.dbl =
CODEC_FLAG2_NON_LINEAR_QUANT }, INT_MIN, INT_MAX, V|E, "flags2"},
#if FF_API_REQUEST_CHANNELS
{"request_channels", "set desired number of audio channels",
OFFSET(request_channels), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, A|D},
--
1.7.5.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel