summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-04-21 17:31:32 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-04-21 17:31:32 +0000
commitd73d923d051efea8d8d044cab512e0358d4010ce (patch)
tree8f29678baa6232cf20d164645bb9af7cac7b79b4
parente0af35ff341724121e26a916c26f0d647d9d59cb (diff)
downloadmpv-d73d923d051efea8d8d044cab512e0358d4010ce.tar.bz2
mpv-d73d923d051efea8d8d044cab512e0358d4010ce.tar.xz
spudec_decode() moved from mplayer.c to spudec.c
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@562 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--mplayer.c31
-rw-r--r--spudec.c29
-rw-r--r--spudec.h1
3 files changed, 35 insertions, 26 deletions
diff --git a/mplayer.c b/mplayer.c
index 3fe87cffe1..e1bed94804 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2065,32 +2065,11 @@ switch(file_format){
if(len>=2){
int len2;
len2=(packet[0]<<8)+packet[1];
- printf("\rDVD sub: %d / %d \n",len,len2);
- if(len==len2){
-
-//-----------------------------------------------------
- int x0, x1;
- int d1, d2;
- int lifetime;
- x0 = (packet[2] << 8) + packet[3];
- x1 = (packet[x0+2] << 8) + packet[x0+3];
-
- /* /Another/ sanity check. */
- if((packet[x1+2]<<8) + packet[x1+3] != x1) {
- printf("spudec: Incorrect packet.\n");
- return;
- }
- lifetime= ((packet[x1]<<8) + packet[x1+1]);
- printf("lifetime=%d\n",lifetime);
-
- d1 = d2 = -1;
- spudec_process_control(packet + x0 + 2, x1-x0-2, &d1, &d2);
-// if((d1 != -1) && (d2 != -1)) {
-// spudec_process_data(packet, x0, d1, d2);
-// }
-//-----------------------------------------------------
-
- } else printf("fragmented dvd-subs not yet supported!!!\n");
+ if(verbose) printf("\rDVD sub: %d / %d \n",len,len2);
+ if(len==len2)
+ spudec_decode(packet,len);
+ else
+ printf("fragmented dvd-subs not yet supported!!!\n");
} else if(len>=0) {
printf("invalud dvd sub\n");
}
diff --git a/spudec.c b/spudec.c
index 17aec44f6e..be9b95c507 100644
--- a/spudec.c
+++ b/spudec.c
@@ -84,5 +84,34 @@ void spudec_process_control(unsigned char *control, int size, int* d1, int* d2)
} while(off < size);
}
+// SPU packet format: (guess only, by A'rpi)
+// 0 word whole packet size
+// 2 word x0 sub-packet size
+// 4 x0-2 pixel data
+// x0+2 word x1 sub-packet size
+// x0+4 x1-x0-2 process control data
+// x1 word lifetime
+// x1+2 word x1 sub-packet size again
+void spudec_decode(unsigned char *packet,int len){
+ int x0, x1;
+ int d1, d2;
+ int lifetime;
+ x0 = (packet[2] << 8) + packet[3];
+ x1 = (packet[x0+2] << 8) + packet[x0+3];
+
+ /* /Another/ sanity check. */
+ if((packet[x1+2]<<8) + packet[x1+3] != x1) {
+ printf("spudec: Incorrect packet.\n");
+ return;
+ }
+ lifetime= ((packet[x1]<<8) + packet[x1+1]);
+ printf("lifetime=%d\n",lifetime);
+
+ d1 = d2 = -1;
+ spudec_process_control(packet + x0 + 2, x1-x0-2, &d1, &d2);
+// if((d1 != -1) && (d2 != -1)) {
+// spudec_process_data(packet, x0, d1, d2);
+// }
+}
diff --git a/spudec.h b/spudec.h
index f02b84334f..c6f0b8b4fd 100644
--- a/spudec.h
+++ b/spudec.h
@@ -2,5 +2,6 @@
#define _MPLAYER_SPUDEC_H
void spudec_process_control(unsigned char *, int, int*, int*);
+void spudec_decode(unsigned char *packet,int len);
#endif