From e0af35ff341724121e26a916c26f0d647d9d59cb Mon Sep 17 00:00:00 2001 From: lgb Date: Sat, 21 Apr 2001 15:38:01 +0000 Subject: Separated dvdsub code to be able to work with it easier git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@561 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Makefile | 4 +-- mplayer.c | 80 +-------------------------------------------------------- spudec.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ spudec.h | 6 +++++ 4 files changed, 97 insertions(+), 81 deletions(-) create mode 100644 spudec.c create mode 100644 spudec.h diff --git a/Makefile b/Makefile index c66a71ae1b..7a9940d9fe 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,8 @@ PRG_CFG = codec-cfg prefix = /usr/local BINDIR = ${prefix}/bin # BINDIR = /usr/local/bin -SRCS = codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c -OBJS = codec-cfg.o subreader.o linux/getch2.o linux/timer-lx.o linux/shmem.o xa/xa_gsm.o lirc_mp.o cfgparser.o mixer.o dvdauth.o +SRCS = codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c +OBJS = codec-cfg.o subreader.o linux/getch2.o linux/timer-lx.o linux/shmem.o xa/xa_gsm.o lirc_mp.o cfgparser.o mixer.o dvdauth.o spudec.o CFLAGS = $(OPTFLAGS) $(CSS_INC) -Iloader -Ilibvo # -Wall A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3 VO_LIBS = -Llibvo -lvo $(X_LIBS) diff --git a/mplayer.c b/mplayer.c index f116bf034d..3fe87cffe1 100644 --- a/mplayer.c +++ b/mplayer.c @@ -51,6 +51,7 @@ #include "codec-cfg.h" #include "dvdauth.h" +#include "spudec.h" #ifdef USE_DIRECTSHOW #include "DirectShow/DS_VideoDec.h" @@ -185,85 +186,6 @@ void find_sub(int key){ } - - - -void spudec_process_control(unsigned char *control, int size, int* d1, int* d2) -{ - int off = 2; - int a,b; /* Temporary vars */ - - do { - int type = control[off]; - off++; - printf("cmd=%d ",type); - - switch(type) { - case 0x00: - /* Menu ID, 1 byte */ - printf("Menu ID\n"); - break; - case 0x01: - /* Start display */ - printf("Start display!\n"); -// gSpudec.geom.bIsVisible = 1; - break; - case 0x03: - /* Palette */ - printf("Palette\n"); -// palette[3] = &(gSpudec.clut[(control[off] >> 4)]); -// palette[2] = &(gSpudec.clut[control[off] & 0xf]); -// palette[1] = &(gSpudec.clut[(control[off+1] >> 4)]); -// palette[0] = &(gSpudec.clut[control[off+1] & 0xf]); - off+=2; - break; - case 0x04: - /* Alpha */ - printf("Alpha\n"); -// alpha[3] = control[off] & 0xf0; -// alpha[2] = (control[off] & 0xf) << 4; -// alpha[1] = control[off+1] & 0xf0; -// alpha[0] = (control[off+1] & 0xf) << 4; - off+=2; - break; - case 0x05: - /* Co-ords */ - a = (control[off] << 16) + (control[off+1] << 8) + control[off+2]; - b = (control[off+3] << 16) + (control[off+4] << 8) + control[off+5]; - - printf("Coords col: %d - %d row: %d - %d\n",a >> 12,a & 0xfff,b >> 12,b & 0xfff); - -// gSpudec.geom.start_col = a >> 12; -// gSpudec.geom.end_col = a & 0xfff; -// gSpudec.geom.start_row = b >> 12; -// gSpudec.geom.end_row = b & 0xfff; - - off+=6; - break; - case 0x06: - /* Graphic lines */ - *(d1) = (control[off] << 8) + control[off+1]; - *(d2) = (control[off+2] << 8) + control[off+3]; - printf("Graphic pos color: %d b/w: %d\n",*d1,*d2); - off+=4; - break; - case 0xff: - /* All done, bye-bye */ - printf("Done!\n"); - return; - break; - default: - printf("spudec: Error determining control type 0x%02x.\n",type); - return; - break; - } - - /* printf("spudec: Processsed control type 0x%02x.\n",type); */ - } while(off < size); -} - - - //**************************************************************************// // Config file //**************************************************************************// diff --git a/spudec.c b/spudec.c new file mode 100644 index 0000000000..17aec44f6e --- /dev/null +++ b/spudec.c @@ -0,0 +1,88 @@ +/* SPUdec.c + Skeleton of function spudec_process_controll() was written by Apri. + Further works: + LGB,... (yeah, try to improve it and insert your name here! ;-) */ + + +#include +#include "spudec.h" + + + + +void spudec_process_control(unsigned char *control, int size, int* d1, int* d2) +{ + int off = 2; + int a,b; /* Temporary vars */ + + do { + int type = control[off]; + off++; + printf("cmd=%d ",type); + + switch(type) { + case 0x00: + /* Menu ID, 1 byte */ + printf("Menu ID\n"); + break; + case 0x01: + /* Start display */ + printf("Start display!\n"); +// gSpudec.geom.bIsVisible = 1; + break; + case 0x03: + /* Palette */ + printf("Palette\n"); +// palette[3] = &(gSpudec.clut[(control[off] >> 4)]); +// palette[2] = &(gSpudec.clut[control[off] & 0xf]); +// palette[1] = &(gSpudec.clut[(control[off+1] >> 4)]); +// palette[0] = &(gSpudec.clut[control[off+1] & 0xf]); + off+=2; + break; + case 0x04: + /* Alpha */ + printf("Alpha\n"); +// alpha[3] = control[off] & 0xf0; +// alpha[2] = (control[off] & 0xf) << 4; +// alpha[1] = control[off+1] & 0xf0; +// alpha[0] = (control[off+1] & 0xf) << 4; + off+=2; + break; + case 0x05: + /* Co-ords */ + a = (control[off] << 16) + (control[off+1] << 8) + control[off+2]; + b = (control[off+3] << 16) + (control[off+4] << 8) + control[off+5]; + + printf("Coords col: %d - %d row: %d - %d\n",a >> 12,a & 0xfff,b >> 12,b & 0xfff); + +// gSpudec.geom.start_col = a >> 12; +// gSpudec.geom.end_col = a & 0xfff; +// gSpudec.geom.start_row = b >> 12; +// gSpudec.geom.end_row = b & 0xfff; + + off+=6; + break; + case 0x06: + /* Graphic lines */ + *(d1) = (control[off] << 8) + control[off+1]; + *(d2) = (control[off+2] << 8) + control[off+3]; + printf("Graphic pos color: %d b/w: %d\n",*d1,*d2); + off+=4; + break; + case 0xff: + /* All done, bye-bye */ + printf("Done!\n"); + return; + break; + default: + printf("spudec: Error determining control type 0x%02x.\n",type); + return; + break; + } + + /* printf("spudec: Processsed control type 0x%02x.\n",type); */ + } while(off < size); +} + + + diff --git a/spudec.h b/spudec.h new file mode 100644 index 0000000000..f02b84334f --- /dev/null +++ b/spudec.h @@ -0,0 +1,6 @@ +#ifndef _MPLAYER_SPUDEC_H +#define _MPLAYER_SPUDEC_H + +void spudec_process_control(unsigned char *, int, int*, int*); + +#endif -- cgit v1.2.3