max_size, max_size);
return AVERROR(EINVAL);
}
+ if ((avctx->width & 0xFFF) == 0 && (avctx->height & 0xFFF) == 1) {
+ av_log(avctx, AV_LOG_ERROR, "Width / Height is invalid for MPEG2\n");
+ return AVERROR(EINVAL);
+ }
- if ((ret = ff_mpv_encode_init(avctx)) < 0)
- return ret;
-
- if (find_frame_rate_index(s) < 0) {
- if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
- av_log(avctx, AV_LOG_ERROR, "MPEG-1/2 does not support %d/%d fps\n",
- avctx->time_base.den, avctx->time_base.num);
+ if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
+ if ((avctx->width & 0xFFF) == 0 || (avctx->height & 0xFFF) == 0) {
+ av_log(avctx, AV_LOG_ERROR, "Width or Height are not allowed to be multiples of 4096\n"
+ "add '-strict %d' if you want to use them anyway.\n", FF_COMPLIANCE_UNOFFICIAL);
return AVERROR(EINVAL);
- } else {
- av_log(avctx, AV_LOG_INFO,
- "MPEG-1/2 does not support %d/%d fps, there may be AV sync issues\n",
- avctx->time_base.den, avctx->time_base.num);
}
}
return AVERROR(EINVAL);
}
/* Main or 4:2:2 */
- avctx->profile = s->chroma_format == CHROMA_420 ? FF_PROFILE_MPEG2_MAIN : FF_PROFILE_MPEG2_422;
+ avctx->profile = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? FF_PROFILE_MPEG2_MAIN
+ : FF_PROFILE_MPEG2_422;
}
-
if (avctx->level == FF_LEVEL_UNKNOWN) {
if (avctx->profile == FF_PROFILE_MPEG2_422) { /* 4:2:2 */
if (avctx->width <= 720 && avctx->height <= 608)
else
avctx->level = 2; /* High */
} else {
- if (avctx->profile != FF_PROFILE_MPEG2_HIGH && s->chroma_format != CHROMA_420) {
+ if (avctx->profile != FF_PROFILE_MPEG2_HIGH &&
+ avctx->pix_fmt != AV_PIX_FMT_YUV420P) {
av_log(avctx, AV_LOG_ERROR,
"Only High(1) and 4:2:2(0) profiles support 4:2:2 color sampling\n");
return AVERROR(EINVAL);
}
}
- if ((avctx->width & 0xFFF) == 0 && (avctx->height & 0xFFF) == 1) {
- av_log(avctx, AV_LOG_ERROR, "Width / Height is invalid for MPEG2\n");
- return AVERROR(EINVAL);
- }
+ if ((ret = ff_mpv_encode_init(avctx)) < 0)
+ return ret;
- if (s->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
- if ((avctx->width & 0xFFF) == 0 || (avctx->height & 0xFFF) == 0) {
- av_log(avctx, AV_LOG_ERROR, "Width or Height are not allowed to be multiples of 4096\n"
- "add '-strict %d' if you want to use them anyway.\n", FF_COMPLIANCE_UNOFFICIAL);
+ if (find_frame_rate_index(s) < 0) {
+ if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
+ av_log(avctx, AV_LOG_ERROR, "MPEG-1/2 does not support %d/%d fps\n",
+ avctx->time_base.den, avctx->time_base.num);
return AVERROR(EINVAL);
+ } else {
+ av_log(avctx, AV_LOG_INFO,
+ "MPEG-1/2 does not support %d/%d fps, there may be AV sync issues\n",
+ avctx->time_base.den, avctx->time_base.num);
}
}
return AVERROR(EINVAL);
}
-#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);
put_bits(&s->pb, 8, 0xff); // marker_bits
} else {
av_log(s->avctx, AV_LOG_WARNING,
- "Warning Closed Caption size (%d) can not exceed 93 bytes "
- "and must be a multiple of 3\n", side_data->size);
+ "Closed Caption size (%"SIZE_SPECIFIER") can not exceed "
+ "93 bytes and must be a multiple of 3\n", side_data->size);
}
}
}
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}, \
+ FF_MPV_COMMON_BFRAME_OPTS
static const AVOption mpeg1_options[] = {
COMMON_OPTS
FF_MPV_COMMON_OPTS
+#if FF_API_MPEGVIDEO_OPTS
+ FF_MPV_DEPRECATED_MPEG_QUANT_OPT
+ FF_MPV_DEPRECATED_A53_CC_OPT
+ FF_MPV_DEPRECATED_MATRIX_OPT
+#endif
{ NULL },
};
OFFSET(intra_vlc_format), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
{ "non_linear_quant", "Use nonlinear quantizer.", OFFSET(q_scale_type), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
{ "alternate_scan", "Enable alternate scantable.", OFFSET(alternate_scan), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+ { "a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE },
{ "seq_disp_ext", "Write sequence_display_extension blocks.", OFFSET(seq_disp_ext), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE, "seq_disp_ext" },
{ "auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, VE, "seq_disp_ext" },
{ "never", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 0, VE, "seq_disp_ext" },
{ LEVEL("low", 10) },
#undef LEVEL
FF_MPV_COMMON_OPTS
+#if FF_API_MPEGVIDEO_OPTS
+ { "mpeg_quant", "Deprecated, does nothing", OFFSET(mpeg_quant),
+ AV_OPT_TYPE_INT, {.i64 = 1 }, 0, 1, VE | AV_OPT_FLAG_DEPRECATED },
+ FF_MPV_DEPRECATED_MATRIX_OPT
+#endif
FF_MPEG2_PROFILE_OPTS
{ NULL },
};
mpeg12_class(1)
mpeg12_class(2)
-AVCodec ff_mpeg1video_encoder = {
+const AVCodec ff_mpeg1video_encoder = {
.name = "mpeg1video",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
.type = AVMEDIA_TYPE_VIDEO,
.priv_class = &mpeg1_class,
};
-AVCodec ff_mpeg2video_encoder = {
+const AVCodec ff_mpeg2video_encoder = {
.name = "mpeg2video",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"),
.type = AVMEDIA_TYPE_VIDEO,