1fba89afeSmrg 2fba89afeSmrgAddendum to the Xv Client library documentation 3fba89afeSmrg=============================================== 4fba89afeSmrg 5fba89afeSmrg The following features are new to version 2.2 6fba89afeSmrg 7fba89afeSmrg1) In addition to XvInputMask and XvOutputMask masks in the type field 8fba89afeSmrg of the XvAdaptorInfo there are 3 new bits defined - XvVideoMask, 9fba89afeSmrg XvStillMask and XvImageMask indicating that the adaptor is capable 10fba89afeSmrg of video, still or image primitives respectively. 11fba89afeSmrg 12fba89afeSmrg2) A new function and structure is defined to allow querying 13fba89afeSmrg port attributes. 14fba89afeSmrg 15fba89afeSmrgtypedef struct { 16cdbfa18aSmrg int flags; 17fba89afeSmrg int min_value; 18fba89afeSmrg int max_value; 19fba89afeSmrg char *name; 20fba89afeSmrg} XvAttribute; 21fba89afeSmrg 22fba89afeSmrg flags - May be XvGettable or XvSettable or both OR'd together 23fba89afeSmrg indicating the particular attribute is readable, writeable 24fba89afeSmrg or readable and writeable. 25fba89afeSmrg 26949d0342Smrg min_value, max_value - Indicate the minimum and maximum attribute 27fba89afeSmrg values which are valid for the driver. 28fba89afeSmrg 29fba89afeSmrg name - A string describing the name of the attribute that may be used 30fba89afeSmrg to retrieve the Atom for the particular attribute. 31fba89afeSmrg 32fba89afeSmrg 33fba89afeSmrgextern XvAttribute* XvQueryPortAttributes( 34fba89afeSmrg Display* /* display */, 35fba89afeSmrg XvPortID /* port */, 36fba89afeSmrg int* /* number */ 37fba89afeSmrg); 38fba89afeSmrg 39fba89afeSmrg XvQueryPortAttributes returns the number of attributes and an 40fba89afeSmrg array of XvAttributes valid for the given port. The array may 41fba89afeSmrg be freed with XFree(). 42fba89afeSmrg 43fba89afeSmrg 44fba89afeSmrg3) The X Video Extension (Xv) is extended to support client images in 45fba89afeSmrgalternate colorspaces (XvImages) in the following way. 46fba89afeSmrg 47fba89afeSmrg Xv Adaptors which are capable of displaying XvImages will have 48fba89afeSmrg the XvImageMask field set in the type field of the XvAdaptorInfo. 49fba89afeSmrg 50cdbfa18aSmrg XvImage formats supported by the port may be queried with 51fba89afeSmrg XvListImageFormats(). 52fba89afeSmrg 53fba89afeSmrg XvImages may be created with the help of XvCreateImage() or 54fba89afeSmrg XvShmCreateImage(); 55fba89afeSmrg 56fba89afeSmrg XvImages may be displayed with XvPutImage() or XvShmPutImage(). 57fba89afeSmrg 58fba89afeSmrg The Port attributes of the port specified in the Xv(Shm)PutImage 59fba89afeSmrg command will be valid for the image operation when applicable. 60fba89afeSmrg 61fba89afeSmrg There will be a port encoding with the name "XV_IMAGE". The 62fba89afeSmrg width and height of that encoding will indicate the maximum 63fba89afeSmrg source image size. 64fba89afeSmrg 65fba89afeSmrgtypedef struct { 66fba89afeSmrg int id; /* Unique descriptor for the format */ 67fba89afeSmrg int type; /* XvRGB, XvYUV */ 68fba89afeSmrg int byte_order; /* LSBFirst, MSBFirst */ 69fba89afeSmrg char guid[16]; /* Globally Unique IDentifier */ 70fba89afeSmrg int bits_per_pixel; 71fba89afeSmrg int format; /* XvPacked, XvPlanar */ 72fba89afeSmrg int num_planes; 73fba89afeSmrg 74fba89afeSmrg /* for RGB formats */ 75fba89afeSmrg int depth; 76cdbfa18aSmrg unsigned int red_mask; 77cdbfa18aSmrg unsigned int green_mask; 78cdbfa18aSmrg unsigned int blue_mask; 79fba89afeSmrg 80fba89afeSmrg /* for YUV formats */ 81fba89afeSmrg unsigned int y_sample_bits; 82fba89afeSmrg unsigned int u_sample_bits; 83cdbfa18aSmrg unsigned int v_sample_bits; 84fba89afeSmrg unsigned int horz_y_period; 85fba89afeSmrg unsigned int horz_u_period; 86fba89afeSmrg unsigned int horz_v_period; 87fba89afeSmrg unsigned int vert_y_period; 88fba89afeSmrg unsigned int vert_u_period; 89fba89afeSmrg unsigned int vert_v_period; 90fba89afeSmrg char component_order[32]; /* eg. UYVY */ 91fba89afeSmrg int scanline_order; /* XvTopToBottom, XvBottomToTop */ 92cdbfa18aSmrg} XvImageFormatValues; 93fba89afeSmrg 94fba89afeSmrg 95fba89afeSmrg id - A unique descriptor for the format. This is often the FOURCC 96fba89afeSmrg for the format, when applicable. This id is used to describe 97fba89afeSmrg the format during XvImage creation. 98fba89afeSmrg 99fba89afeSmrg type - XvRGB or XvYUV. 100fba89afeSmrg 101fba89afeSmrg byte_order - The byte order of the image. It is either LSBFirst 102fba89afeSmrg or MSBFirst. 103cdbfa18aSmrg 104fba89afeSmrg guid - The Globally Unique IDentifier (also known as Universally Unique 105cdbfa18aSmrg IDentifier). When not applicable, all characters are NULL. 106fba89afeSmrg 107fba89afeSmrg bits_per_pixel - The bits taken up (but not necessarily used) by each 108fba89afeSmrg pixel. Note that for some planar formats which have 109fba89afeSmrg fractional bits per pixel (such as IF09) this number 110fba89afeSmrg may be rounded _down_. 111fba89afeSmrg 112fba89afeSmrg format - XvPacked or XvPlanar. 113fba89afeSmrg 114fba89afeSmrg num_planes - The number of planes in planar formats. 115fba89afeSmrg 116fba89afeSmrg depth - Significant bits per pixel. 117fba89afeSmrg 118fba89afeSmrg red_mask, green_mask, blue_mask - The red, green and blue bitmasks 119fba89afeSmrg (RGB formats only). 120fba89afeSmrg 121fba89afeSmrg 122fba89afeSmrg ?_sample_bits - The size of each sample in bits (YUV formats only). 123fba89afeSmrg 124fba89afeSmrg horz_?_period, vert_?_period - The period (in pixels) on which samples 125cdbfa18aSmrg occur in the horizontal and vertical 126fba89afeSmrg directions (YUV formats only). 127fba89afeSmrg 128fba89afeSmrg component_order - Upper case ascii characters representing the order 129fba89afeSmrg that samples are stored within packed formats. 130fba89afeSmrg For planar formats this represents the ordering of 131fba89afeSmrg the planes. 132fba89afeSmrg 133fba89afeSmrg scanline_order - XvTopToBottom or XvBottomToTop. 134fba89afeSmrg 135fba89afeSmrgNote: Since some formats (particularly some planar YUV formats) may not 136fba89afeSmrg be completely defined by the parameters above, the guid, when 137cdbfa18aSmrg available, should provide the most accurate description of the 138fba89afeSmrg format. 139fba89afeSmrg 140fba89afeSmrg 141fba89afeSmrg 142fba89afeSmrgXvImageFormatValues * XvListImageFormats ( 143fba89afeSmrg Display *display, 144fba89afeSmrg XvPortID port_id, 145fba89afeSmrg int *count_return 146fba89afeSmrg); 147fba89afeSmrg 148cdbfa18aSmrg Returns the XvImageFormatValues supported by the specified port. 149fba89afeSmrgThis list should be freed with XFree(). 150cdbfa18aSmrg 151fba89afeSmrg 152fba89afeSmrgtypedef struct { 153fba89afeSmrg int id; 154fba89afeSmrg int width, height; 155fba89afeSmrg int data_size; 156fba89afeSmrg int num_planes; 157fba89afeSmrg int *pitches; 158fba89afeSmrg int *offsets; 159cdbfa18aSmrg char *data; 160cdbfa18aSmrg XPointer obdata; 161fba89afeSmrg} XvImage; 162fba89afeSmrg 163fba89afeSmrg id - XvImageFormatValues id. 164cdbfa18aSmrg 165fba89afeSmrg width, height - The width and height of the image in pixels. 166fba89afeSmrg 167fba89afeSmrg int data_size - The size of the data buffer in bytes. 168fba89afeSmrg 169fba89afeSmrg num_planes - The number of image planes. 170fba89afeSmrg 171fba89afeSmrg pitches - An array of size num_planes indicating the scanline pitch 172fba89afeSmrg in bytes. Each plane may have a different pitch. 173fba89afeSmrg 174fba89afeSmrg offsets - An array of size num_planes indicating the byte offset 175fba89afeSmrg from "data" to the start of each plane. 176fba89afeSmrg 177fba89afeSmrg data - A pointer to the start of the data buffer. 178fba89afeSmrg 179fba89afeSmrg obdata - A private field for holding SHM info. This field will be 180cdbfa18aSmrg set up by the client libraries so the programmer will 181fba89afeSmrg generally need not be concerned with this field. 182fba89afeSmrg 183fba89afeSmrgXvImage * XvCreateImage ( 184fba89afeSmrg Display *display, 185fba89afeSmrg XvPortID port, 186fba89afeSmrg int id, 187fba89afeSmrg char *data, 188cdbfa18aSmrg int width, 189cdbfa18aSmrg int height 190fba89afeSmrg); 191fba89afeSmrg 192fba89afeSmrg display - Specifies the connection to the Xserver. 193fba89afeSmrg port - Specifies the port the XvImage will be used with. 194fba89afeSmrg id - Specifies the format of the image to be created by 195fba89afeSmrg the XvImageFormatValues id. 196fba89afeSmrg data - Specifies the image data. 197fba89afeSmrg width 198fba89afeSmrg height - Specifies the desired width and height of the image. 199fba89afeSmrg 200fba89afeSmrg This function is similar to XCreateImage. The library will 201fba89afeSmrgallocate the XvImage structure and fill out all fields except for 202fba89afeSmrg"data". Width and height may be enlarged in some YUV formats. 203fba89afeSmrgThe size of the data buffer that needs to be allocated will be 204cdbfa18aSmrggive in the "data_size" field in the XvImage. Image data is 205fba89afeSmrgnot allocated by this function. The client may pass a pointer 206fba89afeSmrgto the preallocated memory as "data" or may allocate the memory 207cdbfa18aSmrgand fill in the XvImage structure's data field after the 208fba89afeSmrg"data_size" field has been filled out by the server. The XvImage 209fba89afeSmrgstructure may be freed by XFree(); 210fba89afeSmrg 211fba89afeSmrg 212fba89afeSmrgXvImage * XvShmCreateImage ( 213fba89afeSmrg Display *display, 214fba89afeSmrg XvPortID port, 215fba89afeSmrg int id, 216fba89afeSmrg char* data, 217cdbfa18aSmrg int width, 218fba89afeSmrg int height, 219fba89afeSmrg XShmSegmentInfo *shminfo 220fba89afeSmrg); 221fba89afeSmrg 222fba89afeSmrg This function is similar to XShmCreateImage. The library will 223fba89afeSmrgallocate the XvImage structure and fill out all fields except for 224fba89afeSmrg"data". Width and height may be enlarged in some YUV formats. 225fba89afeSmrgThe size of the data buffer that needs to be allocated will be 226cdbfa18aSmrggive in the "data_size" field in the XvImage. Image data is 227fba89afeSmrgnot allocated by this function. The client may pass a pointer 228fba89afeSmrgto the preallocated memory as "data" or may allocate the memory 229cdbfa18aSmrgand fill in the XvImage structure's data field after the 230fba89afeSmrg"data_size" field has been filled out by the server. The XvImage 231fba89afeSmrgstructure may be freed by XFree(); 232fba89afeSmrg 233fba89afeSmrg 234fba89afeSmrgXvPutImage ( 235fba89afeSmrg Display *display, 236fba89afeSmrg XvPortID id, 237fba89afeSmrg Drawable d, 238fba89afeSmrg GC gc, 239fba89afeSmrg XvImage *image, 240fba89afeSmrg int src_x, 241fba89afeSmrg int src_y, 242fba89afeSmrg unsigned int src_w, 243fba89afeSmrg unsigned int src_h, 244cdbfa18aSmrg int dest_x, 245fba89afeSmrg int dest_y, 246fba89afeSmrg unsigned int dest_w, 247fba89afeSmrg unsigned int dest_h, 248fba89afeSmrg); 249fba89afeSmrg 250fba89afeSmrgXvShmPutImage ( 251fba89afeSmrg Display *display, 252fba89afeSmrg XvPortID id, 253fba89afeSmrg Drawable d, 254fba89afeSmrg GC gc, 255fba89afeSmrg XvImage *image, 256fba89afeSmrg int src_x, 257fba89afeSmrg int src_y, 258fba89afeSmrg unsigned int src_w, 259fba89afeSmrg unsigned int src_h, 260cdbfa18aSmrg int dest_x, 261fba89afeSmrg int dest_y, 262fba89afeSmrg unsigned int dest_w, 263fba89afeSmrg unsigned int dest_h, 264fba89afeSmrg Bool send_event 265fba89afeSmrg); 266fba89afeSmrg 267fba89afeSmrg display - The connection to the X-Server. 268fba89afeSmrg 269fba89afeSmrg id - The port id of a port on an XvImage capable adaptor. 270fba89afeSmrg 271fba89afeSmrg d - The target drawable. 272cdbfa18aSmrg 273fba89afeSmrg gc - the graphics context specifying the clip mask to use, if any. 274fba89afeSmrg 275fba89afeSmrg image - A pointer to the XvImage to be displayed. 276fba89afeSmrg 277fba89afeSmrg src_? - The portion of the XvImage to be displayed. 278cdbfa18aSmrg 279fba89afeSmrg dest_? - The portion of the destination drawable to be filled by the image. 280fba89afeSmrg 281fba89afeSmrg send_event - Indicates whether or not an XShmCompletionEvent should be 282fba89afeSmrg sent. If sent, the event's major_code and minor_code 283fba89afeSmrg fields will indicate the Xv extension's major code and 284fba89afeSmrg XvShmPutImage's minor code. 285fba89afeSmrg 286fba89afeSmrgShared memory segments are attached/detached with XShmAttach/Detach. 287fba89afeSmrg 288fba89afeSmrg 289fba89afeSmrgSome of the possible Errors: 290fba89afeSmrg 291fba89afeSmrg BadDrawable - The specified drawable does not exist. 292fba89afeSmrg BadContext - The specified GC does not exist. 293fba89afeSmrg BadMatch - Incompatible arguments such as a port that isn't capable 294fba89afeSmrg of displaying XvImages. 295fba89afeSmrg XvBadPort - The specified port does not exist. 296cdbfa18aSmrg BadAlloc - The server was unable to allocate resources required 297fba89afeSmrg to complete the operation. 298cdbfa18aSmrg BadValue - Some numeric value falls outside the range of the 299fba89afeSmrg values accepted by the request. 300fba89afeSmrg BadShmSegCode - An invalid shared memory segment. 301