From patchwork Mon Oct 11 16:23: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: 31067 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2084:0:0:0:0 with SMTP id a4csp3871093ioa; Mon, 11 Oct 2021 09:23:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8zuUO39g5yKztHIbQGboHOQqfqTSJUyN0u6l8u/8Lrn258O2Lf7Z5u0Ld+TtKtP654DPA X-Received: by 2002:a05:6402:4308:: with SMTP id m8mr42587685edc.188.1633969410764; Mon, 11 Oct 2021 09:23:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633969410; cv=none; d=google.com; s=arc-20160816; b=iSrNn9ozRA9TrQs0CAE68eSm+hPvmuCgsHt+EKQckIyLQwFlcFBkaoMx/cdMWqJ5BY vZbkBZ7LOXecad0BUf9GZeKYvkxjtiVDF4M8f4DQdOBI/JNavSzlKvG3Pel3HkKT/5GP ukV4OTYpo9HoJO8o+Ib+0E/b6pl+oXbuyq2D+4CuiGL37SKxhqaOynrZUWq4MZCO+R35 VjGMYzvMJyFAg3SVnboqIAeg7ANBtdAnf8NrLxiRrT6rtNCeT5dDQRoH1eoL28G+WqFP Ina1kg2TGlhT9iRc9VfPgQO+eTiwn1oGEhLfmbF2Of1Oo/dvMyHlMBhP27WPThgy8u7c Zh6A== 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=B4YrD0c0H5RFD66qIQSXFY/hE//6g1+eaWT6HQDy50I=; b=RosblHsZn4PDHgi9CsXdqzvOhdvraojzS5f2/QQlI3jt0xSi7X4gPaoOFZpbKeYbwo oK9jfP68VWu8rejP1v4SnVKRe6gte9h/SOA+pjqSsjwsSHGU9HhIWc6csyyHb+9yp05b bXosOyaHNCsl2VWwm2bwXSOq5gSVnP9wIaFT9DkpcBQSAOdKAFxHLxrTPC+P/uz4KMef bYR6r/O+tiLr17qv+yG2vphq7rs2GvvzWc+PIZ1KsgIeeEh2UYzmDcc5bi9W7Bka3xY6 B+gtFeMo3rXCjdvEgzR8rTuB1gI+8gwn5B9HHLzTCWiCnB3ZKqOzgjxcRYbANi28ROM2 6N3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=pTDQRFTO; 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 dd5si18205493ejc.375.2021.10.11.09.23.29; Mon, 11 Oct 2021 09:23:30 -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=pTDQRFTO; 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 522C768052C; Mon, 11 Oct 2021 19:23:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B126968052C for ; Mon, 11 Oct 2021 19:23:19 +0300 (EEST) Received: by mail-pl1-f182.google.com with SMTP id g9so1243272plo.12 for ; Mon, 11 Oct 2021 09:23:19 -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=cj4lTd2Rim5c7nx+6AH4rIoFqK3y8gkONlAOo6sZQck=; b=pTDQRFTOt5qfvUgmVNHVj5QZ/TTP4jJ4cFbd2J6O2MRv+tpD/4ggFY9WFmLD/JfDAG TNCKg9FLNYvtKqKBfg9iPRsDoO3nc287WZgGvITg5LA2kk2WJgYZ6k1jNqRO8AvkXvGQ bFaIrqxDpUUpMw3Lm2BxAnRU9mNFgB+RU4FMh3qBMQRWfivDUxw4vUbdpj780jQ3yjQ5 vH0gJV6yakJ1QJFaG6PJulelW3c/zO9o2xXfaF7zmEMfAzGojglVLQgbe9lCVo0TtkiT FpjQoWVdDxPmP2h/yG4ps1h+evSt5cUL0AGsTWG4aP/InZET6YFRH8H9tNmxHSLN/52p QmEg== 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=cj4lTd2Rim5c7nx+6AH4rIoFqK3y8gkONlAOo6sZQck=; b=hojyA1sDgZB4HEZ+eGS+4rc14PckIUHmndoWkMoKdcAwppxywoWJofcvMeoNaMrG9m Us74Ft+7fJrDy8G0f8A4xbDZQjGaGoE5uqjpbvGrLuejmx1/t/xM2YFDTVjeO104Zz7l xXEcEFXWnDEYnkSYZUoN0L9ehA+V2ggY4EhrFSuNCEXAUk3kB7xpAvYgrkgGEuLeDugM fRAhiRoZeKJaiHsHpchsP3OpZLEhIsCfNk0E/yuOxvm/2ro9nj4ed4GKQifYf7XfeV1B dGSD+BywYujUGwRHJ7yeY+IJ+sKGXXWiYXkpBa5+HuEuqezIN0/2l3OqohhfB7ZQUJ7W IXhQ== X-Gm-Message-State: AOAM532PaR55pGIJMxmAXciygYFr0p3wC1/bWLBsBHdGZlq3c/EBC85n asAbD2AMp/N4JNCvwp7ZLtu1eyeof9A= X-Received: by 2002:a17:90a:9404:: with SMTP id r4mr31263707pjo.240.1633969397558; Mon, 11 Oct 2021 09:23:17 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id k17sm8459152pfk.16.2021.10.11.09.23.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Oct 2021 09:23:17 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Oct 2021 00:23:09 +0800 Message-Id: <1633969392-17937-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1633515251-5156-5-git-send-email-lance.lmwang@gmail.com> References: <1633515251-5156-5-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 1/4] avformat/rtpdec_rfc4175: add support for exactframerate 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: WM0SmfQAqKrm From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 712c683..060f725 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -25,9 +25,11 @@ #include "rtpdec_formats.h" #include "libavutil/avstring.h" #include "libavutil/pixdesc.h" +#include "libavutil/parseutils.h" struct PayloadContext { char *sampling; + AVRational framerate; int depth; int width; int height; @@ -69,6 +71,11 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) stream->codecpar->bits_per_coded_sample = av_get_bits_per_pixel(desc); data->frame_size = data->width * data->height * data->pgroup / data->xinc; + if (data->framerate.den > 0) { + stream->avg_frame_rate = data->framerate; + stream->codecpar->bit_rate = data->frame_size * av_q2d(data->framerate) * 8; + } + return 0; } @@ -84,6 +91,10 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, data->sampling = av_strdup(value); else if (!strncmp(attr, "depth", 5)) data->depth = atoi(value); + else if (!strncmp(attr, "exactframerate", 14)) { + if (av_parse_video_rate(&data->framerate, value) < 0) + return AVERROR(EINVAL); + } return 0; }