[Mplayer-cvslog] CVS: main/libvo Makefile,1.30,1.31 vo_dxr3.c,1.77,1.78

David Holm mswitch at mplayer.dev.hu
Thu Apr 4 18:11:12 CEST 2002


Update of /cvsroot/mplayer/main/libvo
In directory mplayer:/var/tmp.root/cvs-serv26147

Modified Files:
	Makefile vo_dxr3.c 
Log Message:
Added spuenc... should write a draw_alpha_spu perhaps =D


Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/Makefile,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- Makefile	9 Feb 2002 01:30:35 -0000	1.30
+++ Makefile	4 Apr 2002 16:11:09 -0000	1.31
@@ -3,7 +3,7 @@
 
 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 vo_yuv4mpeg.c $(OPTIONAL_SRCS) img_format.c sub.c
+SRCS=aspect.c aclib.c osd.c font_load.c spuenc.c video_out.c vo_null.c vo_pgm.c vo_md5.c vo_mpegpes.c x11_common.c vo_yuv4mpeg.c $(OPTIONAL_SRCS) img_format.c sub.c
 OBJS=$(SRCS:.c=.o)
 
 ifeq ($(VIDIX),yes)

Index: vo_dxr3.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dxr3.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- vo_dxr3.c	30 Mar 2002 06:24:49 -0000	1.77
+++ vo_dxr3.c	4 Apr 2002 16:11:09 -0000	1.78
@@ -6,6 +6,9 @@
  */
 
 /* ChangeLog added 2002-01-10
+ * 2002-04-03:
+ *  Carl George added spuenc support
+ *
  * 2002-03-26:
  *  XorA added an option parser and support for selecting encoder
  *  codec. We thank him again.
@@ -86,7 +89,8 @@
 #include "postproc/rgb2rgb.h"
 #include "postproc/swscale.h"
 #include "cpudetect.h"
-
+#include "spuenc.h"
+ 
 #define USE_LIBFAME
 
 /* Libfame codec initialisation */
@@ -154,6 +158,13 @@
 static int fd_spu = -1;
 static char fdv_name[80];
 
+/* on screen display/subpics */
+static char *osdpicbuf = NULL;
+static int osdpicbuf_w;
+static int osdpicbuf_h;
+static int disposd = 0;
+static encodedata *spued;
+
 /* Static variable used in ioctl's */
 static int ioval = 0;
 
@@ -432,6 +443,21 @@
 		return 0;
 	} else if (format == IMGFMT_MPEGPES) {
 		printf("VO: [dxr3] Format: MPEG-PES (no conversion needed)\n");
+		osdpicbuf = malloc(s_width * s_height);
+		if (osdpicbuf == NULL) {
+			printf("vo_dxr3: out of mem\n");
+			return -1;
+		}
+		spued = (encodedata *) malloc(sizeof(encodedata));
+		if (spued == NULL) {
+			printf("vo_dxr3:out of mem\n");
+			return -1;
+		}
+		osd_w = s_width;
+		osd_h = s_height;
+		osdpicbuf_w = s_width;
+		osdpicbuf_h = s_height;
+		
 		return 0;
 	}
 
@@ -447,19 +473,49 @@
 
 static void draw_alpha(int x, int y, int w, int h, unsigned char* src, unsigned char *srca, int srcstride)
 {
-#if defined(USE_LIBFAME) || defined(USE_LIBAVCODEC)
+	int lx, ly, bx;
+	unsigned char *buf;
+	buf = &osdpicbuf[(y * osdpicbuf_w) + x];
+	if (img_format == IMGFMT_MPEGPES) {
+		for (ly = 0; ly < h - 1; ly++) {
+			for(lx = 0; lx < w; lx++) {
+				if ((srca[(ly * srcstride) + lx] != 0) && (src[(ly * srcstride) + lx] != 0)) {
+					if(src[(ly * srcstride) + lx] >= 128) {
+						buf[ly * osdpicbuf_w + lx] = 3;
+					}
+				}
+			}
+		}	
+		pixbuf_encode_rle(x, y, osdpicbuf_w, osdpicbuf_h - 1, osdpicbuf, osdpicbuf_w, spued);
+	} else {
+#if defined(USE_LIBAVCODEC) || defined(USE_LIBFAME)
 	vo_draw_alpha_yv12(w, h, src, srca, srcstride,
 		picture_data[0] + x + y * picture_linesize[0], picture_linesize[0]);
 #endif
+	}
 }
 
 static void draw_osd(void)
 {
 	if (img_format != IMGFMT_MPEGPES) {
 		vo_draw_text(osd_w, osd_h, draw_alpha);
+	} else if ((disposd % 30) == 0) {
+		vo_draw_text(osd_w, osd_h, draw_alpha);
+		memset(osdpicbuf, 0, s_width * s_height);
+
+		/* could stand some check here to see if the subpic hasn't changed
+		 * as if it hasn't and we re-send it it will "blink" as the last one
+		 * is turned off, and the new one (same one) is turned on
+		 */
+		if (!noprebuf) {
+			ioctl(fd_spu, EM8300_IOCTL_SPU_SETPTS, &vo_pts);
+		}
+		write(fd_spu, spued->data, spued->count);
 	}
+	disposd++;
 }
 
+
 static uint32_t draw_frame(uint8_t * src[])
 {
 	if (img_format == IMGFMT_MPEGPES) {
@@ -567,6 +623,12 @@
 	}
 	if (fd_control) {
 		close(fd_control);
+	}
+	if(osdpicbuf) {
+		free(osdpicbuf);
+	}
+	if(spued) {
+		free(spued);
 	}
 }
 




More information about the MPlayer-cvslog mailing list