summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h7
-rw-r--r--libavcodec/utils.c15
-rw-r--r--libavcodec/version.h2
3 files changed, 19 insertions, 5 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 7df64ae93d..c998ee41c2 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2800,6 +2800,13 @@ typedef struct AVCodecContext {
* - encoding: unused
*/
AVRational framerate;
+
+ /**
+ * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
+ * - encoding: unused.
+ * - decoding: Set by libavcodec before calling get_format()
+ */
+ enum AVPixelFormat sw_pix_fmt;
} AVCodecContext;
/**
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8cbd47b84d..fcc7dde789 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -665,10 +665,13 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
if (ret < 0)
return ret;
- if (hwaccel && hwaccel->alloc_frame) {
- ret = hwaccel->alloc_frame(avctx, frame);
- goto end;
- }
+ if (hwaccel) {
+ if (hwaccel->alloc_frame) {
+ ret = hwaccel->alloc_frame(avctx, frame);
+ goto end;
+ }
+ } else
+ avctx->sw_pix_fmt = avctx->pix_fmt;
#if FF_API_GET_BUFFER
FF_DISABLE_DEPRECATION_WARNINGS
@@ -933,6 +936,10 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
while (fmt[n] != AV_PIX_FMT_NONE)
++n;
+ av_assert0(n >= 1);
+ avctx->sw_pix_fmt = fmt[n - 1];
+ av_assert2(!is_hwaccel_pix_fmt(avctx->sw_pix_fmt));
+
choices = av_malloc_array(n + 1, sizeof(*choices));
if (!choices)
return AV_PIX_FMT_NONE;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index f51c9d7708..5d8f9a1b51 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 56
-#define LIBAVCODEC_VERSION_MINOR 7
+#define LIBAVCODEC_VERSION_MINOR 8
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \