[FFmpeg-devel] [PATCH 1/2] lavc: Add hwaccel_flags field to AVCodecContext

wm4 nfxjfg at googlemail.com
Wed Mar 22 08:47:26 EET 2017


This "reuses" the flags introduced for the av_vdpau_bind_context() API
function, and makes them available to all hwaccels. This does not affect
the current vdpau API, as av_vdpau_bind_context() should obviously
override the AVCodecContext.hwaccel_flags flags for the sake of
compatibility.
---
Libav merge.
---
 doc/APIchanges             | 8 ++++++++
 libavcodec/avcodec.h       | 9 +++++++++
 libavcodec/pthread_frame.c | 2 ++
 libavcodec/version.h       | 4 ++--
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index eccfb70899..bd0ad30a04 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2017-03-xx - xxxxxxx - lavc 57.84.100 - avcodec.h
+  Add AVCodecContext.hwaccel_flags field. This will control some hwaccels at
+  a later point.
+
 2017-03-21 - xxxxxxx - lavf 57.67.100 / 57.08.0 - avio.h
   Add AVIO_SEEKABLE_TIME flag.
 
@@ -27,6 +31,10 @@ API changes, most recent first:
   Add av_image_copy_uc_from(), a version of av_image_copy() for copying
   from GPU mapped memory.
 
+2017-03-xx - xxxxxxx - lavu 55.35.0 - hwcontext.h
+  Add AV_HWDEVICE_TYPE_NONE, av_hwdevice_find_type_by_name(),
+  av_hwdevice_get_type_name() and av_hwdevice_iterate_types().
+
 2017-03-20 - 9c2436e - lavu 55.49.100 - pixdesc.h
   Add AV_PIX_FMT_FLAG_BAYER pixel format flag.
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 3e3c37278a..b3479a7223 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3620,6 +3620,15 @@ typedef struct AVCodecContext {
      * contexts used must be created on the same device.
      */
     AVBufferRef *hw_device_ctx;
+
+    /**
+     * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated
+     * decoding (if active).
+     * - encoding: unused
+     * - decoding: Set by user (either before avcodec_open2(), or in the
+     *             AVCodecContext.get_format callback)
+     */
+    int hwaccel_flags;
 } AVCodecContext;
 
 AVRational av_codec_get_pkt_timebase         (const AVCodecContext *avctx);
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index a52160145e..6768402ed8 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -275,6 +275,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
                     return AVERROR(ENOMEM);
             }
         }
+
+        dst->hwaccel_flags = src->hwaccel_flags;
     }
 
     if (for_user) {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index ec8651f086..97cccef000 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  57
-#define LIBAVCODEC_VERSION_MINOR  83
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR  84
+#define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
-- 
2.11.0



More information about the ffmpeg-devel mailing list