From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 5D1D4454CC for ; Tue, 2 May 2023 09:52:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3CE2468BEDB; Tue, 2 May 2023 12:52:42 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4DBD768C0FA for ; Tue, 2 May 2023 12:52:35 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 130072404EC for ; Tue, 2 May 2023 11:52:35 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id o9RNgriMhKJg for ; Tue, 2 May 2023 11:52:33 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id E7DE7240177 for ; Tue, 2 May 2023 11:52:32 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id A8BE03A02A7 for ; Tue, 2 May 2023 11:52:32 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 May 2023 11:52:30 +0200 Message-Id: <20230502095231.28899-1-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] lavc/codec_par: add AVCodecParameters.framerate 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This corresponds to AVCodecContext.framerate. --- This will be useful in my ffmpeg CLI work, but sending the patches separately because it's an API addition. --- doc/APIchanges | 3 +++ libavcodec/codec_par.c | 3 +++ libavcodec/codec_par.h | 12 ++++++++++++ libavcodec/version.h | 2 +- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 0b609e3d3b..4dbdc5bd01 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-05-xx - xxxxxxxxxx - lavc 60.11.100 - codec_par.h + Add AVCodecParameters.framerate. + 2023-04-10 - xxxxxxxxxx - lavu 58.6.100 - frame.h av_frame_get_plane_buffer() now accepts const AVFrame*. diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c index abda649aa8..775c187073 100644 --- a/libavcodec/codec_par.c +++ b/libavcodec/codec_par.c @@ -46,6 +46,7 @@ static void codec_parameters_reset(AVCodecParameters *par) par->color_space = AVCOL_SPC_UNSPECIFIED; par->chroma_location = AVCHROMA_LOC_UNSPECIFIED; par->sample_aspect_ratio = (AVRational){ 0, 1 }; + par->framerate = (AVRational){ 0, 1 }; par->profile = FF_PROFILE_UNKNOWN; par->level = FF_LEVEL_UNKNOWN; } @@ -126,6 +127,7 @@ int avcodec_parameters_from_context(AVCodecParameters *par, par->chroma_location = codec->chroma_sample_location; par->sample_aspect_ratio = codec->sample_aspect_ratio; par->video_delay = codec->has_b_frames; + par->framerate = codec->framerate; break; case AVMEDIA_TYPE_AUDIO: par->format = codec->sample_fmt; @@ -207,6 +209,7 @@ int avcodec_parameters_to_context(AVCodecContext *codec, codec->chroma_sample_location = par->chroma_location; codec->sample_aspect_ratio = par->sample_aspect_ratio; codec->has_b_frames = par->video_delay; + codec->framerate = par->framerate; break; case AVMEDIA_TYPE_AUDIO: codec->sample_fmt = par->format; diff --git a/libavcodec/codec_par.h b/libavcodec/codec_par.h index f51d27c590..add90fdb1e 100644 --- a/libavcodec/codec_par.h +++ b/libavcodec/codec_par.h @@ -211,6 +211,18 @@ typedef struct AVCodecParameters { * Audio only. The channel layout and number of channels. */ AVChannelLayout ch_layout; + + /** + * Video only. Number of frames per second, for streams with constant frame + * durations. Should be set to { 0, 1 } when some frames have differing + * durations or if the value is not known. + * + * @note This field correponds to values that are stored in codec-level + * headers and is typically overridden by container/transport-layer + * timestamps, when available. It should thus be used only as a last resort, + * when no higher-level timing information is available. + */ + AVRational framerate; } AVCodecParameters; /** diff --git a/libavcodec/version.h b/libavcodec/version.h index 80e2ae630d..8b53586be1 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 10 +#define LIBAVCODEC_VERSION_MINOR 11 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ -- 2.39.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".