285
286
put_header(s, GOP_START_CODE);
286
put_bits(&s->pb, 1, !!(s->avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE)); /* drop frame flag */
287
put_bits(&s->pb, 1, s->drop_frame_timecode); /* drop frame flag */
287
288
/* time code : we must convert from the real frame rate to a
288
289
fake mpeg frame rate in case of low frame rate */
289
290
fps = (framerate.num + framerate.den/2)/ framerate.den;
290
time_code = s->current_picture_ptr->coded_picture_number + s->avctx->timecode_frame_start;
291
time_code = s->current_picture_ptr->f.coded_picture_number + s->avctx->timecode_frame_start;
292
s->gop_picture_number = s->current_picture_ptr->coded_picture_number;
293
if (s->avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE) {
293
s->gop_picture_number = s->current_picture_ptr->f.coded_picture_number;
294
if (s->drop_frame_timecode) {
294
295
/* only works for NTSC 29.97 */
295
296
int d = time_code / 17982;
296
297
int m = time_code % 17982;
925
925
put_bits(&s->pb, table_vlc[112][1], table_vlc[112][0]);
928
#define OFFSET(x) offsetof(MpegEncContext, x)
929
#define VE AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
931
{ "intra_vlc", "Use MPEG-2 intra VLC table.", OFFSET(intra_vlc_format), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },\
932
{ "drop_frame_timecode", "Timecode is in drop frame format.", OFFSET(drop_frame_timecode), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE}, \
933
{ "scan_offset", "Reserve space for SVCD scan offset user data.", OFFSET(scan_offset), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },
935
static const AVOption mpeg1_options[] = {
940
static const AVOption mpeg2_options[] = {
942
{ "non_linear_quant", "Use nonlinear quantizer.", OFFSET(q_scale_type), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },
943
{ "alternate_scan", "Enable alternate scantable.", OFFSET(alternate_scan), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },
947
#define mpeg12_class(x)\
948
static const AVClass mpeg## x ##_class = {\
949
.class_name = "mpeg" #x "video encoder",\
950
.item_name = av_default_item_name,\
951
.option = mpeg## x ##_options,\
952
.version = LIBAVUTIL_VERSION_INT,\
928
958
AVCodec ff_mpeg1video_encoder = {
932
sizeof(MpegEncContext),
936
.supported_framerates= ff_frame_rate_tab+1,
959
.name = "mpeg1video",
960
.type = AVMEDIA_TYPE_VIDEO,
961
.id = CODEC_ID_MPEG1VIDEO,
962
.priv_data_size = sizeof(MpegEncContext),
964
.encode = MPV_encode_picture,
965
.close = MPV_encode_end,
966
.supported_framerates= avpriv_frame_rate_tab+1,
937
967
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
938
968
.capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
939
969
.long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
970
.priv_class = &mpeg1_class,
942
973
AVCodec ff_mpeg2video_encoder = {
946
sizeof(MpegEncContext),
950
.supported_framerates= ff_frame_rate_tab+1,
974
.name = "mpeg2video",
975
.type = AVMEDIA_TYPE_VIDEO,
976
.id = CODEC_ID_MPEG2VIDEO,
977
.priv_data_size = sizeof(MpegEncContext),
979
.encode = MPV_encode_picture,
980
.close = MPV_encode_end,
981
.supported_framerates= avpriv_frame_rate_tab+1,
951
982
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE},
952
983
.capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
953
984
.long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
985
.priv_class = &mpeg2_class,