Bitstream-based hw acceleration does not fit well the per-slice model.
Provide a decode() and a flush() callback to completely override the
software decoder.
---
doc/APIchanges | 4 ++++
libavcodec/avcodec.h | 12 ++++++++++++
libavcodec/utils.c | 9 +++++++--
libavcodec/version.h | 4 ++--
4 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index ee31719..0818a48 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,10 @@ libavutil: 2014-08-09
API changes, most recent first:
+2014-10-xx - xxxxxxx - lavc 56.3.0 - avcodec.h
+ Add AVHWAccel.decode and AVHWAccel.flush callbacks to support
+ bitstream oriented hardware acceleration frameworks.
+
2014-09-xx - xxxxxxx - lavu 54.04.0 - pixdesc.h
Add API to return the name of frame and context color properties.
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f0fa7a9..72a5618 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3014,6 +3014,18 @@ typedef struct AVHWAccel {
* AVCodecInternal.hwaccel_priv_data.
*/
int priv_data_size;
+
+ /**
+ * Directly decode the avpacket, it is called instead of the normal
+ * AVCodec callback.
+ */
+ int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
+ AVPacket *avpkt);
+ /**
+ * Flush the decoder, it is called instead of the normal AVCodec
+ * callback.
+ */
+ void (*flush)(AVCodecContext *);
} AVHWAccel;
/**
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 89f249f..1736949 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1634,7 +1634,10 @@ int attribute_align_arg
avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
av_frame_unref(picture);
if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size ||
(avctx->active_thread_type & FF_THREAD_FRAME)) {
- if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
+ if (avctx->hwaccel && avctx->hwaccel->decode)
+ ret = avctx->hwaccel->decode(avctx, picture, got_picture_ptr,
+ avpkt);
+ else if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
avpkt);
else {
@@ -2055,7 +2058,9 @@ const char *avcodec_license(void)
void avcodec_flush_buffers(AVCodecContext *avctx)
{
- if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
+ if (avctx->hwaccel && avctx->codec->flush)
+ avctx->hwaccel->flush(avctx);
+ else if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
ff_thread_flush(avctx);
else if (avctx->codec->flush)
avctx->codec->flush(avctx);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 90b1f10..d9c4500 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,8 +29,8 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 56
-#define LIBAVCODEC_VERSION_MINOR 2
-#define LIBAVCODEC_VERSION_MICRO 2
+#define LIBAVCODEC_VERSION_MINOR 3
+#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
--
2.1.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel