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 xvmc_private_h
29 #define xvmc_private_h
32 #include <X11/extensions/XvMClib.h>
34 #include <pipe/p_video_state.h>
36 #include <util/u_debug.h>
37 #include <util/u_math.h>
39 #include <vl/vl_csc.h>
40 #include <vl/vl_compositor.h>
42 #define BLOCK_SIZE_SAMPLES 64
43 #define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2)
47 struct pipe_video_decoder
;
48 struct pipe_video_decode_buffer
;
49 struct pipe_video_buffer
;
51 struct pipe_sampler_view
;
52 struct pipe_fence_handle
;
56 struct vl_context
*vctx
;
57 struct pipe_video_decoder
*decoder
;
59 enum VL_CSC_COLOR_STANDARD color_standard
;
60 struct vl_procamp procamp
;
61 struct vl_compositor compositor
;
63 unsigned short subpicture_max_width
;
64 unsigned short subpicture_max_height
;
66 struct pipe_video_rect dst_rect
;
67 struct pipe_surface
*drawable_surface
;
73 struct pipe_video_decode_buffer
*decode_buffer
;
74 struct pipe_video_buffer
*video_buffer
;
76 bool mapped
; // are we still mapped to memory?
79 unsigned num_blocks_added
;
80 struct pipe_ycbcr_block
*stream
;
87 struct pipe_motionvector
*mv
;
90 struct pipe_fence_handle
*fence
;
92 /* The subpicture associated with this surface, if any. */
93 XvMCSubpicture
*subpicture
;
95 /* Some XvMC functions take a surface but not a context,
96 so we keep track of which context each surface belongs to. */
102 struct pipe_sampler_view
*sampler
;
104 /* optional palette for this subpicture */
105 struct pipe_sampler_view
*palette
;
107 struct pipe_video_rect src_rect
;
108 struct pipe_video_rect dst_rect
;
110 /* The surface this subpicture is currently associated with, if any. */
111 XvMCSurface
*surface
;
113 /* Some XvMC functions take a subpicture but not a context,
114 so we keep track of which context each subpicture belongs to. */
115 XvMCContext
*context
;
116 } XvMCSubpicturePrivate
;
123 static INLINE
void XVMC_MSG(unsigned int level
, const char *fmt
, ...)
125 static int debug_level
= -1;
127 if (debug_level
== -1) {
128 debug_level
= MAX2(debug_get_num_option("XVMC_DEBUG", 0), 0);
131 if (level
<= debug_level
) {
134 _debug_vprintf(fmt
, ap
);
139 #endif /* xvmc_private_h */