FFmpeg
libavcodec
videotoolbox.h
Go to the documentation of this file.
1
/*
2
* Videotoolbox hardware acceleration
3
*
4
* copyright (c) 2012 Sebastien Zwickert
5
*
6
* This file is part of FFmpeg.
7
*
8
* FFmpeg is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (at your option) any later version.
12
*
13
* FFmpeg is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with FFmpeg; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
*/
22
23
#ifndef AVCODEC_VIDEOTOOLBOX_H
24
#define AVCODEC_VIDEOTOOLBOX_H
25
26
/**
27
* @file
28
* @ingroup lavc_codec_hwaccel_videotoolbox
29
* Public libavcodec Videotoolbox header.
30
*/
31
32
/**
33
* @defgroup lavc_codec_hwaccel_videotoolbox VideoToolbox Decoder
34
* @ingroup lavc_codec_hwaccel
35
*
36
* Hardware accelerated decoding using VideoToolbox on Apple Platforms
37
*
38
* @{
39
*/
40
41
#include <stdint.h>
42
43
#define Picture QuickdrawPicture
44
#include <VideoToolbox/VideoToolbox.h>
45
#undef Picture
46
47
#include "
libavcodec/avcodec.h
"
48
49
#include "
libavutil/attributes.h
"
50
51
/**
52
* This struct holds all the information that needs to be passed
53
* between the caller and libavcodec for initializing Videotoolbox decoding.
54
* Its size is not a part of the public ABI, it must be allocated with
55
* av_videotoolbox_alloc_context() and freed with av_free().
56
*/
57
typedef
struct
AVVideotoolboxContext
{
58
/**
59
* Videotoolbox decompression session object.
60
*/
61
VTDecompressionSessionRef
session
;
62
63
#if FF_API_VT_OUTPUT_CALLBACK
64
/**
65
* The output callback that must be passed to the session.
66
* Set by av_videottoolbox_default_init()
67
*/
68
attribute_deprecated
69
VTDecompressionOutputCallback
output_callback
;
70
#endif
71
72
/**
73
* CVPixelBuffer Format Type that Videotoolbox will use for decoded frames.
74
* set by the caller. If this is set to 0, then no specific format is
75
* requested from the decoder, and its native format is output.
76
*/
77
OSType
cv_pix_fmt_type
;
78
79
/**
80
* CoreMedia Format Description that Videotoolbox will use to create the decompression session.
81
*/
82
CMVideoFormatDescriptionRef
cm_fmt_desc
;
83
84
/**
85
* CoreMedia codec type that Videotoolbox will use to create the decompression session.
86
*/
87
int
cm_codec_type
;
88
}
AVVideotoolboxContext
;
89
90
#if FF_API_VT_HWACCEL_CONTEXT
91
92
/**
93
* Allocate and initialize a Videotoolbox context.
94
*
95
* This function should be called from the get_format() callback when the caller
96
* selects the AV_PIX_FMT_VIDETOOLBOX format. The caller must then create
97
* the decoder object (using the output callback provided by libavcodec) that
98
* will be used for Videotoolbox-accelerated decoding.
99
*
100
* When decoding with Videotoolbox is finished, the caller must destroy the decoder
101
* object and free the Videotoolbox context using av_free().
102
*
103
* @return the newly allocated context or NULL on failure
104
* @deprecated Use AVCodecContext.hw_frames_ctx or hw_device_ctx instead.
105
*/
106
attribute_deprecated
107
AVVideotoolboxContext
*av_videotoolbox_alloc_context(
void
);
108
109
/**
110
* This is a convenience function that creates and sets up the Videotoolbox context using
111
* an internal implementation.
112
*
113
* @param avctx the corresponding codec context
114
*
115
* @return >= 0 on success, a negative AVERROR code on failure
116
* @deprecated Use AVCodecContext.hw_frames_ctx or hw_device_ctx instead.
117
*/
118
attribute_deprecated
119
int
av_videotoolbox_default_init(
AVCodecContext
*avctx);
120
121
/**
122
* This is a convenience function that creates and sets up the Videotoolbox context using
123
* an internal implementation.
124
*
125
* @param avctx the corresponding codec context
126
* @param vtctx the Videotoolbox context to use
127
*
128
* @return >= 0 on success, a negative AVERROR code on failure
129
* @deprecated Use AVCodecContext.hw_frames_ctx or hw_device_ctx instead.
130
*/
131
attribute_deprecated
132
int
av_videotoolbox_default_init2(
AVCodecContext
*avctx,
AVVideotoolboxContext
*vtctx);
133
134
/**
135
* This function must be called to free the Videotoolbox context initialized with
136
* av_videotoolbox_default_init().
137
*
138
* @param avctx the corresponding codec context
139
* @deprecated Use AVCodecContext.hw_frames_ctx or hw_device_ctx instead.
140
*/
141
attribute_deprecated
142
void
av_videotoolbox_default_free(
AVCodecContext
*avctx);
143
144
#endif
/* FF_API_VT_HWACCEL_CONTEXT */
145
146
/**
147
* @}
148
*/
149
150
#endif
/* AVCODEC_VIDEOTOOLBOX_H */
AVVideotoolboxContext::cm_codec_type
int cm_codec_type
CoreMedia codec type that Videotoolbox will use to create the decompression session.
Definition:
videotoolbox.h:87
AVVideotoolboxContext
This struct holds all the information that needs to be passed between the caller and libavcodec for i...
Definition:
videotoolbox.h:57
output_callback
static void output_callback(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
Definition:
mmaldec.c:219
AVVideotoolboxContext::session
VTDecompressionSessionRef session
Videotoolbox decompression session object.
Definition:
videotoolbox.h:61
AVVideotoolboxContext::cm_fmt_desc
CMVideoFormatDescriptionRef cm_fmt_desc
CoreMedia Format Description that Videotoolbox will use to create the decompression session.
Definition:
videotoolbox.h:82
attribute_deprecated
#define attribute_deprecated
Definition:
attributes.h:104
attributes.h
avcodec.h
AVCodecContext
main external API structure.
Definition:
avcodec.h:441
AVVideotoolboxContext::cv_pix_fmt_type
OSType cv_pix_fmt_type
CVPixelBuffer Format Type that Videotoolbox will use for decoded frames.
Definition:
videotoolbox.h:77
Generated on Thu Apr 18 2024 22:42:13 for FFmpeg by
1.8.17