vlc | branch: master | Thomas Guillem <[email protected]> | Tue Jan 16 10:51:58 
2018 +0100| [5e57c4ecbad4bba9c6da5b3cd3228510dab8046a] | committer: Thomas 
Guillem

codec: vt_utils: change cvpxpic_attach_with_cb args

Add CVPixelBufferRef and numbers of picture fields.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5e57c4ecbad4bba9c6da5b3cd3228510dab8046a
---

 modules/codec/videotoolbox.m |  3 ++-
 modules/codec/vt_utils.c     | 11 +++++++----
 modules/codec/vt_utils.h     |  2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 58a8eee663..5688b89cc3 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -1976,7 +1976,8 @@ static int UpdateVideoFormat(decoder_t *p_dec, 
CVPixelBufferRef imageBuffer)
     return 0;
 }
 
-static void pic_holder_on_cvpx_released(void *data)
+static void
+pic_holder_on_cvpx_released(CVPixelBufferRef cvpx, void *data, unsigned 
nb_fields)
 {
     struct pic_holder *pic_holder = data;
 
diff --git a/modules/codec/vt_utils.c b/modules/codec/vt_utils.c
index ca6769b5f4..42b0bc43dc 100644
--- a/modules/codec/vt_utils.c
+++ b/modules/codec/vt_utils.c
@@ -46,9 +46,10 @@ struct cvpxpic_ctx
 {
     picture_context_t s;
     CVPixelBufferRef cvpx;
+    unsigned nb_fields;
 
     atomic_uint ref_count;
-    void (*on_released_cb)(void *);
+    void (*on_released_cb)(CVPixelBufferRef, void *, unsigned);
     void *on_released_data;
 };
 
@@ -61,7 +62,7 @@ cvpxpic_destroy_cb(picture_context_t *opaque)
     {
         CFRelease(ctx->cvpx);
         if (ctx->on_released_cb)
-            ctx->on_released_cb(ctx->on_released_data);
+            ctx->on_released_cb(ctx->cvpx, ctx->on_released_data, 
ctx->nb_fields);
         free(opaque);
     }
 }
@@ -77,7 +78,8 @@ cvpxpic_copy_cb(struct picture_context_t *opaque)
 static int
 cvpxpic_attach_common(picture_t *p_pic, CVPixelBufferRef cvpx,
                       void (*pf_destroy)(picture_context_t *),
-                      void (*on_released_cb)(void *), void *on_released_data)
+                      void (*on_released_cb)(CVPixelBufferRef, void *, 
unsigned),
+                      void *on_released_data)
 {
     struct cvpxpic_ctx *ctx = malloc(sizeof(struct cvpxpic_ctx));
     if (ctx == NULL)
@@ -88,6 +90,7 @@ cvpxpic_attach_common(picture_t *p_pic, CVPixelBufferRef cvpx,
     ctx->s.destroy = pf_destroy;
     ctx->s.copy = cvpxpic_copy_cb;
     ctx->cvpx = CVPixelBufferRetain(cvpx);
+    ctx->nb_fields = p_pic->i_nb_fields;
     atomic_init(&ctx->ref_count, 1);
 
     ctx->on_released_cb = on_released_cb;
@@ -105,7 +108,7 @@ cvpxpic_attach(picture_t *p_pic, CVPixelBufferRef cvpx)
 }
 
 int cvpxpic_attach_with_cb(picture_t *p_pic, CVPixelBufferRef cvpx,
-                           void (*on_released_cb)(void *),
+                           void (*on_released_cb)(CVPixelBufferRef, void *, 
unsigned),
                            void *on_released_data)
 {
     return cvpxpic_attach_common(p_pic, cvpx, cvpxpic_destroy_cb, 
on_released_cb,
diff --git a/modules/codec/vt_utils.h b/modules/codec/vt_utils.h
index f2f31c3914..24cd4aa898 100644
--- a/modules/codec/vt_utils.h
+++ b/modules/codec/vt_utils.h
@@ -37,7 +37,7 @@ void cfdict_set_int32(CFMutableDictionaryRef dict, 
CFStringRef key, int value);
 int cvpxpic_attach(picture_t *p_pic, CVPixelBufferRef cvpx);
 
 int cvpxpic_attach_with_cb(picture_t *p_pic, CVPixelBufferRef cvpx,
-                           void (*on_released_cb)(void *),
+                           void (*on_released_cb)(CVPixelBufferRef, void *, 
unsigned nb_fields),
                            void *on_released_data);
 
 /*

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to