FFmpeg
9.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libavutil
hwcontext_videotoolbox.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 AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H
20
#define AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H
21
22
#include <stdint.h>
23
24
#include <VideoToolbox/VideoToolbox.h>
25
26
#include "
frame.h
"
27
#include "
pixfmt.h
"
28
29
/**
30
* @file
31
* An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX.
32
*
33
* This API supports frame allocation using a native CVPixelBufferPool
34
* instead of an AVBufferPool.
35
*
36
* If the API user sets a custom pool, AVHWFramesContext.pool must return
37
* AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef.
38
* Note that the underlying CVPixelBuffer could be retained by OS frameworks
39
* depending on application usage, so it is preferable to let CoreVideo manage
40
* the pool using the default implementation.
41
*
42
* Currently AVHWDeviceContext.hwctx are always NULL.
43
*/
44
45
typedef
struct
AVVTFramesContext
{
46
enum
AVColorRange
color_range
;
47
}
AVVTFramesContext
;
48
49
/**
50
* Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat.
51
* Returns AV_PIX_FMT_NONE if no known equivalent was found.
52
*/
53
enum
AVPixelFormat
av_map_videotoolbox_format_to_pixfmt
(uint32_t cv_fmt);
54
55
/**
56
* Convert an AVPixelFormat to a VideoToolbox (actually CoreVideo) format.
57
* Returns 0 if no known equivalent was found.
58
*/
59
uint32_t
av_map_videotoolbox_format_from_pixfmt
(
enum
AVPixelFormat
pix_fmt
);
60
61
/**
62
* Same as av_map_videotoolbox_format_from_pixfmt function, but can map and
63
* return full range pixel formats via a flag.
64
*/
65
uint32_t
av_map_videotoolbox_format_from_pixfmt2
(
enum
AVPixelFormat
pix_fmt
,
bool
full_range);
66
67
/**
68
* Convert an AVChromaLocation to a VideoToolbox/CoreVideo chroma location string.
69
*
70
* The returned string is a CoreVideo constant and must not be released.
71
*
72
* Returns NULL if no known equivalent was found.
73
*/
74
CFStringRef
av_map_videotoolbox_chroma_loc_from_av
(
enum
AVChromaLocation
loc);
75
76
/**
77
* Convert an AVColorSpace to a VideoToolbox/CoreVideo color matrix string.
78
*
79
* The returned string is borrowed from CoreVideo and must not be released.
80
* It is either a constant, or an entry of CoreVideo's internal codepoint
81
* cache; releasing a cached entry makes later lookups of the same value
82
* return a dangling pointer.
83
*
84
* Returns NULL if no known equivalent was found.
85
*/
86
CFStringRef
av_map_videotoolbox_color_matrix_from_av
(
enum
AVColorSpace
space);
87
88
/**
89
* Convert an AVColorPrimaries to a VideoToolbox/CoreVideo color primaries string.
90
*
91
* The returned string is borrowed from CoreVideo and must not be released.
92
* It is either a constant, or an entry of CoreVideo's internal codepoint
93
* cache; releasing a cached entry makes later lookups of the same value
94
* return a dangling pointer.
95
*
96
* Returns NULL if no known equivalent was found.
97
*/
98
CFStringRef
av_map_videotoolbox_color_primaries_from_av
(
enum
AVColorPrimaries
pri);
99
100
/**
101
* Convert an AVColorTransferCharacteristic to a VideoToolbox/CoreVideo color transfer
102
* function string.
103
*
104
* The returned string is borrowed from CoreVideo and must not be released.
105
* It is either a constant, or an entry of CoreVideo's internal codepoint
106
* cache; releasing a cached entry makes later lookups of the same value
107
* return a dangling pointer.
108
*
109
* Returns NULL if no known equivalent was found.
110
*/
111
CFStringRef
av_map_videotoolbox_color_trc_from_av
(
enum
AVColorTransferCharacteristic
trc);
112
113
/**
114
* Set CVPixelBufferRef's metadata based on an AVFrame.
115
*
116
* Sets/unsets the CVPixelBuffer attachments to match as closely as possible the
117
* AVFrame metadata. To prevent inconsistent attachments, the attachments for properties
118
* that could not be matched or are unspecified in the given AVFrame are unset. So if
119
* any attachments already covered by AVFrame metadata need to be set to a specific
120
* value, this should happen after calling this function.
121
*
122
* Returns < 0 in case of an error.
123
*/
124
int
av_vt_pixbuf_set_attachments
(
void
*log_ctx,
125
CVPixelBufferRef pixbuf,
const
struct
AVFrame
*src);
126
127
#endif
/* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */
pix_fmt
static enum AVPixelFormat pix_fmt
Definition
demux_decode.c:41
frame.h
reference-counted frame API
av_map_videotoolbox_chroma_loc_from_av
CFStringRef av_map_videotoolbox_chroma_loc_from_av(enum AVChromaLocation loc)
Convert an AVChromaLocation to a VideoToolbox/CoreVideo chroma location string.
av_vt_pixbuf_set_attachments
int av_vt_pixbuf_set_attachments(void *log_ctx, CVPixelBufferRef pixbuf, const struct AVFrame *src)
Set CVPixelBufferRef's metadata based on an AVFrame.
av_map_videotoolbox_format_to_pixfmt
enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt(uint32_t cv_fmt)
Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat.
av_map_videotoolbox_color_matrix_from_av
CFStringRef av_map_videotoolbox_color_matrix_from_av(enum AVColorSpace space)
Convert an AVColorSpace to a VideoToolbox/CoreVideo color matrix string.
av_map_videotoolbox_color_primaries_from_av
CFStringRef av_map_videotoolbox_color_primaries_from_av(enum AVColorPrimaries pri)
Convert an AVColorPrimaries to a VideoToolbox/CoreVideo color primaries string.
av_map_videotoolbox_format_from_pixfmt
uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt)
Convert an AVPixelFormat to a VideoToolbox (actually CoreVideo) format.
av_map_videotoolbox_format_from_pixfmt2
uint32_t av_map_videotoolbox_format_from_pixfmt2(enum AVPixelFormat pix_fmt, bool full_range)
Same as av_map_videotoolbox_format_from_pixfmt function, but can map and return full range pixel form...
av_map_videotoolbox_color_trc_from_av
CFStringRef av_map_videotoolbox_color_trc_from_av(enum AVColorTransferCharacteristic trc)
Convert an AVColorTransferCharacteristic to a VideoToolbox/CoreVideo color transfer function string.
pixfmt.h
pixel format definitions
AVChromaLocation
AVChromaLocation
Location of chroma samples.
Definition
pixfmt.h:807
AVColorRange
AVColorRange
Visual content value range.
Definition
pixfmt.h:753
AVPixelFormat
AVPixelFormat
Pixel format.
Definition
pixfmt.h:71
AVColorPrimaries
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition
pixfmt.h:647
AVColorTransferCharacteristic
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition
pixfmt.h:677
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition
pixfmt.h:711
AVFrame
This structure describes decoded (raw) audio or video data.
Definition
frame.h:479
AVVTFramesContext
Definition
hwcontext_videotoolbox.h:45
AVVTFramesContext::color_range
enum AVColorRange color_range
Definition
hwcontext_videotoolbox.h:46
Generated by
1.17.0