FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 #include <stdint.h>
33 
34 #define Picture QuickdrawPicture
35 #include <VideoToolbox/VideoToolbox.h>
36 #undef Picture
37 
38 #include "libavcodec/avcodec.h"
39 
40 /**
41  * This struct holds all the information that needs to be passed
42  * between the caller and libavcodec for initializing Videotoolbox decoding.
43  * Its size is not a part of the public ABI, it must be allocated with
44  * av_videotoolbox_alloc_context() and freed with av_free().
45  */
46 typedef struct AVVideotoolboxContext {
47  /**
48  * Videotoolbox decompression session object.
49  * Created and freed the caller.
50  */
51  VTDecompressionSessionRef session;
52 
53  /**
54  * The output callback that must be passed to the session.
55  * Set by av_videottoolbox_default_init()
56  */
57  VTDecompressionOutputCallback output_callback;
58 
59  /**
60  * CVPixelBuffer Format Type that Videotoolbox will use for decoded frames.
61  * set by the caller.
62  */
64 
65  /**
66  * CoreMedia Format Description that Videotoolbox will use to create the decompression session.
67  * Set by the caller.
68  */
69  CMVideoFormatDescriptionRef cm_fmt_desc;
70 
71  /**
72  * CoreMedia codec type that Videotoolbox will use to create the decompression session.
73  * Set by the caller.
74  */
77 
78 /**
79  * Allocate and initialize a Videotoolbox context.
80  *
81  * This function should be called from the get_format() callback when the caller
82  * selects the AV_PIX_FMT_VIDETOOLBOX format. The caller must then create
83  * the decoder object (using the output callback provided by libavcodec) that
84  * will be used for Videotoolbox-accelerated decoding.
85  *
86  * When decoding with Videotoolbox is finished, the caller must destroy the decoder
87  * object and free the Videotoolbox context using av_free().
88  *
89  * @return the newly allocated context or NULL on failure
90  */
92 
93 /**
94  * This is a convenience function that creates and sets up the Videotoolbox context using
95  * an internal implementation.
96  *
97  * @param avctx the corresponding codec context
98  *
99  * @return >= 0 on success, a negative AVERROR code on failure
100  */
102 
103 /**
104  * This is a convenience function that creates and sets up the Videotoolbox context using
105  * an internal implementation.
106  *
107  * @param avctx the corresponding codec context
108  * @param vtctx the Videotoolbox context to use
109  *
110  * @return >= 0 on success, a negative AVERROR code on failure
111  */
113 
114 /**
115  * This function must be called to free the Videotoolbox context initialized with
116  * av_videotoolbox_default_init().
117  *
118  * @param avctx the corresponding codec context
119  */
121 
122 /**
123  * @}
124  */
125 
126 #endif /* AVCODEC_VIDEOTOOLBOX_H */
int cm_codec_type
CoreMedia codec type that Videotoolbox will use to create the decompression session.
Definition: videotoolbox.h:75
AVVideotoolboxContext * av_videotoolbox_alloc_context(void)
Allocate and initialize a Videotoolbox context.
int av_videotoolbox_default_init(AVCodecContext *avctx)
This is a convenience function that creates and sets up the Videotoolbox context using an internal im...
VTDecompressionSessionRef session
Videotoolbox decompression session object.
Definition: videotoolbox.h:51
Libavcodec external API header.
int av_videotoolbox_default_init2(AVCodecContext *avctx, AVVideotoolboxContext *vtctx)
This is a convenience function that creates and sets up the Videotoolbox context using an internal im...
main external API structure.
Definition: avcodec.h:1502
CMVideoFormatDescriptionRef cm_fmt_desc
CoreMedia Format Description that Videotoolbox will use to create the decompression session...
Definition: videotoolbox.h:69
OSType cv_pix_fmt_type
CVPixelBuffer Format Type that Videotoolbox will use for decoded frames.
Definition: videotoolbox.h:63
VTDecompressionOutputCallback output_callback
The output callback that must be passed to the session.
Definition: videotoolbox.h:57
void av_videotoolbox_default_free(AVCodecContext *avctx)
This function must be called to free the Videotoolbox context initialized with av_videotoolbox_defaul...
This struct holds all the information that needs to be passed between the caller and libavcodec for i...
Definition: videotoolbox.h:46