[MPlayer-cvslog] r22875 - in trunk: Makefile vidix/cyberblade_vid.c vidix/drivers.c vidix/drivers.h vidix/mach64_vid.c vidix/mga_vid.c vidix/nvidia_vid.c vidix/pm3_vid.c vidix/radeon_vid.c vidix/savage_vid.c vidix/sis_vid.c vidix/unichrome_vid.c vidix/vidixlib.c vidix/vidixlib.h

ben subversion at mplayerhq.hu
Sun Apr 1 13:06:06 CEST 2007


Author: ben
Date: Sun Apr  1 13:06:06 2007
New Revision: 22875

Added:
   trunk/vidix/drivers.c
   trunk/vidix/drivers.h
Modified:
   trunk/Makefile
   trunk/vidix/cyberblade_vid.c
   trunk/vidix/mach64_vid.c
   trunk/vidix/mga_vid.c
   trunk/vidix/nvidia_vid.c
   trunk/vidix/pm3_vid.c
   trunk/vidix/radeon_vid.c
   trunk/vidix/savage_vid.c
   trunk/vidix/sis_vid.c
   trunk/vidix/unichrome_vid.c
   trunk/vidix/vidixlib.c
   trunk/vidix/vidixlib.h

Log:
switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile	(original)
+++ trunk/Makefile	Sun Apr  1 13:06:06 2007
@@ -78,7 +78,7 @@ LIBS_MPLAYER = libvo/libvo.a \
                libao2/libao2.a \
                input/libinput.a \
 
-LIBS_MPLAYER-$(VIDIX)             += vidix/libvidix.a
+LIBS_MPLAYER-$(VIDIX)             += vidix/libvidix.a libdha/libdha.a
 LIBS_MPLAYER-$(GUI)               += Gui/libgui.a
 LIBS_MPLAYER-$(LIBMENU)           += libmenu/libmenu.a
 

Modified: trunk/vidix/cyberblade_vid.c
==============================================================================
--- trunk/vidix/cyberblade_vid.c	(original)
+++ trunk/vidix/cyberblade_vid.c	Sun Apr  1 13:06:06 2007
@@ -44,6 +44,7 @@
 #include <unistd.h>
 
 #include "vidix.h"
+#include "vidixlib.h"
 #include "fourcc.h"
 #include "../libdha/libdha.h"
 #include "../libdha/pci_ids.h"
@@ -135,7 +136,7 @@ static vidix_capability_t cyberblade_cap
 };
 
 
-unsigned int vixGetVersion(void)
+static unsigned int cyberblade_get_version(void)
 {
 	return(VIDIX_VERSION);
 }
@@ -162,7 +163,7 @@ static int find_chip(unsigned chip_id)
   return -1;
 }
 
-int vixProbe(int verbose, int force)
+static int cyberblade_probe(int verbose, int force)
 {
 	pciinfo_t lst[MAX_PCI_DEVICES];
 	unsigned i,num_pci;
@@ -206,7 +207,7 @@ int vixProbe(int verbose, int force)
 }
 
 
-int vixInit(void)
+static int cyberblade_init(void)
 {
 	cyberblade_mem = map_phys_mem(pci_info.base0, 0x800000); 
 	enable_app_io();
@@ -222,7 +223,7 @@ int vixInit(void)
 	return 0;
 }
 
-void vixDestroy(void)
+static void cyberblade_destroy(void)
 {
 	int protect;
 #ifdef DEBUG_LOGFILE
@@ -244,7 +245,7 @@ void vixDestroy(void)
 }
 
 
-int vixGetCapability(vidix_capability_t *to)
+static int cyberblade_get_caps(vidix_capability_t *to)
 {
 	memcpy(to, &cyberblade_cap, sizeof(vidix_capability_t));
 	return 0;
@@ -266,7 +267,7 @@ static int is_supported_fourcc(uint32_t 
 	}
 }
 
-int vixQueryFourcc(vidix_fourcc_t *to)
+static int cyberblade_query_fourcc(vidix_fourcc_t *to)
 {
 	if(is_supported_fourcc(to->fourcc))
 	{
@@ -288,13 +289,13 @@ static int frames[VID_PLAY_MAXFRAMES];
 
 static vidix_grkey_t cyberblade_grkey;
 
-int vixGetGrKeys(vidix_grkey_t *grkey)
+static int cyberblade_get_gkeys(vidix_grkey_t *grkey)
 {
 	memcpy(grkey, &cyberblade_grkey, sizeof(vidix_grkey_t));
 	return(0);
 }
 
-int vixSetGrKeys(const vidix_grkey_t *grkey)
+static int cyberblade_set_gkeys(const vidix_grkey_t *grkey)
 {
 	int pixfmt=CRINB(0x38);
 	int protect;
@@ -329,19 +330,19 @@ int vixSetGrKeys(const vidix_grkey_t *gr
 }
 
 
-vidix_video_eq_t equal =
+static vidix_video_eq_t equal =
 {
 	VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION | VEQ_CAP_HUE,
 	300, 100, 0, 0, 0, 0, 0, 0
 };
 
-int vixPlaybackGetEq( vidix_video_eq_t * eq)
+static int cyberblade_get_eq( vidix_video_eq_t * eq)
 {
   memcpy(eq,&equal,sizeof(vidix_video_eq_t));
   return 0;
 }
 
-int vixPlaybackSetEq( const vidix_video_eq_t * eq)
+static int cyberblade_set_eq( const vidix_video_eq_t * eq)
 {
 	int br,sat,cr,protect;
 	if(eq->cap & VEQ_CAP_BRIGHTNESS) equal.brightness = eq->brightness;
@@ -381,7 +382,7 @@ int vixPlaybackSetEq( const vidix_video_
 
 static int YOffs,UOffs,VOffs;
 
-int vixConfigPlayback(vidix_playback_t *info)
+static int cyberblade_config_playback(vidix_playback_t *info)
 {
 	int shrink, zoom;
 	int src_w, drw_w;
@@ -465,7 +466,7 @@ int vixConfigPlayback(vidix_playback_t *
 	SROUTB(0x21, 0x34); /* Signature control */
 	SROUTB(0x37, 0x30); /* Video key mode */
 
-        vixSetGrKeys(&cyberblade_grkey);
+        cyberblade_set_gkeys(&cyberblade_grkey);
 
 	/* compute_scale_factor(&src_w, &drw_w, &shrink, &zoom); */
 	{
@@ -598,7 +599,7 @@ int vixConfigPlayback(vidix_playback_t *
 		SROUTB(0x85, ((base0+info->offset.u) >> 19) &0xf); /* Upper 4 bits of start address */
 	}
 
-	vixPlaybackSetEq(&equal);
+	cyberblade_set_eq(&equal);
 
 	/* Protect hardware registers again */
 	SROUTB(0x11, protect);
@@ -606,7 +607,7 @@ int vixConfigPlayback(vidix_playback_t *
 }
 
 
-int vixPlaybackOn(void)
+static int cyberblade_playback_on(void)
 {
 	LOGWRITE("Enable overlay\n");
 	CROUTB(0x8E, 0xd4); /* VDE Flags*/
@@ -615,7 +616,7 @@ int vixPlaybackOn(void)
 }
 
 
-int vixPlaybackOff(void)
+static int cyberblade_playback_off(void)
 {
         LOGWRITE("Disable overlay\n"); 
 	CROUTB(0x8E, 0xc4); /* VDE Flags*/
@@ -624,7 +625,7 @@ int vixPlaybackOff(void)
 }
 
 
-int vixPlaybackFrameSelect(unsigned int frame)
+static int cyberblade_frame_sel(unsigned int frame)
 {
 	int protect;
         LOGWRITE("Frame select\n"); 
@@ -644,4 +645,21 @@ int vixPlaybackFrameSelect(unsigned int 
 	return 0;
 }
 
-
+VDXDriver cyberblade_drv = {
+  "cyberblade",
+  NULL,
+  .probe = cyberblade_probe,
+  .get_version = cyberblade_get_version,
+  .get_caps = cyberblade_get_caps,
+  .query_fourcc = cyberblade_query_fourcc,
+  .init = cyberblade_init,
+  .destroy = cyberblade_destroy,
+  .config_playback = cyberblade_config_playback,
+  .playback_on = cyberblade_playback_on,
+  .playback_off = cyberblade_playback_off,
+  .frame_sel = cyberblade_frame_sel,
+  .get_eq = cyberblade_get_eq,
+  .set_eq = cyberblade_set_eq,
+  .get_gkey = cyberblade_get_gkeys,
+  .set_gkey = cyberblade_set_gkeys,
+};

Added: trunk/vidix/drivers.c
==============================================================================
--- (empty file)
+++ trunk/vidix/drivers.c	Sun Apr  1 13:06:06 2007
@@ -0,0 +1,123 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "vidixlib.h"
+#include "../config.h"
+#include "../libavutil/common.h"
+#include "../mpbswap.h"
+
+VDXDriver *first_driver = NULL;
+
+extern VDXDriver cyberblade_drv;
+extern VDXDriver mach64_drv;
+extern VDXDriver mga_drv;
+extern VDXDriver mga_crtc2_drv;
+extern VDXDriver nvidia_drv;
+extern VDXDriver pm3_drv;
+extern VDXDriver radeon_drv;
+extern VDXDriver rage128_drv;
+extern VDXDriver savage_drv;
+extern VDXDriver sis_drv;
+extern VDXDriver unichrome_drv;
+
+static void vidix_register_driver (VDXDriver *drv)
+{
+  VDXDriver **d;
+  
+  d = &first_driver;
+  while (*d != NULL)
+    d = &(*d)->next;
+  *d = drv;
+  drv->next = NULL;
+}
+
+void vidix_register_all_drivers (void)
+{
+  vidix_register_driver (&cyberblade_drv);
+  vidix_register_driver (&mach64_drv);
+  vidix_register_driver (&mga_drv);
+  vidix_register_driver (&mga_crtc2_drv);
+  vidix_register_driver (&nvidia_drv);
+  vidix_register_driver (&pm3_drv);
+  vidix_register_driver (&radeon_drv);
+  vidix_register_driver (&rage128_drv);
+  vidix_register_driver (&savage_drv);
+  vidix_register_driver (&sis_drv);
+  vidix_register_driver (&unichrome_drv);
+}
+
+static int vidix_probe_driver (VDXContext *ctx, VDXDriver *drv,
+                               unsigned int cap, int verbose)
+{
+  vidix_capability_t vid_cap;
+
+  if (verbose)
+    printf ("vidixlib: PROBING: %s\n", drv->name);
+
+  if (!drv->get_version)
+    return 0;
+  
+  if (drv->get_version () != VIDIX_VERSION)
+  {
+    if (verbose)
+      printf ("vidixlib: %s has wrong version\n", drv->name);
+    return 0;
+  }
+
+  if (!drv->probe || drv->probe (verbose, PROBE_NORMAL) != 0)
+    return 0;
+
+  if (!drv->get_caps || drv->get_caps (&vid_cap) != 0)
+    return 0;
+
+  if ((vid_cap.type & cap) != cap)
+  {
+    if (verbose)
+      printf ("vidixlib: Found %s but has no required capability\n",
+              drv->name);
+     return 0;
+  }
+  
+  if (verbose)
+    printf ("vidixlib: %s probed o'k\n", drv->name);
+
+  ctx->drv = drv;
+  return 1;
+}
+
+int vidix_find_driver (VDXContext *ctx, const char *name,
+                       unsigned int cap, int verbose)
+{
+  VDXDriver *drv;
+
+  drv = first_driver;
+  while (drv)
+  {
+    if (name) /* forced driver */
+    {
+      if (!strcmp (drv->name, name))
+      {
+        if (vidix_probe_driver (ctx, drv, cap, verbose))
+          return 1;
+        else
+        {
+          ctx->drv = NULL;
+          return 0;
+        }
+      }
+    }
+    else /* auto-probe */
+    {
+      if (vidix_probe_driver (ctx, drv, cap, verbose))
+        return 1;
+    }
+    drv = drv->next;
+  }
+
+  if (verbose)
+    printf ("vidixlib: No suitable driver can be found.\n");
+  ctx->drv = NULL;
+  return 0;
+}

Added: trunk/vidix/drivers.h
==============================================================================
--- (empty file)
+++ trunk/vidix/drivers.h	Sun Apr  1 13:06:06 2007
@@ -0,0 +1,10 @@
+
+#ifndef VIDIX_DRIVERS_H
+#define VIDIX_DRIVERS_H
+
+void vidix_register_all_drivers (void);
+
+int vidix_find_driver (VDXContext *ctx, const char *name,
+                       unsigned int cap, int verbose);
+
+#endif /* VIDIX_DRIVERS_H */

Modified: trunk/vidix/mach64_vid.c
==============================================================================
--- trunk/vidix/mach64_vid.c	(original)
+++ trunk/vidix/mach64_vid.c	Sun Apr  1 13:06:06 2007
@@ -17,13 +17,13 @@
 #include "../libavutil/common.h"
 #include "../mpbswap.h"
 #include "vidix.h"
+#include "vidixlib.h"
 #include "fourcc.h"
 #include "../libdha/libdha.h"
 #include "../libdha/pci_ids.h"
 #include "../libdha/pci_names.h"
 
 #include "mach64.h"
-#include "../version.h"
 
 #define UNUSED(x) ((void)(x)) /**< Removes warning about unused arguments */
 
@@ -339,7 +339,7 @@ static void mach64_vid_dump_regs( void )
 }
 
 
-unsigned int vixGetVersion(void)
+static unsigned int mach64_get_version(void)
 {
     return(VIDIX_VERSION);
 }
@@ -396,7 +396,7 @@ static int find_chip(unsigned chip_id)
   return -1;
 }
 
-int vixProbe(int verbose,int force)
+static int mach64_probe(int verbose,int force)
 {
   pciinfo_t lst[MAX_PCI_DEVICES];
   unsigned i,num_pci;
@@ -456,7 +456,7 @@ static void reset_regs( void )
 }
 
 
-int vixInit(void)
+static int mach64_init(void)
 {
   int err;
   if(!probed)
@@ -464,7 +464,7 @@ int vixInit(void)
     printf("[mach64] Driver was not probed but is being initializing\n");
     return EINTR;
   }
-  if(__verbose>0) printf("[mach64] version %s\n", VERSION);
+  if(__verbose>0) printf("[mach64] version %d\n", VIDIX_VERSION);
   
   if((mach64_mmio_base = map_phys_mem(pci_info.base2,0x1000))==(void *)-1) return ENOMEM;
   mach64_wait_for_idle();
@@ -516,7 +516,7 @@ int vixInit(void)
   return 0;
 }
 
-void vixDestroy(void)
+static void mach64_destroy(void)
 {
   /*restore this*/
   mach64_wait_for_idle();
@@ -526,7 +526,7 @@ void vixDestroy(void)
   unmap_phys_mem(mach64_mmio_base,0x1000);
 }
 
-int vixGetCapability(vidix_capability_t *to)
+static int mach64_get_caps(vidix_capability_t *to)
 {
     memcpy(to, &mach64_cap, sizeof(vidix_capability_t));
     return 0;
@@ -872,7 +872,7 @@ static int is_supported_fourcc(uint32_t 
     }
 }
 
-int vixQueryFourcc(vidix_fourcc_t *to)
+static int mach64_query_fourcc(vidix_fourcc_t *to)
 {
     if(is_supported_fourcc(to->fourcc))
     {
@@ -888,7 +888,7 @@ int vixQueryFourcc(vidix_fourcc_t *to)
     return ENOSYS;
 }
 
-int vixConfigPlayback(vidix_playback_t *info)
+static int mach64_config_playback(vidix_playback_t *info)
 {
   if(!is_supported_fourcc(info->fourcc)) return ENOSYS;
 
@@ -908,19 +908,19 @@ int vixConfigPlayback(vidix_playback_t *
   return 0;
 }
 
-int vixPlaybackOn(void)
+static int mach64_playback_on(void)
 {
   mach64_vid_display_video();
   return 0;
 }
 
-int vixPlaybackOff(void)
+static int mach64_playback_off(void)
 {
   mach64_vid_stop_video();
   return 0;
 }
 
-int vixPlaybackFrameSelect(unsigned int frame)
+static int mach64_frame_sel(unsigned int frame)
 {
     uint32_t off[6];
     int i;
@@ -960,19 +960,19 @@ for(i=0; i<10000000; i++);
     return 0;
 }
 
-vidix_video_eq_t equal =
+static vidix_video_eq_t equal =
 {
  VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION
  ,
  0, 0, 0, 0, 0, 0, 0, 0 };
 
-int 	vixPlaybackGetEq( vidix_video_eq_t * eq)
+static int mach64_get_eq( vidix_video_eq_t * eq)
 {
   memcpy(eq,&equal,sizeof(vidix_video_eq_t));
   return 0;
 }
 
-int 	vixPlaybackSetEq( const vidix_video_eq_t * eq)
+static int mach64_set_eq( const vidix_video_eq_t * eq)
 {
   int br,sat;
     if(eq->cap & VEQ_CAP_BRIGHTNESS) equal.brightness = eq->brightness;
@@ -994,13 +994,13 @@ int 	vixPlaybackSetEq( const vidix_video
   return 0;
 }
 
-int vixGetGrKeys(vidix_grkey_t *grkey)
+static int mach64_get_gkeys(vidix_grkey_t *grkey)
 {
     memcpy(grkey, &mach64_grkey, sizeof(vidix_grkey_t));
     return(0);
 }
 
-int vixSetGrKeys(const vidix_grkey_t *grkey)
+static int mach64_set_gkeys(const vidix_grkey_t *grkey)
 {
     memcpy(&mach64_grkey, grkey, sizeof(vidix_grkey_t));
 
@@ -1064,3 +1064,22 @@ int vixSetGrKeys(const vidix_grkey_t *gr
 
     return(0);
 }
+
+VDXDriver mach64_drv = {
+  "mach64",
+  NULL,
+  .probe = mach64_probe,
+  .get_version = mach64_get_version,
+  .get_caps = mach64_get_caps,
+  .query_fourcc = mach64_query_fourcc,
+  .init = mach64_init,
+  .destroy = mach64_destroy,
+  .config_playback = mach64_config_playback,
+  .playback_on = mach64_playback_on,
+  .playback_off = mach64_playback_off,
+  .frame_sel = mach64_frame_sel,
+  .get_eq = mach64_get_eq,
+  .set_eq = mach64_set_eq,
+  .get_gkey = mach64_get_gkeys,
+  .set_gkey = mach64_set_gkeys,
+};

Modified: trunk/vidix/mga_vid.c
==============================================================================
--- trunk/vidix/mga_vid.c	(original)
+++ trunk/vidix/mga_vid.c	Sun Apr  1 13:06:06 2007
@@ -55,6 +55,7 @@
 #include <inttypes.h>
 
 #include "vidix.h"
+#include "vidixlib.h"
 #include "fourcc.h"
 #include "../libdha/libdha.h"
 #include "../libdha/pci_ids.h"
@@ -343,7 +344,7 @@ case 3:
 }
 #endif
 
-int vixPlaybackFrameSelect(unsigned int frame)
+static int mga_frame_select(unsigned int frame)
 {
     mga_next_frame = frame;
     if (mga_verbose>1) printf("[mga] frameselect: %d\n", mga_next_frame);
@@ -696,7 +697,7 @@ void mga_handle_irq(int irq, void *dev_i
 }
 #endif /* MGA_ALLOW_IRQ */
 
-int vixConfigPlayback(vidix_playback_t *config)
+static int mga_config_playback(vidix_playback_t *config)
 {
 	unsigned int i;
 	int x, y, sw, sh, dw, dh;
@@ -1152,7 +1153,7 @@ switch(config->fourcc){
     return(0);
 }
 
-int vixPlaybackOn(void)
+static int mga_playback_on(void)
 {
     if (mga_verbose) printf("[mga] playback on\n");
 
@@ -1171,7 +1172,7 @@ int vixPlaybackOn(void)
     return(0);
 }
 
-int vixPlaybackOff(void)
+static int mga_playback_off(void)
 {
     if (mga_verbose) printf("[mga] playback off\n");
 
@@ -1187,7 +1188,7 @@ int vixPlaybackOff(void)
     return(0);
 }
 
-int vixProbe(int verbose,int force)
+static int mga_probe(int verbose,int force)
 {
 	pciinfo_t lst[MAX_PCI_DEVICES];
 	unsigned int i, num_pci;
@@ -1258,7 +1259,7 @@ card_found:
 	return(0);
 }
 
-int vixInit(void)
+static int mga_init(void)
 {
     unsigned int card_option = 0;
     int err;
@@ -1387,7 +1388,7 @@ int vixInit(void)
     return(0);
 }
 
-void vixDestroy(void)
+static void mga_destroy(void)
 {
     if (mga_verbose) printf("[mga] destroy\n");
 
@@ -1411,7 +1412,7 @@ void vixDestroy(void)
     return;
 }
 
-int vixQueryFourcc(vidix_fourcc_t *to)
+static int mga_query_fourcc(vidix_fourcc_t *to)
 {
     if (mga_verbose) printf("[mga] query fourcc (%x)\n", to->fourcc);
 
@@ -1435,31 +1436,31 @@ int vixQueryFourcc(vidix_fourcc_t *to)
     return(0);
 }
 
-unsigned int vixGetVersion(void)
+static unsigned int mga_get_version(void)
 {
     return(VIDIX_VERSION);
 }
 
-int vixGetCapability(vidix_capability_t *to)
+static int mga_get_caps(vidix_capability_t *to)
 {
     memcpy(to, &mga_cap, sizeof(vidix_capability_t));
     return(0);
 }
 
-int vixGetGrKeys(vidix_grkey_t *grkey)
+static int mga_get_gkeys(vidix_grkey_t *grkey)
 {
     memcpy(grkey, &mga_grkey, sizeof(vidix_grkey_t));
     return(0);
 }
 
-int vixSetGrKeys(const vidix_grkey_t *grkey)
+static int mga_set_gkeys(const vidix_grkey_t *grkey)
 {
     memcpy(&mga_grkey, grkey, sizeof(vidix_grkey_t));
     mga_vid_write_regs(0);
     return(0);
 }
 
-int vixPlaybackSetEq( const vidix_video_eq_t * eq)
+static int mga_set_eq( const vidix_video_eq_t * eq)
 {
     /* contrast and brightness control isn't supported on G200 - alex */
     if (!is_g400)
@@ -1487,7 +1488,7 @@ int vixPlaybackSetEq( const vidix_video_
     return(0);
 }
 
-int vixPlaybackGetEq( vidix_video_eq_t * eq)
+static int mga_get_eq( vidix_video_eq_t * eq)
 {
     /* contrast and brightness control isn't supported on G200 - alex */
     if (!is_g400)
@@ -1506,3 +1507,28 @@ int vixPlaybackGetEq( vidix_video_eq_t *
 
     return(0);
 }
+
+#ifndef CRTC2
+VDXDriver mga_drv = {
+  "mga",
+#else
+VDXDriver mga_crtc2_drv = {
+  "mga_crtc2",
+#endif
+  NULL,
+    
+  .probe = mga_probe,
+  .get_version = mga_get_version,
+  .get_caps = mga_get_caps,
+  .query_fourcc = mga_query_fourcc,
+  .init = mga_init,
+  .destroy = mga_destroy,
+  .config_playback = mga_config_playback,
+  .playback_on = mga_playback_on,
+  .playback_off = mga_playback_off,
+  .frame_sel = mga_frame_select,
+  .get_eq = mga_get_eq,
+  .set_eq = mga_set_eq,
+  .get_gkey = mga_get_gkeys,
+  .set_gkey = mga_set_gkeys,
+};

Modified: trunk/vidix/nvidia_vid.c
==============================================================================
--- trunk/vidix/nvidia_vid.c	(original)
+++ trunk/vidix/nvidia_vid.c	Sun Apr  1 13:06:06 2007
@@ -19,6 +19,7 @@
 
 
 #include "vidix.h"
+#include "vidixlib.h"
 #include "fourcc.h"
 #include "../libdha/libdha.h"
 #include "../libdha/pci_ids.h"
@@ -52,7 +53,7 @@ static vidix_capability_t nvidia_cap = {
 };
 
 
-unsigned int vixGetVersion(void){
+static unsigned int nv_get_version(void){
     return(VIDIX_VERSION);
 }
 
@@ -164,7 +165,7 @@ static int find_chip(unsigned chip_id){
   return -1;
 }
 
-int vixProbe(int verbose, int force){
+static int nv_probe(int verbose, int force){
     pciinfo_t lst[MAX_PCI_DEVICES];
     unsigned i,num_pci;
     int err;
@@ -703,7 +704,7 @@ static rivatv_info* info;
 
       
       
-int vixInit(void){
+static int nv_init(void){
 	int mtrr;
   info = calloc(1,sizeof(rivatv_info));
   info->control_base = map_phys_mem(pci_info.base0, 0x00C00000 + 0x00008000);
@@ -793,13 +794,13 @@ int vixInit(void){
   return 0;
 }
 
-void vixDestroy(void){
+static void nv_destroy(void){
   unmap_phys_mem(info->control_base ,0x00C00000 + 0x00008000);
   unmap_phys_mem(info->video_base, info->chip.fbsize);
   free(info);
 }
 
-int vixGetCapability(vidix_capability_t *to){
+static int nv_get_caps(vidix_capability_t *to){
     memcpy(to, &nvidia_cap, sizeof(vidix_capability_t));
     return 0;
 }
@@ -812,7 +813,7 @@ inline static int is_supported_fourcc(ui
 		return 0;
 }
 
-int vixQueryFourcc(vidix_fourcc_t *to){
+static int nv_query_fourcc(vidix_fourcc_t *to){
     if(is_supported_fourcc(to->fourcc)){
 	to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
 		    VID_DEPTH_4BPP | VID_DEPTH_8BPP |
@@ -826,7 +827,7 @@ int vixQueryFourcc(vidix_fourcc_t *to){
     return ENOSYS;
 }
 
-int vixConfigPlayback(vidix_playback_t *vinfo){
+static int nv_config_playback(vidix_playback_t *vinfo){
     uint32_t i;
     printf("called %s\n", __FUNCTION__);
     if (! is_supported_fourcc(vinfo->fourcc))
@@ -872,17 +873,17 @@ int vixConfigPlayback(vidix_playback_t *
     return 0;
 }
 
-int vixPlaybackOn(void){
+static int nv_playback_on(void){
     rivatv_overlay_start(info,info->cur_frame);
     return 0;
 }
 
-int vixPlaybackOff(void){
+static int nv_playback_off(void){
     rivatv_overlay_stop(info);
     return 0;
 }
 
-int vixSetGrKeys( const vidix_grkey_t * grkey){
+static int nv_set_gkeys( const vidix_grkey_t * grkey){
   if (grkey->ckey.op == CKEY_FALSE)
   {
     info->use_colorkey = 0;
@@ -897,7 +898,7 @@ int vixSetGrKeys( const vidix_grkey_t * 
   return 0;
 }
 
-int vixPlaybackFrameSelect(unsigned int frame){
+static int nv_frame_sel(unsigned int frame){
 //  printf("selecting buffer %d\n", frame);
   rivatv_overlay_start(info, frame);
   if (info->num_frames >= 1)
@@ -905,7 +906,7 @@ int vixPlaybackFrameSelect(unsigned int 
   return 0;
 }
 
-int vixPlaybackSetEq(const vidix_video_eq_t *eq_parm) {
+static int nv_set_eq(const vidix_video_eq_t *eq_parm) {
   double angle;
   int16_t chrom_cos, chrom_sin;
   if (eq_parm->cap & VEQ_CAP_BRIGHTNESS)
@@ -928,8 +929,25 @@ int vixPlaybackSetEq(const vidix_video_e
   return 0;
 }
 
-int vixPlaybackGetEq(vidix_video_eq_t *eq_parm) {
+static int nv_get_eq(vidix_video_eq_t *eq_parm) {
   memcpy(eq_parm, &eq.vals, sizeof(vidix_video_eq_t));
   return 0;
 }
 
+VDXDriver nvidia_drv = {
+  "nvidia",
+  NULL,
+  .probe = nv_probe,
+  .get_version = nv_get_version,
+  .get_caps = nv_get_caps,
+  .query_fourcc = nv_query_fourcc,
+  .init = nv_init,
+  .destroy = nv_destroy,
+  .config_playback = nv_config_playback,
+  .playback_on = nv_playback_on,
+  .playback_off = nv_playback_off,
+  .frame_sel = nv_frame_sel,
+  .get_eq = nv_get_eq,
+  .set_eq = nv_set_eq,
+  .set_gkey = nv_set_gkeys,
+};

Modified: trunk/vidix/pm3_vid.c
==============================================================================
--- trunk/vidix/pm3_vid.c	(original)
+++ trunk/vidix/pm3_vid.c	Sun Apr  1 13:06:06 2007
@@ -26,6 +26,7 @@
 #include <unistd.h>
 
 #include "vidix.h"
+#include "vidixlib.h"
 #include "fourcc.h"
 #include "../libdha/libdha.h"
 #include "../libdha/pci_ids.h"
@@ -65,7 +66,7 @@ static vidix_capability_t pm3_cap =
 };
 
 
-unsigned int vixGetVersion(void)
+static unsigned int pm3_get_version(void)
 {
     return(VIDIX_VERSION);
 }
@@ -85,7 +86,7 @@ static int find_chip(unsigned chip_id)
   return -1;
 }
 
-int vixProbe(int verbose, int force)
+static int pm3_probe(int verbose, int force)
 {
     pciinfo_t lst[MAX_PCI_DEVICES];
     unsigned i,num_pci;
@@ -134,20 +135,20 @@ int vixProbe(int verbose, int force)
     printf("[pm3] " #reg " (%x) = %#lx (%li)\n", reg, _foo, _foo);	\
 }
 
-int vixInit(void)
+static int pm3_init(void)
 {
     pm3_reg_base = map_phys_mem(pci_info.base0, 0x20000);
     pm3_mem = map_phys_mem(pci_info.base2, 0x2000000);
     return 0;
 }
 
-void vixDestroy(void)
+static void pm3_destroy(void)
 {
     unmap_phys_mem(pm3_reg_base, 0x20000);
     unmap_phys_mem(pm3_mem, 0x2000000);
 }
 
-int vixGetCapability(vidix_capability_t *to)
+static int pm3_get_caps(vidix_capability_t *to)
 {
     memcpy(to, &pm3_cap, sizeof(vidix_capability_t));
     return 0;
@@ -164,7 +165,7 @@ static int is_supported_fourcc(uint32_t 
     }
 }
 
-int vixQueryFourcc(vidix_fourcc_t *to)
+static int pm3_query_fourcc(vidix_fourcc_t *to)
 {
     if(is_supported_fourcc(to->fourcc))
     {
@@ -228,7 +229,7 @@ static int frames[VID_PLAY_MAXFRAMES];
 
 static long overlay_mode, overlay_control;
 
-int vixConfigPlayback(vidix_playback_t *info)
+static int pm3_config_playback(vidix_playback_t *info)
 {
     int shrink, zoom;
     short src_w, drw_w;
@@ -339,7 +340,7 @@ int vixConfigPlayback(vidix_playback_t *
     return 0;
 }
 
-int vixPlaybackOn(void)
+static int pm3_playback_on(void)
 {
     TRACE_ENTER();
 
@@ -354,7 +355,7 @@ int vixPlaybackOn(void)
     return 0;
 }
 
-int vixPlaybackOff(void)
+static int pm3_playback_off(void)
 {
     RAMDAC_SET_REG(PM3RD_VideoOverlayControl,
 		   PM3RD_VideoOverlayControl_DISABLE);
@@ -368,8 +369,23 @@ int vixPlaybackOff(void)
     return 0;
 }
 
-int vixPlaybackFrameSelect(unsigned int frame)
+static int pm3_frame_select(unsigned int frame)
 {
     WRITE_REG(PM3VideoOverlayBase0, frames[frame]);
     return 0;
 }
+
+VDXDriver pm3_drv = {
+  "pm3",
+  NULL,
+  .probe = pm3_probe,
+  .get_version = pm3_get_version,
+  .get_caps = pm3_get_caps,
+  .query_fourcc = pm3_query_fourcc,
+  .init = pm3_init,
+  .destroy = pm3_destroy,
+  .config_playback = pm3_config_playback,
+  .playback_on = pm3_playback_on,
+  .playback_off = pm3_playback_off,
+  .frame_sel = pm3_frame_select,
+};

Modified: trunk/vidix/radeon_vid.c
==============================================================================
--- trunk/vidix/radeon_vid.c	(original)
+++ trunk/vidix/radeon_vid.c	Sun Apr  1 13:06:06 2007
@@ -22,6 +22,7 @@
 #include "../libdha/pci_ids.h"
 #include "../libdha/pci_names.h"
 #include "vidix.h"
+#include "vidixlib.h"
 #include "fourcc.h"
 #include "../libdha/libdha.h"
 #include "radeon.h"
@@ -794,7 +795,7 @@ static void radeon_vid_make_default(void
 }
 
 
-unsigned vixGetVersion( void ) { return VIDIX_VERSION; }
+static unsigned int radeon_get_version( void ) { return VIDIX_VERSION; }
 
 static unsigned short ati_card_ids[] = 
 {
@@ -930,7 +931,7 @@ static int find_chip(unsigned chip_id)
 static pciinfo_t pci_info;
 static int probed=0;
 
-vidix_capability_t def_cap = 
+static vidix_capability_t def_cap = 
 {
 #ifdef RAGE128
     "BES driver for Rage128 cards",
@@ -981,7 +982,7 @@ static void probe_fireGL_driver(void) {
 }
 #endif
 
-int vixProbe( int verbose,int force )
+static int radeon_probe( int verbose,int force )
 {
   pciinfo_t lst[MAX_PCI_DEVICES];
   unsigned i,num_pci;
@@ -1139,7 +1140,7 @@ int vixProbe( int verbose,int force )
 
 static void radeon_vid_dump_regs( void ); /* forward declaration */
 
-int vixInit( void )
+static int radeon_init( void )
 {
   int err;
   if(!probed) 
@@ -1239,7 +1240,7 @@ int vixInit( void )
   return 0;  
 }
 
-void vixDestroy( void )
+static void radeon_destroy( void )
 {
   /* remove colorkeying */
   radeon_fifo_wait(3);
@@ -1264,7 +1265,7 @@ void vixDestroy( void )
   unmap_phys_mem(radeon_mmio_base,0xFFFF);
 }
 
-int vixGetCapability(vidix_capability_t *to)
+static int radeon_get_caps(vidix_capability_t *to)
 {
   memcpy(to,&def_cap,sizeof(vidix_capability_t));
   return 0; 
@@ -1275,7 +1276,7 @@ int vixGetCapability(vidix_capability_t 
   YUY2, UYVY, DDES, OGLT, OGL2, OGLS, OGLB, OGNT, OGNZ, OGNS,
   IF09, YVU9, IMC4, M2IA, IYUV, VBID, DXT1, DXT2, DXT3, DXT4, DXT5
 */
-uint32_t supported_fourcc[] = 
+static uint32_t supported_fourcc[] = 
 {
   IMGFMT_Y800, IMGFMT_Y8, IMGFMT_YVU9, IMGFMT_IF09,
   IMGFMT_YV12, IMGFMT_I420, IMGFMT_IYUV, 
@@ -1295,7 +1296,7 @@ inline static int is_supported_fourcc(ui
   return 0;
 }
 
-int vixQueryFourcc(vidix_fourcc_t *to)
+static int radeon_query_fourcc(vidix_fourcc_t *to)
 {
     if(is_supported_fourcc(to->fourcc))
     {
@@ -1803,7 +1804,7 @@ static void radeon_compute_framesize(vid
   }
 }
 
-int vixConfigPlayback(vidix_playback_t *info)
+static int radeon_config_playback(vidix_playback_t *info)
 {
   unsigned rgb_size,nfr;
   if(!is_supported_fourcc(info->fourcc)) return ENOSYS;
@@ -1844,19 +1845,19 @@ int vixConfigPlayback(vidix_playback_t *
   return 0;
 }
 
-int vixPlaybackOn( void )
+static int radeon_playback_on( void )
 {
   radeon_vid_display_video();
   return 0;
 }
 
-int vixPlaybackOff( void )
+static int radeon_playback_off( void )
 {
   radeon_vid_stop_video();
   return 0;
 }
 
-int vixPlaybackFrameSelect(unsigned frame)
+static int radeon_frame_select(unsigned frame)
 {
     uint32_t off[6];
     int prev_frame= (frame-1+besr.vid_nbufs) % besr.vid_nbufs;
@@ -1889,7 +1890,7 @@ int vixPlaybackFrameSelect(unsigned fram
     return 0;
 }
 
-vidix_video_eq_t equal =
+static vidix_video_eq_t equal =
 {
  VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION
 #ifndef RAGE128
@@ -1898,7 +1899,7 @@ vidix_video_eq_t equal =
  ,
  0, 0, 0, 0, 0, 0, 0, 0 };
 
-int 	vixPlaybackGetEq( vidix_video_eq_t * eq)
+static int radeon_get_eq( vidix_video_eq_t * eq)
 {
   memcpy(eq,&equal,sizeof(vidix_video_eq_t));
   return 0;
@@ -1913,7 +1914,7 @@ int 	vixPlaybackGetEq( vidix_video_eq_t 
 #define RTFCheckParam(a) {if((a)<-1000) (a)=-1000; if((a)>1000) (a)=1000;}
 #endif
 
-int 	vixPlaybackSetEq( const vidix_video_eq_t * eq)
+static int radeon_set_eq( const vidix_video_eq_t * eq)
 {
 #ifdef RAGE128
   int br,sat;
@@ -1958,7 +1959,7 @@ int 	vixPlaybackSetEq( const vidix_video
   return 0;
 }
 
-int 	vixPlaybackSetDeint( const vidix_deinterlace_t * info)
+static int radeon_playback_set_deint (const vidix_deinterlace_t * info)
 {
   unsigned sflg;
   switch(info->flags)
@@ -1996,7 +1997,7 @@ int 	vixPlaybackSetDeint( const vidix_de
   return 0;  
 }
 
-int 	vixPlaybackGetDeint( vidix_deinterlace_t * info)
+static int radeon_playback_get_deint (vidix_deinterlace_t * info)
 {
   if(!besr.deinterlace_on) info->flags = CFG_NON_INTERLACED;
   else
@@ -2087,15 +2088,42 @@ static void set_gr_key( void )
     OUTREG(OV0_KEY_CNTL,besr.ckey_cntl);
 }
 
-int vixGetGrKeys(vidix_grkey_t *grkey)
+static int radeon_get_gkey(vidix_grkey_t *grkey)
 {
     memcpy(grkey, &radeon_grkey, sizeof(vidix_grkey_t));
     return(0);
 }
 
-int vixSetGrKeys(const vidix_grkey_t *grkey)
+static int radeon_set_gkey(const vidix_grkey_t *grkey)
 {
     memcpy(&radeon_grkey, grkey, sizeof(vidix_grkey_t));
     set_gr_key();
     return(0);
 }
+
+#ifdef RAGE128
+VDXDriver rage128_drv = {
+  "rage128",
+#else
+VDXDriver radeon_drv = {
+  "radeon",
+#endif
+  NULL,
+    
+  .probe = radeon_probe,
+  .get_version = radeon_get_version,
+  .get_caps = radeon_get_caps,
+  .query_fourcc = radeon_query_fourcc,
+  .init = radeon_init,
+  .destroy = radeon_destroy,
+  .config_playback = radeon_config_playback,
+  .playback_on = radeon_playback_on,
+  .playback_off = radeon_playback_off,
+  .frame_sel = radeon_frame_select,
+  .get_eq = radeon_get_eq,
+  .set_eq = radeon_set_eq,
+  .get_deint = radeon_playback_get_deint,
+  .set_deint = radeon_playback_set_deint,
+  .get_gkey = radeon_get_gkey,
+  .set_gkey = radeon_set_gkey,
+};

Modified: trunk/vidix/savage_vid.c
==============================================================================
--- trunk/vidix/savage_vid.c	(original)
+++ trunk/vidix/savage_vid.c	Sun Apr  1 13:06:06 2007
@@ -39,6 +39,7 @@
 #include <math.h>
 
 #include "vidix.h"
+#include "vidixlib.h"
 #include "fourcc.h"
 #include "../libdha/libdha.h"
 #include "../libdha/pci_ids.h"
@@ -768,8 +769,8 @@ static void SavageStreamsOff(void)
  *
  * @return vidix version number.
  */
-unsigned int
-vixGetVersion (void)
+static unsigned int
+savage_get_version (void)
 {
   return (VIDIX_VERSION);
 }
@@ -803,7 +804,7 @@ static int find_chip(unsigned chip_id){
  *          a negative error code otherwise.
  */
 
-int vixProbe(int verbose, int force){
+static int savage_probe(int verbose, int force){
     pciinfo_t lst[MAX_PCI_DEVICES];
     unsigned i,num_pci;
     int err;
@@ -849,8 +850,8 @@ int vixProbe(int verbose, int force){
  * @returns 0 if ok.
  *          a negative error code otherwise.
  */
-int
-vixInit (void)
+static int
+savage_init (void)
 {
 	int mtrr;
   unsigned char config1, m, n, n1, n2, sr8, cr3f, cr66 = 0, tmp;
@@ -1033,8 +1034,8 @@ vixInit (void)
 /**
  * @brief Destroys driver.
  */
-void
-vixDestroy (void)
+static void
+savage_destroy (void)
 {
 	unmap_phys_mem(info->video_base, info->chip.fbsize);
 	unmap_phys_mem(info->control_base, SAVAGE_NEWMMIO_REGSIZE);
@@ -1048,8 +1049,8 @@ vixDestroy (void)
  *
  * @returns 0.
  */
-int
-vixGetCapability (vidix_capability_t * to)
+static int
+savage_get_caps (vidix_capability_t * to)
 {
   memcpy (to, &savage_cap, sizeof (vidix_capability_t));
   return 0;
@@ -1091,8 +1092,8 @@ is_supported_fourcc (uint32_t fourcc)
  * @returns 0 if ok.
  *          errno otherwise.
  */
-int
-vixQueryFourcc (vidix_fourcc_t * to)
+static int
+savage_query_fourcc (vidix_fourcc_t * to)
 {
   if (is_supported_fourcc (to->fourcc))
     {
@@ -1133,8 +1134,8 @@ vixGetGrKeys (vidix_grkey_t * grkey)
  *
  * @return 0.
  */
-int
-vixSetGrKeys (const vidix_grkey_t * grkey)
+static int
+savage_set_gkeys (const vidix_grkey_t * grkey)
 {
   if (grkey->ckey.op == CKEY_FALSE)
   {
@@ -1156,7 +1157,7 @@ vixSetGrKeys (const vidix_grkey_t * grke
 /**
  * @brief Unichrome driver equalizer capabilities.
  */
-vidix_video_eq_t equal = {
+static vidix_video_eq_t equal = {
   VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION | VEQ_CAP_HUE,
   300, 100, 0, 0, 0, 0, 0, 0
 };
@@ -1169,8 +1170,8 @@ vidix_video_eq_t equal = {
  *
  * @return 0.
  */
-int
-vixPlaybackGetEq (vidix_video_eq_t * eq)
+static int
+savage_get_eq (vidix_video_eq_t * eq)
 {
   memcpy (eq, &equal, sizeof (vidix_video_eq_t));
   return 0;
@@ -1183,8 +1184,8 @@ vixPlaybackGetEq (vidix_video_eq_t * eq)
  *
  * @return 0.
  */
-int
-vixPlaybackSetEq (const vidix_video_eq_t * eq)
+static int
+savage_set_eq (const vidix_video_eq_t * eq)
 {
   return 0;
 }
@@ -1202,8 +1203,8 @@ static int YOffs, UOffs, VOffs;
  * @returns  0 in case of success.
  *          -1 otherwise.
  */
-int
-vixConfigPlayback (vidix_playback_t * vinfo)
+static int
+savage_config_playback (vidix_playback_t * vinfo)
 {
   int uv_size, swap_uv;
   unsigned int i;
@@ -1325,8 +1326,8 @@ vixConfigPlayback (vidix_playback_t * vi
  *
  * @return 0.
  */
-int
-vixPlaybackOn (void)
+static int
+savage_playback_on (void)
 {
  // FIXME: enable
   SavageDisplayVideoOld();
@@ -1339,8 +1340,8 @@ vixPlaybackOn (void)
  *
  * @return 0.
  */
-int
-vixPlaybackOff (void)
+static int
+savage_playback_off (void)
 {
 	// otherwise we wont disable streams properly in new xorg
 	// FIXME: shouldnt this be enabled?
@@ -1365,8 +1366,8 @@ vixPlaybackOff (void)
  *       and never used for single buffering playback.
  */
 #if 0
-int
-vixPlaybackFrameSelect (unsigned int frame)
+static int
+savage_frame_select (unsigned int frame)
 {
 ////FIXME ADD
 //    savage_overlay_start(info, frame);
@@ -1472,4 +1473,22 @@ void debugout(unsigned int addr, unsigne
     fprintf(stderr,":\t\t 0x%08X = %u\n",val,val);
 }
 
-
+VDXDriver savage_drv = {
+  "savage",
+  NULL,
+  .probe = savage_probe,
+  .get_version = savage_get_version,
+  .get_caps = savage_get_caps,
+  .query_fourcc = savage_query_fourcc,
+  .init = savage_init,
+  .destroy = savage_destroy,
+  .config_playback = savage_config_playback,
+  .playback_on = savage_playback_on,
+  .playback_off = savage_playback_off,
+#if 0
+  .frame_sel = savage_frame_select,
+#endif
+  .get_eq = savage_get_eq,
+  .set_eq = savage_set_eq,
+  .set_gkey = savage_set_gkeys,
+};

Modified: trunk/vidix/sis_vid.c
==============================================================================
--- trunk/vidix/sis_vid.c	(original)
+++ trunk/vidix/sis_vid.c	Sun Apr  1 13:06:06 2007
@@ -31,6 +31,7 @@
 #include <unistd.h>
 
 #include "vidix.h"
+#include "vidixlib.h"
 #include "fourcc.h"
 #include "../libdha/libdha.h"
 #include "../libdha/pci_ids.h"
@@ -148,7 +149,7 @@ static vidix_capability_t sis_cap = {
     {0, 0, 0, 0}
 };
 
-vidix_video_eq_t sis_equal = {
+static vidix_video_eq_t sis_equal = {
     VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST,
     200, 0, 0, 0, 0, 0, 0, 0
 };
@@ -237,7 +238,7 @@ static uint8_t vblank_active_CRT2(void)
 }
 
 
-unsigned int vixGetVersion(void)
+static unsigned int sis_get_version(void)
 {
     return (VIDIX_VERSION);
 }
@@ -252,7 +253,7 @@ static int find_chip(unsigned chip_id)
     return -1;
 }
 
-int vixProbe(int verbose, int force)
+static int sis_probe(int verbose, int force)
 {
     pciinfo_t lst[MAX_PCI_DEVICES];
     unsigned i, num_pci;
@@ -343,7 +344,7 @@ int vixProbe(int verbose, int force)
     return err;
 }
 
-int vixInit(void)
+static int sis_init(void)
 {
     uint8_t sr_data, cr_data, cr_data2;
     char *env_overlay_crt;
@@ -406,14 +407,14 @@ int vixInit(void)
     return 0;
 }
 
-void vixDestroy(void)
+static void sis_destroy(void)
 {
     /* unmap_phys_mem(sis_reg_base, 0x20000); */
     /* JCP: see above, hence also a hack. */
     unmap_phys_mem(sis_mem_base, 0x1000000);
 }
 
-int vixGetCapability(vidix_capability_t * to)
+static int sis_get_caps(vidix_capability_t * to)
 {
     memcpy(to, &sis_cap, sizeof(vidix_capability_t));
     return 0;
@@ -434,7 +435,7 @@ static int is_supported_fourcc(uint32_t 
     }
 }
 
-int vixQueryFourcc(vidix_fourcc_t * to)
+static int sis_query_fourcc(vidix_fourcc_t * to)
 {
     if (is_supported_fourcc(to->fourcc)) {
 	to->depth = VID_DEPTH_8BPP | VID_DEPTH_16BPP | VID_DEPTH_32BPP;
@@ -595,7 +596,9 @@ static void init_overlay(void)
     }
 }
 
-int vixConfigPlayback(vidix_playback_t * info)
+static int sis_set_eq(const vidix_video_eq_t * eq);
+
+static int sis_config_playback(vidix_playback_t * info)
 {
     SISOverlayRec overlay;
     int srcOffsetX = 0, srcOffsetY = 0;
@@ -822,7 +825,7 @@ int vixConfigPlayback(vidix_playback_t *
 
     set_colorkey();
 
-    vixPlaybackSetEq(&sis_equal);
+    sis_set_eq(&sis_equal);
 
     /* set up video overlay registers */
     set_overlay(&overlay, index);
@@ -837,13 +840,13 @@ int vixConfigPlayback(vidix_playback_t *
     return 0;
 }
 
-int vixPlaybackOn(void)
+static int sis_playback_on(void)
 {
     setvideoregmask(Index_VI_Control_Misc0, 0x02, 0x02);
     return 0;
 }
 
-int vixPlaybackOff(void)
+static int sis_playback_off(void)
 {
     unsigned char sridx, cridx;
     sridx = inSISREG(SISSR);
@@ -855,7 +858,7 @@ int vixPlaybackOff(void)
     return 0;
 }
 
-int vixPlaybackFrameSelect(unsigned int frame)
+static int sis_frame_select(unsigned int frame)
 {
     uint8_t data;
     int index = 0;
@@ -925,26 +928,26 @@ int vixPlaybackFrameSelect(unsigned int 
     return 0;
 }
 
-int vixGetGrKeys(vidix_grkey_t * grkey)
+static int sis_get_gkeys(vidix_grkey_t * grkey)
 {
     memcpy(grkey, &sis_grkey, sizeof(vidix_grkey_t));
     return 0;
 }
 
-int vixSetGrKeys(const vidix_grkey_t * grkey)
+static int sis_set_gkeys(const vidix_grkey_t * grkey)
 {
     memcpy(&sis_grkey, grkey, sizeof(vidix_grkey_t));
     set_colorkey();
     return 0;
 }
 
-int vixPlaybackGetEq(vidix_video_eq_t * eq)
+static int sis_get_eq(vidix_video_eq_t * eq)
 {
     memcpy(eq, &sis_equal, sizeof(vidix_video_eq_t));
     return 0;
 }
 
-int vixPlaybackSetEq(const vidix_video_eq_t * eq)
+static int sis_set_eq(const vidix_video_eq_t * eq)
 {
     int br, sat, cr, hue;
     if (eq->cap & VEQ_CAP_BRIGHTNESS)
@@ -1558,3 +1561,23 @@ static void set_alpha(uint8_t alpha)
     setvideoreg(Index_VI_Key_Overlay_OP, data | (alpha << 4));
 }
 #endif
+
+VDXDriver sis_drv = {
+  "sis",
+  NULL,
+    
+  .probe = sis_probe,
+  .get_version = sis_get_version,
+  .get_caps = sis_get_caps,
+  .query_fourcc = sis_query_fourcc,
+  .init = sis_init,
+  .destroy = sis_destroy,
+  .config_playback = sis_config_playback,
+  .playback_on = sis_playback_on,
+  .playback_off = sis_playback_off,
+  .frame_sel = sis_frame_select,
+  .get_eq = sis_get_eq,
+  .set_eq = sis_set_eq,
+  .get_gkey = sis_get_gkeys,
+  .set_gkey = sis_set_gkeys,
+};

Modified: trunk/vidix/unichrome_vid.c
==============================================================================
--- trunk/vidix/unichrome_vid.c	(original)
+++ trunk/vidix/unichrome_vid.c	Sun Apr  1 13:06:06 2007
@@ -40,6 +40,7 @@
 #include <unistd.h>
 
 #include "vidix.h"
+#include "vidixlib.h"
 #include "fourcc.h"
 #include "../libdha/libdha.h"
 #include "../libdha/pci_ids.h"
@@ -120,8 +121,8 @@ static unsigned short uc_card_ids[] = {
  *
  * @return vidix version number.
  */
-unsigned int
-vixGetVersion (void)
+static unsigned int
+unichrome_get_version (void)
 {
   return (VIDIX_VERSION);
 }
@@ -474,8 +475,8 @@ uc_ovl_vcmd_wait (volatile uint8_t * vio
  * @returns 0 if it can handle something in PC.
  *          a negative error code otherwise.
  */
-int
-vixProbe (int verbose, int force)
+static int
+unichrome_probe (int verbose, int force)
 {
   pciinfo_t lst[MAX_PCI_DEVICES];
   unsigned i, num_pci;
@@ -526,8 +527,8 @@ vixProbe (int verbose, int force)
  * @returns 0 if ok.
  *          a negative error code otherwise.
  */
-int
-vixInit (void)
+static int
+unichrome_init (void)
 {
   long tmp;
   uc_mem = map_phys_mem (pci_info.base0, VIDEOMEMORY_SIZE);
@@ -576,8 +577,8 @@ vixInit (void)
 /**
  * @brief Destroys driver.
  */
-void
-vixDestroy (void)
+static void
+unichrome_destroy (void)
 {
 #ifdef DEBUG_LOGFILE
   if (logfile)
@@ -602,8 +603,8 @@ vixDestroy (void)
  *
  * @returns 0.
  */
-int
-vixGetCapability (vidix_capability_t * to)
+static int
+unichrome_get_caps (vidix_capability_t * to)
 {
   memcpy (to, &uc_cap, sizeof (vidix_capability_t));
   return 0;
@@ -644,8 +645,8 @@ is_supported_fourcc (uint32_t fourcc)
  * @returns 0 if ok.
  *          errno otherwise.
  */
-int
-vixQueryFourcc (vidix_fourcc_t * to)
+static int
+unichrome_query_fourcc (vidix_fourcc_t * to)
 {
   if (is_supported_fourcc (to->fourcc))
     {
@@ -668,8 +669,8 @@ vixQueryFourcc (vidix_fourcc_t * to)
  *
  * @return 0.
  */
-int
-vixGetGrKeys (vidix_grkey_t * grkey)
+static int
+unichrome_get_gkey (vidix_grkey_t * grkey)
 {
   memcpy (grkey, &uc_grkey, sizeof (vidix_grkey_t));
   return (0);
@@ -682,8 +683,8 @@ vixGetGrKeys (vidix_grkey_t * grkey)
  *
  * @return 0.
  */
-int
-vixSetGrKeys (const vidix_grkey_t * grkey)
+static int
+unichrome_set_gkey (const vidix_grkey_t * grkey)
 {
   unsigned long dwCompose = VIDEO_IN (vio, V_COMPOSE_MODE) & ~0x0f;
   memcpy (&uc_grkey, grkey, sizeof (vidix_grkey_t));
@@ -714,7 +715,7 @@ vixSetGrKeys (const vidix_grkey_t * grke
 /**
  * @brief Unichrome driver equalizer capabilities.
  */
-vidix_video_eq_t equal = {
+static vidix_video_eq_t equal = {
   VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION | VEQ_CAP_HUE,
   300, 100, 0, 0, 0, 0, 0, 0
 };
@@ -727,8 +728,8 @@ vidix_video_eq_t equal = {
  *
  * @return 0.
  */
-int
-vixPlaybackGetEq (vidix_video_eq_t * eq)
+static int
+unichrome_get_eq (vidix_video_eq_t * eq)
 {
   memcpy (eq, &equal, sizeof (vidix_video_eq_t));
   return 0;
@@ -741,8 +742,8 @@ vixPlaybackGetEq (vidix_video_eq_t * eq)
  *
  * @return 0.
  */
-int
-vixPlaybackSetEq (const vidix_video_eq_t * eq)
+static int
+unichrome_set_eq (const vidix_video_eq_t * eq)
 {
   return 0;
 }
@@ -752,6 +753,8 @@ vixPlaybackSetEq (const vidix_video_eq_t
  */
 static int YOffs, UOffs, VOffs;
 
+static int unichrome_frame_select (unsigned int frame);
+
 /**
  * @brief Configure driver for playback. Driver should prepare BES.
  *
@@ -760,8 +763,8 @@ static int YOffs, UOffs, VOffs;
  * @returns  0 in case of success.
  *          -1 otherwise.
  */
-int
-vixConfigPlayback (vidix_playback_t * info)
+static int
+unichrome_config_playback (vidix_playback_t * info)
 {
   int src_w, drw_w;
   int src_h, drw_h;
@@ -896,7 +899,7 @@ vixConfigPlayback (vidix_playback_t * in
   VIDEO_OUT (vio, V1_ZOOM_CONTROL, zoom);
 
   /* Configure buffer address and execute the changes now! */
-  vixPlaybackFrameSelect (0);
+  unichrome_frame_select (0);
 
   return 0;
 }
@@ -906,8 +909,8 @@ vixConfigPlayback (vidix_playback_t * in
  *
  * @return 0.
  */
-int
-vixPlaybackOn (void)
+static int
+unichrome_playback_on (void)
 {
   LOGWRITE ("Enable overlay\n");
 
@@ -926,8 +929,8 @@ vixPlaybackOn (void)
  *
  * @return 0.
  */
-int
-vixPlaybackOff (void)
+static int
+unichrome_playback_off (void)
 {
   LOGWRITE ("Disable overlay\n");
 
@@ -956,8 +959,8 @@ vixPlaybackOff (void)
  * @note This function is used only for double and triple buffering
  *       and never used for single buffering playback.
  */
-int
-vixPlaybackFrameSelect (unsigned int frame)
+static int
+unichrome_frame_select (unsigned int frame)
 {
   LOGWRITE ("Frame select\n");
 
@@ -974,3 +977,22 @@ vixPlaybackFrameSelect (unsigned int fra
 
   return 0;
 }
+
+VDXDriver unichrome_drv = {
+  "unichrome",
+  NULL,
+  .probe = unichrome_probe,
+  .get_version = unichrome_get_version,
+  .get_caps = unichrome_get_caps,
+  .query_fourcc = unichrome_query_fourcc,
+  .init = unichrome_init,
+  .destroy = unichrome_destroy,
+  .config_playback = unichrome_config_playback,
+  .playback_on = unichrome_playback_on,
+  .playback_off = unichrome_playback_off,
+  .frame_sel = unichrome_frame_select,
+  .get_eq = unichrome_get_eq,
+  .set_eq = unichrome_set_eq,
+  .get_gkey = unichrome_get_gkey,
+  .set_gkey = unichrome_set_gkey,
+};

Modified: trunk/vidix/vidixlib.c
==============================================================================
--- trunk/vidix/vidixlib.c	(original)
+++ trunk/vidix/vidixlib.c	Sun Apr  1 13:06:06 2007
@@ -21,238 +21,81 @@
 #include <errno.h>
 #include <string.h>
 
-#ifndef WIN32
-#include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */
-#else
-#include <windows.h>
-#define dlsym(h,s) GetProcAddress(h,s)
-#define dlopen(h,s) LoadLibrary(h)
-#define dlclose(h) FreeLibrary(h)
-static char* dlerror(){
- char errormsg[10];
- sprintf(errormsg,"%i\n",GetLastError());
- return errormsg;
-}
-#endif
-
-
-#include <dirent.h>
-
-#if defined(__OpenBSD__) && !defined(__ELF__)
-#define dlsym(h,s) dlsym(h, "_" s)
-#endif
-
 #include "vidixlib.h"
+#include "drivers.h"
 #include "../config.h"
 #include "../libavutil/common.h"
 #include "../mpbswap.h"
 
-static char drv_name[FILENAME_MAX];
-
-typedef struct vdl_stream_s
-{
-	void *  handle;
-	int	(*get_caps)(vidix_capability_t *);
-	int	(*query_fourcc)(vidix_fourcc_t *);
-	int	(*config_playback)(vidix_playback_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 	(*get_deint)( vidix_deinterlace_t * );
-	int 	(*set_deint)( const vidix_deinterlace_t * );
-	int 	(*copy_frame)( const vidix_dma_t * );
-	int 	(*get_gkey)( vidix_grkey_t * );
-	int 	(*set_gkey)( const vidix_grkey_t * );
-	int 	(*get_num_fx)( unsigned * );
-	int 	(*get_fx)( vidix_oem_fx_t * );
-	int 	(*set_fx)( const vidix_oem_fx_t * );
-}vdl_stream_t;
-
-#define t_vdl(p) (((vdl_stream_t *)p))
-
-extern unsigned   vdlGetVersion( void )
+extern unsigned int  vdlGetVersion( void )
 {
    return VIDIX_VERSION;
 }
 
-static int vdl_fill_driver(VDL_HANDLE stream)
+VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap,int verbose)
 {
-  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)->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)->get_gkey	= dlsym(t_vdl(stream)->handle,"vixGetGrKeys");
-  t_vdl(stream)->set_gkey	= dlsym(t_vdl(stream)->handle,"vixSetGrKeys");
-  t_vdl(stream)->get_deint	= dlsym(t_vdl(stream)->handle,"vixPlaybackGetDeint");
-  t_vdl(stream)->set_deint	= dlsym(t_vdl(stream)->handle,"vixPlaybackSetDeint");
-  t_vdl(stream)->copy_frame	= dlsym(t_vdl(stream)->handle,"vixPlaybackCopyFrame");
-  t_vdl(stream)->get_num_fx	= dlsym(t_vdl(stream)->handle,"vixQueryNumOemEffects");
-  t_vdl(stream)->get_fx		= dlsym(t_vdl(stream)->handle,"vixGetOemEffect");
-  t_vdl(stream)->set_fx		= dlsym(t_vdl(stream)->handle,"vixSetOemEffect");
-  /* check driver viability */
-  if(!( t_vdl(stream)->get_caps && t_vdl(stream)->query_fourcc &&
-	t_vdl(stream)->config_playback && t_vdl(stream)->playback_on &&
-	t_vdl(stream)->playback_off))
-  {
-    printf("vidixlib: Incomplete driver: some of essential features are missed in it.\n");
-    return 0;
-  }
-  return 1;
-}
+  VDXContext *ctx;
 
-#ifndef RTLD_GLOBAL
-#define RTLD_GLOBAL RTLD_LAZY
-#endif
-#ifndef RTLD_NOW
-#define RTLD_NOW RTLD_LAZY
-#endif
+  if (!(ctx = malloc (sizeof (VDXContext))))
+    return NULL;
+  memset (ctx, 0, sizeof (VDXContext));
 
-static int vdl_probe_driver(VDL_HANDLE stream,const char *path,const char *name,unsigned cap,int verbose)
-{
-  vidix_capability_t vid_cap;
-  unsigned (*_ver)(void);
-  int      (*_probe)(int,int);
-  int      (*_cap)(vidix_capability_t*);
-  strlcpy(drv_name,path, sizeof( drv_name ));
-  strlcat(drv_name,name, sizeof( drv_name ));
-  if(verbose) printf("vidixlib: PROBING: %s\n",drv_name);
-  if(!(t_vdl(stream)->handle = dlopen(drv_name,RTLD_LAZY|RTLD_GLOBAL)))
-  {
-    if(verbose) printf("vidixlib: %s not driver: %s\n",drv_name,dlerror());
-    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) 
-    { 
-      if(verbose) printf("vidixlib: %s has wrong version\n",drv_name);
-      err:
-      dlclose(t_vdl(stream)->handle);
-      t_vdl(stream)->handle = 0;
-      return 0;
-     }
-  }
-  else
-  {
-    fatal_err:
-    if(verbose) printf("vidixlib: %s has no function definition\n",drv_name);
-    goto err;
-  }
-  if(_probe) { if((*_probe)(verbose,PROBE_NORMAL) != 0) goto err; }
-  else goto fatal_err;
-  if(_cap) { if((*_cap)(&vid_cap) != 0) goto err; }
-  else goto fatal_err;
-  if((vid_cap.type & cap) != cap)
+  /* register all drivers */
+  vidix_register_all_drivers ();
+  
+  if (!vidix_find_driver (ctx, name, cap, verbose))
   {
-     if(verbose) printf("vidixlib: Found %s but has no required capability\n",drv_name);
-     goto err;
+    free (ctx);
+    return NULL;
   }
-  if(verbose) printf("vidixlib: %s probed o'k\n",drv_name);
-  return 1;
-}
 
-static int vdl_find_driver(VDL_HANDLE stream,const char *path,unsigned cap,int verbose)
-{
-  DIR *dstream;
-  struct dirent *name;
-  int done = 0;
-  if(!(dstream = opendir(path))) return 0;
-  while(!done)
+  if (verbose)
+    printf ("vidixlib: will use %s driver\n", ctx->drv->name);
+
+  if (!ctx->drv || !ctx->drv->init)
   {
-    name = readdir(dstream);
-    if(name) 
-    { 
-      if(name->d_name[0] != '.')
-	if(vdl_probe_driver(stream,path,name->d_name,cap,verbose)) break; 
-    }
-    else done = 1;
+    if (verbose)
+      printf ("vidixlib: Can't init driver\n");
+    free (ctx);
+    return NULL;
   }
-  closedir(dstream);
-  return done?0:1;
-}
+  
+  if (verbose)
+    printf ("vidixlib: Attempt to initialize driver at: %p\n",
+            ctx->drv->init);
 
-VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap,int verbose)
-{
-  vdl_stream_t *stream;
-  int errcode;
-  if(!(stream = malloc(sizeof(vdl_stream_t)))) return NULL;
-  memset(stream,0,sizeof(vdl_stream_t));
-  if(name)
+  if (ctx->drv->init () !=0)
   {
-    unsigned (*ver)(void);
-    int (*probe)(int,int);
-    unsigned version = 0;
-    strlcpy(drv_name,path, sizeof( drv_name ));
-    strlcat(drv_name,name, sizeof( drv_name ));
-    if(!(t_vdl(stream)->handle = dlopen(drv_name,RTLD_NOW|RTLD_GLOBAL)))
-    {
-      if (verbose)
-	printf("vidixlib: dlopen error: %s\n", dlerror());
-      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;
-    }
-    probe = dlsym(t_vdl(stream)->handle,"vixProbe");
-    if(probe) { if((*probe)(verbose,PROBE_FORCE)!=0) goto drv_err; }
-    else goto drv_err;
-    fill:
-    if(!vdl_fill_driver(stream)) goto drv_err;
-    goto ok;
+    if (verbose)
+      printf ("vidixlib: Can't init driver\n");
+    free (ctx);
+    return NULL;
   }
-  else
-    if(vdl_find_driver(stream,path,cap,verbose))
-    {
-      if(verbose) printf("vidixlib: will use %s driver\n",drv_name);
-      goto fill;
-    }  
-    else goto err;
-  ok:
-  if(t_vdl(stream)->init)
-  {
-   if(verbose) printf("vidixlib: Attempt to initialize driver at: %p\n",t_vdl(stream)->init);
-   if((errcode=t_vdl(stream)->init())!=0)
-   {
-    if(verbose) printf("vidixlib: Can't init driver: %s\n",strerror(errcode));
-    goto drv_err;
-   }
-  } 
-  if(verbose) printf("vidixlib: '%s'successfully loaded\n",drv_name);
-  return stream;
+  
+  if (verbose)
+    printf("vidixlib: '%s'successfully loaded\n", ctx->drv->name);
+  
+  return ctx;
 }
 
 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);
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) stream;
+  if (ctx->drv->destroy)
+    ctx->drv->destroy ();
+  
+  memset (ctx, 0, sizeof (VDXContext)); /* <- it's not stupid */
+  free (ctx);
 }
 
 int  vdlGetCapability(VDL_HANDLE handle, vidix_capability_t *cap)
 {
-  return t_vdl(handle)->get_caps(cap);
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  return ctx->drv->get_caps (cap);
 }
 
 #define MPLAYER_IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8))
@@ -269,77 +112,155 @@ static uint32_t normalize_fourcc(uint32_
 
 int  vdlQueryFourcc(VDL_HANDLE handle,vidix_fourcc_t *f)
 {
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
   f->fourcc = normalize_fourcc(f->fourcc);
-  return t_vdl(handle)->query_fourcc(f);
+  return ctx->drv->query_fourcc (f);
 }
 
 int  vdlConfigPlayback(VDL_HANDLE handle,vidix_playback_t *p)
 {
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
   p->fourcc = normalize_fourcc(p->fourcc);
-  return t_vdl(handle)->config_playback(p);
+  return ctx->drv->config_playback (p);
 }
 
 int  vdlPlaybackOn(VDL_HANDLE handle)
 {
-  return t_vdl(handle)->playback_on();
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  return ctx->drv->playback_on ();
 }
 
 int  vdlPlaybackOff(VDL_HANDLE handle)
 {
-  return t_vdl(handle)->playback_off();
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  return ctx->drv->playback_off ();
 }
 
 int  vdlPlaybackFrameSelect(VDL_HANDLE handle, unsigned frame_idx )
 {
-  return t_vdl(handle)->frame_sel ? t_vdl(handle)->frame_sel(frame_idx) : ENOSYS;
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  if (ctx->drv->frame_sel)
+    return ctx->drv->frame_sel (frame_idx);
+
+  return ENOSYS;
 }
 
 int  vdlPlaybackGetEq(VDL_HANDLE handle, vidix_video_eq_t * e)
 {
-  return t_vdl(handle)->get_eq ? t_vdl(handle)->get_eq(e) : ENOSYS;
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  if (ctx->drv->get_eq)
+    return ctx->drv->get_eq (e);
+
+  return 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;
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  if (ctx->drv->set_eq)
+    return ctx->drv->set_eq (e);
+
+  return ENOSYS;
 }
 
 int  vdlPlaybackCopyFrame(VDL_HANDLE handle, const vidix_dma_t * f)
 {
-  return t_vdl(handle)->copy_frame ? t_vdl(handle)->copy_frame(f) : ENOSYS;
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  if (ctx->drv->copy_frame)
+    return ctx->drv->copy_frame (f);
+
+  return ENOSYS;
 }
 
 int 	  vdlGetGrKeys(VDL_HANDLE handle, vidix_grkey_t * k)
 {
-  return t_vdl(handle)->get_gkey ? t_vdl(handle)->get_gkey(k) : ENOSYS;
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  if (ctx->drv->get_gkey)
+    return ctx->drv->get_gkey (k);
+
+  return ENOSYS;
 }
 
 int 	  vdlSetGrKeys(VDL_HANDLE handle, const vidix_grkey_t * k)
 {
-  return t_vdl(handle)->set_gkey ? t_vdl(handle)->set_gkey(k) : ENOSYS;
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  if (ctx->drv->set_gkey)
+    return ctx->drv->set_gkey (k);
+
+  return ENOSYS;
 }
 
 int	  vdlPlaybackGetDeint(VDL_HANDLE handle, vidix_deinterlace_t * d)
 {
-  return t_vdl(handle)->get_deint ? t_vdl(handle)->get_deint(d) : ENOSYS;
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  if (ctx->drv->get_deint)
+    return ctx->drv->get_deint (d);
+
+  return ENOSYS;
 }
 
 int 	  vdlPlaybackSetDeint(VDL_HANDLE handle, const vidix_deinterlace_t * d)
 {
-  return t_vdl(handle)->set_deint ? t_vdl(handle)->set_deint(d) : ENOSYS;
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  if (ctx->drv->set_deint)
+    return ctx->drv->set_deint (d);
+
+  return ENOSYS;
 }
 
 int	  vdlQueryNumOemEffects(VDL_HANDLE handle, unsigned * number )
 {
-  return t_vdl(handle)->get_num_fx ? t_vdl(handle)->get_num_fx(number) : ENOSYS;
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  if (ctx->drv->get_num_fx)
+    return ctx->drv->get_num_fx (number);
+
+  return ENOSYS;
 }
 
 int	  vdlGetOemEffect(VDL_HANDLE handle, vidix_oem_fx_t * f)
 {
-  return t_vdl(handle)->get_fx ? t_vdl(handle)->get_fx(f) : ENOSYS;
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  if (ctx->drv->get_fx)
+    return ctx->drv->get_fx (f);
+
+  return ENOSYS;
 }
 
 int	  vdlSetOemEffect(VDL_HANDLE handle, const vidix_oem_fx_t * f)
 {
-  return t_vdl(handle)->set_fx ? t_vdl(handle)->set_fx(f) : ENOSYS;
+  VDXContext *ctx;
+
+  ctx = (VDXContext *) handle;
+  if (ctx->drv->set_fx)
+    return ctx->drv->set_fx (f);
+
+  return ENOSYS;
 }

Modified: trunk/vidix/vidixlib.h
==============================================================================
--- trunk/vidix/vidixlib.h	(original)
+++ trunk/vidix/vidixlib.h	Sun Apr  1 13:06:06 2007
@@ -25,6 +25,37 @@ extern "C" {
 
 #include "vidix.h"
 
+typedef struct VDXDriver {
+  const char *name;
+  struct VDXDriver *next;
+  int (* probe) (int verbose, int force);
+  unsigned int (* get_version)(void);
+  int (* get_caps) (vidix_capability_t *cap);
+  int (*query_fourcc)(vidix_fourcc_t *);
+  int (*init)(void);
+  void (*destroy)(void);
+  int (*config_playback)(vidix_playback_t *);
+  int (*playback_on)( void );
+  int (*playback_off)( void );
+  /* Functions below can be missed in driver ;) */
+  int (*frame_sel)( unsigned frame_idx );
+  int (*get_eq)( vidix_video_eq_t * );
+  int (*set_eq)( const vidix_video_eq_t * );
+  int (*get_deint)( vidix_deinterlace_t * );
+  int (*set_deint)( const vidix_deinterlace_t * );
+  int (*copy_frame)( const vidix_dma_t * );
+  int (*get_gkey)( vidix_grkey_t * );
+  int (*set_gkey)( const vidix_grkey_t * );
+  int (*get_num_fx)( unsigned * );
+  int (*get_fx)( vidix_oem_fx_t * );
+  int (*set_fx)( const vidix_oem_fx_t * );
+} VDXDriver;
+
+typedef struct VDXContext {
+  VDXDriver *drv;
+  /* might be filled in by much more info later on */
+} VDXContext;
+
 typedef void * VDL_HANDLE;
 
 			/* returns library version */



More information about the MPlayer-cvslog mailing list