From patchwork Sat Dec 9 15:37:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 6623 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp808280jah; Sat, 9 Dec 2017 07:39:21 -0800 (PST) X-Google-Smtp-Source: AGs4zMZdTVxlLAbyvCjbtbgHQEUKf5AJCh0E6d40xWBNGrt7yuw4w1WKZjVvU28/h9KRoesZGaC/ X-Received: by 10.223.152.234 with SMTP id w97mr29344676wrb.215.1512833961260; Sat, 09 Dec 2017 07:39:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512833961; cv=none; d=google.com; s=arc-20160816; b=t2gPpwc85l92+z/PvWkMUrR+C1IwAaxwb/Ydvq4m2MMuK2/WzZwelbymJMANQBkbg9 GyfAF+izU0Rtf4zxrh5bb+GndrVDqBcoeCdPDUsMkLMqF3d5e4UdLbyb2Dr5MGQxTYkr CXYb22Hp2XNmCYLz50KGryWbyFajLw0xj3OjzQ/pXxeRpWPst52F7VMSwBF8nq9mL0Rd zSVtJvr076P/59UN+0+Nivzb4QCiaIabB9v9I50FQks1RxUeSPbUTqFWvNvVmnkP7wqD 3mw9TE+i6e55R3h6jbLbPOM648WFv7EEmwLOtMklqU1emDvas48AhPILBIfjxpoqBuqH TbGQ== 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:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=772Zr6+9AP7URy0xbGjw41+fJ/1W3WHw12JG0ddGkU8=; b=oEaStpdV7XBWIeohwAV0m7m1q7/UeQacBlPsYy+hUBf15eapwF8tGCqq+cPFTFrqIh FF4mUi+9I3a2Io+yDT2QktQ23qkDnYth31HjD2baCAi1mvypEC7dtfbR2a+nC9AhWwhx PhtGDSxj+5aAjaHLijJ55x2uBRWu12LQPM+YqiGnTyj0fqayVIFxqq3R36TKo/nbnyvO w9olZFuRpk4FJkOxNhlsL/ZBKd13c6O5rUIPIerMUFAO0FE97MKhjfkIx96W9jlm9Z3h aoPLp6PPvP8ddznsHcgdFLuNF7SfEmeFrbizgcJXpIG2DWaYhmLX/IdKtvnc+w1pz5D3 mg5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=ZtXii1kc; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g44si8092954wra.347.2017.12.09.07.39.20; Sat, 09 Dec 2017 07:39:21 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=ZtXii1kc; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E0C5268A3F9; Sat, 9 Dec 2017 17:39:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E3C0468A042 for ; Sat, 9 Dec 2017 17:38:57 +0200 (EET) Received: by mail-wm0-f66.google.com with SMTP id t8so7548228wmc.3 for ; Sat, 09 Dec 2017 07:39:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=pS8lA8HL3jHKFA6zOz6IA1hA87+IO1SzTaQ5QQgzoOI=; b=ZtXii1kc4x8du/dU2wP4uCVzeHhl1aFdlOcI4NNpJUYIEH1ZyRoerDw4F5XCvSepQF tPP73J/5uWAv2RZEViKoQ4fuMRAAzC6KwmYWgnTWw24qbDY9b1F52GMxNMzGXB7xtCUa E0pgKggePEIEixV/3OcXf7lie8/s48E1ZlecM4q7g93RDJWCafZoXG10Q7DKcLgsYPhE rUVafYu1xsYQrLVAv17fZqiEBTA1lmE7pMNzkDbSk+gaepuG11lpaLKCqaQwRAXuOsXR NVhI9C37MGRo1TB9Qv0cOJCgMZPrjIFtfDnxk8E4Kl0FkP++off/t8NVZ3jDhArPWOKB dpFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=pS8lA8HL3jHKFA6zOz6IA1hA87+IO1SzTaQ5QQgzoOI=; b=eK7l9ciuszMyqmrVMzWMGSkMaG4y7SO/U24CJl6AxSKZhlCSPyDaeCWzNffCYlhm6x 2gYHyFoeSg/1gDZxRORc2+zu7iykyQ7BG0u0kwAN0JXGH7qgRWechhmBrtrZPvhojLzx Uy4Qjhjy/wVYEPosi7rl9Zv5MrKoPJA6y6Jclrke59f99My4K45u0dmDp2wtDp4wiC3a W5excu0UbrEVhnNobxMmVW1NfbsIfYjUC3CnZgAxvqDj2OLPpYtojv6Vp5mYc4yux/np iFL9XRzAvv2j9yfFjt/2vEjgxEvlTPYYOjFyU5HJdKurkORd/kK9GMEX4s32s2eHS231 JerQ== X-Gm-Message-State: AKGB3mJPY5xhAjNh6zoLwZeaGHd9hlk9qy/utcaxcWEDEdikzcIyQRrD aipap3iQV2gwSWQXpBYmDEBKsw== X-Received: by 10.28.107.211 with SMTP id a80mr6380118wmi.71.1512833944210; Sat, 09 Dec 2017 07:39:04 -0800 (PST) Received: from localhost.localdomain ([94.250.174.60]) by smtp.gmail.com with ESMTPSA id 52sm14654536wrv.8.2017.12.09.07.39.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Dec 2017 07:39:03 -0800 (PST) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Sat, 9 Dec 2017 16:37:55 +0100 Message-Id: <20171209153819.19007-3-onemda@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171209153819.19007-1-onemda@gmail.com> References: <20171209153819.19007-1-onemda@gmail.com> Subject: [FFmpeg-devel] [PATCH 03/27] avfilter/buffersrc: recognize color_range as additonal parameter and set it to input link 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Paul B Mahol --- libavfilter/buffersrc.c | 13 +++++++++++++ libavfilter/buffersrc.h | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index cd56f8ca45..67f8bdf158 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -52,6 +52,7 @@ typedef struct BufferSourceContext { int w, h; enum AVPixelFormat pix_fmt; AVRational pixel_aspect; + int color_range; char *sws_param; AVBufferRef *hw_frames_ctx; @@ -109,6 +110,8 @@ int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *par s->h = param->height; if (param->sample_aspect_ratio.num > 0 && param->sample_aspect_ratio.den > 0) s->pixel_aspect = param->sample_aspect_ratio; + if (param->color_range > 0) + s->color_range = param->color_range; if (param->frame_rate.num > 0 && param->frame_rate.den > 0) s->frame_rate = param->frame_rate; if (param->hw_frames_ctx) { @@ -309,6 +312,15 @@ static const AVOption buffer_options[] = { { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V }, { "frame_rate", NULL, OFFSET(frame_rate), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V }, { "sws_param", NULL, OFFSET(sws_param), AV_OPT_TYPE_STRING, .flags = V }, + { "color_range", NULL, OFFSET(color_range), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V, "range" }, + { "unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, 0, V, "range"}, + { "unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, 0, V, "range"}, + { "limited", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, V, "range"}, + { "tv", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, V, "range"}, + { "mpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, V, "range"}, + { "full", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, V, "range"}, + { "pc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, V, "range"}, + { "jpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, V, "range"}, { NULL }, }; @@ -434,6 +446,7 @@ static int config_props(AVFilterLink *link) link->w = c->w; link->h = c->h; link->sample_aspect_ratio = c->pixel_aspect; + link->color_range = c->color_range; if (c->hw_frames_ctx) { link->hw_frames_ctx = av_buffer_ref(c->hw_frames_ctx); diff --git a/libavfilter/buffersrc.h b/libavfilter/buffersrc.h index 0652113f2b..cc32d532c2 100644 --- a/libavfilter/buffersrc.h +++ b/libavfilter/buffersrc.h @@ -114,6 +114,11 @@ typedef struct AVBufferSrcParameters { * Audio only, the audio channel layout */ uint64_t channel_layout; + + /** + * Video only + */ + int color_range; } AVBufferSrcParameters; /**