From 76c7e8371b711de7d00736588ff766eb763e829c Mon Sep 17 00:00:00 2001 From: nick Date: Sat, 5 Jan 2002 10:13:25 +0000 Subject: preliminary version git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3992 b3059339-0415-0410-9bf9-f77b7e298cf2 --- vidix/Makefile | 39 ++++++++++ vidix/README | 5 ++ vidix/fourcc.h | 66 +++++++++++++++++ vidix/vidix.h | 215 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ vidix/vidixlib.c | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++++ vidix/vidixlib.h | 78 ++++++++++++++++++++ 6 files changed, 610 insertions(+) create mode 100644 vidix/Makefile create mode 100644 vidix/README create mode 100644 vidix/fourcc.h create mode 100644 vidix/vidix.h create mode 100644 vidix/vidixlib.c create mode 100644 vidix/vidixlib.h (limited to 'vidix') diff --git a/vidix/Makefile b/vidix/Makefile new file mode 100644 index 0000000000..0e964faa90 --- /dev/null +++ b/vidix/Makefile @@ -0,0 +1,39 @@ + +LIBNAME = libvidix.a + +include ../config.mak + +SRCS = vidixlib.c +OBJS = $(SRCS:.c=.o) + +CFLAGS = $(OPTFLAGS) -W -Wall + +.SUFFIXES: .c .o + +# .PHONY: all clean + +.c.o: + $(CC) -c $(CFLAGS) -o $@ $< + +$(LIBNAME): $(OBJS) + $(AR) r $(LIBNAME) $(OBJS) + +all: $(LIBNAME) + +clean: + rm -f *.o *.a *~ + +distclean: + rm -f test *.o *.a *~ .depend + +dep: depend + +depend: + $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend + +# +# include dependency files if they exist +# +ifneq ($(wildcard .depend),) +include .depend +endif diff --git a/vidix/README b/vidix/README new file mode 100644 index 0000000000..04e3b9e16f --- /dev/null +++ b/vidix/README @@ -0,0 +1,5 @@ +VIDIX - Video Interface for *niX. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +This library was designed and introduced as interface to userspace drivers +to provide DGA everywhere where it's possible (unline X11). +I hope that these drivers will be portable same as X11 (not only on *nix). diff --git a/vidix/fourcc.h b/vidix/fourcc.h new file mode 100644 index 0000000000..9b15245247 --- /dev/null +++ b/vidix/fourcc.h @@ -0,0 +1,66 @@ +/* + * fourcc.h + * This file is part of VIDIX + * Copyright 2002 Nick Kurshev + * Licence: GPL + * This interface is based on v4l2, fbvid.h, mga_vid.h projects + * and personally my ideas. +*/ +#ifndef FOURCC_H +#define FOURCC_H + +/* Four-character-code (FOURCC) */ +#define vid_fourcc(a,b,c,d)\ + (((unsigned)(a)<<0)|((unsigned)(b)<<8)|((unsigned)(c)<<16)|((unsigned)(d)<<24)) + +/* RGB fourcc */ +#define IMGFMT_RGB332 vid_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ +#define IMGFMT_RGB555 vid_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ +#define IMGFMT_RGB565 vid_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ +#define IMGFMT_RGB555X vid_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */ +#define IMGFMT_RGB565X vid_fourcc('R','G','B','R') /* 16 RGB-5-6-5 BE */ +#define IMGFMT_BGR15 vid_fourcc('B','G','R',15) /* 15 BGR-5-5-5 */ +#define IMGFMT_RGB15 vid_fourcc('R','G','B',15) /* 15 RGB-5-5-5 */ +#define IMGFMT_BGR16 vid_fourcc('B','G','R',16) /* 32 BGR-5-6-5 */ +#define IMGFMT_RGB16 vid_fourcc('R','G','B',16) /* 32 RGB-5-6-5 */ +#define IMGFMT_BGR24 vid_fourcc('B','G','R',24) /* 24 BGR-8-8-8 */ +#define IMGFMT_RGB24 vid_fourcc('R','G','B',24) /* 24 RGB-8-8-8 */ +#define IMGFMT_BGR32 vid_fourcc('B','G','R',32) /* 32 BGR-8-8-8-8 */ +#define IMGFMT_RGB32 vid_fourcc('R','G','B',32) /* 32 RGB-8-8-8-8 */ + +/* Planar YUV Formats */ +#define IMGFMT_YVU9 vid_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ +#define IMGFMT_IF09 vid_fourcc('I','F','0','9') /* 9.5 YUV 4:1:0 */ +#define IMGFMT_YV12 vid_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ +#define IMGFMT_I420 vid_fourcc('I','4','2','0') /* 12 YUV 4:2:0 */ +#define IMGFMT_IYUV vid_fourcc('I','Y','U','V') /* 12 YUV 4:2:0 */ +#define IMGFMT_CLPL vid_fourcc('C','L','P','L') /* 12 */ +#define IMGFMT_Y800 vid_fourcc('Y','8','0','0') /* 8 Y Grayscale */ +#define IMGFMT_Y8 vid_fourcc('Y','8',' ',' ') /* 8 Y Grayscale */ + +/* Packed YUV Formats */ +#define IMGFMT_IUYV vid_fourcc('I','U','Y','V') /* 16 line order {0,2,4,...1,3,5} */ +#define IMGFMT_IY41 vid_fourcc('I','Y','4','1') /* 12 line order {0,2,4,...1,3,5} */ +#define IMGFMT_IYU1 vid_fourcc('I','Y','U','1') /* 12 IEEE 1394 Digital Camera */ +#define IMGFMT_IYU2 vid_fourcc('I','Y','U','2') /* 24 IEEE 1394 Digital Camera */ +#define IMGFMT_UYVY vid_fourcc('U','Y','V','Y') /* 16 UYVY 4:2:2 */ +#define IMGFMT_UYNV vid_fourcc('U','Y','N','V') /* 16 UYVY 4:2:2 */ +#define IMGFMT_cyuv vid_fourcc('c','y','u','v') /* 16 */ +#define IMGFMT_Y422 vid_fourcc('Y','4','2','2') /* 16 UYVY 4:2:2 */ +#define IMGFMT_YUY2 vid_fourcc('Y','U','Y','2') /* 16 YUYV 4:2:2 */ +#define IMGFMT_YUNV vid_fourcc('Y','U','N','V') /* 16 YUYV 4:2:2 */ +#define IMGFMT_YVYU vid_fourcc('Y','V','Y','U') /* 16 YVYU 4:2:2 */ +#define IMGFMT_Y41P vid_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */ +#define IMGFMT_Y211 vid_fourcc('Y','2','1','1') /* 8.5 YUV 2:1:1 */ +#define IMGFMT_Y41T vid_fourcc('Y','4','1','T') /* 12 YUV 4:1:1 */ +#define IMGFMT_Y42T vid_fourcc('Y','4','2','T') /* 16 UYVU 4:2:2 */ +#define IMGFMT_V422 vid_fourcc('V','4','2','2') /* 16 YUY2 4:2:2 */ +#define IMGFMT_V655 vid_fourcc('V','6','5','5') /* 16 YUV 4:2:2 */ +#define IMGFMT_CLJR vid_fourcc('C','L','J','R') /* 7.9 YUV 4:1:1 */ +#define IMGFMT_YUVP vid_fourcc('Y','U','V','P') /* 24 Y0U0Y1V0 */ +#define IMGFMT_UYVP vid_fourcc('U','Y','V','P') /* 24 U0Y0V0Y1 */ + +/* Vendor-specific formats */ +#define IMGFMT_WNVA vid_fourcc('W','N','V','A') /* Winnov hw compress */ + +#endif diff --git a/vidix/vidix.h b/vidix/vidix.h new file mode 100644 index 0000000000..0111c0e922 --- /dev/null +++ b/vidix/vidix.h @@ -0,0 +1,215 @@ +/* + * vidix.h + * VIDIX - VIDeo Interface for *niX + * This interface is introduced as universal one to MPEG decoder, + * BES == Back End Scaler and YUV2RGB hw accelerators. + * In the future it may be expanded up to capturing and audio things. + * Main goal of this this interface imlpementation is providing DGA + * everywhere where it's possible (unlike X11 and other). + * Copyright 2002 Nick Kurshev + * Licence: GPL + * This interface is based on v4l2, fbvid.h, mga_vid.h projects + * and personally my ideas. + * NOTE: This interface is introduces as driver interface. + * Don't use it for APP. +*/ +#ifndef VIDIX_H +#define VIDIX_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define VIDIX_VERSION 100 + + /* returns driver version */ +extern unsigned vixGetVersion( void ); + + /* Probes video hw. Returns 0 if ok else errno */ +extern int vixProbe( void ); + /* Initializes driver. Returns 0 if ok else errno */ +extern int vixInit( void ); + /* Destroys driver */ +extern void vixDestroy( void ); + +typedef struct vidix_capability_s +{ + char name[32]; /* Driver name */ +#define TYPE_OUTPUT 0x00000000 /* Is a video capture device */ +#define TYPE_CAPTURE 0x00000001 /* Is a CODEC device */ +#define TYPE_CODEC 0x00000002 /* Is a video output device */ +#define TYPE_FX 0x00000004 /* Is a video effects device */ + int type; /* Device type, see below */ + int inputs; /* Num video inputs */ + int outputs; /* Num video outputs */ + int in_audios; /* Num audio inputs */ + int out_audios; /* Num audio outputs */ + int maxwidth; + int maxheight; + int minwidth; + int minheight; + int maxframerate; /* -1 if unlimited */ +#define FLAG_NONE 0x00000000 /* No flags defined */ +#define FLAG_DMA 0x00000001 /* Card can use DMA */ +#define FLAG_UPSCALER 0x00000010 /* Card supports hw upscaling */ +#define FLAG_DOWNSCALER 0x00000020 /* Card supports hw downscaling */ +#define FLAG_SUBPIC 0x00001000 /* Card supports DVD subpictures */ + unsigned flags; /* Feature flags, see below */ + unsigned short vendor_id; + unsigned short device_id; + unsigned reserved[4]; +}vidix_capability_t; + + /* Should fill at least type before init. + Returns 0 if ok else errno */ +extern int vixGetCapability(vidix_capability_t *); + +typedef struct vidix_fourcc_s +{ + unsigned fourcc; +#define VID_DEPTH_NONE 0x0000 +#define VID_DEPTH_1BPP 0x0001 +#define VID_DEPTH_2BPP 0x0002 +#define VID_DEPTH_4BPP 0x0004 +#define VID_DEPTH_8BPP 0x0008 +#define VID_DEPTH_12BPP 0x0010 +#define VID_DEPTH_15BPP 0x0020 +#define VID_DEPTH_16BPP 0x0040 +#define VID_DEPTH_24BPP 0x0080 +#define VID_DEPTH_32BPP 0x0100 + unsigned depth; +#define VID_CAP_NONE 0x0000 +#define VID_CAP_EXPAND 0x0001 /* if overlay can be bigger than source */ +#define VID_CAP_SHRINK 0x0002 /* if overlay can be smaller than source */ +#define VID_CAP_BLEND 0x0004 /* if overlay can be blended with framebuffer */ +#define VID_CAP_COLORKEY 0x0008 /* if overlay can be restricted to a colorkey */ +#define VID_CAP_ALPHAKEY 0x0010 /* if overlay can be restricted to an alpha channel */ +#define VID_CAP_COLORKEY_ISRANGE 0x0020 /* if the colorkey can be a range */ +#define VID_CAP_ALPHAKEY_ISRANGE 0x0040 /* if the alphakey can be a range */ +#define VID_CAP_COLORKEY_ISMAIN 0x0080 /* colorkey is checked against framebuffer */ +#define VID_CAP_COLORKEY_ISOVERLAY 0x0100 /* colorkey is checked against overlay */ +#define VID_CAP_ALPHAKEY_ISMAIN 0x0200 /* alphakey is checked against framebuffer */ +#define VID_CAP_ALPHAKEY_ISOVERLAY 0x0400 /* alphakey is checked against overlay */ + unsigned flags; +}vidix_fourcc_t; + + /* Returns 0 if ok else errno */ +extern int vixQueryFourcc(vidix_fourcc_t *); + +typedef struct vidix_yuv_s +{ + unsigned y,u,v; +}vidix_yuv_t; + +typedef struct vidix_rect_s +{ + unsigned x,y,w,h; /* in pixels */ + vidix_yuv_t pitch; /* bytes per line */ +}vidix_rect_t; + +typedef struct vidix_color_key_s +{ +#define CKEY_FALSE 0 +#define CKEY_TRUE 1 +#define CKEY_EQ 2 +#define CKEY_NEQ 3 + unsigned op; /* defines logical operation */ + unsigned char red; + unsigned char green; + unsigned char blue; + unsigned char reserved; +}vidix_ckey_t; + +typedef struct vidix_video_key_s +{ +#define VKEY_FALSE 0 +#define VKEY_TRUE 1 +#define VKEY_EQ 2 +#define VKEY_NEQ 3 + unsigned op; /* defines logical operation */ + unsigned char key[8]; +}vidix_vkey_t; + +typedef struct vidix_playback_s +{ + unsigned fourcc; /* app -> driver: movies's fourcc */ + unsigned capability; /* app -> driver: what capability to use */ + unsigned blend_factor; /* app -> driver: blenfing factor */ + vidix_rect_t src; /* app -> driver: original movie size */ + vidix_rect_t dest; /* app -> driver: destinition movie size. driver->app dest_pitch */ + vidix_ckey_t ckey; /* app -> driver: color key */ + vidix_vkey_t vkey; /* app -> driver: video key */ +#define KEYS_PUT 0 +#define KEYS_AND 1 +#define KEYS_OR 2 +#define KEYS_XOR 3 + unsigned key_op; /* app -> driver: keys operations */ +}vidix_playback_t; + + /* Returns 0 if ok else errno */ +extern int vixConfigPlayback(const vidix_playback_t *); + +typedef struct vidix_dga_s +{ + unsigned frame_size; /* app -> driver */ + unsigned num_frames; /* app -> driver; after call: driver -> app */ +#define LVO_MAXFRAMES 32 + unsigned offsets[LVO_MAXFRAMES]; /* driver -> app */ + vidix_yuv_t offset; /* driver -> app: relative offsets within frame for yuv planes */ + void* dga_addr; /* driver -> app: linear address */ +}vidix_dga_t; + + /* Returns 0 if ok else errno */ +extern int vixMapPlayback(vidix_dga_t *); + + /* Returns 0 if ok else errno */ +extern int vixPlaybackOn( void ); + + /* Returns 0 if ok else errno */ +extern int vixPlaybackOff( void ); + + /* Returns 0 if ok else errno */ +extern int vixPlaybackFrameSelect( unsigned frame_idx ); + +typedef struct vidix_video_eq_s +{ +/* end-user app can have presets like: cold-normal-hot picture and so on */ + int brightness; /* -1000 : +1000 */ + int contrast; /* -1000 : +1000 */ + int saturation; /* -1000 : +1000 */ + int hue; /* -1000 : +1000 */ + int red_intense; /* -1000 : +1000 */ + int green_intense; /* -1000 : +1000 */ + int blue_intense; /* -1000 : +1000 */ +}vidix_video_eq_t; + + /* Returns 0 if ok else errno */ +extern int vixPlaybackGetEq( vidix_video_eq_t * ); + + /* Returns 0 if ok else errno */ +extern int vixPlaybackSetEq( const vidix_video_eq_t * ); + +typedef struct vidix_slice_s +{ + void* address; /* app -> driver */ + unsigned size; /* app -> driver */ + vidix_rect_t slice; /* app -> driver */ +}vidix_slice_t; + +typedef struct vidix_dma_s +{ + vidix_slice_t src; /* app -> driver */ + vidix_slice_t dest; /* app -> driver */ +#define LVO_DMA_NOSYNC 0 +#define LVO_DMA_SYNC 1 /* means: wait vsync or hsync */ + unsigned flags; /* app -> driver */ +}vidix_dma_t; + + /* Returns 0 if ok else errno */ +extern int vixPlaybackCopyFrame( const vidix_dma_t * ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/vidix/vidixlib.c b/vidix/vidixlib.c new file mode 100644 index 0000000000..1dc4a53e26 --- /dev/null +++ b/vidix/vidixlib.c @@ -0,0 +1,207 @@ +/* + * vidixlib.c + * VIDIXLib - Library for VIDeo Interface for *niX + * This interface is introduced as universal one to MPEG decoder, + * BES == Back End Scaler and YUV2RGB hw accelerators. + * In the future it may be expanded up to capturing and audio things. + * Main goal of this this interface imlpementation is providing DGA + * everywhere where it's possible (unlike X11 and other). + * Copyright 2002 Nick Kurshev + * Licence: GPL + * This interface is based on v4l2, fbvid.h, mga_vid.h projects + * and personally my ideas. + * NOTE: This interface is introduces as APP interface. + * Don't use it for driver. + * It provides multistreaming. This mean that APP can handle + * several streams simultaneously. (Example: Video capturing and video + * playback or capturing, video playback, audio encoding and so on). +*/ +#include +#include +#include +#include + +#include /* GLIBC specific. Exists under cygwin too! */ +#include + +#include "vidixlib.h" + + +typedef struct vdl_stream_s +{ + void * handle; + int (*get_caps)(vidix_capability_t *); + int (*query_fourcc)(vidix_fourcc_t *); + int (*config_playback)(const vidix_playback_t *); + int (*map_playback)(vidix_dga_t *); + int (*playback_on)( void ); + int (*playback_off)( void ); + /* Functions below can be missed in driver ;) */ + int (*init)(void); + void (*destroy)(void); + int (*frame_sel)( unsigned frame_idx ); + int (*get_eq)( vidix_video_eq_t * ); + int (*set_eq)( const vidix_video_eq_t * ); + int (*copy_frame)( const vidix_dma_t * ); +}vdl_stream_t; + +#define t_vdl(p) (((vdl_stream_t *)p)) + +extern unsigned vdlGetVersion( void ) +{ + return VIDIX_VERSION; +} + +static int vdl_fill_driver(VDL_HANDLE stream) +{ + t_vdl(stream)->init = dlsym(t_vdl(stream)->handle,"vixInit"); + t_vdl(stream)->destroy = dlsym(t_vdl(stream)->handle,"vixDestroy"); + t_vdl(stream)->get_caps = dlsym(t_vdl(stream)->handle,"vixGetCapability"); + t_vdl(stream)->query_fourcc = dlsym(t_vdl(stream)->handle,"vixQueryFourcc"); + t_vdl(stream)->config_playback= dlsym(t_vdl(stream)->handle,"vixConfigPlayback"); + t_vdl(stream)->map_playback = dlsym(t_vdl(stream)->handle,"vixMapPlayback"); + t_vdl(stream)->playback_on = dlsym(t_vdl(stream)->handle,"vixPlaybackOn"); + t_vdl(stream)->playback_off = dlsym(t_vdl(stream)->handle,"vixPlaybackOff"); + t_vdl(stream)->frame_sel = dlsym(t_vdl(stream)->handle,"vixPlaybackFrameSelect"); + t_vdl(stream)->get_eq = dlsym(t_vdl(stream)->handle,"vixPlaybackGetEq"); + t_vdl(stream)->set_eq = dlsym(t_vdl(stream)->handle,"vixPlaybackSetEq"); + t_vdl(stream)->copy_frame = dlsym(t_vdl(stream)->handle,"vixPlaybackCopyFrame"); + /* check driver viability */ + if(!( t_vdl(stream)->get_caps && t_vdl(stream)->query_fourcc && t_vdl(stream)->config_playback && + t_vdl(stream)->map_playback && t_vdl(stream)->playback_on && t_vdl(stream)->playback_off)) + return 0; + return 1; +} + +static int vdl_probe_driver(VDL_HANDLE stream,const char *path,const char *name,unsigned cap) +{ + char drv_name[FILENAME_MAX]; + vidix_capability_t vid_cap; + unsigned (*_ver)(void); + int (*_probe)(void); + int (*_cap)(vidix_capability_t*); + strcpy(drv_name,path); + strcat(drv_name,name); + if(!(t_vdl(stream)->handle = dlopen(drv_name,RTLD_NOW|RTLD_GLOBAL))) return 0; + _ver = dlsym(t_vdl(stream)->handle,"vixGetVersion"); + _probe = dlsym(t_vdl(stream)->handle,"vixProbe"); + _cap = dlsym(t_vdl(stream)->handle,"vixGetCapability"); + if(_ver) { if((*_ver)() != VIDIX_VERSION) { err: dlclose(t_vdl(stream)->handle); t_vdl(stream)->handle = 0; return 0; } } + else goto err; + if(_probe) { if((*_probe)() != 0) goto err; } + else goto err; + if(_cap) { if((*_cap)(&vid_cap) != 0) goto err; } + else goto err; + if((vid_cap.type & cap) != cap) goto err; + return 1; +} + +static int vdl_find_driver(VDL_HANDLE stream,const char *path,unsigned cap) +{ + DIR *dstream; + struct dirent *name; + int done = 0; + if(!(dstream = opendir(path))) return 0; + while(!done) + { + name = readdir(dstream); + if(name) { if(vdl_probe_driver(stream,path,name->d_name,cap)) break; } + else done = 1; + } + closedir(dstream); + return done?0:1; +} + +VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap) +{ + vdl_stream_t *stream; + char drv_name[FILENAME_MAX]; + if(!(stream = malloc(sizeof(vdl_stream_t)))) return NULL; + memset(stream,0,sizeof(vdl_stream_t)); + if(name) + { + unsigned (*ver)(void); + unsigned version = 0; + strcpy(drv_name,path); + strcat(drv_name,name); + if(!(t_vdl(stream)->handle = dlopen(drv_name,RTLD_NOW|RTLD_GLOBAL))) + { + err: + free(stream); + return NULL; + } + ver = dlsym(t_vdl(stream)->handle,"vixGetVersion"); + if(ver) version = (*ver)(); + if(version != VIDIX_VERSION) + { + drv_err: + if(t_vdl(stream)->handle) dlclose(t_vdl(stream)->handle); + goto err; + } + fill: + if(!vdl_fill_driver(stream)) goto drv_err; + } + else + if(vdl_find_driver(stream,path,cap)) goto fill; + else goto err; + if(t_vdl(stream)->init) t_vdl(stream)->init(); + return stream; +} + +void vdlClose(VDL_HANDLE stream) +{ + if(t_vdl(stream)->destroy) t_vdl(stream)->destroy(); + dlclose(t_vdl(stream)->handle); + memset(stream,0,sizeof(vdl_stream_t)); /* <- it's not stupid */ + free(stream); +} + +int vdlGetCapability(VDL_HANDLE handle, vidix_capability_t *cap) +{ + return t_vdl(handle)->get_caps(cap); +} + +int vdlQueryFourcc(VDL_HANDLE handle,vidix_fourcc_t *f) +{ + return t_vdl(handle)->query_fourcc(f); +} + +int vdlConfigPlayback(VDL_HANDLE handle,const vidix_playback_t *p) +{ + return t_vdl(handle)->config_playback(p); +} + +int vdlMapPlayback(VDL_HANDLE handle,vidix_dga_t *m) +{ + return t_vdl(handle)->map_playback(m); +} + +int vdlPlaybackOn(VDL_HANDLE handle) +{ + return t_vdl(handle)->playback_on(); +} + +int vdlPlaybackOff(VDL_HANDLE handle) +{ + return t_vdl(handle)->playback_off(); +} + +int vdlPlaybackFrameSelect(VDL_HANDLE handle, unsigned frame_idx ) +{ + return t_vdl(handle)->frame_sel ? t_vdl(handle)->frame_sel(frame_idx) : ENOSYS; +} + +int vdlPlaybackGetEq(VDL_HANDLE handle, vidix_video_eq_t * e) +{ + return t_vdl(handle)->get_eq ? t_vdl(handle)->get_eq(e) : ENOSYS; +} + +int vdlPlaybackSetEq(VDL_HANDLE handle, const vidix_video_eq_t * e) +{ + return t_vdl(handle)->set_eq ? t_vdl(handle)->set_eq(e) : ENOSYS; +} + +int vdlPlaybackCopyFrame(VDL_HANDLE handle, const vidix_dma_t * f) +{ + return t_vdl(handle)->copy_frame ? t_vdl(handle)->copy_frame(f) : ENOSYS; +} diff --git a/vidix/vidixlib.h b/vidix/vidixlib.h new file mode 100644 index 0000000000..fd023d5de0 --- /dev/null +++ b/vidix/vidixlib.h @@ -0,0 +1,78 @@ +/* + * vidixlib.h + * VIDIXLib - Library for VIDeo Interface for *niX + * This interface is introduced as universal one to MPEG decoder, + * BES == Back End Scaler and YUV2RGB hw accelerators. + * In the future it may be expanded up to capturing and audio things. + * Main goal of this this interface imlpementation is providing DGA + * everywhere where it's possible (unlike X11 and other). + * Copyright 2002 Nick Kurshev + * Licence: GPL + * This interface is based on v4l2, fbvid.h, mga_vid.h projects + * and personally my ideas. + * NOTE: This interface is introduces as APP interface. + * Don't use it for driver. + * It provides multistreaming. This mean that APP can handle + * several streams simultaneously. (Example: Video capturing and video + * playback or capturing, video playback, audio encoding and so on). +*/ +#ifndef VIDIXLIB_H +#define VIDIXLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vidix.h" + +typedef void * VDL_HANDLE; + + /* returns library version */ +extern unsigned vdlGetVersion( void ); + + /* Opens corresponded video driver and returns handle + of associated stream. + path - specifies path where drivers are located. + name - specifies prefered driver name (can be NULL). + cap - specifies driver capability (TYPE_* constants). + returns !0 if ok else NULL. + */ +extern VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap); + /* Closes stream and corresponded driver. */ +extern void vdlClose(VDL_HANDLE stream); + + /* Queries driver capabilities. Return 0 if ok else errno */ +extern int vdlGetCapability(VDL_HANDLE, vidix_capability_t *); + + /* Queries support for given fourcc. Returns 0 if ok else errno */ +extern int vdlQueryFourcc(VDL_HANDLE,vidix_fourcc_t *); + + /* Returns 0 if ok else errno */ +extern int vdlConfigPlayback(VDL_HANDLE,const vidix_playback_t *); + + /* Returns 0 if ok else errno */ +extern int vdlMapPlayback(VDL_HANDLE,vidix_dga_t *); + + /* Returns 0 if ok else errno */ +extern int vdlPlaybackOn(VDL_HANDLE); + + /* Returns 0 if ok else errno */ +extern int vdlPlaybackOff(VDL_HANDLE); + + /* Returns 0 if ok else errno */ +extern int vdlPlaybackFrameSelect(VDL_HANDLE, unsigned frame_idx ); + + /* Returns 0 if ok else errno */ +extern int vdlPlaybackGetEq(VDL_HANDLE, vidix_video_eq_t * ); + + /* Returns 0 if ok else errno */ +extern int vdlPlaybackSetEq(VDL_HANDLE, const vidix_video_eq_t * ); + + /* Returns 0 if ok else errno */ +extern int vdlPlaybackCopyFrame(VDL_HANDLE, const vidix_dma_t * ); + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.2.3