Commit ce6ce595 authored by Marton Balint's avatar Marton Balint

avcodec/mpeg12enc: add support for specifying video_format in the sequence_display_extension

In a recent commit the default was changed from 0 (component) to 5
(unspecified), however some standards require using 0. With this option, the
user will be able to do so.
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent 0018f17f
...@@ -2359,6 +2359,11 @@ Never write it. ...@@ -2359,6 +2359,11 @@ Never write it.
@itemx always @itemx always
Always write it. Always write it.
@end table @end table
@item video_format @var{integer}
Specifies the video_format written into the sequence display extension
indicating the source of the video pictures. The default is @samp{unspecified},
can be @samp{component}, @samp{pal}, @samp{ntsc}, @samp{secam} or @samp{mac}.
For maximum compatibility, use @samp{component}.
@end table @end table
@section png @section png
......
...@@ -348,12 +348,13 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) ...@@ -348,12 +348,13 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
height != s->height || height != s->height ||
s->avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || s->avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
s->avctx->color_trc != AVCOL_TRC_UNSPECIFIED || s->avctx->color_trc != AVCOL_TRC_UNSPECIFIED ||
s->avctx->colorspace != AVCOL_SPC_UNSPECIFIED); s->avctx->colorspace != AVCOL_SPC_UNSPECIFIED ||
s->video_format != VIDEO_FORMAT_UNSPECIFIED);
if (s->seq_disp_ext == 1 || (s->seq_disp_ext == -1 && use_seq_disp_ext)) { if (s->seq_disp_ext == 1 || (s->seq_disp_ext == -1 && use_seq_disp_ext)) {
put_header(s, EXT_START_CODE); put_header(s, EXT_START_CODE);
put_bits(&s->pb, 4, 2); // sequence display extension put_bits(&s->pb, 4, 2); // sequence display extension
put_bits(&s->pb, 3, 5); // video_format: 5 is unspecified put_bits(&s->pb, 3, s->video_format); // video_format
put_bits(&s->pb, 1, 1); // colour_description put_bits(&s->pb, 1, 1); // colour_description
put_bits(&s->pb, 8, s->avctx->color_primaries); // colour_primaries put_bits(&s->pb, 8, s->avctx->color_primaries); // colour_primaries
put_bits(&s->pb, 8, s->avctx->color_trc); // transfer_characteristics put_bits(&s->pb, 8, s->avctx->color_trc); // transfer_characteristics
...@@ -1125,6 +1126,13 @@ static const AVOption mpeg2_options[] = { ...@@ -1125,6 +1126,13 @@ static const AVOption mpeg2_options[] = {
{ "auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, 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" }, { "never", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 0, VE, "seq_disp_ext" },
{ "always", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 0, VE, "seq_disp_ext" }, { "always", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 0, VE, "seq_disp_ext" },
{ "video_format", "Video_format in the sequence_display_extension indicating the source of the video.", OFFSET(video_format), AV_OPT_TYPE_INT, { .i64 = VIDEO_FORMAT_UNSPECIFIED }, 0, 7, VE, "video_format" },
{ "component", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VIDEO_FORMAT_COMPONENT }, 0, 0, VE, "video_format" },
{ "pal", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VIDEO_FORMAT_PAL }, 0, 0, VE, "video_format" },
{ "ntsc", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VIDEO_FORMAT_NTSC }, 0, 0, VE, "video_format" },
{ "secam", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VIDEO_FORMAT_SECAM }, 0, 0, VE, "video_format" },
{ "mac", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VIDEO_FORMAT_MAC }, 0, 0, VE, "video_format" },
{ "unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VIDEO_FORMAT_UNSPECIFIED}, 0, 0, VE, "video_format" },
FF_MPV_COMMON_OPTS FF_MPV_COMMON_OPTS
{ NULL }, { NULL },
}; };
......
...@@ -464,6 +464,13 @@ typedef struct MpegEncContext { ...@@ -464,6 +464,13 @@ typedef struct MpegEncContext {
int intra_vlc_format; int intra_vlc_format;
int alternate_scan; int alternate_scan;
int seq_disp_ext; int seq_disp_ext;
int video_format;
#define VIDEO_FORMAT_COMPONENT 0
#define VIDEO_FORMAT_PAL 1
#define VIDEO_FORMAT_NTSC 2
#define VIDEO_FORMAT_SECAM 3
#define VIDEO_FORMAT_MAC 4
#define VIDEO_FORMAT_UNSPECIFIED 5
int repeat_first_field; int repeat_first_field;
int chroma_420_type; int chroma_420_type;
int chroma_format; int chroma_format;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR 11 #define LIBAVCODEC_VERSION_MINOR 11
#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \ LIBAVCODEC_VERSION_MINOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment