19f606849Smrg/***********************************************************
29f606849SmrgCopyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
39f606849Smrgand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
49f606849Smrg
59f606849Smrg                        All Rights Reserved
69f606849Smrg
7cdbfa18aSmrgPermission to use, copy, modify, and distribute this software and its
8cdbfa18aSmrgdocumentation for any purpose and without fee is hereby granted,
99f606849Smrgprovided that the above copyright notice appear in all copies and that
10cdbfa18aSmrgboth that copyright notice and this permission notice appear in
119f606849Smrgsupporting documentation, and that the names of Digital or MIT not be
129f606849Smrgused in advertising or publicity pertaining to distribution of the
13cdbfa18aSmrgsoftware without specific, written prior permission.
149f606849Smrg
159f606849SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
169f606849SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
179f606849SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
189f606849SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
199f606849SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
209f606849SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
219f606849SmrgSOFTWARE.
229f606849Smrg
239f606849Smrg******************************************************************/
249f606849Smrg
259f606849Smrg#ifndef XVLIB_H
269f606849Smrg#define XVLIB_H
279f606849Smrg/*
28cdbfa18aSmrg** File:
299f606849Smrg**
309f606849Smrg**   Xvlib.h --- Xv library public header file
319f606849Smrg**
32cdbfa18aSmrg** Author:
339f606849Smrg**
349f606849Smrg**   David Carver (Digital Workstation Engineering/Project Athena)
359f606849Smrg**
369f606849Smrg** Revisions:
379f606849Smrg**
389f606849Smrg**   26.06.91 Carver
399f606849Smrg**     - changed XvFreeAdaptors to XvFreeAdaptorInfo
409f606849Smrg**     - changed XvFreeEncodings to XvFreeEncodingInfo
419f606849Smrg**
429f606849Smrg**   11.06.91 Carver
439f606849Smrg**     - changed SetPortControl to SetPortAttribute
449f606849Smrg**     - changed GetPortControl to GetPortAttribute
459f606849Smrg**     - changed QueryBestSize
469f606849Smrg**
479f606849Smrg**   05.15.91 Carver
489f606849Smrg**     - version 2.0 upgrade
499f606849Smrg**
509f606849Smrg**   01.24.91 Carver
519f606849Smrg**     - version 1.4 upgrade
529f606849Smrg**
539f606849Smrg*/
549f606849Smrg
559f606849Smrg#include <X11/Xfuncproto.h>
569f606849Smrg#include <X11/extensions/Xv.h>
57fba89afeSmrg#include <X11/extensions/XShm.h>
589f606849Smrg
599f606849Smrgtypedef struct {
60fef5d1ffSmrg    int numerator;
61fef5d1ffSmrg    int denominator;
629f606849Smrg} XvRational;
639f606849Smrg
649f606849Smrgtypedef struct {
65fef5d1ffSmrg    int flags;                  /* XvGettable, XvSettable */
66fef5d1ffSmrg    int min_value;
67fef5d1ffSmrg    int max_value;
68fef5d1ffSmrg    char *name;
699f606849Smrg} XvAttribute;
709f606849Smrg
719f606849Smrgtypedef struct {
72fef5d1ffSmrg    XvEncodingID encoding_id;
73fef5d1ffSmrg    char *name;
74fef5d1ffSmrg    unsigned long width;
75fef5d1ffSmrg    unsigned long height;
76fef5d1ffSmrg    XvRational rate;
77fef5d1ffSmrg    unsigned long num_encodings;
789f606849Smrg} XvEncodingInfo;
799f606849Smrg
809f606849Smrgtypedef struct {
81fef5d1ffSmrg    char depth;
82fef5d1ffSmrg    unsigned long visual_id;
839f606849Smrg} XvFormat;
849f606849Smrg
859f606849Smrgtypedef struct {
86fef5d1ffSmrg    XvPortID base_id;
87fef5d1ffSmrg    unsigned long num_ports;
88fef5d1ffSmrg    char type;
89fef5d1ffSmrg    char *name;
90fef5d1ffSmrg    unsigned long num_formats;
91fef5d1ffSmrg    XvFormat *formats;
92fef5d1ffSmrg    unsigned long num_adaptors;
939f606849Smrg} XvAdaptorInfo;
949f606849Smrg
959f606849Smrgtypedef struct {
96fef5d1ffSmrg    int type;
97fef5d1ffSmrg    unsigned long serial;       /* # of last request processed by server */
98fef5d1ffSmrg    Bool send_event;            /* true if this came from a SendEvent request */
99fef5d1ffSmrg    Display *display;           /* Display the event was read from */
100fef5d1ffSmrg    Drawable drawable;          /* drawable */
101fef5d1ffSmrg    unsigned long reason;       /* what generated this event */
102fef5d1ffSmrg    XvPortID port_id;           /* what port */
103fef5d1ffSmrg    Time time;                  /* milliseconds */
1049f606849Smrg} XvVideoNotifyEvent;
1059f606849Smrg
1069f606849Smrgtypedef struct {
107fef5d1ffSmrg    int type;
108fef5d1ffSmrg    unsigned long serial;       /* # of last request processed by server */
109fef5d1ffSmrg    Bool send_event;            /* true if this came from a SendEvent request */
110fef5d1ffSmrg    Display *display;           /* Display the event was read from */
111fef5d1ffSmrg    XvPortID port_id;           /* what port */
112fef5d1ffSmrg    Time time;                  /* milliseconds */
113fef5d1ffSmrg    Atom attribute;             /* atom that identifies attribute */
114fef5d1ffSmrg    long value;                 /* value of attribute */
1159f606849Smrg} XvPortNotifyEvent;
1169f606849Smrg
1179f606849Smrgtypedef union {
118fef5d1ffSmrg    int type;
119fef5d1ffSmrg    XvVideoNotifyEvent xvvideo;
120fef5d1ffSmrg    XvPortNotifyEvent xvport;
121fef5d1ffSmrg    long pad[24];
1229f606849Smrg} XvEvent;
1239f606849Smrg
1249f606849Smrgtypedef struct {
125fef5d1ffSmrg    int id;                     /* Unique descriptor for the format */
126fef5d1ffSmrg    int type;                   /* XvRGB, XvYUV */
127fef5d1ffSmrg    int byte_order;             /* LSBFirst, MSBFirst */
128fef5d1ffSmrg    char guid[16];              /* Globally Unique IDentifier */
129fef5d1ffSmrg    int bits_per_pixel;
130fef5d1ffSmrg    int format;                 /* XvPacked, XvPlanar */
131fef5d1ffSmrg    int num_planes;
132fef5d1ffSmrg
133fef5d1ffSmrg    /* for RGB formats only */
134fef5d1ffSmrg    int depth;
135fef5d1ffSmrg    unsigned int red_mask;
136fef5d1ffSmrg    unsigned int green_mask;
137fef5d1ffSmrg    unsigned int blue_mask;
138fef5d1ffSmrg
139fef5d1ffSmrg    /* for YUV formats only */
140fef5d1ffSmrg    unsigned int y_sample_bits;
141fef5d1ffSmrg    unsigned int u_sample_bits;
142fef5d1ffSmrg    unsigned int v_sample_bits;
143fef5d1ffSmrg    unsigned int horz_y_period;
144fef5d1ffSmrg    unsigned int horz_u_period;
145fef5d1ffSmrg    unsigned int horz_v_period;
146fef5d1ffSmrg    unsigned int vert_y_period;
147fef5d1ffSmrg    unsigned int vert_u_period;
148fef5d1ffSmrg    unsigned int vert_v_period;
149fef5d1ffSmrg    char component_order[32];   /* eg. UYVY */
150fef5d1ffSmrg    int scanline_order;         /* XvTopToBottom, XvBottomToTop */
151cdbfa18aSmrg} XvImageFormatValues;
1529f606849Smrg
1539f606849Smrgtypedef struct {
154fef5d1ffSmrg    int id;
155fef5d1ffSmrg    int width, height;
156fef5d1ffSmrg    int data_size;              /* bytes */
157fef5d1ffSmrg    int num_planes;
158fef5d1ffSmrg    int *pitches;               /* bytes */
159fef5d1ffSmrg    int *offsets;               /* bytes */
160fef5d1ffSmrg    char *data;
161fef5d1ffSmrg    XPointer obdata;
1629f606849Smrg} XvImage;
1639f606849Smrg
1649f606849Smrg_XFUNCPROTOBEGIN
1659f606849Smrg
1669f606849Smrgextern int XvQueryExtension(
167fef5d1ffSmrg    Display *                   /* display */,
168fef5d1ffSmrg    unsigned int *              /* p_version */,
169fef5d1ffSmrg    unsigned int *              /* p_revision */,
170fef5d1ffSmrg    unsigned int *              /* p_requestBase */,
171fef5d1ffSmrg    unsigned int *              /* p_eventBase */,
172fef5d1ffSmrg    unsigned int *              /* p_errorBase */
1739f606849Smrg);
1749f606849Smrg
1759f606849Smrgextern int XvQueryAdaptors(
176fef5d1ffSmrg    Display *                   /* display */,
177fef5d1ffSmrg    Window                      /* window */,
178fef5d1ffSmrg    unsigned int *              /* p_nAdaptors */,
179fef5d1ffSmrg    XvAdaptorInfo **            /* p_pAdaptors */
1809f606849Smrg);
1819f606849Smrg
1829f606849Smrgextern int XvQueryEncodings(
183fef5d1ffSmrg    Display *                   /* display */,
184fef5d1ffSmrg    XvPortID                    /* port */,
185fef5d1ffSmrg    unsigned int *              /* p_nEncoding */,
186fef5d1ffSmrg    XvEncodingInfo **           /* p_pEncoding */
1879f606849Smrg);
1889f606849Smrg
1899f606849Smrgextern int XvPutVideo(
190fef5d1ffSmrg    Display *                   /* display */,
191fef5d1ffSmrg    XvPortID                    /* port */,
192fef5d1ffSmrg    Drawable                    /* d */,
193fef5d1ffSmrg    GC                          /* gc */,
194fef5d1ffSmrg    int                         /* vx */,
195fef5d1ffSmrg    int                         /* vy */,
196fef5d1ffSmrg    unsigned int                /* vw */,
197fef5d1ffSmrg    unsigned int                /* vh */,
198fef5d1ffSmrg    int                         /* dx */,
199fef5d1ffSmrg    int                         /* dy */,
200fef5d1ffSmrg    unsigned int                /* dw */,
201fef5d1ffSmrg    unsigned int                /* dh */
2029f606849Smrg);
2039f606849Smrg
2049f606849Smrgextern int XvPutStill(
205fef5d1ffSmrg    Display *                   /* display */,
206fef5d1ffSmrg    XvPortID                    /* port */,
207fef5d1ffSmrg    Drawable                    /* d */,
208fef5d1ffSmrg    GC                          /* gc */,
209fef5d1ffSmrg    int                         /* vx */,
210fef5d1ffSmrg    int                         /* vy */,
211fef5d1ffSmrg    unsigned int                /* vw */,
212fef5d1ffSmrg    unsigned int                /* vh */,
213fef5d1ffSmrg    int                         /* dx */,
214fef5d1ffSmrg    int                         /* dy */,
215fef5d1ffSmrg    unsigned int                /* dw */,
216fef5d1ffSmrg    unsigned int                /* dh */
2179f606849Smrg);
2189f606849Smrg
2199f606849Smrgextern int XvGetVideo(
220fef5d1ffSmrg    Display *                   /* display */,
221fef5d1ffSmrg    XvPortID                    /* port */,
222fef5d1ffSmrg    Drawable                    /* d */,
223fef5d1ffSmrg    GC                          /* gc */,
224fef5d1ffSmrg    int                         /* vx */,
225fef5d1ffSmrg    int                         /* vy */,
226fef5d1ffSmrg    unsigned int                /* vw */,
227fef5d1ffSmrg    unsigned int                /* vh */,
228fef5d1ffSmrg    int                         /* dx */,
229fef5d1ffSmrg    int                         /* dy */,
230fef5d1ffSmrg    unsigned int                /* dw */,
231fef5d1ffSmrg    unsigned int                /* dh */
2329f606849Smrg);
2339f606849Smrg
2349f606849Smrgextern int XvGetStill(
235fef5d1ffSmrg    Display *                   /* display */,
236fef5d1ffSmrg    XvPortID                    /* port */,
237fef5d1ffSmrg    Drawable                    /* d */,
238fef5d1ffSmrg    GC                          /* gc */,
239fef5d1ffSmrg    int                         /* vx */,
240fef5d1ffSmrg    int                         /* vy */,
241fef5d1ffSmrg    unsigned int                /* vw */,
242fef5d1ffSmrg    unsigned int                /* vh */,
243fef5d1ffSmrg    int                         /* dx */,
244fef5d1ffSmrg    int                         /* dy */,
245fef5d1ffSmrg    unsigned int                /* dw */,
246fef5d1ffSmrg    unsigned int                /* dh */
2479f606849Smrg);
2489f606849Smrg
2499f606849Smrgextern int XvStopVideo(
250fef5d1ffSmrg    Display *                   /* display */,
251fef5d1ffSmrg    XvPortID                    /* port */,
252fef5d1ffSmrg    Drawable                    /* drawable */
2539f606849Smrg);
2549f606849Smrg
2559f606849Smrgextern int XvGrabPort(
256fef5d1ffSmrg    Display *                   /* display */,
257fef5d1ffSmrg    XvPortID                    /* port */,
258fef5d1ffSmrg    Time                        /* time */
2599f606849Smrg);
2609f606849Smrg
2619f606849Smrgextern int XvUngrabPort(
262fef5d1ffSmrg    Display *                   /* display */,
263fef5d1ffSmrg    XvPortID                    /* port */,
264fef5d1ffSmrg    Time                        /* time */
2659f606849Smrg);
2669f606849Smrg
2679f606849Smrgextern int XvSelectVideoNotify(
268fef5d1ffSmrg    Display *                   /* display */,
269fef5d1ffSmrg    Drawable                    /* drawable */,
270fef5d1ffSmrg    Bool                        /* onoff */
2719f606849Smrg);
2729f606849Smrg
2739f606849Smrgextern int XvSelectPortNotify(
274fef5d1ffSmrg    Display *                   /* display */,
275fef5d1ffSmrg    XvPortID                    /* port */,
276fef5d1ffSmrg    Bool                        /* onoff */
2779f606849Smrg);
2789f606849Smrg
2799f606849Smrgextern int XvSetPortAttribute(
280fef5d1ffSmrg    Display *                   /* display */,
281fef5d1ffSmrg    XvPortID                    /* port */,
282fef5d1ffSmrg    Atom                        /* attribute */,
283fef5d1ffSmrg    int                         /* value */
2849f606849Smrg);
2859f606849Smrg
2869f606849Smrgextern int XvGetPortAttribute(
287fef5d1ffSmrg    Display *                   /* display */,
288fef5d1ffSmrg    XvPortID                    /* port */,
289fef5d1ffSmrg    Atom                        /* attribute */,
290fef5d1ffSmrg    int *                       /* p_value */
2919f606849Smrg);
2929f606849Smrg
2939f606849Smrgextern int XvQueryBestSize(
294fef5d1ffSmrg    Display *                   /* display */,
295fef5d1ffSmrg    XvPortID                    /* port */,
296fef5d1ffSmrg    Bool                        /* motion */,
297fef5d1ffSmrg    unsigned int                /* vid_w */,
298fef5d1ffSmrg    unsigned int                /* vid_h */,
299fef5d1ffSmrg    unsigned int                /* drw_w */,
300fef5d1ffSmrg    unsigned int                /* drw_h */,
301fef5d1ffSmrg    unsigned int *              /* p_actual_width */,
302fef5d1ffSmrg    unsigned int *              /* p_actual_width */
3039f606849Smrg);
3049f606849Smrg
305fef5d1ffSmrgextern XvAttribute *XvQueryPortAttributes(
306fef5d1ffSmrg    Display *                   /* display */,
307fef5d1ffSmrg    XvPortID                    /* port */,
308fef5d1ffSmrg    int *                       /* number */
3099f606849Smrg);
3109f606849Smrg
3119f606849Smrg
3129f606849Smrgextern void XvFreeAdaptorInfo(
313fef5d1ffSmrg    XvAdaptorInfo *             /* adaptors */
3149f606849Smrg);
3159f606849Smrg
3169f606849Smrgextern void XvFreeEncodingInfo(
317fef5d1ffSmrg    XvEncodingInfo *            /* encodings */
3189f606849Smrg);
3199f606849Smrg
3209f606849Smrg
321fef5d1ffSmrgextern XvImageFormatValues *XvListImageFormats (
322fef5d1ffSmrg    Display     *display,
323fef5d1ffSmrg    XvPortID    port_id,
324fef5d1ffSmrg    int         *count_return
3259f606849Smrg);
3269f606849Smrg
327fef5d1ffSmrgextern XvImage *XvCreateImage (
328fef5d1ffSmrg    Display *display,
329fef5d1ffSmrg    XvPortID port,
330fef5d1ffSmrg    int id,
331fef5d1ffSmrg    char *data,
332fef5d1ffSmrg    int width,
333fef5d1ffSmrg    int height
3349f606849Smrg);
3359f606849Smrg
3369f606849Smrgextern int XvPutImage (
337fef5d1ffSmrg    Display *display,
338fef5d1ffSmrg    XvPortID id,
339fef5d1ffSmrg    Drawable d,
340fef5d1ffSmrg    GC gc,
341fef5d1ffSmrg    XvImage *image,
342fef5d1ffSmrg    int src_x,
343fef5d1ffSmrg    int src_y,
344fef5d1ffSmrg    unsigned int src_w,
345fef5d1ffSmrg    unsigned int src_h,
346fef5d1ffSmrg    int dest_x,
347fef5d1ffSmrg    int dest_y,
348fef5d1ffSmrg    unsigned int dest_w,
349fef5d1ffSmrg    unsigned int dest_h
3509f606849Smrg);
3519f606849Smrg
3529f606849Smrgextern int XvShmPutImage (
353fef5d1ffSmrg    Display *display,
354fef5d1ffSmrg    XvPortID id,
355fef5d1ffSmrg    Drawable d,
356fef5d1ffSmrg    GC gc,
357fef5d1ffSmrg    XvImage *image,
358fef5d1ffSmrg    int src_x,
359fef5d1ffSmrg    int src_y,
360fef5d1ffSmrg    unsigned int src_w,
361fef5d1ffSmrg    unsigned int src_h,
362fef5d1ffSmrg    int dest_x,
363fef5d1ffSmrg    int dest_y,
364fef5d1ffSmrg    unsigned int dest_w,
365fef5d1ffSmrg    unsigned int dest_h,
366fef5d1ffSmrg    Bool send_event
3679f606849Smrg);
3689f606849Smrg
369fef5d1ffSmrgextern XvImage *XvShmCreateImage (
370fef5d1ffSmrg    Display *display,
371fef5d1ffSmrg    XvPortID port,
372fef5d1ffSmrg    int id,
373fef5d1ffSmrg    char *data,
374fef5d1ffSmrg    int width,
375fef5d1ffSmrg    int height,
376fef5d1ffSmrg    XShmSegmentInfo *shminfo
3779f606849Smrg);
3789f606849Smrg
3799f606849Smrg
3809f606849Smrg_XFUNCPROTOEND
3819f606849Smrg
3829f606849Smrg#endif /* XVLIB_H */
383