OSDN Git Service

Merge remote branch 'origin/master' into pipe-video
[android-x86/external-mesa.git] / src / gallium / state_trackers / vdpau / mixer.c
1 /**************************************************************************
2  *
3  * Copyright 2010 Thomas Balling Sørensen.
4  * All Rights Reserved.
5  *
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:
13  *
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial portions
16  * of the Software.
17  *
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.
25  *
26  **************************************************************************/
27  
28  #include <vdpau/vdpau.h>
29  #include <util/u_memory.h>
30   #include <util/u_debug.h>
31   #include "vdpau_private.h"
32
33  
34  VdpStatus      
35  vlVdpVideoMixerCreate (VdpDevice device, 
36                                                 uint32_t feature_count, 
37                                                 VdpVideoMixerFeature const *features, 
38                                                 uint32_t parameter_count, 
39                                                 VdpVideoMixerParameter const *parameters, 
40                                                 void const *const *parameter_values, 
41                                                 VdpVideoMixer *mixer)
42 {
43         VdpStatus ret;
44         vlVdpVideoMixer *vmixer = NULL;
45         
46         debug_printf("[VDPAU] Creating VideoMixer\n");
47         
48         vlVdpDevice *dev = vlGetDataHTAB(device);
49         if (!dev)
50       return VDP_STATUS_INVALID_HANDLE;
51           
52         vmixer = CALLOC(1, sizeof(vlVdpVideoMixer));
53         if (!vmixer)
54       return VDP_STATUS_RESOURCES;
55           
56         vmixer->device = dev;
57           /*
58            * TODO: Handle features and parameters
59            * */
60           
61         *mixer = vlAddDataHTAB(vmixer);
62     if (*mixer == 0) {
63       ret = VDP_STATUS_ERROR;
64       goto no_handle;
65     }
66    
67    
68    return VDP_STATUS_OK;
69    no_handle:
70    return ret;
71 }
72
73 VdpStatus
74 vlVdpVideoMixerSetFeatureEnables (
75                         VdpVideoMixer mixer, 
76                         uint32_t feature_count, 
77                         VdpVideoMixerFeature const *features, 
78                         VdpBool const *feature_enables)
79 {
80         debug_printf("[VDPAU] Setting VideoMixer features\n");
81         
82         if (!(features && feature_enables))     
83                 return VDP_STATUS_INVALID_POINTER;
84         
85         vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
86         if (!vmixer)
87                 return VDP_STATUS_INVALID_HANDLE;
88                 
89         /*
90            * TODO: Set features
91            * */
92         
93         
94         return VDP_STATUS_OK;
95 }
96
97 VdpStatus vlVdpVideoMixerRender (
98                 VdpVideoMixer mixer, 
99                 VdpOutputSurface background_surface, 
100                 VdpRect const *background_source_rect, 
101                 VdpVideoMixerPictureStructure current_picture_structure, 
102                 uint32_t video_surface_past_count, 
103                 VdpVideoSurface const *video_surface_past, 
104                 VdpVideoSurface video_surface_current, 
105                 uint32_t video_surface_future_count, 
106                 VdpVideoSurface const *video_surface_future, 
107                 VdpRect const *video_source_rect, 
108                 VdpOutputSurface destination_surface, 
109                 VdpRect const *destination_rect, 
110                 VdpRect const *destination_video_rect, 
111                 uint32_t layer_count, 
112                 VdpLayer const *layers)
113 {
114         if (!(background_source_rect && video_surface_past && video_surface_future && video_source_rect && destination_rect && destination_video_rect && layers))       
115                 return VDP_STATUS_INVALID_POINTER;
116
117         return VDP_STATUS_NO_IMPLEMENTATION;
118 }
119
120 VdpStatus
121 vlVdpVideoMixerSetAttributeValues (
122                 VdpVideoMixer mixer, 
123                 uint32_t attribute_count, 
124                 VdpVideoMixerAttribute const *attributes, 
125                 void const *const *attribute_values)
126 {
127         if (!(attributes && attribute_values))  
128                 return VDP_STATUS_INVALID_POINTER;
129         
130         vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
131         if (!vmixer)
132                 return VDP_STATUS_INVALID_HANDLE;
133                 
134         /*
135          * TODO: Implement the function
136          * 
137          * */
138         
139         return VDP_STATUS_OK;
140 }