FFmpeg: libavutil/hwcontext_internal.h Source File

FFmpeg
hwcontext_internal.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_INTERNAL_H
20 #define AVUTIL_HWCONTEXT_INTERNAL_H
21 
22 #include <stddef.h>
23 
24 #include "buffer.h"
25 #include "hwcontext.h"
26 #include "frame.h"
27 #include "pixfmt.h"
28 
29  typedef struct HWContextType {
30   enum AVHWDeviceType type;
31   const char *name;
32 
33  /**
34  * An array of pixel formats supported by the AVHWFramesContext instances
35  * Terminated by AV_PIX_FMT_NONE.
36  */
37   const enum AVPixelFormat *pix_fmts;
38 
39  /**
40  * size of the public hardware-specific context,
41  * i.e. AVHWDeviceContext.hwctx
42  */
43   size_t device_hwctx_size;
44  /**
45  * size of the private data, i.e.
46  * AVHWDeviceInternal.priv
47  */
48   size_t device_priv_size;
49 
50  /**
51  * Size of the hardware-specific device configuration.
52  * (Used to query hwframe constraints.)
53  */
54   size_t device_hwconfig_size;
55 
56  /**
57  * size of the public frame pool hardware-specific context,
58  * i.e. AVHWFramesContext.hwctx
59  */
60   size_t frames_hwctx_size;
61  /**
62  * size of the private data, i.e.
63  * AVHWFramesInternal.priv
64  */
65   size_t frames_priv_size;
66 
67   int (*device_create)(AVHWDeviceContext *ctx, const char *device,
68  AVDictionary *opts, int flags);
69   int (*device_derive)(AVHWDeviceContext *dst_ctx,
70  AVHWDeviceContext *src_ctx, int flags);
71 
72   int (*device_init)(AVHWDeviceContext *ctx);
73   void (*device_uninit)(AVHWDeviceContext *ctx);
74 
75   int (*frames_get_constraints)(AVHWDeviceContext *ctx,
76  const void *hwconfig,
77  AVHWFramesConstraints *constraints);
78 
79   int (*frames_init)(AVHWFramesContext *ctx);
80   void (*frames_uninit)(AVHWFramesContext *ctx);
81 
82   int (*frames_get_buffer)(AVHWFramesContext *ctx, AVFrame *frame);
83   int (*transfer_get_formats)(AVHWFramesContext *ctx,
84  enum AVHWFrameTransferDirection dir,
85  enum AVPixelFormat **formats);
86   int (*transfer_data_to)(AVHWFramesContext *ctx, AVFrame *dst,
87  const AVFrame *src);
88   int (*transfer_data_from)(AVHWFramesContext *ctx, AVFrame *dst,
89  const AVFrame *src);
90 
91   int (*map_to)(AVHWFramesContext *ctx, AVFrame *dst,
92  const AVFrame *src, int flags);
93   int (*map_from)(AVHWFramesContext *ctx, AVFrame *dst,
94  const AVFrame *src, int flags);
95 
96   int (*frames_derive_to)(AVHWFramesContext *dst_ctx,
97  AVHWFramesContext *src_ctx, int flags);
98   int (*frames_derive_from)(AVHWFramesContext *dst_ctx,
99  AVHWFramesContext *src_ctx, int flags);
100 } HWContextType;
101 
102  struct AVHWDeviceInternal {
103   const HWContextType *hw_type;
104   void *priv;
105 
106  /**
107  * For a derived device, a reference to the original device
108  * context it was derived from.
109  */
110   AVBufferRef *source_device;
111 };
112 
113  struct AVHWFramesInternal {
114   const HWContextType *hw_type;
115   void *priv;
116 
117   AVBufferPool *pool_internal;
118 
119  /**
120  * For a derived context, a reference to the original frames
121  * context it was derived from.
122  */
123   AVBufferRef *source_frames;
124  /**
125  * Flags to apply to the mapping from the source to the derived
126  * frame context when trying to allocate in the derived context.
127  */
128   int source_allocation_map_flags;
129 };
130 
131  typedef struct HWMapDescriptor {
132  /**
133  * A reference to the original source of the mapping.
134  */
135   AVFrame *source;
136  /**
137  * A reference to the hardware frames context in which this
138  * mapping was made. May be the same as source->hw_frames_ctx,
139  * but need not be.
140  */
141   AVBufferRef *hw_frames_ctx;
142  /**
143  * Unmap function.
144  */
145   void (*unmap)(AVHWFramesContext *ctx,
146  struct HWMapDescriptor *hwmap);
147  /**
148  * Hardware-specific private data associated with the mapping.
149  */
150   void *priv;
151 } HWMapDescriptor;
152 
153 int ff_hwframe_map_create(AVBufferRef *hwframe_ref,
154  AVFrame *dst, const AVFrame *src,
155  void (*unmap)(AVHWFramesContext *ctx,
156  HWMapDescriptor *hwmap),
157  void *priv);
158 
159 
160 extern const HWContextType ff_hwcontext_type_cuda;
161 extern const HWContextType ff_hwcontext_type_d3d11va;
162 extern const HWContextType ff_hwcontext_type_drm;
163 extern const HWContextType ff_hwcontext_type_dxva2;
164 extern const HWContextType ff_hwcontext_type_opencl;
165 extern const HWContextType ff_hwcontext_type_qsv;
166 extern const HWContextType ff_hwcontext_type_vaapi;
167 extern const HWContextType ff_hwcontext_type_vdpau;
168 extern const HWContextType ff_hwcontext_type_videotoolbox;
169 extern const HWContextType ff_hwcontext_type_mediacodec;
170 
171 #endif /* AVUTIL_HWCONTEXT_INTERNAL_H */
AVHWDeviceContext
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Definition: hwcontext.h:60
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:218
HWContextType::frames_uninit
void(* frames_uninit)(AVHWFramesContext *ctx)
Definition: hwcontext_internal.h:80
ff_hwcontext_type_vdpau
const HWContextType ff_hwcontext_type_vdpau
Definition: hwcontext_vdpau.c:480
ff_hwcontext_type_mediacodec
const HWContextType ff_hwcontext_type_mediacodec
Definition: hwcontext_mediacodec.c:38
HWContextType::frames_derive_to
int(* frames_derive_to)(AVHWFramesContext *dst_ctx, AVHWFramesContext *src_ctx, int flags)
Definition: hwcontext_internal.h:96
ff_hwcontext_type_dxva2
const HWContextType ff_hwcontext_type_dxva2
Definition: hwcontext_dxva2.c:576
HWContextType::device_priv_size
size_t device_priv_size
size of the private data, i.e.
Definition: hwcontext_internal.h:48
src
#define src
Definition: vp8dsp.c:254
AVHWFramesInternal::hw_type
const HWContextType * hw_type
Definition: hwcontext_internal.h:114
HWContextType::map_to
int(* map_to)(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src, int flags)
Definition: hwcontext_internal.h:91
HWContextType::device_derive
int(* device_derive)(AVHWDeviceContext *dst_ctx, AVHWDeviceContext *src_ctx, int flags)
Definition: hwcontext_internal.h:69
AVHWFramesInternal::pool_internal
AVBufferPool * pool_internal
Definition: hwcontext_internal.h:117
HWContextType::frames_priv_size
size_t frames_priv_size
size of the private data, i.e.
Definition: hwcontext_internal.h:65
HWContextType::type
enum AVHWDeviceType type
Definition: hwcontext_internal.h:30
HWContextType::device_hwctx_size
size_t device_hwctx_size
size of the public hardware-specific context, i.e.
Definition: hwcontext_internal.h:43
HWContextType::frames_get_constraints
int(* frames_get_constraints)(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
Definition: hwcontext_internal.h:75
frame
static AVFrame * frame
Definition: demuxing_decoding.c:53
ff_hwcontext_type_qsv
const HWContextType ff_hwcontext_type_qsv
Definition: hwcontext_qsv.c:1122
flags
static int flags
Definition: log.c:55
HWContextType::frames_hwctx_size
size_t frames_hwctx_size
size of the public frame pool hardware-specific context, i.e.
Definition: hwcontext_internal.h:60
AVBufferPool
The buffer pool.
Definition: buffer_internal.h:76
AVDictionary
Definition: dict.c:30
HWContextType::map_from
int(* map_from)(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src, int flags)
Definition: hwcontext_internal.h:93
AVHWFramesInternal::source_frames
AVBufferRef * source_frames
For a derived context, a reference to the original frames context it was derived from.
Definition: hwcontext_internal.h:123
ff_hwcontext_type_videotoolbox
const HWContextType ff_hwcontext_type_videotoolbox
Definition: hwcontext_videotoolbox.c:232
frame.h
reference-counted frame API
HWContextType::device_uninit
void(* device_uninit)(AVHWDeviceContext *ctx)
Definition: hwcontext_internal.h:73
opts
AVDictionary * opts
Definition: movenc.c:50
HWMapDescriptor::source
AVFrame * source
A reference to the original source of the mapping.
Definition: hwcontext_internal.h:135
HWContextType::pix_fmts
enum AVPixelFormat * pix_fmts
An array of pixel formats supported by the AVHWFramesContext instances Terminated by AV_PIX_FMT_NONE...
Definition: hwcontext_internal.h:37
HWContextType::name
const char * name
Definition: hwcontext_internal.h:31
HWContextType::device_hwconfig_size
size_t device_hwconfig_size
Size of the hardware-specific device configuration.
Definition: hwcontext_internal.h:54
HWMapDescriptor::unmap
void(* unmap)(AVHWFramesContext *ctx, struct HWMapDescriptor *hwmap)
Unmap function.
Definition: hwcontext_internal.h:145
void
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
ctx
AVFormatContext * ctx
Definition: movenc.c:48
ff_hwframe_map_create
int ff_hwframe_map_create(AVBufferRef *hwframe_ref, AVFrame *dst, const AVFrame *src, void(*unmap)(AVHWFramesContext *ctx, HWMapDescriptor *hwmap), void *priv)
Definition: hwcontext.c:689
HWMapDescriptor::priv
void * priv
Hardware-specific private data associated with the mapping.
Definition: hwcontext_internal.h:150
AVHWFramesConstraints
This struct describes the constraints on hardware frames attached to a given device with a hardware-s...
Definition: hwcontext.h:432
HWContextType::device_create
int(* device_create)(AVHWDeviceContext *ctx, const char *device, AVDictionary *opts, int flags)
Definition: hwcontext_internal.h:67
AVHWFramesInternal::source_allocation_map_flags
int source_allocation_map_flags
Flags to apply to the mapping from the source to the derived frame context when trying to allocate in...
Definition: hwcontext_internal.h:128
HWContextType::frames_get_buffer
int(* frames_get_buffer)(AVHWFramesContext *ctx, AVFrame *frame)
Definition: hwcontext_internal.h:82
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:123
buffer.h
refcounted data buffer API
HWMapDescriptor::hw_frames_ctx
AVBufferRef * hw_frames_ctx
A reference to the hardware frames context in which this mapping was made.
Definition: hwcontext_internal.h:141
HWContextType::frames_derive_from
int(* frames_derive_from)(AVHWFramesContext *dst_ctx, AVHWFramesContext *src_ctx, int flags)
Definition: hwcontext_internal.h:98
HWContextType::transfer_data_from
int(* transfer_data_from)(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
Definition: hwcontext_internal.h:88
HWContextType::transfer_data_to
int(* transfer_data_to)(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
Definition: hwcontext_internal.h:86
ff_hwcontext_type_d3d11va
const HWContextType ff_hwcontext_type_d3d11va
Definition: hwcontext_d3d11va.c:595
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:81
int
int
Definition: ffmpeg_filter.c:190
AVHWDeviceInternal::hw_type
const HWContextType * hw_type
Definition: hwcontext_internal.h:103
ff_hwcontext_type_opencl
const HWContextType ff_hwcontext_type_opencl
Definition: hwcontext_opencl.c:2910
ff_hwcontext_type_drm
const HWContextType ff_hwcontext_type_drm
Definition: hwcontext_drm.c:270
ff_hwcontext_type_cuda
const HWContextType ff_hwcontext_type_cuda
Definition: hwcontext_cuda.c:400
AVHWFrameTransferDirection
AVHWFrameTransferDirection
Definition: hwcontext.h:394
pixfmt.h
pixel format definitions
AVHWDeviceType
AVHWDeviceType
Definition: hwcontext.h:27
HWContextType::transfer_get_formats
int(* transfer_get_formats)(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
Definition: hwcontext_internal.h:83
AVHWDeviceInternal::source_device
AVBufferRef * source_device
For a derived device, a reference to the original device context it was derived from.
Definition: hwcontext_internal.h:110
HWContextType::device_init
int(* device_init)(AVHWDeviceContext *ctx)
Definition: hwcontext_internal.h:72
formats
formats
Definition: signature.h:48
HWContextType::frames_init
int(* frames_init)(AVHWFramesContext *ctx)
Definition: hwcontext_internal.h:79
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60
ff_hwcontext_type_vaapi
const HWContextType ff_hwcontext_type_vaapi
Definition: hwcontext_vaapi.c:1540

Generated on Sun May 13 2018 02:04:08 for FFmpeg by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /