From patchwork Sat Feb 10 18:45:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 7550 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.150.1 with SMTP id c1csp2238008jai; Sat, 10 Feb 2018 10:45:51 -0800 (PST) X-Google-Smtp-Source: AH8x225z+xHFtM4Q8P/MYNTmYExQzTIGVLoq0eKDbYdpQhydBbJbaaYFCGtujtIQZ3IaDGRw2xdQ X-Received: by 10.28.93.83 with SMTP id r80mr5469668wmb.154.1518288351308; Sat, 10 Feb 2018 10:45:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518288351; cv=none; d=google.com; s=arc-20160816; b=PWkhJJil8fP0KN5AnDnUMjJ4MXLKkGPx7fKP3Dhna+3Nz6yMuPC95LC64FiNutI4HD 2o7GS8ncb/8ZREyohKkQiy9i5JT0Phm0GHb2N4aqJIyZhyvKUShq+15PQoSdlNDUmnry r6fIQt683oQUvHMKEUgmtVJJWUeshJG5ZN72RAGWeM/WthJyXa2K/gJxefZ9HuDSJqOO BRe53nykAQXl6QcN9aNkl+HMSwr3fYWT1vI5D2bAukY+ey7cQ0iny6W280JlWedk8Akj mj6EMqmABd7YrIUHS7NeJoRSfN0/waEvPUrH4pqw3W7uVoq9Ll4+CsSNRGvKFLhGil0s pIGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=WVGxEypjT1DaEaKQ7N7kVSbavnRfnQ3GBWYjWeokiGA=; b=Af99vRg3+0kQ30N6kMOGBnbsH28ui/H6yTZK7M73Q0PyNxyJaHUBm+5F4ebNUzwJlC uWP67fGl/USUnmfxvUQ1so2OLuDLtnOgYmwflMtuuCMkKyYm13zjd8oeK+0lxQ46jelM hzL3diR/EtEUN50pWN/voVe+dw7l/jofiAtDOVEaZ8AB562RG8DFPjygSLuJiX0rcp/0 Uqje2NhluQg1P09blrnCsNYUTgQOzSeIeZN8s9d+YgJVI2Drm4FH7dR2dd10PzmOKyR4 B2V6yxy4QOdI6i2FqG1VZduArmh5UqAXzeFp2nrev28AhkOAX/IsyWt2vH6pWKZ0EgwR yf4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q3si1244545wmf.50.2018.02.10.10.45.50; Sat, 10 Feb 2018 10:45:51 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3A3C1689811; Sat, 10 Feb 2018 20:45:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DB596687EAF for ; Sat, 10 Feb 2018 20:45:32 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id C0498E196B; Sat, 10 Feb 2018 19:45:42 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B1X4qcajVXkf; Sat, 10 Feb 2018 19:45:41 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 7C611E17CA; Sat, 10 Feb 2018 19:45:41 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sat, 10 Feb 2018 19:45:36 +0100 Message-Id: <20180210184536.25146-1-cus@passwd.hu> X-Mailer: git-send-email 2.13.6 Subject: [FFmpeg-devel] [PATCH] avformat/mpeg12enc: add support for specifying video_format in the sequence_display_extension X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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. Signed-off-by: Marton Balint --- doc/encoders.texi | 5 +++++ libavcodec/mpeg12enc.c | 12 ++++++++++-- libavcodec/mpegvideo.h | 7 +++++++ libavcodec/version.h | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index c5dfc646d9..f25d47e272 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -2359,6 +2359,11 @@ Never write it. @itemx always Always write it. @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 @section png diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 0084f544f2..d0b458e34b 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -348,12 +348,13 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) height != s->height || s->avctx->color_primaries != AVCOL_PRI_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)) { put_header(s, EXT_START_CODE); 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, 8, s->avctx->color_primaries); // colour_primaries put_bits(&s->pb, 8, s->avctx->color_trc); // transfer_characteristics @@ -1125,6 +1126,13 @@ static const AVOption mpeg2_options[] = { { "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" }, { "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 { NULL }, }; diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index c5e3359458..e800e4a3b8 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -464,6 +464,13 @@ typedef struct MpegEncContext { int intra_vlc_format; int alternate_scan; 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 chroma_420_type; int chroma_format; diff --git a/libavcodec/version.h b/libavcodec/version.h index e36cea30b5..e5eefd789c 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 10 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \