1 /* 2 * This file is part of FFmpeg. 3 * 4 * FFmpeg is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * FFmpeg is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with FFmpeg; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 #ifndef AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H 20 #define AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H 21 22 #include <stdint.h> 23 24 #include <VideoToolbox/VideoToolbox.h> 25 26 #include "pixfmt.h" 27 28 /** 29 * @file 30 * An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX. 31 * 32 * This API currently does not support frame allocation, as the raw VideoToolbox 33 * API does allocation, and FFmpeg itself never has the need to allocate frames. 34 * 35 * If the API user sets a custom pool, AVHWFramesContext.pool must return 36 * AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef. 37 * 38 * Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always 39 * NULL. 40 */ 41 42 /** 43 * Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat. 44 * Returns AV_PIX_FMT_NONE if no known equivalent was found. 45 */ 46 enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt(uint32_t cv_fmt); 47 48 /** 49 * Convert an AVPixelFormat to a VideoToolbox (actually CoreVideo) format. 50 * Returns 0 if no known equivalent was found. 51 */ 52 uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt); 53 54 /** 55 * Same as av_map_videotoolbox_format_from_pixfmt function, but can map and 56 * return full range pixel formats via a flag. 57 */ 58 uint32_t av_map_videotoolbox_format_from_pixfmt2(enum AVPixelFormat pix_fmt, bool full_range); 59 60 #endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */ 61