From patchwork Wed Oct 6 10:14:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 30950 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp219525iob; Wed, 6 Oct 2021 03:15:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCUTWz66pCLA2H1q/xNE9vy168tZy4897IK9to3YGFcugxsnOeZs5v10sluWW70gF5kIFa X-Received: by 2002:a17:906:1bb1:: with SMTP id r17mr31017807ejg.533.1633515323272; Wed, 06 Oct 2021 03:15:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633515323; cv=none; d=google.com; s=arc-20160816; b=iXcqWormqQT77CDrKv/pyAhoz4nlFzzCSSFMzlabJDV+3mNzPYzrOgqdyVOyMHbYoC KsmYnXnCVADobIhz3bc+D3ii60wIkC/68bfjQ9BrSlZmw/24hkqOT0mordjEB9WvOWqU WlJJi7eUlbpecSPwejz1N51o+ACdTLR+ef5ydV1JyeCi3IJOmabflAUQn29sPV8AqANy r4aPXk5wVbvt6mK6uLRXmlhzPKlHsC/igoyy21Ch7cE5fRLRONxiEnBcA7S+0k49X6HM yevrCnrg4Mw/8cz4Vq6Cpbx70CcxreYMA9VmqqtE0q6ZSHR9ZaxIhoJVN3e6m8ZQoFNt Jt+g== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=HMBJ7x4O4oREtad9+4nG8PeqKaYMVmTBZW00dkSMepY=; b=BpUS2+g/eEqAnJMuBGy+ysSY3XPkKC8y7hVhcdkE1ff6EFm8No7PfMVVrlpJ3EmP8V 36oeAUFRaF3DEALN6NKTuibkKtVnjEO9dE2r5gqq47PaMWClxAlJHt78DA6zboZdT4ne 2JXa/8Tcz7/PbCINNbZXxa3CXmK8cs3coELSSBvxgBShUwGDz3VanpM/R1CA1fgkBexq FHlSC/tN3wWmTsWK/jn3dwPs50hTVhAB6MMxUYRmZW6rhzH/5lONNuQ35ZvbDZKrM/3Z bq084torI7WehKaThdL4N66saWG8fcMXX/YuKp/BlIeSgStvH/aS0prC18HXDIdevdPX 9CWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=VgRRg+rr; 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 m9si16840406edf.531.2021.10.06.03.15.22; Wed, 06 Oct 2021 03:15:23 -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=VgRRg+rr; 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 08F4268AC65; Wed, 6 Oct 2021 13:14:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AD58568AC87 for ; Wed, 6 Oct 2021 13:14:22 +0300 (EEST) Received: by mail-pg1-f178.google.com with SMTP id s75so2048645pgs.5 for ; Wed, 06 Oct 2021 03:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GEkGW5ggWr2Njc4vCyDp5c1uV6/esEbt77Jd6F+ukWE=; b=VgRRg+rr1sy7iRK0HSVUACWstbGLSoU45XT+EQg3WqE0FFVwJ1YY5wxrO6+5wvvdqq 4usS7FgHydCEjEHFM/h7+RPlnMTr3YyUpdo1JFZVfz3wF7/JRuqXF6J+CRQ9iULViZE9 zlMGY2IUmkgPjzDGCPqR5kUR39i6DXaKFdOSAdH2heOaQlSD7+Ej5uzVOnQXbRCLEbUO s0OJINydUPjqfROlppvb2vKbyb4YxaA4vfAushNKlRlfYF/uPJucZMa5UlnLhIfTtEew oIRYtQuRCC0mGVoxrTssAkYnJfvLESCAOxGKR0YIaN2F/orIoSK6eUZk8wzwgEU+8wtw XDSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GEkGW5ggWr2Njc4vCyDp5c1uV6/esEbt77Jd6F+ukWE=; b=oytTSvXyxjuQVn8ytv4FcVqhCFvdbUlHh4R4jacCF3v4i9DVzCdIfg7tns00Y4/6v3 +WZET+0LzdMwuri6ObGUyjbbugFr2psF4aQ2HgUvxs1JkCpQGyJh5at9dr3pUHh/oXMW I9w/KDU3NlaJVFgxmnQn5vRN60507PD/jgoxLj9Xd06VnRY3WHhEPpLAKZW8UePNEESY aDsHS73G29Ivb59rPeGgg3uTfySYZVjNktIiU//C7Uu393GjPvHM8Fib6zwX3BX+8qQo PaQZDSheKA6QnVPingzkG/ItygJsWVyW4ik28gDyNqZzKQhSRYVb3XWcKsXAYmvfP5MN HuJA== X-Gm-Message-State: AOAM531nmDfQrWkA6jXuj+VYqUoX1ke47sx9zHpLnpAndPE0yMfdTQpD gPZBh100dcRcILx5Zi5oZbP82fLf7IQ= X-Received: by 2002:a62:dd84:0:b0:44b:b54a:c2a5 with SMTP id w126-20020a62dd84000000b0044bb54ac2a5mr36926128pff.11.1633515260943; Wed, 06 Oct 2021 03:14:20 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id i125sm20338309pfc.36.2021.10.06.03.14.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Oct 2021 03:14:20 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Oct 2021 18:14:09 +0800 Message-Id: <1633515251-5156-6-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1633515251-5156-1-git-send-email-lance.lmwang@gmail.com> References: <1633515251-5156-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 6/8] avformat/rtpdec_rfc4175: add support for TCS 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 0IAUKBQRL66x From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 367567d..db6b9b8 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -30,6 +30,7 @@ struct PayloadContext { char *sampling; char *framerate; + char *TCS; int depth; int width; int height; @@ -66,6 +67,21 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) return AVERROR_INVALIDDATA; } + if (!data->TCS) + stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; + else if (!strncmp(data->TCS, "SDR", 3)) + stream->codecpar->color_trc = AVCOL_TRC_BT709; + else if (!strncmp(data->TCS, "PQ", 2)) + stream->codecpar->color_trc = AVCOL_TRC_SMPTE2084; + else if (!strncmp(data->TCS, "HLG", 3)) + stream->codecpar->color_trc = AVCOL_TRC_ARIB_STD_B67; + else if (!strncmp(data->TCS, "LINEAR", 6)) + stream->codecpar->color_trc = AVCOL_TRC_LINEAR; + else if (!strncmp(data->TCS, "ST428-1", 7)) + stream->codecpar->color_trc = AVCOL_TRC_SMPTEST428_1; + else if (!strncmp(data->TCS, "UNSPECIFIED", 11)) + stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; + desc = av_pix_fmt_desc_get(pixfmt); stream->codecpar->format = pixfmt; stream->codecpar->codec_tag = tag; @@ -97,6 +113,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, data->depth = atoi(value); else if (!strncmp(attr, "exactframerate", 14)) data->framerate = av_strdup(value); + else if (!strncmp(attr, "TCS", 3)) + data->TCS = av_strdup(value); return 0; } @@ -126,6 +144,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int st_index, ret = rfc4175_parse_format(stream, data); av_freep(&data->sampling); av_freep(&data->framerate); + av_freep(&data->TCS); return ret; }