config: add more generic config_GetSysDir()
[vlc.git] / modules / codec / vt_utils.h
blob24cd4aa89830748430fc05d9f9b3c6c4d3dfcd32
1 /*****************************************************************************
2 * vt_utils.h: videotoolbox/cvpx utility functions
3 *****************************************************************************
4 * Copyright (C) 2017 VLC authors, VideoLAN and VideoLabs
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #ifndef VLC_CODEC_VTUTILS_H_
22 #define VLC_CODEC_VTUTILS_H_
24 #include <VideoToolbox/VideoToolbox.h>
25 #include <vlc_picture.h>
27 CFMutableDictionaryRef cfdict_create(CFIndex capacity);
29 void cfdict_set_int32(CFMutableDictionaryRef dict, CFStringRef key, int value);
32 * Attach a cvpx buffer to a picture
34 * The cvpx ref will be released when the picture is released
35 * @return VLC_SUCCESS or VLC_ENOMEM
37 int cvpxpic_attach(picture_t *p_pic, CVPixelBufferRef cvpx);
39 int cvpxpic_attach_with_cb(picture_t *p_pic, CVPixelBufferRef cvpx,
40 void (*on_released_cb)(CVPixelBufferRef, void *, unsigned nb_fields),
41 void *on_released_data);
44 * Get the cvpx buffer attached to a picture
46 CVPixelBufferRef cvpxpic_get_ref(picture_t *pic);
49 * Create a picture mapped to a cvpx buffer
51 * @param fmt i_chroma must be VLC_CODEC_UYVY, VLC_CODEC_NV12 or VLC_CODEC_I420
52 * @param cvpx buffer to map
53 * @param readonly true to map read-only, false otherwise
54 * @return a valid picture, call picture_Release() or cvpxpic_unmap() to free
55 * the picture and unmap the cvpx buffer.
57 picture_t *cvpxpic_create_mapped(const video_format_t *fmt,
58 CVPixelBufferRef cvpx, bool readonly);
61 * Create a picture attached to an unmapped cvpx buffer
63 * @param mapped_pic must be a picture created with cvpxpic_create_mapped()
64 * @return a valid picture, the pic chroma will one of VLC_CODEC_CVPX_* chromas
66 picture_t *cvpxpic_unmap(picture_t *mapped_pic);
69 * Create a cvpx pool
71 * @param fmt i_chroma must be one of VLC_CODEC_CVPX_* chromas
72 * @param count number of pictures to alloc
73 * @return a valid cvpx pool or NULL, release it with CVPixelBufferPoolRelease()
75 CVPixelBufferPoolRef cvpxpool_create(const video_format_t *fmt, unsigned count);
78 * Get a cvpx buffer from a pool
80 CVPixelBufferRef cvpxpool_new_cvpx(CVPixelBufferPoolRef pool);
82 #endif