Home | History | Annotate | Download | only in extensions
      1 /***********************************************************
      2 Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
      3 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
      4 
      5                         All Rights Reserved
      6 
      7 Permission to use, copy, modify, and distribute this software and its
      8 documentation for any purpose and without fee is hereby granted,
      9 provided that the above copyright notice appear in all copies and that
     10 both that copyright notice and this permission notice appear in
     11 supporting documentation, and that the names of Digital or MIT not be
     12 used in advertising or publicity pertaining to distribution of the
     13 software without specific, written prior permission.
     14 
     15 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
     16 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
     17 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
     18 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
     19 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
     20 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
     21 SOFTWARE.
     22 
     23 ******************************************************************/
     24 /* $XFree86: xc/include/extensions/Xvlib.h,v 1.3 1999/12/11 19:28:48 mvojkovi Exp $ */
     25 
     26 #ifndef XVLIB_H
     27 #define XVLIB_H
     28 /*
     29 ** File:
     30 **
     31 **   Xvlib.h --- Xv library public header file
     32 **
     33 ** Author:
     34 **
     35 **   David Carver (Digital Workstation Engineering/Project Athena)
     36 **
     37 ** Revisions:
     38 **
     39 **   26.06.91 Carver
     40 **     - changed XvFreeAdaptors to XvFreeAdaptorInfo
     41 **     - changed XvFreeEncodings to XvFreeEncodingInfo
     42 **
     43 **   11.06.91 Carver
     44 **     - changed SetPortControl to SetPortAttribute
     45 **     - changed GetPortControl to GetPortAttribute
     46 **     - changed QueryBestSize
     47 **
     48 **   05.15.91 Carver
     49 **     - version 2.0 upgrade
     50 **
     51 **   01.24.91 Carver
     52 **     - version 1.4 upgrade
     53 **
     54 */
     55 
     56 #include <X11/Xfuncproto.h>
     57 #include "Xv.h"
     58 #include "SDL_name.h"
     59 
     60 typedef struct {
     61   int numerator;
     62   int denominator;
     63 } SDL_NAME(XvRational);
     64 
     65 typedef struct {
     66   int flags;	/* XvGettable, XvSettable */
     67   int min_value;
     68   int max_value;
     69   char *name;
     70 } SDL_NAME(XvAttribute);
     71 
     72 typedef struct {
     73   XvEncodingID encoding_id;
     74   char *name;
     75   unsigned long width;
     76   unsigned long height;
     77   SDL_NAME(XvRational) rate;
     78   unsigned long num_encodings;
     79 } SDL_NAME(XvEncodingInfo);
     80 
     81 typedef struct {
     82   char depth;
     83   unsigned long visual_id;
     84 } SDL_NAME(XvFormat);
     85 
     86 typedef struct {
     87   XvPortID base_id;
     88   unsigned long num_ports;
     89   char type;
     90   char *name;
     91   unsigned long num_formats;
     92   SDL_NAME(XvFormat) *formats;
     93   unsigned long num_adaptors;
     94 } SDL_NAME(XvAdaptorInfo);
     95 
     96 typedef struct {
     97   int type;
     98   unsigned long serial;	   /* # of last request processed by server */
     99   Bool send_event;	   /* true if this came from a SendEvent request */
    100   Display *display;	   /* Display the event was read from */
    101   Drawable drawable;       /* drawable */
    102   unsigned long reason;    /* what generated this event */
    103   XvPortID port_id;        /* what port */
    104   Time time;		   /* milliseconds */
    105 } SDL_NAME(XvVideoNotifyEvent);
    106 
    107 typedef struct {
    108   int type;
    109   unsigned long serial;	   /* # of last request processed by server */
    110   Bool send_event;	   /* true if this came from a SendEvent request */
    111   Display *display;	   /* Display the event was read from */
    112   XvPortID port_id;        /* what port */
    113   Time time;		   /* milliseconds */
    114   Atom attribute;           /* atom that identifies attribute */
    115   long value;              /* value of attribute */
    116 } SDL_NAME(XvPortNotifyEvent);
    117 
    118 typedef union {
    119   int type;
    120   SDL_NAME(XvVideoNotifyEvent) xvvideo;
    121   SDL_NAME(XvPortNotifyEvent) xvport;
    122   long pad[24];
    123 } SDL_NAME(XvEvent);
    124 
    125 typedef struct {
    126   int id;                      /* Unique descriptor for the format */
    127   int type;                    /* XvRGB, XvYUV */
    128   int byte_order;              /* LSBFirst, MSBFirst */
    129   char guid[16];               /* Globally Unique IDentifier */
    130   int bits_per_pixel;
    131   int format;                  /* XvPacked, XvPlanar */
    132   int num_planes;
    133 
    134   /* for RGB formats only */
    135   int depth;
    136   unsigned int red_mask;
    137   unsigned int green_mask;
    138   unsigned int blue_mask;
    139 
    140   /* for YUV formats only */
    141   unsigned int y_sample_bits;
    142   unsigned int u_sample_bits;
    143   unsigned int v_sample_bits;
    144   unsigned int horz_y_period;
    145   unsigned int horz_u_period;
    146   unsigned int horz_v_period;
    147   unsigned int vert_y_period;
    148   unsigned int vert_u_period;
    149   unsigned int vert_v_period;
    150   char component_order[32];    /* eg. UYVY */
    151   int scanline_order;          /* XvTopToBottom, XvBottomToTop */
    152 } SDL_NAME(XvImageFormatValues);
    153 
    154 typedef struct {
    155   int id;
    156   int width, height;
    157   int data_size;              /* bytes */
    158   int num_planes;
    159   int *pitches;               /* bytes */
    160   int *offsets;               /* bytes */
    161   char *data;
    162   XPointer obdata;
    163 } SDL_NAME(XvImage);
    164 
    165 _XFUNCPROTOBEGIN
    166 
    167 extern int SDL_NAME(XvQueryExtension)(
    168 #if NeedFunctionPrototypes
    169   Display*                 /* display */,
    170   unsigned int*            /* p_version */,
    171   unsigned int*            /* p_revision */,
    172   unsigned int*            /* p_requestBase */,
    173   unsigned int*            /* p_eventBase */,
    174   unsigned int*            /* p_errorBase */
    175 #endif
    176 );
    177 
    178 extern int SDL_NAME(XvQueryAdaptors)(
    179 #if NeedFunctionPrototypes
    180   Display*                 /* display */,
    181   Window                   /* window */,
    182   unsigned int*            /* p_nAdaptors */,
    183   SDL_NAME(XvAdaptorInfo)**          /* p_pAdaptors */
    184 #endif
    185 );
    186 
    187 extern int SDL_NAME(XvQueryEncodings)(
    188 #if NeedFunctionPrototypes
    189   Display*                 /* display */,
    190   XvPortID                 /* port */,
    191   unsigned int*            /* p_nEncoding */,
    192   SDL_NAME(XvEncodingInfo)**         /* p_pEncoding */
    193 #endif
    194 );
    195 
    196 extern int SDL_NAME(XvPutVideo)(
    197 #if NeedFunctionPrototypes
    198   Display*                 /* display */,
    199   XvPortID                 /* port */,
    200   Drawable                 /* d */,
    201   GC                       /* gc */,
    202   int                      /* vx */,
    203   int                      /* vy */,
    204   unsigned int             /* vw */,
    205   unsigned int             /* vh */,
    206   int                      /* dx */,
    207   int                      /* dy */,
    208   unsigned int             /* dw */,
    209   unsigned int             /* dh */
    210 #endif
    211 );
    212 
    213 extern int SDL_NAME(XvPutStill)(
    214 #if NeedFunctionPrototypes
    215   Display*                 /* display */,
    216   XvPortID                 /* port */,
    217   Drawable                 /* d */,
    218   GC                       /* gc */,
    219   int                      /* vx */,
    220   int                      /* vy */,
    221   unsigned int             /* vw */,
    222   unsigned int             /* vh */,
    223   int                      /* dx */,
    224   int                      /* dy */,
    225   unsigned int             /* dw */,
    226   unsigned int             /* dh */
    227 #endif
    228 );
    229 
    230 extern int SDL_NAME(XvGetVideo)(
    231 #if NeedFunctionPrototypes
    232   Display*                 /* display */,
    233   XvPortID                 /* port */,
    234   Drawable                 /* d */,
    235   GC                       /* gc */,
    236   int                      /* vx */,
    237   int                      /* vy */,
    238   unsigned int             /* vw */,
    239   unsigned int             /* vh */,
    240   int                      /* dx */,
    241   int                      /* dy */,
    242   unsigned int             /* dw */,
    243   unsigned int             /* dh */
    244 #endif
    245 );
    246 
    247 extern int SDL_NAME(XvGetStill)(
    248 #if NeedFunctionPrototypes
    249   Display*                 /* display */,
    250   XvPortID                 /* port */,
    251   Drawable                 /* d */,
    252   GC                       /* gc */,
    253   int                      /* vx */,
    254   int                      /* vy */,
    255   unsigned int             /* vw */,
    256   unsigned int             /* vh */,
    257   int                      /* dx */,
    258   int                      /* dy */,
    259   unsigned int             /* dw */,
    260   unsigned int             /* dh */
    261 #endif
    262 );
    263 
    264 extern int SDL_NAME(XvStopVideo)(
    265 #if NeedFunctionPrototypes
    266   Display*                /* display */,
    267   XvPortID                /* port */,
    268   Drawable                /* drawable */
    269 #endif
    270 );
    271 
    272 extern int SDL_NAME(XvGrabPort)(
    273 #if NeedFunctionPrototypes
    274   Display*                /* display */,
    275   XvPortID                /* port */,
    276   Time                    /* time */
    277 #endif
    278 );
    279 
    280 extern int SDL_NAME(XvUngrabPort)(
    281 #if NeedFunctionPrototypes
    282   Display*                /* display */,
    283   XvPortID                /* port */,
    284   Time                    /* time */
    285 #endif
    286 );
    287 
    288 extern int SDL_NAME(XvSelectVideoNotify)(
    289 #if NeedFunctionPrototypes
    290   Display*                /* display */,
    291   Drawable                /* drawable */,
    292   Bool                    /* onoff */
    293 #endif
    294 );
    295 
    296 extern int SDL_NAME(XvSelectPortNotify)(
    297 #if NeedFunctionPrototypes
    298   Display*                /* display */,
    299   XvPortID                /* port */,
    300   Bool                    /* onoff */
    301 #endif
    302 );
    303 
    304 extern int SDL_NAME(XvSetPortAttribute)(
    305 #if NeedFunctionPrototypes
    306   Display*                /* display */,
    307   XvPortID                /* port */,
    308   Atom                    /* attribute */,
    309   int                     /* value */
    310 #endif
    311 );
    312 
    313 extern int SDL_NAME(XvGetPortAttribute)(
    314 #if NeedFunctionPrototypes
    315   Display*                /* display */,
    316   XvPortID                /* port */,
    317   Atom                    /* attribute */,
    318   int*                    /* p_value */
    319 #endif
    320 );
    321 
    322 extern int SDL_NAME(XvQueryBestSize)(
    323 #if NeedFunctionPrototypes
    324   Display*                /* display */,
    325   XvPortID                /* port */,
    326   Bool                    /* motion */,
    327   unsigned int            /* vid_w */,
    328   unsigned int            /* vid_h */,
    329   unsigned int            /* drw_w */,
    330   unsigned int            /* drw_h */,
    331   unsigned int*           /* p_actual_width */,
    332   unsigned int*           /* p_actual_width */
    333 #endif
    334 );
    335 
    336 extern SDL_NAME(XvAttribute)* SDL_NAME(XvQueryPortAttributes)(
    337 #if NeedFunctionPrototypes
    338   Display*                /* display */,
    339   XvPortID                /* port */,
    340   int*                    /* number */
    341 #endif
    342 );
    343 
    344 
    345 extern void SDL_NAME(XvFreeAdaptorInfo)(
    346 #if NeedFunctionPrototypes
    347   SDL_NAME(XvAdaptorInfo)*          /* adaptors */
    348 #endif
    349 );
    350 
    351 extern void SDL_NAME(XvFreeEncodingInfo)(
    352 #if NeedFunctionPrototypes
    353   SDL_NAME(XvEncodingInfo)*         /* encodings */
    354 #endif
    355 );
    356 
    357 
    358 extern SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) (
    359 #if NeedFunctionPrototypes
    360    Display 	*display,
    361    XvPortID 	port_id,
    362    int 		*count_return
    363 #endif
    364 );
    365 
    366 extern SDL_NAME(XvImage) * SDL_NAME(XvCreateImage) (
    367 #if NeedFunctionPrototypes
    368    Display *display,
    369    XvPortID port,
    370    int id,
    371    char *data,
    372    int width,
    373    int height
    374 #endif
    375 );
    376 
    377 extern int SDL_NAME(XvPutImage) (
    378 #if NeedFunctionPrototypes
    379   Display *display,
    380    XvPortID id,
    381    Drawable d,
    382    GC gc,
    383    SDL_NAME(XvImage) *image,
    384    int src_x,
    385    int src_y,
    386    unsigned int src_w,
    387    unsigned int src_h,
    388    int dest_x,
    389    int dest_y,
    390    unsigned int dest_w,
    391    unsigned int dest_h
    392 #endif
    393 );
    394 
    395 extern int SDL_NAME(XvShmPutImage) (
    396 #if NeedFunctionPrototypes
    397    Display *display,
    398    XvPortID id,
    399    Drawable d,
    400    GC gc,
    401    SDL_NAME(XvImage) *image,
    402    int src_x,
    403    int src_y,
    404    unsigned int src_w,
    405    unsigned int src_h,
    406    int dest_x,
    407    int dest_y,
    408    unsigned int dest_w,
    409    unsigned int dest_h,
    410    Bool send_event
    411 #endif
    412 );
    413 
    414 #ifdef _XSHM_H_
    415 
    416 extern SDL_NAME(XvImage) * SDL_NAME(XvShmCreateImage) (
    417 #if NeedFunctionPrototypes
    418    Display *display,
    419    XvPortID port,
    420    int id,
    421    char* data,
    422    int width,
    423    int height,
    424    XShmSegmentInfo *shminfo
    425 #endif
    426 );
    427 
    428 #endif
    429 
    430 
    431 _XFUNCPROTOEND
    432 
    433 #endif /* XVLIB_H */
    434