annotate dxva2.h @ 12494:94eaea836bf4 libavcodec

Check avctx width/height more thoroughly (e.g. all values 0 except width would have been accepted before). Also do not fail if they are invalid but instead override them to 0. This allows decoding e.g. MPEG video when only the container values are corrupted. For encoding a value of 0,0 of course makes no sense, but was allowed through before and will be caught by an extra check in the encode function.
author reimar
date Wed, 15 Sep 2010 04:46:55 +0000
parents ea8f891d997d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10952
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
1 /*
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
2 * DXVA2 HW acceleration
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
3 *
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
4 * copyright (c) 2009 Laurent Aimar
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
5 *
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
6 * This file is part of FFmpeg.
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
7 *
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
12 *
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
16 * Lesser General Public License for more details.
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
17 *
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
21 */
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
22
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
23 #ifndef AVCODEC_DXVA_H
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
24 #define AVCODEC_DXVA_H
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
25
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
26 #include <stdint.h>
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
27
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
28 #include <dxva2api.h>
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
29
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
30 /**
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
31 * This structure is used to provides the necessary configurations and data
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
32 * to the DXVA2 FFmpeg HWAccel implementation.
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
33 *
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
34 * The application must make it available as AVCodecContext.hwaccel_context.
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
35 */
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
36 struct dxva_context {
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
37 /**
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
38 * DXVA2 decoder object
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
39 */
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
40 IDirectXVideoDecoder *decoder;
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
41
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
42 /**
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
43 * DXVA2 configuration used to create the decoder
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
44 */
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
45 const DXVA2_ConfigPictureDecode *cfg;
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
46
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
47 /**
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
48 * The number of surface in the surface array
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
49 */
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
50 unsigned surface_count;
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
51
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
52 /**
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
53 * The array of Direct3D surfaces used to create the decoder
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
54 */
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
55 LPDIRECT3DSURFACE9 *surface;
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
56
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
57 /**
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
58 * A bit field configuring the workarounds needed for using the decoder
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
59 */
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
60 uint64_t workaround;
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
61
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
62 /**
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
63 * Private to the FFmpeg AVHWAccel implementation
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
64 */
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
65 unsigned report_id;
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
66 };
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
67
ea8f891d997d H264 DXVA2 implementation
fenrir
parents:
diff changeset
68 #endif /* AVCODEC_DXVA_H */