mixer.c revision 574ffb440dbd878d51fc9b9794a6396cbe6f75bb
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 33VdpStatus 34vlVdpVideoMixerCreate(VdpDevice device, 35 uint32_t feature_count, 36 VdpVideoMixerFeature const *features, 37 uint32_t parameter_count, 38 VdpVideoMixerParameter const *parameters, 39 void const *const *parameter_values, 40 VdpVideoMixer *mixer) 41{ 42 vlVdpVideoMixer *vmixer = NULL; 43 struct pipe_video_context *context; 44 VdpStatus ret; 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 context = dev->context->vpipe; 53 54 vmixer = CALLOC(1, sizeof(vlVdpVideoMixer)); 55 if (!vmixer) 56 return VDP_STATUS_RESOURCES; 57 58 vmixer->device = dev; 59 vmixer->compositor = context->create_compositor(context); 60 61 /* 62 * TODO: Handle features and parameters 63 * */ 64 65 *mixer = vlAddDataHTAB(vmixer); 66 if (*mixer == 0) { 67 ret = VDP_STATUS_ERROR; 68 goto no_handle; 69 } 70 71 return VDP_STATUS_OK; 72no_handle: 73 return ret; 74} 75 76VdpStatus 77vlVdpVideoMixerSetFeatureEnables(VdpVideoMixer mixer, 78 uint32_t feature_count, 79 VdpVideoMixerFeature const *features, 80 VdpBool const *feature_enables) 81{ 82 debug_printf("[VDPAU] Setting VideoMixer features\n"); 83 84 if (!(features && feature_enables)) 85 return VDP_STATUS_INVALID_POINTER; 86 87 vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer); 88 if (!vmixer) 89 return VDP_STATUS_INVALID_HANDLE; 90 91 /* 92 * TODO: Set features 93 * */ 94 95 return VDP_STATUS_OK; 96} 97 98VdpStatus vlVdpVideoMixerRender(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 && 115 video_source_rect && destination_rect && destination_video_rect && layers)) 116 return VDP_STATUS_INVALID_POINTER; 117 118 return VDP_STATUS_NO_IMPLEMENTATION; 119} 120 121VdpStatus 122vlVdpVideoMixerSetAttributeValues(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} 141