Mercurial > mplayer.hg
changeset 5490:78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
author | mswitch |
---|---|
date | Thu, 04 Apr 2002 16:11:09 +0000 |
parents | 5e6e08ff47d5 |
children | 846285e8e0b4 |
files | libvo/Makefile libvo/vo_dxr3.c |
diffstat | 2 files changed, 65 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/Makefile Thu Apr 04 14:44:47 2002 +0000 +++ b/libvo/Makefile Thu Apr 04 16:11:09 2002 +0000 @@ -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)
--- a/libvo/vo_dxr3.c Thu Apr 04 14:44:47 2002 +0000 +++ b/libvo/vo_dxr3.c Thu Apr 04 16:11:09 2002 +0000 @@ -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) { @@ -568,6 +624,12 @@ if (fd_control) { close(fd_control); } + if(osdpicbuf) { + free(osdpicbuf); + } + if(spued) { + free(spued); + } } static void check_events(void)