From patchwork Thu Nov 25 17:28:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lynne X-Patchwork-Id: 31673 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1059285iob; Thu, 25 Nov 2021 09:29:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgN+faFFFBgvD1cyVKFuUnD/q6x8H6VP0/a9OPzY+K8lxhI2tyHNZ/1VPbU5HoTOXw1ccb X-Received: by 2002:a05:6402:42c6:: with SMTP id i6mr42462093edc.223.1637861342297; Thu, 25 Nov 2021 09:29:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637861342; cv=none; d=google.com; s=arc-20160816; b=TwVpA7FG0Ll88CbyzCZ5KSh4BpOSZmX202F+NCPqfr1bvyW45YZD7HwM6Gjd2xCV6/ 98nSKOneDGyXR2mOa90rJRdPEuLIyJ5JTW/diRULJBb+6sxAS9jU5kmv9IM017AU+chJ eDl9j0oeAp0ip5K1E3PUtDlnxFxyWnlVjR+o4LozV9is4nwK+kNhiuv9zKA5iWqE3fYb deAmwvp5VNItGQDIUFPjMhzff71s2Ob+Z1+MRel5zF9mU+m36h4soMmlpLJq3juFzz/t sq2yIa0zPXQrqX3+GfdQ4t9Qks3PnSOKGtoxyKTn6zn21LakrqeMqfRvGQM+N7HztUAr rIfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:to:from:date:dkim-signature:delivered-to; bh=DUAmH5agVDOls1wXvY1yVdjpYv0TligJmDQIidiwNlA=; b=aX6uCwhZzIzPUr+hajcvYSxPwft2GRBQ2PTk/Q50McOay4HqVLATDJSBXKGokj7qed ULLX/yacakxLJFvjyV/XLCyQYC3PdPgsZiUdHQqVJPwGL5nWMpropIAhQpmkg8NfFFU5 J9jR0UpE3Ob+LNqe0VGd3o/CoARgESgGIiVlay/PQampNbWJZyMnZ3Pa6MiMgUzoRfIl w386uh/t23MAGobuTzgDbd47tlHIfwbubAql10dEpGUQBogrCwUDKQ/YKIpMI3B5vA2o OByWo3j94gm29ouvWqCfcPOPSbrPtRZIoFsCLopepKfApa4Y0jp+Ygzbbtp7B6k1zLQT kyKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@lynne.ee header.s=s1 header.b=kUrghkAt; 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=lynne.ee Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id jl22si6267135ejc.423.2021.11.25.09.29.01; Thu, 25 Nov 2021 09:29:02 -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=@lynne.ee header.s=s1 header.b=kUrghkAt; 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=lynne.ee Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C8D7368A990; Thu, 25 Nov 2021 19:28:58 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6C4F3680588 for ; Thu, 25 Nov 2021 19:28:52 +0200 (EET) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id 0F3AA1060CCA for ; Thu, 25 Nov 2021 17:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1637861331; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=iBBuMcYsZT9xe2SmFvlitVpsjMb26haXV8eccXQ5EhA=; b=kUrghkAtxmvxDq8TGaz23KPnNfdcXa32RAeqoVDUsiL7aLNjJHpxY7CMkQnXjzxi R+TBVkz8MAIoRoEQrIBSi50QntrGD5bvd5BkIVFJi2aIwYppr+m7aWLSOydG175612w kA4YVDBi9kEEy1Jv6b3/Lx8v3F++j66C1cxKt4wM4zlS//vFeIHZ6/HsdvaAJ9Cdsn1 EU37MrW7WdwrrXVZid9F3GE+mOOR4k3bJrZJSqwtHkx1FjEytUVXwsIHww2MbwK9fPv OYjXUOS6z8f2IQdvFCLh6X0OXj4rBI245vH1pRM/r7FuYiQl8skOF2BQbabpC495bN5 FhFjvN2R6w== Date: Thu, 25 Nov 2021 18:28:51 +0100 (CET) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] lavu/avframe: add a time_base field 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 0z4iWUqMTVbT This adds a time_base field (currently unused), analogue to the AVPacket.time_base field. This allows for API clients to exchange AVFrames directly, without needing to plumb extra data from sources via side mechanisms. Patch attached. Subject: [PATCH] lavu/avframe: add a time_base field This adds a time_base field (currently unused), analogue to the AVPacket.time_base field. --- libavutil/frame.c | 2 ++ libavutil/frame.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/libavutil/frame.c b/libavutil/frame.c index d4d3ad6988..64eed5b0dd 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -63,6 +63,7 @@ static void get_frame_defaults(AVFrame *frame) frame->pkt_duration = 0; frame->pkt_pos = -1; frame->pkt_size = -1; + frame->time_base = (AVRational){ 0, 1 }; frame->key_frame = 1; frame->sample_aspect_ratio = (AVRational){ 0, 1 }; frame->format = -1; /* unknown */ @@ -278,6 +279,7 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy) dst->pkt_pos = src->pkt_pos; dst->pkt_size = src->pkt_size; dst->pkt_duration = src->pkt_duration; + dst->time_base = src->time_base; dst->reordered_opaque = src->reordered_opaque; dst->quality = src->quality; dst->best_effort_timestamp = src->best_effort_timestamp; diff --git a/libavutil/frame.h b/libavutil/frame.h index 753234792e..66fe3070f8 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -421,6 +421,12 @@ typedef struct AVFrame { */ int64_t pkt_dts; + /** + * Time base for the timestamps in this frame. May be 0, in which case the + * time_base from the frame source should be used. + */ + AVRational time_base; + /** * picture number in bitstream order */