1 /**************************************************************************
3 * Copyright 2009 Younes Manton.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 #ifndef PIPE_VIDEO_CONTEXT_H
29 #define PIPE_VIDEO_CONTEXT_H
35 #include "pipe/p_video_state.h"
39 struct pipe_macroblock
;
40 struct pipe_picture_desc
;
41 struct pipe_fence_handle
;
44 * Gallium video decoder for a specific codec/profile
46 struct pipe_video_decoder
48 struct pipe_context
*context
;
50 enum pipe_video_profile profile
;
51 enum pipe_video_entrypoint entrypoint
;
52 enum pipe_video_chroma_format chroma_format
;
57 * destroy this video decoder
59 void (*destroy
)(struct pipe_video_decoder
*decoder
);
62 * Creates a decoder buffer
64 void *(*create_buffer
)(struct pipe_video_decoder
*decoder
);
67 * Destroys a decoder buffer
69 void (*destroy_buffer
)(struct pipe_video_decoder
*decoder
, void *buffer
);
72 * set the current decoder buffer
74 void (*set_decode_buffer
)(struct pipe_video_decoder
*decoder
, void *buffer
);
77 * set the picture parameters for the next frame
78 * only used for bitstream decoding
80 void (*set_picture_parameters
)(struct pipe_video_decoder
*decoder
,
81 struct pipe_picture_desc
*picture
);
84 * set the quantification matrixes
86 void (*set_quant_matrix
)(struct pipe_video_decoder
*decoder
,
87 const struct pipe_quant_matrix
*matrix
);
90 * set target where video data is decoded to
92 void (*set_decode_target
)(struct pipe_video_decoder
*decoder
,
93 struct pipe_video_buffer
*target
);
96 * set reference frames for motion compensation
98 void (*set_reference_frames
)(struct pipe_video_decoder
*decoder
,
99 struct pipe_video_buffer
**ref_frames
,
100 unsigned num_ref_frames
);
103 * start decoding of a new frame
105 void (*begin_frame
)(struct pipe_video_decoder
*decoder
);
108 * decode a macroblock
110 void (*decode_macroblock
)(struct pipe_video_decoder
*decoder
,
111 const struct pipe_macroblock
*macroblocks
,
112 unsigned num_macroblocks
);
117 void (*decode_bitstream
)(struct pipe_video_decoder
*decoder
,
118 unsigned num_bytes
, const void *data
);
121 * end decoding of the current frame
123 void (*end_frame
)(struct pipe_video_decoder
*decoder
);
126 * flush any outstanding command buffers to the hardware
127 * should be called before a video_buffer is acessed by the state tracker again
129 void (*flush
)(struct pipe_video_decoder
*decoder
);
133 * output for decoding / input for displaying
135 struct pipe_video_buffer
137 struct pipe_context
*context
;
139 enum pipe_format buffer_format
;
140 enum pipe_video_chroma_format chroma_format
;
145 * destroy this video buffer
147 void (*destroy
)(struct pipe_video_buffer
*buffer
);
150 * get a individual sampler view for each plane
152 struct pipe_sampler_view
**(*get_sampler_view_planes
)(struct pipe_video_buffer
*buffer
);
155 * get a individual sampler view for each component
157 struct pipe_sampler_view
**(*get_sampler_view_components
)(struct pipe_video_buffer
*buffer
);
160 * get a individual surfaces for each plane
162 struct pipe_surface
**(*get_surfaces
)(struct pipe_video_buffer
*buffer
);
169 #endif /* PIPE_VIDEO_CONTEXT_H */