[vlc-devel] [PATCH 02/23] picture_pool: add a video context to the pictures in the pool

Steve Lhomme robux4 at ycbcr.xyz
Thu Nov 7 10:31:15 CET 2019


May be NULL.
---
 include/vlc_picture_pool.h      | 2 ++
 modules/codec/qsv.c             | 2 +-
 src/input/decoder.c             | 1 +
 src/misc/picture_pool.c         | 3 ++-
 src/test/picture_pool.c         | 4 ++--
 src/video_output/display.c      | 2 +-
 src/video_output/vout_wrapper.c | 2 +-
 7 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/vlc_picture_pool.h b/include/vlc_picture_pool.h
index de385d6a984..57a997de565 100644
--- a/include/vlc_picture_pool.h
+++ b/include/vlc_picture_pool.h
@@ -87,11 +87,13 @@ VLC_API picture_pool_t * picture_pool_New(unsigned count,
  * picture_pool_New().
  *
  * @param fmt video format of pictures to allocate from the heap
+ * @param vctx video context of pictures to allocate from the heap
  * @param count number of pictures to allocate
  *
  * @return a pointer to the new pool on success, NULL on error
  */
 VLC_API picture_pool_t * picture_pool_NewFromFormat(const video_format_t *fmt,
+                                                    vlc_video_context *vctx,
                                                     unsigned count) VLC_USED;
 
 /**
diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c
index b9e69bb3220..52868331a56 100644
--- a/modules/codec/qsv.c
+++ b/modules/codec/qsv.c
@@ -562,7 +562,7 @@ static int Open(vlc_object_t *this)
     video_format_t pool_fmt = enc->fmt_in.video;
     pool_fmt.i_width  = sys->params.mfx.FrameInfo.Width;
     pool_fmt.i_height = sys->params.mfx.FrameInfo.Height;
-    sys->input_pool = picture_pool_NewFromFormat( &pool_fmt, 18 );
+    sys->input_pool = picture_pool_NewFromFormat( &pool_fmt, NULL, 18 );
     if (sys->input_pool == NULL)
     {
         msg_Err(enc, "Failed to create the internal pool");
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 2aa973c99c7..51dda32c97a 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -451,6 +451,7 @@ static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec, vlc_video_context *
         }
 
         p_owner->out_pool = picture_pool_NewFromFormat( &p_dec->fmt_out.video,
+                            vctx,
                             dpb_size + p_dec->i_extra_picture_buffers + 1 );
         if (p_owner->out_pool == NULL)
             return -1;
diff --git a/src/misc/picture_pool.c b/src/misc/picture_pool.c
index 25f73b021a1..acfc547235e 100644
--- a/src/misc/picture_pool.c
+++ b/src/misc/picture_pool.c
@@ -154,13 +154,14 @@ picture_pool_t *picture_pool_New(unsigned count, picture_t *const *tab)
 }
 
 picture_pool_t *picture_pool_NewFromFormat(const video_format_t *fmt,
+                                           vlc_video_context *vctx,
                                            unsigned count)
 {
     picture_t *picture[count ? count : 1];
     unsigned i;
 
     for (i = 0; i < count; i++) {
-        picture[i] = picture_NewFromFormat(fmt);
+        picture[i] = picture_NewFromFormatCtx(fmt, vctx);
         if (picture[i] == NULL)
             goto error;
     }
diff --git a/src/test/picture_pool.c b/src/test/picture_pool.c
index af2d36a06b2..7bad9b8be34 100644
--- a/src/test/picture_pool.c
+++ b/src/test/picture_pool.c
@@ -41,7 +41,7 @@ static void test(bool zombie)
 {
     picture_t *pics[PICTURES];
 
-    pool = picture_pool_NewFromFormat(&fmt, PICTURES);
+    pool = picture_pool_NewFromFormat(&fmt, NULL, PICTURES);
     assert(pool != NULL);
 
     for (unsigned i = 0; i < PICTURES; i++) {
@@ -112,7 +112,7 @@ int main(void)
 {
     video_format_Setup(&fmt, VLC_CODEC_I420, 320, 200, 320, 200, 1, 1);
 
-    pool = picture_pool_NewFromFormat(&fmt, PICTURES);
+    pool = picture_pool_NewFromFormat(&fmt, NULL, PICTURES);
     assert(pool != NULL);
     assert(picture_pool_GetSize(pool) == PICTURES);
 
diff --git a/src/video_output/display.c b/src/video_output/display.c
index f5742295a52..277d6f6dc11 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -397,7 +397,7 @@ picture_pool_t *vout_GetPool(vout_display_t *vd, unsigned count)
         return vd->pool(vd, count);
 
     if (osys->pool == NULL)
-        osys->pool = picture_pool_NewFromFormat(&vd->fmt, count);
+        osys->pool = picture_pool_NewFromFormat(&vd->fmt, NULL, count);
     return osys->pool;
 }
 
diff --git a/src/video_output/vout_wrapper.c b/src/video_output/vout_wrapper.c
index 9e5b14a56bc..171fb0c303c 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -103,7 +103,7 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
         sys->private_pool = picture_pool_Reserve(display_pool, private_picture);
     } else {
         sys->private_pool =
-            picture_pool_NewFromFormat(&vd->source,
+            picture_pool_NewFromFormat(&vd->source, vctx,
                                        __MAX(VOUT_MAX_PICTURES,
                                              reserved_picture - DISPLAY_PICTURE_COUNT));
     }
-- 
2.17.1



More information about the vlc-devel mailing list