summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-05-01 13:35:18 +0200
committerAnton Khirnov <anton@khirnov.net>2023-05-07 15:47:25 +0200
commitc2ae8e30b7f3629b097eb0db89e509756ed923e8 (patch)
tree95b028bb49cffaccf73152d5251f8440beaeff05 /libavcodec
parent55ea1da1c0fb3d04878d38c668ec159c2f45f06e (diff)
downloadffmpeg-c2ae8e30b7f3629b097eb0db89e509756ed923e8.tar.gz
lavc/codec_par: add AVCodecParameters.framerate
This corresponds to AVCodecContext.framerate.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/codec_par.c3
-rw-r--r--libavcodec/codec_par.h12
-rw-r--r--libavcodec/version.h2
3 files changed, 16 insertions, 1 deletions
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, \