FFmpeg
utils.h
Go to the documentation of this file.
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 AVFILTER_METAL_UTILS_H
20 #define AVFILTER_METAL_UTILS_H
21 
22 #include <Metal/Metal.h>
23 
24 #include <AvailabilityMacros.h>
25 
26 // CoreVideo accidentally(?) preprocessor-gates Metal functionality
27 // on MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 (FB9816002).
28 // There doesn't seem to be any particular reason for this,
29 // so here we temporarily redefine it to at least that value
30 // so CV will give us CVMetalTextureRef and the related functions.
31 
32 #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && (MAC_OS_X_VERSION_MIN_REQUIRED < 101100)
33 #define ORIG_MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_MIN_REQUIRED
34 #undef MAC_OS_X_VERSION_MIN_REQUIRED
35 #define MAC_OS_X_VERSION_MIN_REQUIRED 101100
36 #endif
37 
38 #include <CoreVideo/CoreVideo.h>
39 
40 #ifdef ORIG_MAC_OS_X_VERSION_MIN_REQUIRED
41 #undef MAC_OS_X_VERSION_MIN_REQUIRED
42 #define MAC_OS_X_VERSION_MIN_REQUIRED ORIG_MAC_OS_X_VERSION_MIN_REQUIRED
43 #undef ORIG_MAC_OS_X_VERSION_MIN_REQUIRED
44 #endif
45 
46 void ff_metal_compute_encoder_dispatch(id<MTLDevice> device,
47  id<MTLComputePipelineState> pipeline,
48  id<MTLComputeCommandEncoder> encoder,
49  NSUInteger width, NSUInteger height)
50  API_AVAILABLE(macos(10.11), ios(8.0));
51 
52 CVMetalTextureRef ff_metal_texture_from_pixbuf(void *avclass,
53  CVMetalTextureCacheRef textureCache,
54  CVPixelBufferRef pixbuf,
55  int plane,
56  MTLPixelFormat format)
57  API_AVAILABLE(macos(10.11), ios(8.0));
58 
59 #endif /* AVFILTER_METAL_UTILS_H */
ios
void ios(8.0))
width
#define width
format
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
ff_metal_texture_from_pixbuf
CVMetalTextureRef ff_metal_texture_from_pixbuf(void *avclass, CVMetalTextureCacheRef textureCache, CVPixelBufferRef pixbuf, int plane, MTLPixelFormat format) API_AVAILABLE(macos(10.11)
height
#define height
ff_metal_compute_encoder_dispatch
void ff_metal_compute_encoder_dispatch(id< MTLDevice > device, id< MTLComputePipelineState > pipeline, id< MTLComputeCommandEncoder > encoder, NSUInteger width, NSUInteger height) API_AVAILABLE(macos(10.11)