History

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.

Marton Balint committed 8 years ago

Commit ce6ce591 parent 0018f174 files · +23 −3Browse files

Unified · Split

4 files
  1. doc/encoders.texi +5 −0
  2. libavcodec/mpeg12enc.c +10 −2
  3. libavcodec/mpegvideo.h +7 −0
  4. libavcodec/version.h +1 −1
doc/encoders.texi+5−0
@@ -2359,6 +2359,11 @@ Never write it. · 2358 unmodified lines
23592359 @itemx always
23602360 Always write it.
23612361 @end table
2362+@item video_format @var{integer}
2363+Specifies the video_format written into the sequence display extension
2364+indicating the source of the video pictures. The default is @samp{unspecified},
2365+can be @samp{component}, @samp{pal}, @samp{ntsc}, @samp{secam} or @samp{mac}.
2366+For maximum compatibility, use @samp{component}.
23622367 @end table
23632368
23642369 @section png
libavcodec/mpeg12enc.c+10−2
@@ -348,12 +348,13 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) · 347 unmodified lines
348348 height != s->height ||
349349 s->avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
350350 s->avctx->color_trc != AVCOL_TRC_UNSPECIFIED ||
351− s->avctx->colorspace != AVCOL_SPC_UNSPECIFIED);
351+ s->avctx->colorspace != AVCOL_SPC_UNSPECIFIED ||
352+ s->video_format != VIDEO_FORMAT_UNSPECIFIED);
352353
353354 if (s->seq_disp_ext == 1 || (s->seq_disp_ext == -1 && use_seq_disp_ext)) {
354355 put_header(s, EXT_START_CODE);
355356 put_bits(&s->pb, 4, 2); // sequence display extension
356− put_bits(&s->pb, 3, 5); // video_format: 5 is unspecified
357+ put_bits(&s->pb, 3, s->video_format); // video_format
357358 put_bits(&s->pb, 1, 1); // colour_description
358359 put_bits(&s->pb, 8, s->avctx->color_primaries); // colour_primaries
359360 put_bits(&s->pb, 8, s->avctx->color_trc); // transfer_characteristics
@@ -1125,6 +1126,13 @@ static const AVOption mpeg2_options[] = { · 765 unmodified lines
11251126 { "auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, VE, "seq_disp_ext" },
11261127 { "never", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 0, VE, "seq_disp_ext" },
11271128 { "always", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 0, VE, "seq_disp_ext" },
1129+ { "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" },
1130+ { "component", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VIDEO_FORMAT_COMPONENT }, 0, 0, VE, "video_format" },
1131+ { "pal", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VIDEO_FORMAT_PAL }, 0, 0, VE, "video_format" },
1132+ { "ntsc", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VIDEO_FORMAT_NTSC }, 0, 0, VE, "video_format" },
1133+ { "secam", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VIDEO_FORMAT_SECAM }, 0, 0, VE, "video_format" },
1134+ { "mac", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VIDEO_FORMAT_MAC }, 0, 0, VE, "video_format" },
1135+ { "unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VIDEO_FORMAT_UNSPECIFIED}, 0, 0, VE, "video_format" },
11281136 FF_MPV_COMMON_OPTS
11291137 { NULL },
11301138 };
libavcodec/mpegvideo.h+7−0
@@ -464,6 +464,13 @@ typedef struct MpegEncContext { · 463 unmodified lines
464464 int intra_vlc_format;
465465 int alternate_scan;
466466 int seq_disp_ext;
467+ int video_format;
468+#define VIDEO_FORMAT_COMPONENT 0
469+#define VIDEO_FORMAT_PAL 1
470+#define VIDEO_FORMAT_NTSC 2
471+#define VIDEO_FORMAT_SECAM 3
472+#define VIDEO_FORMAT_MAC 4
473+#define VIDEO_FORMAT_UNSPECIFIED 5
467474 int repeat_first_field;
468475 int chroma_420_type;
469476 int chroma_format;
libavcodec/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929
3030 #define LIBAVCODEC_VERSION_MAJOR 58
3131 #define LIBAVCODEC_VERSION_MINOR 11
32−#define LIBAVCODEC_VERSION_MICRO 100
32+#define LIBAVCODEC_VERSION_MICRO 101
3333
3434 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
3535 LIBAVCODEC_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t