author | dag10 |
Mon, 21 Jan 2013 14:14:56 -0500 | |
changeset 8420 | 98e3cc0418f9 |
parent 7813 | 7ac83d79b897 |
permissions | -rw-r--r-- |
7813
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
1 |
/* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
2 |
* Copyright (C) 2003 Ivan Kalvachev |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
3 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
4 |
* This file is part of Libav. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
5 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
6 |
* Libav is free software; you can redistribute it and/or |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
7 |
* modify it under the terms of the GNU Lesser General Public |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
8 |
* License as published by the Free Software Foundation; either |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
9 |
* version 2.1 of the License, or (at your option) any later version. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
10 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
11 |
* Libav is distributed in the hope that it will be useful, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
14 |
* Lesser General Public License for more details. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
15 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
16 |
* You should have received a copy of the GNU Lesser General Public |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
17 |
* License along with Libav; if not, write to the Free Software |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
19 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
20 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
21 |
#ifndef AVCODEC_XVMC_H |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
22 |
#define AVCODEC_XVMC_H |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
23 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
24 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
25 |
* @file |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
26 |
* @ingroup lavc_codec_hwaccel_xvmc |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
27 |
* Public libavcodec XvMC header. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
28 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
29 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
30 |
#include <X11/extensions/XvMC.h> |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
31 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
32 |
#include "avcodec.h" |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
33 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
34 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
35 |
* @defgroup lavc_codec_hwaccel_xvmc XvMC |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
36 |
* @ingroup lavc_codec_hwaccel |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
37 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
38 |
* @{ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
39 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
40 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
41 |
#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
42 |
the number is 1337 speak for the letters IDCT MCo (motion compensation) */ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
43 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
44 |
struct xvmc_pix_fmt { |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
45 |
/** The field contains the special constant value AV_XVMC_ID. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
46 |
It is used as a test that the application correctly uses the API, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
47 |
and that there is no corruption caused by pixel routines. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
48 |
- application - set during initialization |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
49 |
- libavcodec - unchanged |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
50 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
51 |
int xvmc_id; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
52 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
53 |
/** Pointer to the block array allocated by XvMCCreateBlocks(). |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
54 |
The array has to be freed by XvMCDestroyBlocks(). |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
55 |
Each group of 64 values represents one data block of differential |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
56 |
pixel information (in MoCo mode) or coefficients for IDCT. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
57 |
- application - set the pointer during initialization |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
58 |
- libavcodec - fills coefficients/pixel data into the array |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
59 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
60 |
short* data_blocks; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
61 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
62 |
/** Pointer to the macroblock description array allocated by |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
63 |
XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks(). |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
64 |
- application - set the pointer during initialization |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
65 |
- libavcodec - fills description data into the array |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
66 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
67 |
XvMCMacroBlock* mv_blocks; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
68 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
69 |
/** Number of macroblock descriptions that can be stored in the mv_blocks |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
70 |
array. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
71 |
- application - set during initialization |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
72 |
- libavcodec - unchanged |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
73 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
74 |
int allocated_mv_blocks; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
75 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
76 |
/** Number of blocks that can be stored at once in the data_blocks array. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
77 |
- application - set during initialization |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
78 |
- libavcodec - unchanged |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
79 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
80 |
int allocated_data_blocks; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
81 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
82 |
/** Indicate that the hardware would interpret data_blocks as IDCT |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
83 |
coefficients and perform IDCT on them. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
84 |
- application - set during initialization |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
85 |
- libavcodec - unchanged |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
86 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
87 |
int idct; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
88 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
89 |
/** In MoCo mode it indicates that intra macroblocks are assumed to be in |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
90 |
unsigned format; same as the XVMC_INTRA_UNSIGNED flag. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
91 |
- application - set during initialization |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
92 |
- libavcodec - unchanged |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
93 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
94 |
int unsigned_intra; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
95 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
96 |
/** Pointer to the surface allocated by XvMCCreateSurface(). |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
97 |
It has to be freed by XvMCDestroySurface() on application exit. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
98 |
It identifies the frame and its state on the video hardware. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
99 |
- application - set during initialization |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
100 |
- libavcodec - unchanged |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
101 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
102 |
XvMCSurface* p_surface; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
103 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
104 |
/** Set by the decoder before calling ff_draw_horiz_band(), |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
105 |
needed by the XvMCRenderSurface function. */ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
106 |
//@{ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
107 |
/** Pointer to the surface used as past reference |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
108 |
- application - unchanged |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
109 |
- libavcodec - set |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
110 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
111 |
XvMCSurface* p_past_surface; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
112 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
113 |
/** Pointer to the surface used as future reference |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
114 |
- application - unchanged |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
115 |
- libavcodec - set |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
116 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
117 |
XvMCSurface* p_future_surface; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
118 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
119 |
/** top/bottom field or frame |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
120 |
- application - unchanged |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
121 |
- libavcodec - set |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
122 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
123 |
unsigned int picture_structure; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
124 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
125 |
/** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
126 |
- application - unchanged |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
127 |
- libavcodec - set |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
128 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
129 |
unsigned int flags; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
130 |
//}@ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
131 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
132 |
/** Number of macroblock descriptions in the mv_blocks array |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
133 |
that have already been passed to the hardware. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
134 |
- application - zeroes it on get_buffer(). |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
135 |
A successful ff_draw_horiz_band() may increment it |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
136 |
with filled_mb_block_num or zero both. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
137 |
- libavcodec - unchanged |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
138 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
139 |
int start_mv_blocks_num; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
140 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
141 |
/** Number of new macroblock descriptions in the mv_blocks array (after |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
142 |
start_mv_blocks_num) that are filled by libavcodec and have to be |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
143 |
passed to the hardware. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
144 |
- application - zeroes it on get_buffer() or after successful |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
145 |
ff_draw_horiz_band(). |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
146 |
- libavcodec - increment with one of each stored MB |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
147 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
148 |
int filled_mv_blocks_num; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
149 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
150 |
/** Number of the next free data block; one data block consists of |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
151 |
64 short values in the data_blocks array. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
152 |
All blocks before this one have already been claimed by placing their |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
153 |
position into the corresponding block description structure field, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
154 |
that are part of the mv_blocks array. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
155 |
- application - zeroes it on get_buffer(). |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
156 |
A successful ff_draw_horiz_band() may zero it together |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
157 |
with start_mb_blocks_num. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
158 |
- libavcodec - each decoded macroblock increases it by the number |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
159 |
of coded blocks it contains. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
160 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
161 |
int next_free_data_block_num; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
162 |
}; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
163 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
164 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
165 |
* @} |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
166 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
167 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
168 |
#endif /* AVCODEC_XVMC_H */ |