From patchwork Mon Aug 29 00:02:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hutchinson X-Patchwork-Id: 37541 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp1633838pzh; Sun, 28 Aug 2022 17:03:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR62rsVwGLk1aGIdv3PJCRzGfuu7esErxLm9fWTatuPpGLrtlNR0EDDo+ORZOAWbu3S2wVEn X-Received: by 2002:a05:6402:294c:b0:446:fb0:723b with SMTP id ed12-20020a056402294c00b004460fb0723bmr14839108edb.258.1661731426718; Sun, 28 Aug 2022 17:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661731426; cv=none; d=google.com; s=arc-20160816; b=lqVCwllAfa/axhdCi4goqpI/7EfiPvXoB9XLdwZDgWpUE1GEUGOx2TCJj1Ri+nhRZi Dl745lQewc87ADU/vfs3g/17TI74LFca+g+B4zYReBjRklNB/Gq3gSOxfkjAPh+pfTVd upLYw/ClyW1jlSfcK5mlCT42pkjMRYlEaxGMmCN+LMZ0El266uLAW2of/Blw+UB2nSos TWS4yppsVNU7bDAAaKnZ5GhWMrr1wJwRYsPDPQrheWv+/t2CY417qVnaHdzMNUkYqiO9 q2Ax8sgb5/uC2iUqyY+fwTyYvnE/kh89bR40DTBH7uhEESG0qRI1E2r4BfxluiPntngg eXFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=TEfMT9hTLWTPps7f0550xfrPViCmEL4W1l9nC59NkQ4=; b=AUXD1S4w8Gmlr7Woqdp79CGlx8gqp6zLCBQ8N4RoPpcR7RtSOijJcOEctzk6cXExAd l3ecctE3wReNP7+y6HCvbGozD/JxHsVyd5ApOaUBSGA7yYkvFM/lzX0lkdTwz1LM2dWT QKzz4z2kZjuK2PwVZLdCoD3/+wV5o5vL5L+VR1KH9ilHnx8ImgDO4l+om49kUkbvhmNF 3XLriaSUBim/DtuuoYohFJfBpcI7udMsoC+VaQ5OUmrJpF7r3uOSwFjb8EkIoJ6VThKn XRPxT3EwD9XqNwkpEaLMix0dBdAb+ckKogoWkwfMBjAgQYqxRm0gJplIbBfoYxE3WEPo ShCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=he7f4A0L; 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=QUARANTINE 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 nc40-20020a1709071c2800b00732f83f9a17si5267526ejc.349.2022.08.28.17.03.46; Sun, 28 Aug 2022 17:03:46 -0700 (PDT) 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=20210112 header.b=he7f4A0L; 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=QUARANTINE 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 43BD468B9CD; Mon, 29 Aug 2022 03:03:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6488368B9C4 for ; Mon, 29 Aug 2022 03:02:59 +0300 (EEST) Received: by mail-vs1-f51.google.com with SMTP id f185so2039962vsc.4 for ; Sun, 28 Aug 2022 17:02:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=GQJAwDPOrGlnvY02DUpj6b3/VAEhNwKPhM/hIw6vocc=; b=he7f4A0LbnHE59g1+bhpN85MQ64HiJaYbyUAqneoKFuhrk00i3zH8lwT3j0Q1coG/I QN83M8UmWtMoOeAI8PXVQf1htVu3qmCLQcWDKh48aTKWZBoRQ6ifB0Cs7W6VFP7zTThW iejgPfGnJw4AANILX+R/Cvonh4HvIGGB4HrmPansHwqc9KFBz1/abwMPmlgYdUZQHpSb zOsg8Rb7qizm7kjl6tyVT4lgY3mkmXffWbDUmRljaQLjfuVk95Sz6eR1InTJ1IfLogqO 3CvrmVLgrZO1KiAv9nHYZfT6BGjyKcdwcpSUD/LyxkeDgUfLNc7/OVS5aKvgVzoDRi57 NDLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=GQJAwDPOrGlnvY02DUpj6b3/VAEhNwKPhM/hIw6vocc=; b=0vQIF0xQu/cxZOKiDhnjni54zLqb3ZmQ5i2CndAKROVZW8ulh6dby3RVL6Lg1WJbEA oeTgatfp4uMF/Oe6xD6LQHOyvPfpi042DyxcQ5a7sQnMxSCrtwMTQ6m3dMD9CuZNe2TY meagPN7NY4sf58OMG6r75HtzfR/1+FtwCf2e03h6A9KIooY5rfiL2vQYN9gwUmSy04m2 71xIWG06FJfW3pcWuYeYGrplhFQoCEIbq2Uafw0/Yb4mxirGvNxmpp4yCucPx514Rw1r AzZatXVi5yz2l/wmGoQ9TIpcctZh+ISCy5ehsjHsZlYcUVMjH2ROws2qmTkO+tW430nV aHaA== X-Gm-Message-State: ACgBeo04f7XEK5LGkmkibnCl9aOIhRm8zdqKMcf8pPvCazIidiuEUi2n oXB0I2s7G/6rIHqAAkLyaJDQnT1AvhP7eQ== X-Received: by 2002:a67:d582:0:b0:390:d6dd:5612 with SMTP id m2-20020a67d582000000b00390d6dd5612mr1254243vsj.78.1661731377758; Sun, 28 Aug 2022 17:02:57 -0700 (PDT) Received: from cappuccino.. (075-115-109-114.inf.spectrum.com. [75.115.109.114]) by smtp.gmail.com with ESMTPSA id z5-20020ab05645000000b0039f07e29623sm1382804uaa.4.2022.08.28.17.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Aug 2022 17:02:57 -0700 (PDT) From: Stephen Hutchinson To: ffmpeg-devel@ffmpeg.org Date: Sun, 28 Aug 2022 20:02:40 -0400 Message-Id: <20220829000244.71123-6-qyot27@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220829000244.71123-1-qyot27@gmail.com> References: <20220829000244.71123-1-qyot27@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/9] avformat/avisynth: add read_frameprop_range option X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Stephen Hutchinson Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: O+a3RpCkwQRF Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index c76b50421c..65d8448e89 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -105,6 +105,7 @@ typedef struct AviSynthContext { /* (de)activate reading frame properties */ int frameprops; int frameprop_field_order; + int frameprop_range; int frameprop_sar; /* Linked list pointers. */ @@ -547,18 +548,20 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } /* Color Range */ - if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ColorRange") == AVS_PROPTYPE_UNSET) { - st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED; - } else { - switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_ColorRange", 0, &error)) { - case 0: - st->codecpar->color_range = AVCOL_RANGE_JPEG; - break; - case 1: - st->codecpar->color_range = AVCOL_RANGE_MPEG; - break; - default: + if(avs->frameprop_range) { + if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ColorRange") == AVS_PROPTYPE_UNSET) { st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED; + } else { + switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_ColorRange", 0, &error)) { + case 0: + st->codecpar->color_range = AVCOL_RANGE_JPEG; + break; + case 1: + st->codecpar->color_range = AVCOL_RANGE_MPEG; + break; + default: + st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED; + } } } @@ -1156,6 +1159,7 @@ static int avisynth_read_seek(AVFormatContext *s, int stream_index, static const AVOption avisynth_options[] = { { "read_frameprops", "Read frame properties from script (AviSynth+ v3.7.1+).", OFFSET(frameprops), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { "read_frameprop_field_order", "Read field order from script's frame properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_field_order), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, + { "read_frameprop_range", "Read color range from script's frame properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_range), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { "read_frameprop_sar", "Read SAR from script's frame properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_sar), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, };