diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-12-02 21:17:26 +0100 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-12-02 21:26:17 +0100 |
commit | ca956af446387f409f51160c1d2c674f70788bda (patch) | |
tree | f902d17aaf883211d58c24b1a050a5a7eaaa9c08 /video/out/gl_hwdec_vda.c | |
parent | 14d92a4685417610e63307926a799cd5c43b1940 (diff) | |
download | mpv-ca956af446387f409f51160c1d2c674f70788bda.tar.bz2 mpv-ca956af446387f409f51160c1d2c674f70788bda.tar.xz |
gl_video: change internal API for hwdec mp_image download
Previous API worked under the assumption that download_image is always called
after map_image. In practice this is true, but it's better to have a much
generic API that doesn't depend on the order in which the functions are called.
Diffstat (limited to 'video/out/gl_hwdec_vda.c')
-rw-r--r-- | video/out/gl_hwdec_vda.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/video/out/gl_hwdec_vda.c b/video/out/gl_hwdec_vda.c index 65615bac6b..945a57bb1c 100644 --- a/video/out/gl_hwdec_vda.c +++ b/video/out/gl_hwdec_vda.c @@ -102,14 +102,15 @@ static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image, static void unmap_image(struct gl_hwdec *hw) { } -static struct mp_image *download_image(struct gl_hwdec *hw) +static struct mp_image *download_image(struct gl_hwdec *hw, + struct mp_image *hw_image) { - struct priv *p = hw->priv; - CVPixelBufferLockBaseAddress(p->pbuf, 0); - void *base = CVPixelBufferGetBaseAddress(p->pbuf); - size_t width = CVPixelBufferGetWidth(p->pbuf); - size_t height = CVPixelBufferGetHeight(p->pbuf); - size_t stride = CVPixelBufferGetBytesPerRow(p->pbuf); + CVPixelBufferRef pbuf = (CVPixelBufferRef)hw_image->planes[3]; + CVPixelBufferLockBaseAddress(pbuf, 0); + void *base = CVPixelBufferGetBaseAddress(pbuf); + size_t width = CVPixelBufferGetWidth(pbuf); + size_t height = CVPixelBufferGetHeight(pbuf); + size_t stride = CVPixelBufferGetBytesPerRow(pbuf); struct mp_image img = {0}; mp_image_setfmt(&img, IMGFMT_UYVY); @@ -118,7 +119,7 @@ static struct mp_image *download_image(struct gl_hwdec *hw) img.stride[0] = stride; struct mp_image *image = mp_image_new_copy(&img); - CVPixelBufferUnlockBaseAddress(p->pbuf, 0); + CVPixelBufferUnlockBaseAddress(pbuf, 0); return image; } |