1 /*
2  *  vdpau_image.h - VDPAU backend for VA-API (VA images)
3  *
4  *  libva-vdpau-driver (C) 2009-2011 Splitted-Desktop Systems
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
19  */
20 
21 #ifndef VDPAU_IMAGE_H
22 #define VDPAU_IMAGE_H
23 
24 #include "vdpau_driver.h"
25 
26 typedef enum {
27     VDP_IMAGE_FORMAT_TYPE_YCBCR = 1,
28     VDP_IMAGE_FORMAT_TYPE_RGBA,
29     VDP_IMAGE_FORMAT_TYPE_INDEXED
30 } VdpImageFormatType;
31 
32 typedef struct object_image object_image_t;
33 struct object_image {
34     struct object_base  base;
35     VAImage             image;
36     VdpImageFormatType  vdp_format_type;
37     uint32_t            vdp_format;
38     VdpOutputSurface    vdp_rgba_output_surface;
39     uint32_t           *vdp_palette;
40 };
41 
42 // vaQueryImageFormats
43 VAStatus
44 vdpau_QueryImageFormats(
45     VADriverContextP    ctx,
46     VAImageFormat      *format_list,
47     int                *num_formats
48 ) attribute_hidden;
49 
50 // vaCreateImage
51 VAStatus
52 vdpau_CreateImage(
53     VADriverContextP    ctx,
54     VAImageFormat      *format,
55     int                 width,
56     int                 height,
57     VAImage            *image
58 ) attribute_hidden;
59 
60 // vaDestroyImage
61 VAStatus
62 vdpau_DestroyImage(
63     VADriverContextP    ctx,
64     VAImageID           image_id
65 ) attribute_hidden;
66 
67 // vaDeriveImage
68 VAStatus
69 vdpau_DeriveImage(
70     VADriverContextP    ctx,
71     VASurfaceID         surface,
72     VAImage            *image
73 ) attribute_hidden;
74 
75 // vaSetImagePalette
76 VAStatus
77 vdpau_SetImagePalette(
78     VADriverContextP    ctx,
79     VAImageID           image,
80     unsigned char      *palette
81 ) attribute_hidden;
82 
83 // vaGetImage
84 VAStatus
85 vdpau_GetImage(
86     VADriverContextP    ctx,
87     VASurfaceID         surface,
88     int                 x,
89     int                 y,
90     unsigned int        width,
91     unsigned int        height,
92     VAImageID           image_id
93 ) attribute_hidden;
94 
95 // vaPutImage
96 VAStatus
97 vdpau_PutImage(
98     VADriverContextP    ctx,
99     VASurfaceID         surface,
100     VAImageID           image,
101     int                 src_x,
102     int                 src_y,
103     unsigned int        width,
104     unsigned int        height,
105     int                 dest_x,
106     int                 dest_y
107 ) attribute_hidden;
108 
109 // vaPutImage2
110 VAStatus
111 vdpau_PutImage_full(
112     VADriverContextP    ctx,
113     VASurfaceID         surface,
114     VAImageID           image,
115     int                 src_x,
116     int                 src_y,
117     unsigned int        src_width,
118     unsigned int        src_height,
119     int                 dest_x,
120     int                 dest_y,
121     unsigned int        dest_width,
122     unsigned int        dest_height
123 ) attribute_hidden;
124 
125 #endif /* VDPAU_IMAGE_H */
126