[FFmpeg-cvslog] avutil/hwcontext_vdpau: Correctly initialise pixfmts

Philip Langdale git at videolan.org
Mon Jul 13 00:05:36 EEST 2020


ffmpeg | branch: master | Philip Langdale <philipl at overt.org> | Sat Jul 11 20:23:03 2020 -0700| [93febc4e15f78277f8532597c76c8092e65af71f] | committer: Philip Langdale

avutil/hwcontext_vdpau: Correctly initialise pixfmts

The number of declared vdpau formats can vary depending on which
version of libvdpau we build against, so the number of pix fmts
can vary too. Let's make sure we keep those numbers in sync.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=93febc4e15f78277f8532597c76c8092e65af71f
---

 libavutil/hwcontext_vdpau.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c
index dbef5495af..8f014eaba7 100644
--- a/libavutil/hwcontext_vdpau.c
+++ b/libavutil/hwcontext_vdpau.c
@@ -32,27 +32,6 @@
 #include "pixfmt.h"
 #include "pixdesc.h"
 
-typedef struct VDPAUDeviceContext {
-    VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities *get_transfer_caps;
-    VdpVideoSurfaceGetBitsYCbCr                     *get_data;
-    VdpVideoSurfacePutBitsYCbCr                     *put_data;
-    VdpVideoSurfaceCreate                           *surf_create;
-    VdpVideoSurfaceDestroy                          *surf_destroy;
-
-    enum AVPixelFormat *pix_fmts[8];
-    int              nb_pix_fmts[8];
-} VDPAUDeviceContext;
-
-typedef struct VDPAUFramesContext {
-    VdpVideoSurfaceGetBitsYCbCr *get_data;
-    VdpVideoSurfacePutBitsYCbCr *put_data;
-    VdpChromaType chroma_type;
-    int chroma_idx;
-
-    const enum AVPixelFormat *pix_fmts;
-    int                       nb_pix_fmts;
-} VDPAUFramesContext;
-
 typedef struct VDPAUPixFmtMap {
     VdpYCbCrFormat vdpau_fmt;
     enum AVPixelFormat pix_fmt;
@@ -103,6 +82,27 @@ static const struct {
 #endif
 };
 
+typedef struct VDPAUDeviceContext {
+    VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities *get_transfer_caps;
+    VdpVideoSurfaceGetBitsYCbCr                     *get_data;
+    VdpVideoSurfacePutBitsYCbCr                     *put_data;
+    VdpVideoSurfaceCreate                           *surf_create;
+    VdpVideoSurfaceDestroy                          *surf_destroy;
+
+    enum AVPixelFormat *pix_fmts[FF_ARRAY_ELEMS(vdpau_pix_fmts)];
+    int              nb_pix_fmts[FF_ARRAY_ELEMS(vdpau_pix_fmts)];
+} VDPAUDeviceContext;
+
+typedef struct VDPAUFramesContext {
+    VdpVideoSurfaceGetBitsYCbCr *get_data;
+    VdpVideoSurfacePutBitsYCbCr *put_data;
+    VdpChromaType chroma_type;
+    int chroma_idx;
+
+    const enum AVPixelFormat *pix_fmts;
+    int                       nb_pix_fmts;
+} VDPAUFramesContext;
+
 static int count_pixfmts(const VDPAUPixFmtMap *map)
 {
     int count = 0;



More information about the ffmpeg-cvslog mailing list