1/* 2 * Xephyr - A kdrive X server thats runs in a host X window. 3 * Authored by Matthew Allum <mallum@openedhand.com> 4 * 5 * Copyright © 2007 OpenedHand Ltd 6 * 7 * Permission to use, copy, modify, distribute, and sell this software and its 8 * documentation for any purpose is hereby granted without fee, provided that 9 * the above copyright notice appear in all copies and that both that 10 * copyright notice and this permission notice appear in supporting 11 * documentation, and that the name of OpenedHand Ltd not be used in 12 * advertising or publicity pertaining to distribution of the software without 13 * specific, written prior permission. OpenedHand Ltd makes no 14 * representations about the suitability of this software for any purpose. It 15 * is provided "as is" without express or implied warranty. 16 * 17 * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 18 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 19 * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR 20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 21 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 22 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 23 * PERFORMANCE OF THIS SOFTWARE. 24 * 25 * Authors: 26 * Dodji Seketeli <dodji@openedhand.com> 27 */ 28#ifndef __EPHYRHOSTVIDEO_H__ 29#define __EPHYRHOSTVIDEO_H__ 30 31typedef void* EphyrHostXVAdaptor ; 32typedef struct _EphyrHostXVAdaptorArray EphyrHostXVAdaptorArray ; 33 34typedef struct _EphyrHostVideoFormat { 35 char depth ; 36 short visual_class; 37} EphyrHostVideoFormat ; 38 39typedef struct _EphyrHostRational { 40 int numerator ; 41 int denominator ; 42} EphyrHostRational; 43 44typedef struct _EphyrHostEncoding { 45 int id ; 46 char *name ; 47 unsigned short width, height ; 48 EphyrHostRational rate ; 49} EphyrHostEncoding ; 50 51typedef struct _EphyrHostAttribute { 52 int flags; 53 int min_value; 54 int max_value; 55 char *name; 56} EphyrHostAttribute ; 57 58typedef struct _EphyrHostImageFormat { 59 int id; /* Unique descriptor for the format */ 60 int type; /* XvRGB, XvYUV */ 61 int byte_order; /* LSBFirst, MSBFirst */ 62 char guid[16]; /* Globally Unique IDentifier */ 63 int bits_per_pixel; 64 int format; /* XvPacked, XvPlanar */ 65 int num_planes; 66 67 /* for RGB formats only */ 68 int depth; 69 unsigned int red_mask; 70 unsigned int green_mask; 71 unsigned int blue_mask; 72 73 /* for YUV formats only */ 74 unsigned int y_sample_bits; 75 unsigned int u_sample_bits; 76 unsigned int v_sample_bits; 77 unsigned int horz_y_period; 78 unsigned int horz_u_period; 79 unsigned int horz_v_period; 80 unsigned int vert_y_period; 81 unsigned int vert_u_period; 82 unsigned int vert_v_period; 83 char component_order[32]; /* eg. UYVY */ 84 int scanline_order; /* XvTopToBottom, XvBottomToTop */ 85} EphyrHostImageFormat ; 86 87typedef struct { 88 unsigned short x1, y1, x2, y2 ; 89} EphyrHostBox ; 90 91void ephyrHostXVInit (void) ; 92 93void ephyrHostFree (void *a_pointer) ; 94 95/* 96 * host adaptor array 97 */ 98Bool ephyrHostXVQueryAdaptors (EphyrHostXVAdaptorArray **a_adaptors) ; 99void ephyrHostXVAdaptorArrayDelete (EphyrHostXVAdaptorArray *a_adaptors) ; 100int ephyrHostXVAdaptorArrayGetSize (const EphyrHostXVAdaptorArray *a_this) ; 101EphyrHostXVAdaptor* ephyrHostXVAdaptorArrayAt (const EphyrHostXVAdaptorArray *a_this, 102 int a_index) ; 103 104/* 105 * host adaptor 106 */ 107 108char ephyrHostXVAdaptorGetType (const EphyrHostXVAdaptor *a_this) ; 109const char* ephyrHostXVAdaptorGetName (const EphyrHostXVAdaptor *a_this) ; 110EphyrHostVideoFormat* ephyrHostXVAdaptorGetVideoFormats 111 (const EphyrHostXVAdaptor *a_this, 112 int *a_nb_formats) ; 113int ephyrHostXVAdaptorGetNbPorts (const EphyrHostXVAdaptor *a_this) ; 114int ephyrHostXVAdaptorGetFirstPortID (const EphyrHostXVAdaptor *a_this) ; 115 116Bool ephyrHostXVAdaptorHasPutVideo (const EphyrHostXVAdaptor *a_this, 117 Bool *a_result) ; 118Bool ephyrHostXVAdaptorHasGetVideo (const EphyrHostXVAdaptor *a_this, 119 Bool *a_result) ; 120Bool ephyrHostXVAdaptorHasPutStill (const EphyrHostXVAdaptor *a_this, 121 Bool *a_result) ; 122Bool ephyrHostXVAdaptorHasGetStill (const EphyrHostXVAdaptor *a_this, 123 Bool *a_result) ; 124Bool ephyrHostXVAdaptorHasPutImage (const EphyrHostXVAdaptor *a_this, 125 Bool *a_result) ; 126 127/* 128 * encoding 129 */ 130Bool ephyrHostXVQueryEncodings (int a_port_id, 131 EphyrHostEncoding **a_encodings, 132 unsigned int *a_num_encodings) ; 133 134void ephyrHostEncodingsDelete (EphyrHostEncoding *a_encodings, 135 int a_num_encodings) ; 136 137/* 138 * attribute 139 */ 140Bool ephyrHostXVQueryPortAttributes (int a_port_id, 141 EphyrHostAttribute **a_attributes, 142 int *a_num_attributes) ; 143 144void ephyrHostAttributesDelete (EphyrHostAttribute *a_attributes) ; 145/* 146 * image format 147 */ 148 149Bool ephyrHostXVQueryImageFormats (int a_port_id, 150 EphyrHostImageFormat **a_formats, 151 int *a_num_format) ; 152/* 153 * Port Attribute Get/Set 154 */ 155Bool ephyrHostXVSetPortAttribute (int a_port_id, 156 int a_atom, 157 int a_attr_value) ; 158Bool ephyrHostXVGetPortAttribute (int a_port_id, 159 int a_atom, 160 int *a_attr_value) ; 161/* 162 *size query 163 */ 164Bool ephyrHostXVQueryBestSize (int a_port_id, 165 Bool a_motion, 166 unsigned int a_frame_w, 167 unsigned int a_frame_h, 168 unsigned int a_drw_w, 169 unsigned int a_drw_h, 170 unsigned int *a_actual_w, 171 unsigned int *a_actual_h) ; 172 173Bool ephyrHostXVQueryImageAttributes (int a_port_id, 174 int a_image_id /*image fourcc code*/, 175 unsigned short *a_width, 176 unsigned short *a_height, 177 int *a_image_size, 178 int *a_pitches, 179 int *a_offsets) ; 180/* 181 * atom 182 */ 183Bool ephyrHostGetAtom (const char* a_name, 184 Bool a_create_if_not_exists, 185 int *a_atom) ; 186char* ephyrHostGetAtomName (int a_atom) ; 187 188/* 189 *PutImage 190 * (ignore clipping for now) 191 */ 192Bool ephyrHostXVPutImage (int a_screen_num, 193 int a_port_id, 194 int a_image_id, 195 int a_drw_x, 196 int a_drw_y, 197 int a_drw_w, 198 int a_drw_h, 199 int a_src_x, 200 int a_src_y, 201 int a_src_w, 202 int a_src_h, 203 int a_image_width, 204 int a_image_height, 205 unsigned char *a_buf, 206 EphyrHostBox *a_clip_rects, 207 int a_clip_rect_nums) ; 208 209/* 210 * Putvideo/PutStill/GetVideo 211 */ 212Bool ephyrHostXVPutVideo (int a_screen_num, 213 int a_port_id, 214 int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, 215 int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ; 216 217Bool ephyrHostXVGetVideo (int a_screen_num, 218 int a_port_id, 219 int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, 220 int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ; 221 222Bool ephyrHostXVPutStill (int a_screen_num, 223 int a_port_id, 224 int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, 225 int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ; 226 227Bool ephyrHostXVGetStill (int a_screen_num, 228 int a_port_id, 229 int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, 230 int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ; 231 232/* 233 * StopVideo 234 */ 235Bool ephyrHostXVStopVideo (int a_screen_num, int a_port_id) ; 236 237#endif /*__EPHYRHOSTVIDEO_H__*/ 238 239