changeset 4030:922241968c63

Embedding vidix
author nick
date Mon, 07 Jan 2002 09:28:22 +0000
parents 3c87dee7a324
children 8b8569b255d0
files Makefile libdha/Makefile libvo/Makefile libvo/vo_vesa.c vidix/Makefile vidix/drivers/Makefile vidix/drivers/radeon_vid.c
diffstat 7 files changed, 77 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Mon Jan 07 09:22:01 2002 +0000
+++ b/Makefile	Mon Jan 07 09:28:22 2002 +0000
@@ -13,6 +13,9 @@
 PRG_TV = tvision
 PRG_CFG = codec-cfg
 PRG_MENCODER = mencoder
+# these subdirectories required installation due binaries within them
+SUBDIRS = libdha vidix
+DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
 
 #prefix = /usr/local
 BINDIR = ${prefix}/bin
@@ -42,11 +45,12 @@
 A_LIBS = $(ALSA_LIB) $(NAS_LIB) $(MAD_LIB) $(VORBIS_LIB) $(SGIAUDIO_LIB)
 
 CODEC_LIBS = -Lg72x -lg72x -Lmp3lib -lMP3 -Llibac3 -lac3 -Lliba52 -la52 -Lxa -lxa -Llibmpeg2 -lmpeg2 $(AV_LIB)
-COMMON_LIBS = -Llinux -losdep -Lpostproc -lpostproc
+COMMON_LIBS = -Llinux -losdep -Lpostproc -lpostproc -Lvidix -lvidix
+MISC_LIBS = -Llibdha -ldha
 
 CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader $(VO_INC) $(EXTRA_INC) # -Wall
 
-PARTS = g72x libmpdemux mp3lib libac3 liba52 libmp1e libmpeg2 opendivx libavcodec libao2 drivers drivers/syncfb linux postproc xa
+PARTS = g72x libmpdemux mp3lib libac3 liba52 libmp1e libmpeg2 opendivx libavcodec libao2 drivers drivers/syncfb linux postproc xa libdha vidix
 ifeq ($(VO2),yes)
 PARTS += libvo2
 else
@@ -85,7 +89,7 @@
 .c.o:
 	$(CC) -c $(CFLAGS) -o $@ $<
 
-COMMON_DEPS = g72x/libg72x.a libmpdemux/libmpdemux.a libao2/libao2.a libac3/libac3.a liba52/liba52.a mp3lib/libMP3.a libmpeg2/libmpeg2.a opendivx/libdecore.a linux/libosdep.a postproc/libpostproc.a xa/libxa.a
+COMMON_DEPS = g72x/libg72x.a libmpdemux/libmpdemux.a libao2/libao2.a libac3/libac3.a liba52/liba52.a mp3lib/libMP3.a libmpeg2/libmpeg2.a opendivx/libdecore.a linux/libosdep.a postproc/libpostproc.a libdha/libdha.so vidix/libvidix.a xa/libxa.a
 
 ifeq ($(VO2),yes)
 COMMON_DEPS += libvo2/libvo2.a
@@ -135,6 +139,12 @@
 opendivx/libdecore.a:
 	$(MAKE) -C opendivx
 
+libdha/libdha.so:
+	$(MAKE) -C libdha
+
+vidix/libvidix.a:
+	$(MAKE) -C vidix
+
 # encore/libencore.a:
 # 	$(MAKE) -C encore
 
@@ -162,8 +172,10 @@
 GUI_LIBS = -LGui -lgui
 endif
 
+VIDIX_LIBS = -Lvidix -lvidix
+
 $(PRG):	$(MPLAYER_DEP)
-	$(CC) $(CFLAGS) -o $(PRG) $(OBJS_MPLAYER) $(CODEC_LIBS) -Llibmpdemux -lmpdemux $(VO_LIBS) $(AO_LIBS) $(LIB_LOADER) $(GUI_LIBS) $(COMMON_LIBS) $(EXTRA_LIB) $(A_LIBS) $(V_LIBS) $(LIRC_LIB) $(CSS_LIB) $(ARCH_LIB) $(DECORE_LIB) $(TERMCAP_LIB) $(STATIC_LIB) $(GTK_LIBS) $(PNG_LIB) $(Z_LIB) $(STREAMING_LIB) -lm
+	$(CC) $(CFLAGS) -o $(PRG) $(OBJS_MPLAYER) $(CODEC_LIBS) -Llibmpdemux -lmpdemux $(VO_LIBS) $(AO_LIBS) $(LIB_LOADER) $(GUI_LIBS) $(COMMON_LIBS) $(EXTRA_LIB) $(A_LIBS) $(V_LIBS) $(LIRC_LIB) $(CSS_LIB) $(ARCH_LIB) $(DECORE_LIB) $(TERMCAP_LIB) $(STATIC_LIB) $(GTK_LIBS) $(PNG_LIB) $(Z_LIB) $(STREAMING_LIB) $(VIDIX_LIBS) -lm
 
 $(PRG_FIBMAP): fibmap_mplayer.o
 	$(CC) -o $(PRG_FIBMAP) fibmap_mplayer.o
@@ -185,6 +197,7 @@
 	$(CC) $(CFLAGS) -g codec-cfg.c -o $(PRG_CFG) -DCODECS2HTML
 
 install: $(ALL_PRG)
+	$(DO_MAKE)
 	if test ! -d $(BINDIR) ; then mkdir -p $(BINDIR) ; fi
 	$(INSTALL) -m 755 -s $(PRG) $(BINDIR)/$(PRG)
 ifeq ($(GUI),yes)
--- a/libdha/Makefile	Mon Jan 07 09:22:01 2002 +0000
+++ b/libdha/Makefile	Mon Jan 07 09:28:22 2002 +0000
@@ -41,7 +41,7 @@
 
 install:
 	cp $(LIBNAME) $(prefix)/lib/$(LIBNAME)
-	rm $(prefix)/lib/libdha.so
+	rm -f $(prefix)/lib/libdha.so
 	ln -sf $(LIBNAME) $(prefix)/lib/libdha.so
 	ldconfig
 
--- a/libvo/Makefile	Mon Jan 07 09:22:01 2002 +0000
+++ b/libvo/Makefile	Mon Jan 07 09:28:22 2002 +0000
@@ -3,10 +3,10 @@
 
 LIBNAME = libvo.a
 
-SRCS=aspect.c aclib.c osd.c font_load.c video_out.c vo_null.c vo_pgm.c vo_md5.c vo_mpegpes.c x11_common.c $(OPTIONAL_SRCS) img_format.c
+SRCS=aspect.c aclib.c osd.c font_load.c video_out.c vo_null.c vo_pgm.c vo_md5.c vo_mpegpes.c x11_common.c $(OPTIONAL_SRCS) img_format.c vosub_vidix.c
 OBJS=$(SRCS:.c=.o)
 
-CFLAGS  = $(OPTFLAGS) -I. -I.. $(SDL_INC) $(X11_INC) $(EXTRA_INC) $(DVB_INC) -DMPG12PLAY #-Wall
+CFLAGS  = $(OPTFLAGS) -I. -I.. $(SDL_INC) $(X11_INC) $(EXTRA_INC) $(DVB_INC) -DMPG12PLAY -DVIDIX_PATH='"$(prefix)/lib/mplayer/vidix/"' #-Wall
 # -I/usr/X11R6/include/
 
 .SUFFIXES: .c .o
--- a/libvo/vo_vesa.c	Mon Jan 07 09:22:01 2002 +0000
+++ b/libvo/vo_vesa.c	Mon Jan 07 09:28:22 2002 +0000
@@ -35,6 +35,7 @@
 #include "bswap.h"
 #include "aspect.h"
 #include "vesa_lvo.h"
+#include "vosub_vidix.h"
 
 #include "../postproc/swscale.h"
 #include "../postproc/rgb2rgb.h"
@@ -99,6 +100,7 @@
 
 /* Linux Video Overlay */
 static const char *lvo_name = NULL;
+static const char *vidix_name = NULL;
 static int pre_init_err = 0;
 
 #define HAS_DGA()  (win.idx == -1)
@@ -133,6 +135,7 @@
 {
   int err;
   if(lvo_name) vlvo_term();
+  else if(vidix_name) vidix_term();
   if((err=vbeRestoreState(init_state)) != VBE_OK) PRINT_VBE_ERR("vbeRestoreState",err);
   if((err=vbeSetMode(init_mode,NULL)) != VBE_OK) PRINT_VBE_ERR("vbeSetMode",err);
   if(HAS_DGA()) vbeUnmapVideoBuffer((unsigned long)win.ptr,win.high);
@@ -330,7 +333,7 @@
     if(!HAS_DGA()) __vbeCopyData(dga_buffer);
     flip_trigger = 0;
   }
-  if(vo_doublebuffering && multi_size > 1 && !lvo_name)
+  if(vo_doublebuffering && multi_size > 1 && !lvo_name && !vidix_name)
   {
     int err;
     if((err=vbeSetDisplayStart(multi_buff[multi_idx],1)) != VBE_OK)
@@ -388,7 +391,7 @@
       if(verbose > 2)
           printf("vo_vesa: rgb2rgb_fnc was called\n");
     } 
-    if((!rgb2rgb_fnc || !HAS_DGA()) && !lvo_name) __vbeCopyData(data);
+    if((!rgb2rgb_fnc || !HAS_DGA()) && !lvo_name && !vidix_name) __vbeCopyData(data);
     return 0;
 }
 
@@ -403,7 +406,9 @@
    if(strcmp(sd,"dga") == 0)   { flags &= ~(SUBDEV_NODGA); flags |= SUBDEV_FORCEDGA; }
    else
    if(memcmp(sd,"lvo:",4) == 0) lvo_name = &sd[4]; /* lvo_name will be valid within init() */
-   else { printf("vo_vesa: Unknown subdevice: %s\n", sd); return -1; }
+   else
+   if(memcmp(sd,"vidix",5) == 0) vidix_name = &sd[5]; /* vidix_name will be valid within init() */
+   else { printf("vo_vesa: Unknown subdevice: '%s'\n", sd); return -1; }
    return flags;
 }
 
@@ -419,11 +424,16 @@
         printf("vo_vesa: subdevice %s have been initialized\n",vo_subdevice);
       if(vo_subdevice) parseSubDevice(vo_subdevice);
       if(lvo_name) pre_init_err = vlvo_preinit(lvo_name);
+      else if(vidix_name) pre_init_err = vidix_preinit(vidix_name);
       if(verbose > 2)
         printf("vo_subdevice: initialization returns: %i\n",pre_init_err);
       first = 0;
     }
-    if(!pre_init_err && lvo_name) return vlvo_query_info(format);
+    if(!pre_init_err) 
+    {
+      if(lvo_name) return vlvo_query_info(format);
+      else if(vidix_name) return vidix_query_fourcc(format);
+    }
 	switch(format)
 	{
 		case IMGFMT_YV12:
@@ -706,7 +716,7 @@
 		if(sd_flags & SUBDEV_NODGA) video_mode_info.PhysBasePtr = 0;
 		if( vesa_zoom || fs_mode )
 		{
-		  if( format==IMGFMT_YV12 || lvo_name )
+		  if(format==IMGFMT_YV12 || lvo_name || vidix_name)
 		  {
 		      /* software scale */
 		      if(vesa_zoom > 1)
@@ -725,7 +735,7 @@
 		      }
 		      scale_srcW=width;
 	    	      scale_srcH=height;
-		      if(!lvo_name) SwScale_Init();
+		      if(!lvo_name && !vidix_name) SwScale_Init();
 		      if(verbose) printf("vo_vesa: Using SCALE\n");
 		  }      
     		  else
@@ -734,7 +744,7 @@
 		      return -1;
 		  }
 		}
-		if(format != IMGFMT_YV12 && image_bpp != video_mode_info.BitsPerPixel && !lvo_name)
+		if(format != IMGFMT_YV12 && image_bpp != video_mode_info.BitsPerPixel && !lvo_name && !vidix_name)
 		{
 		  if(image_bpp == 24 && video_mode_info.BitsPerPixel == 32) rgb2rgb_fnc = rgb24to32;
 		  else 
@@ -830,7 +840,7 @@
 		else
 		{
 		  cpy_blk_fnc = __vbeCopyBlock;
-		  if((yuv_fmt || rgb2rgb_fnc) && !lvo_name)
+		  if((yuv_fmt || rgb2rgb_fnc) && !lvo_name && !vidix_name)
 		  {
 		    if(!(dga_buffer = memalign(64,video_mode_info.XResolution*video_mode_info.YResolution*video_mode_info.BitsPerPixel)))
 		    {
@@ -868,6 +878,20 @@
 		  }
 		  else printf("vo_vesa: Using video overlay: %s\n",lvo_name);
 		}
+		else
+		if(vidix_name)
+		{
+		  if(vidix_init(width,height,x_offset,y_offset,image_width,
+				image_height,format,video_mode_info.BitsPerPixel,
+				video_mode_info.XResolution,video_mode_info.YResolution) != 0)
+		  {
+		    printf("vo_vesa: Can't initialize VIDIX driver\n");
+		    vidix_name = NULL;
+		    vesa_term();
+		    return -1;
+		  }
+		  else printf("vo_vesa: Using VIDIX\n",lvo_name);
+		}
 	}
 	else
 	{
--- a/vidix/Makefile	Mon Jan 07 09:22:01 2002 +0000
+++ b/vidix/Makefile	Mon Jan 07 09:28:22 2002 +0000
@@ -1,5 +1,6 @@
-
 LIBNAME = libvidix.a
+SUBDIRS = drivers
+DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
 
 include ../config.mak
 
@@ -15,22 +16,30 @@
 .c.o:
 	$(CC) -c $(CFLAGS) -o $@ $<
 
+all:	$(SUBDIRS) $(LIBNAME)
+	$(DO_MAKE)
+
 $(LIBNAME):	$(OBJS)
 	$(AR) r $(LIBNAME) $(OBJS)
 
-all:	$(LIBNAME)
 
 clean:
 	rm -f *.o *.a *~
+	$(DO_MAKE)
 
 distclean:
 	rm -f test *.o *.a *~ .depend
+	$(DO_MAKE)
 
 dep:    depend
+	$(DO_MAKE)
 
 depend:
 	$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
 
+install:
+	$(DO_MAKE)
+
 #
 # include dependency files if they exist
 #
--- a/vidix/drivers/Makefile	Mon Jan 07 09:22:01 2002 +0000
+++ b/vidix/drivers/Makefile	Mon Jan 07 09:28:22 2002 +0000
@@ -2,6 +2,8 @@
 
 include ../../config.mak
 
+BINDIR = $(prefix)/lib/mplayer/vidix
+
 
 RADEON_VID=radeon_vid.so
 RADEON_SRCS=radeon_vid.c
@@ -26,13 +28,13 @@
 	$(CC) -c $(RADEON_CFLAGS) -o $@ $<
 
 $(RADEON_VID):     $(RADEON_OBJS)
-	$(CC) $(RADEON_LIBS) -shared -o $(RADEON_VID) $(RADEON_OBJS)
+	$(LD) $(RADEON_LIBS) -shared -soname $(RADEON_VID) -o $(RADEON_VID) $(RADEON_OBJS)
 
 $(RAGE128_OBJS):    $(RAGE128_SRCS)
 	$(CC) -c $(RAGE128_CFLAGS) -o $@ $<
 
 $(RAGE128_VID):     $(RAGE128_OBJS)
-	$(CC) $(RAGE128_LIBS) -shared -o $(RAGE128_VID) $(RAGE128_OBJS)
+	$(LD) $(RAGE128_LIBS) -shared -soname $(RAGE128_VID) -o $(RAGE128_VID) $(RAGE128_OBJS)
 
 clean:
 	rm -f *.o *.so *~
@@ -46,7 +48,8 @@
 	$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
 
 install:
-
+	mkdir -p $(BINDIR)
+	cp *.so $(BINDIR)
 #
 # include dependency files if they exist
 #
--- a/vidix/drivers/radeon_vid.c	Mon Jan 07 09:22:01 2002 +0000
+++ b/vidix/drivers/radeon_vid.c	Mon Jan 07 09:28:22 2002 +0000
@@ -1,5 +1,8 @@
 /*
    radeon_vid - VIDIX based video driver for Radeon and Rage128 chips
+   Copyrights 2002 Nick Kurshev. This file is based on sources from
+   GATOS (gatos.sf.net) and X11 (www.xfree86.org)
+   Licence: GPL
 */
 
 #include <linux/pci_ids.h>
@@ -25,7 +28,7 @@
 #endif
 #endif
 
-#define DEBUG 1
+static int __verbose = 0;
 
 typedef struct bes_registers_s
 {
@@ -83,9 +86,7 @@
 
 typedef struct video_registers_s
 {
-#ifdef DEBUG
   const char * sname;
-#endif
   uint32_t name;
   uint32_t value;
 }video_registers_t;
@@ -94,12 +95,7 @@
 #ifndef RAGE128
 static int IsR200=0;
 #endif
-#ifdef DEBUG
 #define DECLARE_VREG(name) { #name, name, 0 }
-#else
-#define DECLARE_VREG(name) { name, 0 }
-#endif
-#ifdef DEBUG
 static video_registers_t vregs[] = 
 {
   DECLARE_VREG(VIDEOMUX_CNTL),
@@ -194,7 +190,7 @@
   DECLARE_VREG(IDCT_AUTH),
   DECLARE_VREG(IDCT_CONTROL)
 };
-#endif
+
 static void * radeon_mmio_base = 0;
 static void * radeon_mem_base = 0; 
 static int32_t radeon_overlay_off = 0;
@@ -629,6 +625,7 @@
   pciinfo_t lst[MAX_PCI_DEVICES];
   unsigned i,num_pci;
   int err;
+  __verbose = verbose;
   err = pci_scan(lst,&num_pci);
   if(err)
   {
@@ -724,7 +721,6 @@
     return ENOSYS;
 }
 
-#ifdef DEBUG
 static void radeon_vid_dump_regs( void )
 {
   size_t i;
@@ -738,7 +734,6 @@
 	printf(RADEON_MSG"%s = %08X\n",vregs[i].sname,INREG(vregs[i].name));
   printf(RADEON_MSG"*** End of OV0 registers dump ***\n");
 }
-#endif
 
 static void radeon_vid_stop_video( void )
 {
@@ -848,9 +843,7 @@
     }
     OUTREG(OV0_SCALE_CNTL,		bes_flags);
     OUTREG(OV0_REG_LOAD_CNTL,		0);
-#ifdef DEBUG
-    radeon_vid_dump_regs();
-#endif
+    if(__verbose > 1) radeon_vid_dump_regs();
 }
 
 static unsigned radeon_query_pitch(unsigned fourcc)
@@ -1050,9 +1043,7 @@
     OUTREG(OV0_VID_BUF1_BASE_ADRS,	off1);
     OUTREG(OV0_VID_BUF2_BASE_ADRS,	off2);
     OUTREG(OV0_REG_LOAD_CNTL,		0);
-#ifdef DEBUG
-    radeon_vid_dump_regs();
-#endif
+    if(__verbose > 1) radeon_vid_dump_regs();
     return 0;
 }