summaryrefslogtreecommitdiffstats
path: root/video/vt.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-09-26 19:13:26 +0200
committerwm4 <wm4@nowhere>2017-09-26 19:13:26 +0200
commit9b60398f4e2710e304eb4bbb51ed70e0b8523845 (patch)
tree9af483e3ac1fb5a7cdc0b4420a4c1b86fd21135c /video/vt.c
parenta730717281c08934c3b6a00313881ecc9280ad5c (diff)
downloadmpv-9b60398f4e2710e304eb4bbb51ed70e0b8523845.tar.bz2
mpv-9b60398f4e2710e304eb4bbb51ed70e0b8523845.tar.xz
video: remove old videotoolbox support
Like as in previous commits, you need a very recent FFmpeg (probably git master).
Diffstat (limited to 'video/vt.c')
-rw-r--r--video/vt.c74
1 files changed, 0 insertions, 74 deletions
diff --git a/video/vt.c b/video/vt.c
deleted file mode 100644
index 8488256399..0000000000
--- a/video/vt.c
+++ /dev/null
@@ -1,74 +0,0 @@
-#include <CoreVideo/CoreVideo.h>
-
-#include "video/decode/lavc.h"
-
-#include "mp_image.h"
-#include "mp_image_pool.h"
-#include "vt.h"
-
-static const uint32_t map_imgfmt_cvpixfmt[][2] = {
- {IMGFMT_420P, kCVPixelFormatType_420YpCbCr8Planar},
- {IMGFMT_UYVY, kCVPixelFormatType_422YpCbCr8},
- {IMGFMT_NV12, kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange},
- {0}
-};
-
-uint32_t mp_imgfmt_to_cvpixelformat(int mpfmt)
-{
- for (int n = 0; map_imgfmt_cvpixfmt[n][0]; n++) {
- if (map_imgfmt_cvpixfmt[n][0] == mpfmt)
- return map_imgfmt_cvpixfmt[n][1];
- }
- return 0;
-}
-
-int mp_imgfmt_from_cvpixelformat(uint32_t cvpixfmt)
-{
- for (int n = 0; map_imgfmt_cvpixfmt[n][0]; n++) {
- if (map_imgfmt_cvpixfmt[n][1] == cvpixfmt)
- return map_imgfmt_cvpixfmt[n][0];
- }
- return 0;
-}
-
-// (ctx is unused - it's for compatibility with mp_hwdec_ctx.download_image())
-struct mp_image *mp_vt_download_image(struct mp_hwdec_ctx *ctx,
- struct mp_image *hw_image,
- struct mp_image_pool *swpool)
-{
- if (hw_image->imgfmt != IMGFMT_VIDEOTOOLBOX)
- return NULL;
-
- struct mp_image *image = NULL;
- CVPixelBufferRef pbuf = (CVPixelBufferRef)hw_image->planes[3];
- CVPixelBufferLockBaseAddress(pbuf, kCVPixelBufferLock_ReadOnly);
- size_t width = CVPixelBufferGetWidth(pbuf);
- size_t height = CVPixelBufferGetHeight(pbuf);
- uint32_t cvpixfmt = CVPixelBufferGetPixelFormatType(pbuf);
- int imgfmt = mp_imgfmt_from_cvpixelformat(cvpixfmt);
- if (!imgfmt)
- goto unlock;
-
- struct mp_image img = {0};
- mp_image_setfmt(&img, imgfmt);
- mp_image_set_size(&img, width, height);
-
- if (CVPixelBufferIsPlanar(pbuf)) {
- int planes = CVPixelBufferGetPlaneCount(pbuf);
- for (int i = 0; i < planes; i++) {
- img.planes[i] = CVPixelBufferGetBaseAddressOfPlane(pbuf, i);
- img.stride[i] = CVPixelBufferGetBytesPerRowOfPlane(pbuf, i);
- }
- } else {
- img.planes[0] = CVPixelBufferGetBaseAddress(pbuf);
- img.stride[0] = CVPixelBufferGetBytesPerRow(pbuf);
- }
-
- mp_image_copy_attributes(&img, hw_image);
-
- image = mp_image_pool_new_copy(swpool, &img);
-
-unlock:
- CVPixelBufferUnlockBaseAddress(pbuf, kCVPixelBufferLock_ReadOnly);
- return image;
-}