Update of /cvsroot/freevo/freevo/runtime/patches
In directory sc8-pr-cvs1:/tmp/cvs-serv31265
Added Files:
SDL-1.2.4.diff SDL_ttf-2.0.6.diff libsdl1.2-dxr3-fame.diff
libsdl1.2-dxr3-ffmpeg.diff mp1e_btaudio.diff
sdl12cvs-directfb09-16-tvout.diff
Log Message:
Moved patches from around the source tree to here.
--- NEW FILE: SDL-1.2.4.diff ---
diff -aur SDL-1.2.4/src/video/fbcon/SDL_fbevents.c
SDL-1.2.4-freevo/src/video/fbcon/SDL_fbevents.c
--- SDL-1.2.4/src/video/fbcon/SDL_fbevents.c Wed Mar 6 05:23:03 2002
+++ SDL-1.2.4-freevo/src/video/fbcon/SDL_fbevents.c Mon Aug 5 23:15:52 2002
@@ -156,10 +156,40 @@
return((keyboard_fd >= 0) && (saved_kbd_mode >= 0));
}
+static void
+tty_disable (void)
+{
+ int tty;
+
+
+ tty = open ("/dev/tty0", O_RDWR);
+ if(tty < 0) {
+ perror("Error can't open /dev/tty0");
+ exit (1);
+ }
+
+ if(ioctl (tty, KDSETMODE, KD_GRAPHICS) == -1) {
+ perror("Error setting graphics mode for tty");
+ close(tty);
+ exit (1);
+ }
+
+ close(tty);
+
+}
+
+
int FB_EnterGraphicsMode(_THIS)
{
struct termios keyboard_termios;
+ int fd;
+
+ if (getenv("SDL_NOKEYBOARD") != NULL) {
+ tty_disable ();
+ return(1); /* XXX Do not touch the keyboard */
+ }
+
/* Set medium-raw keyboard mode */
if ( (keyboard_fd >= 0) && !FB_InGraphicsMode(this) ) {
@@ -841,6 +871,10 @@
Uint32 screen_arealen;
Uint8 *screen_contents;
+ if (getenv("SDL_NOKEYBOARD") != NULL) {
+ return; /* XXX Do not touch the keyboard */
+ }
+
/* Figure out whether or not we're switching to a new console */
if ( (ioctl(keyboard_fd, VT_GETSTATE, &vtstate) < 0) ||
(which == vtstate.v_active) ) {
@@ -891,6 +925,10 @@
int scancode;
SDL_keysym keysym;
+ if (getenv("SDL_NOKEYBOARD") != NULL) {
+ return; /* XXX Do not touch the keyboard */
+ }
+
nread = read(keyboard_fd, keybuf, BUFSIZ);
for ( i=0; i<nread; ++i ) {
scancode = keybuf[i] & 0x7F;
@@ -934,6 +972,10 @@
int max_fd;
static struct timeval zero;
+ if (getenv("SDL_NOKEYBOARD") != NULL) {
+ return; /* XXX Do not touch the keyboard */
+ }
+
do {
posted = 0;
diff -aur SDL-1.2.4/src/video/fbcon/SDL_fbvideo.c
SDL-1.2.4-freevo/src/video/fbcon/SDL_fbvideo.c
--- SDL-1.2.4/src/video/fbcon/SDL_fbvideo.c Wed Apr 3 15:45:25 2002
+++ SDL-1.2.4-freevo/src/video/fbcon/SDL_fbvideo.c Mon Aug 5 23:17:53 2002
@@ -525,10 +525,18 @@
}
/* Enable mouse and keyboard support */
- if ( FB_OpenKeyboard(this) < 0 ) {
- FB_VideoQuit(this);
- return(-1);
- }
+ {
+ const char *sdl_nokbd;
+
+ sdl_nokbd = getenv("SDL_NOKEYBOARD");
+ if (!sdl_nokbd) {
+ if ( FB_OpenKeyboard(this) < 0 ) {
+ FB_VideoQuit(this);
+ return(-1);
+ }
+ }
+ }
+
if ( FB_OpenMouse(this) < 0 ) {
const char *sdl_nomouse;
--- NEW FILE: SDL_ttf-2.0.6.diff ---
--- SDL_ttf-2.0.5/SDL_ttf.c Fri Jan 18 15:46:04 2002
+++ SDL_ttf-2.0.5-freevo1/SDL_ttf.c Wed Oct 2 22:36:39 2002
@@ -632,6 +632,8 @@
int x, z;
int minx, maxx;
int miny, maxy;
+ int max_height;
+ int rows;
c_glyph *glyph;
FT_Error error;
@@ -642,7 +644,8 @@
status = 0;
minx = maxx = 0;
miny = maxy = 0;
-
+ max_height = 0;
+
/* Load each character and sum it's bounding box */
x= 0;
for ( ch=text; *ch; ++ch ) {
@@ -652,6 +655,11 @@
}
glyph = font->current;
+ rows = glyph->maxy - glyph->miny;
+
+ if ( max_height < (rows + glyph->yoffset) ) {
+ max_height = (rows + glyph->yoffset);
+ }
z = x + glyph->minx;
if ( minx > z ) {
minx = z;
@@ -685,7 +693,14 @@
#if 0 /* This is correct, but breaks many applications */
*h = (maxy - miny);
#else
- *h = font->height;
+ if (font->height >= max_height) {
+ *h = font->height;
+ } else {
+ *h = max_height;
+ }
+
+ /* *h = font->height; XXX This doesn't take into account
+ * the bearingY, leading to memory access errors */
#endif
}
return status;
@@ -760,11 +775,10 @@
FT_Error error;
/* Get the dimensions of the text surface */
- if( ( TTF_SizeUNICODE(font, text, &width, NULL) < 0 ) || !width ) {
+ if( ( TTF_SizeUNICODE(font, text, &width, &height) < 0 ) || !width ) {
TTF_SetError( "Text has zero width" );
return NULL;
}
- height = font->height;
/* Create the target surface */
textbuf = SDL_AllocSurface(SDL_SWSURFACE, width, height, 8, 0, 0, 0, 0);
@@ -964,11 +978,10 @@
FT_Error error;
/* Get the dimensions of the text surface */
- if( ( TTF_SizeUNICODE(font, text, &width, NULL) < 0 ) || !width ) {
+ if( ( TTF_SizeUNICODE(font, text, &width, &height) < 0 ) || !width ) {
TTF_SetError("Text has zero width");
return NULL;
}
- height = font->height;
/* Create the target surface */
textbuf = SDL_AllocSurface(SDL_SWSURFACE, width, height, 8, 0, 0, 0, 0);
@@ -1168,11 +1181,10 @@
FT_Error error;
/* Get the dimensions of the text surface */
- if ( (TTF_SizeUNICODE(font, text, &width, NULL) < 0) || !width ) {
+ if ( (TTF_SizeUNICODE(font, text, &width, &height) < 0) || !width ) {
TTF_SetError("Text has zero width");
return(NULL);
}
- height = font->height;
textbuf = SDL_AllocSurface(SDL_SWSURFACE, width, height, 32,
0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
--- NEW FILE: libsdl1.2-dxr3-fame.diff ---
diff -u -r --new-file cvs/SDL12/configure.in SDL12/configure.in
--- cvs/SDL12/configure.in Wed Nov 20 08:43:39 2002
+++ SDL12/configure.in Fri Nov 22 08:20:20 2002
@@ -1000,6 +1000,25 @@
fi
}
+dnl Set up the Dxr3 video driver.
+CheckDxr3Video()
+{
+ AC_ARG_ENABLE(video-dxr3,
+[ --enable-video-dxr3 use dxr3 video driver [default=yes]],
+ , enable_video_dxr3=yes)
+ if test x$enable_video_dxr3 = xyes; then
+ CFLAGS="$CFLAGS -DENABLE_DXR3VIDEO"
+ VIDEO_SUBDIRS="$VIDEO_SUBDIRS dxr3"
+ VIDEO_DRIVERS="$VIDEO_DRIVERS dxr3/libvideo_dxr3.la"
+
+ DXR3_CFLAGS=`libfame-config --cflags`
[...1052 lines suppressed...]
+/* Private display data */
+
+struct SDL_PrivateVideoData {
+ int w, h;
+ void *buffer;
+
+ fame_context_t *fame_ctx ;
+ fame_yuv_t fame_yuv;
+
+ unsigned char* outbuf;
+ unsigned char *yuv;
+
+ int fd_video;
+ int fd_control;
+ struct termios tio_orig;
+ int fd_keyboard;
+ int posted;
+};
+
+#endif /* _SDL_dxr3video_h */
--- NEW FILE: libsdl1.2-dxr3-ffmpeg.diff ---
--- /usr/local/SDL-1.2.5/configure.in 2002-10-06 13:34:53.000000000 -0700
+++ SDL-1.2.5/configure.in 2002-12-29 06:58:58.000000000 -0800
@@ -1000,6 +1002,25 @@
fi
}
+dnl Set up the Dxr3 video driver.
+CheckDxr3Video()
+{
+ AC_ARG_ENABLE(video-dxr3,
+[ --enable-video-dxr3 use dxr3 video driver [default=yes]],
+ , enable_video_dxr3=yes)
+ if test x$enable_video_dxr3 = xyes; then
+ CFLAGS="$CFLAGS -DENABLE_DXR3VIDEO"
+ VIDEO_SUBDIRS="$VIDEO_SUBDIRS dxr3"
+ VIDEO_DRIVERS="$VIDEO_DRIVERS dxr3/libvideo_dxr3.la"
+
+ DXR3_CFLAGS="-I/usr/include/ffmpeg"
+ DXR3_LIBS="-lavcodec"
+
+ AC_SUBST(DXR3_CFLAGS)
+ AC_SUBST(DXR3_LIBS)
+ fi
+}
+
dnl Check to see if OpenGL support is desired
AC_ARG_ENABLE(video-opengl,
[ --enable-video-opengl include OpenGL context creation [default=yes]],
@@ -1680,6 +1701,7 @@
case "$target" in
*-*-linux*)
ARCH=linux
+ CheckDxr3Video
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
@@ -2623,6 +2643,7 @@
src/video/photon/Makefile
src/video/epoc/Makefile
src/video/dummy/Makefile
+src/video/dxr3/Makefile
src/video/ataricommon/Makefile
src/video/xbios/Makefile
src/video/gem/Makefile
--- /dev/null 2002-11-18 10:54:08.000000000 -0800
+++ SDL-1.2.5/src/video/dxr3/Makefile.am 2002-12-29 06:58:58.000000000 -0800
@@ -0,0 +1,18 @@
+
+## Makefile.am for SDL using the dxr3 video driver
+
+CFLAGS = @CFLAGS@ $(DXR3_CFLAGS)
+
+noinst_LTLIBRARIES = libvideo_dxr3.la
+libvideo_dxr3_la_SOURCES = $(DXR3_SRCS)
+libvideo_dxr3_la_LIBADD = $(DXR3_LIBS)
+
+# The SDL null video driver sources
+DXR3_SRCS = \
+ SDL_dxr3video.h \
+ SDL_dxr3events.c \
+ SDL_dxr3events_c.h \
+ SDL_dxr3mouse.c \
+ SDL_dxr3mouse_c.h \
+ SDL_dxr3video.c
+
--- /dev/null 2002-11-18 10:54:08.000000000 -0800
+++ SDL-1.2.5/src/video/dxr3/SDL_dxr3events.c 2002-12-29 09:10:13.000000000 -0800
@@ -0,0 +1,234 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Sam Lantinga
+ [EMAIL PROTECTED]
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id: libsdl1.2-dxr3-ffmpeg.diff,v 1.1 2003/06/24 23:31:33 outlyer Exp $";
+#endif
+
+/* Being a dxr3 driver, there's no event stream. We just define stubs for
+ most of the API. */
+
+#include "SDL.h"
+#include "SDL_sysevents.h"
+#include "SDL_keysym.h"
+#include "SDL_events_c.h"
+#include "SDL_dxr3video.h"
+#include "SDL_dxr3events_c.h"
+
+#include <time.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+int DXR3_OpenKeyboard(SDL_VideoDevice *vdev)
+{
+ struct SDL_PrivateVideoData *data = vdev->hidden;
+ struct termios tio_new;
+
+// fprintf(stderr,"DXR3_OpenKeyboard() called.\n");
+
+ ioctl(0,TCGETS,&data->tio_orig);
+
+ memcpy(&tio_new,&data->tio_orig,sizeof(struct termios));
+ tio_new.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */
+ tio_new.c_cc[VMIN] = 1;
+ tio_new.c_cc[VTIME] = 0;
+
+ ioctl(0,TCSETS,&tio_new);
+
+ return 0;
+}
+
+void DXR3_CloseKeyboard(SDL_VideoDevice *vdev)
+{
+ struct SDL_PrivateVideoData *data = vdev->hidden;
+
+// fprintf(stderr,"DXR3_CloseKeyboard() called.\n");
+
+ ioctl(0,TCSETS,&data->tio_orig);
+
+ if ( data->fd_keyboard >= 0 ) {
+ /* not necessary... */
+ /* close(data->fd_keyboard); */
+ }
+ data->fd_keyboard = -1;
+}
+
+#ifdef axa
+static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym)
+{
+// fprintf(stderr,"TranslateKey() called.\n");
+ /* Set the keysym information */
+ keysym->scancode = scancode;
+ keysym->sym = scancode; // keymap[scancode];
+ keysym->mod = KMOD_NONE;
+
+ /* If UNICODE is on, get the UNICODE value for the key */
+ keysym->unicode = 0;
+ if ( SDL_TranslateUNICODE ) {
+ int map;
+ SDLMod modstate;
+
+ modstate = SDL_GetModState();
+ map = 0;
+ if ( modstate & KMOD_SHIFT ) {
+ map |= (1<<KG_SHIFT);
+ }
+ if ( modstate & KMOD_CTRL ) {
+ map |= (1<<KG_CTRL);
+ }
+ if ( modstate & KMOD_ALT ) {
+ map |= (1<<KG_ALT);
+ }
+ if ( modstate & KMOD_MODE ) {
+ map |= (1<<KG_ALTGR);
+ }
+ if ( KTYP(vga_keymap[map][scancode]) == KT_LETTER ) {
+ if ( modstate & KMOD_CAPS ) {
+ map ^= (1<<KG_SHIFT);
+ }
+ }
+ if ( KTYP(vga_keymap[map][scancode]) == KT_PAD ) {
+ if ( modstate & KMOD_NUM ) {
+ keysym->unicode=KVAL(vga_keymap[map][scancode]);
+ }
+ } else {
+ keysym->unicode = KVAL(vga_keymap[map][scancode]);
+ }
+ }
+ return(keysym);
+}
+#endif
+
+static void handle_keyboard(SDL_VideoDevice *vdev)
+{
+ struct SDL_PrivateVideoData *data = vdev->hidden;
+
+ unsigned char keybuf[BUFSIZ];
+ int i, nread;
+ SDL_keysym keysym;
+
+ struct timespec ts;
+ ts.tv_sec = 0;
+ ts.tv_nsec = 50*1000;
+
+// fprintf(stderr,"handle_keyboard() in.\n");
+
+ nread = read(data->fd_keyboard, keybuf, BUFSIZ);
+ i = 0;
+ while( i < nread) {
+
+
+ memset(&keysym, 0, sizeof(keysym));
+ keysym.mod = KMOD_NONE;
+ keysym.unicode = 0;
+
+ if( (nread-i) >= 3 ) {
+ if(keybuf[i] == 27 && keybuf[i+1] == 91) {
+ switch( keybuf[i+2] ) {
+ case 68: {
+ keysym.sym = SDLK_LEFT;
+ break;
+ }
+ case 67: {
+ keysym.sym = SDLK_RIGHT;
+ break;
+ }
+ case 65: {
+ keysym.sym = SDLK_UP;
+ break;
+ }
+ case 66: {
+ keysym.sym = SDLK_DOWN;
+ break;
+ }
+ default: {
+ printf("unknow key: %d\n",keybuf[i+2]);
+ break;
+ }
+ }
+ data->posted += SDL_PrivateKeyboard(SDL_PRESSED, &keysym);
+ data->posted += SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
+ i += 3;
+ continue;
+ }
+ }
+ switch( keybuf[i] ) {
+ case 10:
+ keysym.sym = SDLK_RETURN;
+ break;
+ default:
+ keysym.sym = keybuf[i];
+ break;
+
+ }
+// printf("key pressed: %d\n",keysym.sym);
+
+ i += 1;
+ data->posted += SDL_PrivateKeyboard(SDL_PRESSED, &keysym);
+ data->posted += SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
+// nanosleep(&ts,NULL);
+ }
+
+// fprintf(stderr,"handle_keyboard() out.\n");
+}
+
+void DXR3_PumpEvents(SDL_VideoDevice *vdev)
+{
+ struct SDL_PrivateVideoData *data = vdev->hidden;
+
+ fd_set fdset;
+ int max_fd;
+ static struct timeval zero;
+
+// fprintf(stderr,"DXR3_PumpEvents() in.\n");
+
+ do {
+ data->posted = 0;
+
+ FD_ZERO(&fdset);
+ max_fd = 0;
+ if ( data->fd_keyboard >= 0 ) {
+ FD_SET(data->fd_keyboard, &fdset);
+ if ( max_fd < data->fd_keyboard ) {
+ max_fd = data->fd_keyboard;
+ }
+ }
+ if ( select(max_fd+1, &fdset, NULL, NULL, &zero) > 0 ) {
+ if ( data->fd_keyboard >= 0 ) {
+ if ( FD_ISSET(data->fd_keyboard, &fdset) ) {
+ handle_keyboard(vdev);
+ }
+ }
+ }
+ } while ( data->posted );
+// fprintf(stderr,"DXR3_PumpEvents() out.\n");
+}
+
+void DXR3_InitOSKeymap(SDL_VideoDevice *vdev)
+{
+ /* do nothing. */
+}
+
+/* end of SDL_dxr3events.c ... */
+
--- /dev/null 2002-11-18 10:54:08.000000000 -0800
+++ SDL-1.2.5/src/video/dxr3/SDL_dxr3events_c.h 2002-12-29 09:10:59.000000000 -0800
@@ -0,0 +1,39 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Sam Lantinga
+ [EMAIL PROTECTED]
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id: libsdl1.2-dxr3-ffmpeg.diff,v 1.1 2003/06/24 23:31:33 outlyer Exp $";
+#endif
+
+#include "SDL_dxr3video.h"
+
+/* Variables and functions exported by SDL_sysevents.c to other parts
+ of the native video subsystem (SDL_sysvideo.c)
+*/
+extern void DXR3_InitOSKeymap(SDL_VideoDevice *vdev);
+extern void DXR3_PumpEvents(SDL_VideoDevice *vdev);
+extern int DXR3_OpenKeyboard(SDL_VideoDevice *vdev);
+extern void DXR3_CloseKeyboard(SDL_VideoDevice *vdev);
+
+/* end of SDL_dxr3events_c.h ... */
+
--- /dev/null 2002-11-18 10:54:08.000000000 -0800
+++ SDL-1.2.5/src/video/dxr3/SDL_dxr3mouse.c 2002-12-29 06:58:58.000000000 -0800
@@ -0,0 +1,40 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Sam Lantinga
+ [EMAIL PROTECTED]
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id: libsdl1.2-dxr3-ffmpeg.diff,v 1.1 2003/06/24 23:31:33 outlyer Exp $";
+#endif
+
+#include <stdio.h>
+
+#include "SDL_error.h"
+#include "SDL_mouse.h"
+#include "SDL_events_c.h"
+
+#include "SDL_dxr3mouse_c.h"
+
+
+/* The implementation dependent data for the window manager cursor */
+struct WMcursor {
+ int unused;
+};
--- /dev/null 2002-11-18 10:54:08.000000000 -0800
+++ SDL-1.2.5/src/video/dxr3/SDL_dxr3mouse_c.h 2002-12-29 06:58:58.000000000 -0800
@@ -0,0 +1,30 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Sam Lantinga
+ [EMAIL PROTECTED]
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id: libsdl1.2-dxr3-ffmpeg.diff,v 1.1 2003/06/24 23:31:33 outlyer Exp $";
+#endif
+
+#include "SDL_dxr3video.h"
+
+/* Functions to be exported */
--- /dev/null 2002-11-18 10:54:08.000000000 -0800
+++ SDL-1.2.5/src/video/dxr3/SDL_dxr3video.c 2002-12-29 10:32:16.000000000 -0800
@@ -0,0 +1,433 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Sam Lantinga
+ [EMAIL PROTECTED]
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id: libsdl1.2-dxr3-ffmpeg.diff,v 1.1 2003/06/24 23:31:33 outlyer Exp $";
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <linux/em8300.h>
+
+#include "SDL.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "SDL_sysvideo.h"
+#include "SDL_pixels_c.h"
+#include "SDL_events_c.h"
+
+#include "SDL_dxr3video.h"
+#include "SDL_dxr3events_c.h"
+#include "SDL_dxr3mouse_c.h"
+
+#define DXR3VID_DRIVER_NAME "dxr3"
+
+/* Initialization/Query functions */
+static int DXR3_VideoInit(SDL_VideoDevice *vdev, SDL_PixelFormat *vformat);
+static SDL_Rect **DXR3_ListModes(SDL_VideoDevice *vdev, SDL_PixelFormat *format,
Uint32 flags);
+static SDL_Surface *DXR3_SetVideoMode(SDL_VideoDevice *vdev, SDL_Surface *current,
int width, int height, int bpp, Uint32 flags);
+static int DXR3_SetColors(SDL_VideoDevice *vdev, int firstcolor, int ncolors,
SDL_Color *colors);
+static void DXR3_VideoQuit(SDL_VideoDevice *vdev);
+
+/* Hardware surface functions */
+static int DXR3_AllocHWSurface(SDL_VideoDevice *vdev, SDL_Surface *surface);
+static int DXR3_LockHWSurface(SDL_VideoDevice *vdev, SDL_Surface *surface);
+static void DXR3_UnlockHWSurface(SDL_VideoDevice *vdev, SDL_Surface *surface);
+static void DXR3_FreeHWSurface(SDL_VideoDevice *vdev, SDL_Surface *surface);
+
+/* etc. */
+static void DXR3_UpdateRects(SDL_VideoDevice *vdev, int numrects, SDL_Rect *rects);
+
+
+const char *devname_v = "/dev/em8300_mv-0";
+const char *devname_c = "/dev/em8300-0";
+
+#define OUTBUF_SIZE 300000
+
+#define MAX_WIDTH 720
+#define MAX_HEIGHT 576
+
+/* DXR3 driver bootstrap functions */
+
+static int DXR3_Available(void)
+{
+ const char *envr = getenv("SDL_VIDEODRIVER");
+
+ if (envr && !strcmp(envr, DXR3VID_DRIVER_NAME))
+ return 1;
+
+ return 0;
+}
+
+static void DXR3_DeleteDevice(SDL_VideoDevice *device)
+{
+ free(device->hidden);
+ device->hidden = NULL;
+ free(device);
+}
+
+static SDL_VideoDevice *DXR3_CreateDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+
+ /* Initialize all variables that we clean on shutdown */
+ device = malloc(sizeof(SDL_VideoDevice));
+ if (!device)
+ return NULL;
+ memset(device, 0, sizeof(*device));
+
+ device->hidden = malloc((sizeof(*device->hidden)));
+ if (!device->hidden) {
+ free(device);
+ return NULL;
+ }
+ memset(device->hidden, 0, sizeof(*device->hidden));
+
+ /* Set the function pointers */
+ device->VideoInit = DXR3_VideoInit;
+ device->ListModes = DXR3_ListModes;
+ device->SetVideoMode = DXR3_SetVideoMode;
+ device->CreateYUVOverlay = NULL;
+ device->SetColors = DXR3_SetColors;
+ device->UpdateRects = DXR3_UpdateRects;
+ device->VideoQuit = DXR3_VideoQuit;
+ device->AllocHWSurface = DXR3_AllocHWSurface;
+ device->CheckHWBlit = NULL;
+ device->FillHWRect = NULL;
+ device->SetHWColorKey = NULL;
+ device->SetHWAlpha = NULL;
+ device->LockHWSurface = DXR3_LockHWSurface;
+ device->UnlockHWSurface = DXR3_UnlockHWSurface;
+ device->FlipHWSurface = NULL;
+ device->FreeHWSurface = DXR3_FreeHWSurface;
+ device->SetCaption = NULL;
+ device->SetIcon = NULL;
+ device->IconifyWindow = NULL;
+ device->GrabInput = NULL;
+ device->GetWMInfo = NULL;
+ device->InitOSKeymap = DXR3_InitOSKeymap;
+ device->PumpEvents = DXR3_PumpEvents;
+
+ device->free = DXR3_DeleteDevice;
+
+ return device;
+}
+
+VideoBootStrap DXR3_bootstrap = {
+ DXR3VID_DRIVER_NAME,
+ "SDL dxr3 video driver",
+ DXR3_Available,
+ DXR3_CreateDevice
+};
+
+
+int DXR3_VideoInit(SDL_VideoDevice *vdev, SDL_PixelFormat *vformat)
+{
+ struct SDL_PrivateVideoData *data = vdev->hidden;
+
+ fprintf(stderr, "WARNING: You are using the SDL dxr3 video driver!\n");
+
+ /* Determine the screen depth (use default 8-bit depth) */
+ /* we change this during the SDL_SetVideoMode implementation... */
+ vformat->BitsPerPixel = 8;
+ vformat->BytesPerPixel = 1;
+
+ /* fixme: 0 means stdin */
+ data->fd_keyboard = 0;
+
+ if (DXR3_OpenKeyboard(vdev) < 0) {
+ DXR3_VideoQuit(vdev);
+ return -1;
+ }
+
+ /* We're done! */
+ return 0;
+}
+
+SDL_Rect **DXR3_ListModes(SDL_VideoDevice *vdev, SDL_PixelFormat *format,
+ Uint32 flags)
+{
+ return (SDL_Rect **) -1;
+}
+
+SDL_Surface *DXR3_SetVideoMode(SDL_VideoDevice *vdev, SDL_Surface *current,
+ int width, int height, int bpp, Uint32 flags)
+{
+ struct SDL_PrivateVideoData *data = vdev->hidden;
+ em8300_register_t reg;
+ int ioval = 0;
+ int tmp1, tmp2;
+
+ if (vdev->hidden->buffer)
+ free(vdev->hidden->buffer);
+
+ vdev->hidden->buffer = malloc(width * height * (bpp / 8));
+ if (!vdev->hidden->buffer) {
+ SDL_SetError("Couldn't allocate buffer for requested mode");
+ return NULL;
+ }
+
+ memset(vdev->hidden->buffer, 0, width * height * (bpp / 8));
+
+ /* Allocate the new pixel format for the screen */
+ if (!SDL_ReallocFormat(current, bpp, 0, 0, 0, 0)) {
+ SDL_SetError("Couldn't allocate new pixel format for requested mode");
+ goto err_buffer;
+ }
+
+ /* Set up the new mode framebuffer */
+ current->flags = flags & SDL_FULLSCREEN;
+ current->w = width;
+ current->h = height;
+
+ /* quick hack */
+ if (width > MAX_WIDTH) {
+ fprintf(stderr, "WARNING: width (%d) out of bounds. cropping to %d
pixels!\n", width, MAX_WIDTH);
+ width = MAX_WIDTH;
+ }
+ if (height > MAX_HEIGHT ) {
+ fprintf(stderr, "WARNING: height (%d) out of bounds. cropping to %d
pixels!\n", height, MAX_HEIGHT);
+ height = MAX_HEIGHT;
+ }
+
+ vdev->hidden->w = width;
+ vdev->hidden->h = height;
+ current->pitch = width * (bpp / 8);
+ current->pixels = vdev->hidden->buffer;
+
+ /* Open and set up the dxr3 */
+ data->fd_video = open(devname_v, O_WRONLY | O_NONBLOCK);
+ if (data->fd_video < 0) {
+ SDL_SetError("Couldn't open video part of dxr3.");
+ goto err_buffer;
+ }
+
+ data->fd_control = open(devname_c, O_WRONLY | O_NONBLOCK);
+ if (data->fd_control < 0) {
+ SDL_SetError("Couldn't open control part of dxr3.");
+ goto err_control;
+ }
+
+ /* Set the playmode to play (just in case another app has set it to something
else) */
+ ioval = EM8300_PLAYMODE_PLAY;
+ if (ioctl(data->fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
+ SDL_SetError("Couldn't set playmode of dxr3.");
+ goto err_set_play;
+ }
+
+ /* Start em8300 prebuffering and sync engine */
+ reg.microcode_register = 1;
+ reg.reg = 0;
+ reg.val = MVCOMMAND_SYNC;
+ if (ioctl(data->fd_control, EM8300_IOCTL_WRITEREG, ®)) {
+ SDL_SetError("Couldn't EM8300_IOCTL_WRITEREG (dxr3).");
+ goto err_set_play;
+ }
+
+ /* Clean buffer by syncing it */
+ ioval = EM8300_SUBDEVICE_VIDEO;
+ ioctl(data->fd_control, EM8300_IOCTL_FLUSH, &ioval);
+ ioval = EM8300_SUBDEVICE_AUDIO;
+ ioctl(data->fd_control, EM8300_IOCTL_FLUSH, &ioval);
+
+ fsync(data->fd_video);
+
+ tmp1 = abs(height - ((width / 4) * 3));
+ tmp2 = abs(height - (int)(width / 2.35));
+ if (tmp1 < tmp2)
+ ioval = EM8300_ASPECTRATIO_4_3;
+ else
+ ioval = EM8300_ASPECTRATIO_16_9;
+ ioctl(data->fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &ioval);
+
+ data->outbuf = malloc(OUTBUF_SIZE);
+ if (!data->outbuf) {
+ SDL_SetError("malloc() failed (dxr3).");
+ goto err_set_play;
+ }
+
+ data->picture_yuv = malloc((width * height * 3) / 2);
+ if (!data->picture_yuv) {
+ SDL_SetError("malloc() failed (dxr3).");
+ goto err_outbuf;
+ }
+
+ avcodec_init();
+ avcodec_register_all();
+
+ /* fix me: error handling */
+ data->codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO);
+ if (!data->codec)
+ goto err_outbuf;
+
+ data->c = avcodec_alloc_context();
+ if (!data->c)
+ goto err_outbuf;
+
+ data->picture = avcodec_alloc_frame();
+ if (!data->picture)
+ goto err_alloc_frame;
+
+ data->c->bit_rate = 1000000;
+ data->c->width = width;
+ data->c->height = height;
+
+ data->c->frame_rate = 25 * FRAME_RATE_BASE;
+ data->c->gop_size = 1;
+ data->c->flags = CODEC_FLAG_QSCALE;
+
+ if (avcodec_open(data->c, data->codec) < 0)
+ goto err_avc_open;
+
+ data->picture->data[0] = data->picture_yuv;
+ data->picture->data[1] = data->picture->data[0] + width * height;
+ data->picture->data[2] = data->picture->data[1] + (width * height / 4);
+
+ data->picture->linesize[0] = width;
+ data->picture->linesize[1] = width / 2;
+ data->picture->linesize[2] = width / 2;
+
+ data->picture->quality = 2;
+
+ /* We're done */
+ return current;
+
+err_avc_open:
+ free(data->picture);
+ data->picture = NULL;
+err_alloc_frame:
+ free(data->c);
+ data->c = NULL;
+err_outbuf:
+ free(data->outbuf);
+ data->outbuf = NULL;
+err_set_play:
+ close(data->fd_control);
+ data->fd_control = -1;
+err_control:
+ close(data->fd_video);
+ data->fd_video = -1;
+err_buffer:
+ free(vdev->hidden->buffer);
+ vdev->hidden->buffer = NULL;
+ return NULL;
+}
+
+/* We don't actually allow hardware surfaces other than the main one */
+static int DXR3_AllocHWSurface(SDL_VideoDevice *vdev, SDL_Surface *surface)
+{
+ return -1;
+}
+
+static void DXR3_FreeHWSurface(SDL_VideoDevice *vdev, SDL_Surface *surface)
+{
+}
+
+/* We need to wait for vertical retrace on page flipped displays */
+static int DXR3_LockHWSurface(SDL_VideoDevice *vdev, SDL_Surface *surface)
+{
+ return 0;
+}
+
+static void DXR3_UnlockHWSurface(SDL_VideoDevice *vdev, SDL_Surface *surface)
+{
+}
+
+static void DXR3_UpdateRects(SDL_VideoDevice *vdev, int numrects,
+ SDL_Rect *rects)
+{
+ struct SDL_PrivateVideoData *data = vdev->hidden;
+ AVPicture dst, src;
+ int size;
+
+ if (data->picture_yuv) {
+ dst.data[0] = data->picture->data[0];
+ dst.data[1] = data->picture->data[1];
+ dst.data[2] = data->picture->data[2];
+ src.data[0] = data->buffer;
+ img_convert(&dst, PIX_FMT_YUV420P, &src, PIX_FMT_BGRA32,
data->c->width, data->c->height);
+
+ size = avcodec_encode_video(data->c, data->outbuf, OUTBUF_SIZE,
data->picture);
+ if (data->outbuf[size - 1] != 0xb7) {
+ /* add sequence end code */
+ data->outbuf[size] = 0x00;
+ data->outbuf[size + 1] = 0x00;
+ data->outbuf[size + 2] = 0x01;
+ data->outbuf[size + 3] = 0xb7;
+ size += 4;
+ }
+
+ write(data->fd_video, data->outbuf, size);
+ }
+}
+
+int DXR3_SetColors(SDL_VideoDevice *vdev, int firstcolor, int ncolors,
+ SDL_Color *colors)
+{
+ /* do nothing of note. */
+ return 1;
+}
+
+/* Note: If we are terminated, this could be called in the middle of
+ another SDL video routine -- notably UpdateRects.
+*/
+void DXR3_VideoQuit(SDL_VideoDevice *vdev)
+{
+ struct SDL_PrivateVideoData *data = vdev->hidden;
+
+ if (vdev->screen->pixels) {
+ free(vdev->screen->pixels);
+ vdev->screen->pixels = NULL;
+ }
+
+ /* DXR3 cleanup */
+ if (data->fd_video != -1) {
+ close(data->fd_video);
+ data->fd_video = -1;
+ }
+ if (data->fd_control != -1) {
+ close(data->fd_control);
+ data->fd_control = -1;
+ }
+
+ /* avcodec clean up */
+ if (data->picture_yuv) {
+ free(data->picture_yuv);
+ data->picture_yuv = 0;
+ }
+ if (data->outbuf) {
+ free(data->outbuf);
+ data->outbuf = 0;
+ }
+
+ DXR3_CloseKeyboard(vdev);
+}
--- /dev/null 2002-11-18 10:54:08.000000000 -0800
+++ SDL-1.2.5/src/video/dxr3/SDL_dxr3video.h 2002-12-29 09:09:01.000000000 -0800
@@ -0,0 +1,61 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Sam Lantinga
+ [EMAIL PROTECTED]
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id: libsdl1.2-dxr3-ffmpeg.diff,v 1.1 2003/06/24 23:31:33 outlyer Exp $";
+#endif
+
+#ifndef _SDL_dxr3video_h
+#define _SDL_dxr3video_h
+
+#include <unistd.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/termios.h>
+
+#include <avcodec.h>
+
+#include "SDL_mouse.h"
+#include "SDL_sysvideo.h"
+#include "SDL_mutex.h"
+
+/* Private display data */
+
+struct SDL_PrivateVideoData {
+ int w, h;
+ UINT8 *buffer;
+
+ AVCodec *codec;
+ AVCodecContext *c;
+ AVFrame *picture;
+ UINT8 *picture_yuv;
+ UINT8 *outbuf;
+
+ int fd_video;
+ int fd_control;
+ struct termios tio_orig;
+ int fd_keyboard;
+ int posted;
+};
+
+#endif /* _SDL_dxr3video_h */
--- /usr/local/SDL-1.2.5/src/video/Makefile.am 2002-10-06 11:47:20.000000000 -0700
+++ SDL-1.2.5/src/video/Makefile.am 2002-12-29 06:58:58.000000000 -0800
@@ -5,7 +5,7 @@
# Define which subdirectories need to be built
SUBDIRS = @VIDEO_SUBDIRS@
-DIST_SUBDIRS = dummy x11 dga nanox fbcon directfb vgl svga ggi aalib \
+DIST_SUBDIRS = dxr3 dummy x11 dga nanox fbcon directfb vgl svga ggi aalib \
wincommon windib windx5 \
maccommon macdsp macrom quartz \
bwindow ps2gs photon cybergfx epoc picogui \
--- /usr/local/SDL-1.2.5/src/video/SDL_sysvideo.h 2002-10-05 09:50:56.000000000
-0700
+++ SDL-1.2.5/src/video/SDL_sysvideo.h 2002-12-29 06:58:58.000000000 -0800
@@ -394,6 +394,9 @@
#ifdef ENABLE_DUMMYVIDEO
extern VideoBootStrap DUMMY_bootstrap;
#endif
+#ifdef ENABLE_DXR3VIDEO
+extern VideoBootStrap DXR3_bootstrap;
+#endif
#ifdef ENABLE_XBIOS
extern VideoBootStrap XBIOS_bootstrap;
#endif
--- /usr/local/SDL-1.2.5/src/video/SDL_video.c 2002-10-05 09:50:56.000000000 -0700
+++ SDL-1.2.5/src/video/SDL_video.c 2002-12-29 06:58:58.000000000 -0800
@@ -105,6 +105,9 @@
#ifdef ENABLE_DUMMYVIDEO
&DUMMY_bootstrap,
#endif
+#ifdef ENABLE_DXR3VIDEO
+ &DXR3_bootstrap,
+#endif
#ifdef ENABLE_XBIOS
&XBIOS_bootstrap,
#endif
--- NEW FILE: mp1e_btaudio.diff ---
Index: devices/oss.c
===================================================================
RCS file: /cvsroot/zapping/rte/mp1e/devices/oss.c,v
retrieving revision 1.6
diff -u -w -b -B -d -r1.6 oss.c
--- devices/oss.c 14 Dec 2002 00:43:44 -0000 1.6
+++ devices/oss.c 15 Feb 2003 05:58:11 -0000
@@ -329,17 +329,17 @@
ASSERT("get PCM rec source",
IOCTL(fd, SOUND_MIXER_READ_RECSRC, &old_recsrc) == 0);
- ASSERT("get PCM rec volume",
- IOCTL(fd, MIXER_READ(mix_line), &old_recvol) == 0);
+ /*ASSERT("get PCM rec volume",
+ IOCTL(fd, MIXER_READ(mix_line), &old_recvol) == 0);S */
atexit(mix_restore);
ASSERT("set PCM rec source %d:%s",
IOCTL(fd, SOUND_MIXER_WRITE_RECSRC,
&recsrc) == 0, mix_line, sources[mix_line]);
- ASSERT("set PCM rec volume %d%%",
+/* ASSERT("set PCM rec volume %d%%",
IOCTL(fd, MIXER_WRITE(mix_line),
- &recvol) == 0, mix_volume);
+ &recvol) == 0, mix_volume); */
close(fd);
--- NEW FILE: sdl12cvs-directfb09-16-tvout.diff ---
--- src/video/directfb/SDL_DirectFB_video.orig.c 2003-04-16 21:05:50.000000000
+0300
+++ src/video/directfb/SDL_DirectFB_video.c 2003-04-16 21:21:06.000000000 +0300
@@ -387,7 +387,25 @@
goto error;
}
+#if 0
ret = dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer);
+#else
+ ret = dfb->GetDisplayLayer (dfb, 2, &layer);
+ if (ret == DFB_OK) {
+
+ DFBDisplayLayerConfig dlc;
+ DFBResult ret2;
+
+ layer->SetCooperativeLevel(layer, DLSCL_EXCLUSIVE);
+
+ dlc.flags = DLCONF_PIXELFORMAT;
+ dlc.pixelformat = DSPF_RGB32;
+ fprintf(stderr, "setting pixelformat to %x\n", dlc.pixelformat);
+ ret2 = layer->SetConfiguration(layer, &dlc);
+ if (ret2 != DFB_OK)
+ DirectFBError ("gdk_windowing_init_check: SetConfiguration",ret2);
+ }
+#endif
if (ret)
{
SetDirectFBerror ("dfb->GetDisplayLayer", ret);
@@ -511,6 +529,7 @@
}
}
+#if 0
/* Set cooperative level depending on flag SDL_FULLSCREEN */
if (flags & SDL_FULLSCREEN)
{
@@ -557,11 +576,23 @@
if (ret)
{
SetDirectFBerror ("dfb->CreateSurface", ret);
+#else
+/* HIDDEN->layer->SetCooperativeLevel(HIDDEN->layer, DLSCL_SHARED); */
+ ret = HIDDEN->layer->GetSurface (HIDDEN->layer, &surface);
+ if (ret)
+ {
+ SetDirectFBerror ("dfb->GetSurface", ret);
return NULL;
}
+#endif
+#if 0
current->w = width;
current->h = height;
+#else
+ HIDDEN->layer->SetOpacity(HIDDEN->layer, 0xff);
+ surface->GetSize(surface, ¤t->w, ¤t->h);
+#endif
current->flags = SDL_HWSURFACE | SDL_PREALLOC;
if (flags & SDL_FULLSCREEN)
@@ -808,8 +839,10 @@
}
if (region_valid)
+{
surface->Flip (surface, ®ion, DSFLIP_WAITFORSYNC);
}
+}
int DirectFB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
{
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog