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
2359@itemx always2359@itemx always
2360Always write it.2360Always write it.
2361@end table2361@end table
2362@item video_format @var{integer}
2363Specifies the video_format written into the sequence display extension
2364indicating the source of the video pictures. The default is @samp{unspecified},
2365can be @samp{component}, @samp{pal}, @samp{ntsc}, @samp{secam} or @samp{mac}.
2366For maximum compatibility, use @samp{component}.
2362@end table2367@end table
2363 2368
2364@section png2369@section png
libavcodec/mpeg12enc.c+10−2
@@ -348,12 +348,13 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) · 347 unmodified lines
348 height != s->height ||348 height != s->height ||
349 s->avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||349 s->avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
350 s->avctx->color_trc != AVCOL_TRC_UNSPECIFIED ||350 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);
352 353
353 if (s->seq_disp_ext == 1 || (s->seq_disp_ext == -1 && use_seq_disp_ext)) {354 if (s->seq_disp_ext == 1 || (s->seq_disp_ext == -1 && use_seq_disp_ext)) {
354 put_header(s, EXT_START_CODE);355 put_header(s, EXT_START_CODE);
355 put_bits(&s->pb, 4, 2); // sequence display extension356 put_bits(&s->pb, 4, 2); // sequence display extension
356 put_bits(&s->pb, 3, 5); // video_format: 5 is unspecified357 put_bits(&s->pb, 3, s->video_format); // video_format
357 put_bits(&s->pb, 1, 1); // colour_description358 put_bits(&s->pb, 1, 1); // colour_description
358 put_bits(&s->pb, 8, s->avctx->color_primaries); // colour_primaries359 put_bits(&s->pb, 8, s->avctx->color_primaries); // colour_primaries
359 put_bits(&s->pb, 8, s->avctx->color_trc); // transfer_characteristics360 put_bits(&s->pb, 8, s->avctx->color_trc); // transfer_characteristics
@@ -1125,6 +1126,13 @@ static const AVOption mpeg2_options[] = { · 765 unmodified lines
1125 { "auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, VE, "seq_disp_ext" },1126 { "auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, VE, "seq_disp_ext" },
1126 { "never", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 0, VE, "seq_disp_ext" },1127 { "never", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 0, VE, "seq_disp_ext" },
1127 { "always", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 0, VE, "seq_disp_ext" },1128 { "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" },
1128 FF_MPV_COMMON_OPTS1136 FF_MPV_COMMON_OPTS
1129 { NULL },1137 { NULL },
1130};1138};
libavcodec/mpegvideo.h+7−0
@@ -464,6 +464,13 @@ typedef struct MpegEncContext { · 463 unmodified lines
464 int intra_vlc_format;464 int intra_vlc_format;
465 int alternate_scan;465 int alternate_scan;
466 int seq_disp_ext;466 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
467 int repeat_first_field;474 int repeat_first_field;
468 int chroma_420_type;475 int chroma_420_type;
469 int chroma_format;476 int chroma_format;
libavcodec/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
29 29
30#define LIBAVCODEC_VERSION_MAJOR 5830#define LIBAVCODEC_VERSION_MAJOR 58
31#define LIBAVCODEC_VERSION_MINOR 1131#define LIBAVCODEC_VERSION_MINOR 11
32#define LIBAVCODEC_VERSION_MICRO 10032#define LIBAVCODEC_VERSION_MICRO 101
33 33
34#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \34#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
35 LIBAVCODEC_VERSION_MINOR, \35 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