[FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters
Zhong Li
zhong.li at intel.com
Thu Jan 18 07:03:33 EET 2018
coded_width/height may be different from width/height sometimes
(e.g, crop or lowres cases).
ffprobe always show coded_width/height same as width/height since they
are overwritten.
This fixes tiket #6958.
Signed-off-by: Zhong Li <zhong.li at intel.com>
---
libavcodec/avcodec.h | 7 +++++++
libavcodec/utils.c | 4 ++++
libavcodec/version.h | 2 +-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 8fbbc79..710e90c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3905,6 +3905,13 @@ typedef struct AVCodecParameters {
int height;
/**
+ * Video only. The dimensions of the coded video frame in pixels.
+ *
+ */
+ int coded_width;
+ int coded_height;
+
+ /**
* Video only. The aspect ratio (width / height) which a single pixel
* should have when displayed.
*
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4c71843..427f612 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2147,6 +2147,8 @@ int avcodec_parameters_from_context(AVCodecParameters *par,
par->format = codec->pix_fmt;
par->width = codec->width;
par->height = codec->height;
+ par->coded_width = codec->coded_width;
+ par->coded_height = codec->coded_height;
par->field_order = codec->field_order;
par->color_range = codec->color_range;
par->color_primaries = codec->color_primaries;
@@ -2202,6 +2204,8 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
codec->pix_fmt = par->format;
codec->width = par->width;
codec->height = par->height;
+ codec->coded_width = par->coded_width;
+ codec->coded_height = par->coded_height;
codec->field_order = par->field_order;
codec->color_range = par->color_range;
codec->color_primaries = par->color_primaries;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 47a15d5..ec536bf 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR 9
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
--
1.8.3.1
More information about the ffmpeg-devel
mailing list