summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-04-21 02:24:36 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-04-21 02:24:36 +0000
commit7f9753b1031700bee194fb5be045a13016a1e4e3 (patch)
tree66e8accb14d939d798814e4b0ff7cfe0fa601475 /mplayer.c
parent158e68356b21942ece7daa641a18c51630a202cd (diff)
downloadmpv-7f9753b1031700bee194fb5be045a13016a1e4e3.tar.bz2
mpv-7f9753b1031700bee194fb5be045a13016a1e4e3.tar.xz
some dvd sub parsing and check added
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@558 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c117
1 files changed, 113 insertions, 4 deletions
diff --git a/mplayer.c b/mplayer.c
index 5842d01757..f116bf034d 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -184,6 +184,86 @@ void find_sub(int key){
vo_sub=NULL; // no sub here
}
+
+
+
+
+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
//**************************************************************************//
@@ -2058,10 +2138,39 @@ switch(file_format){
}
// DVD sub:
- { unsigned char* buf=NULL;
- int len=ds_get_packet_sub(d_dvdsub,&buf);
- if(len>0){
- printf("\rDVD sub: %d \n",len);
+ { unsigned char* packet=NULL;
+ int len=ds_get_packet_sub(d_dvdsub,&packet);
+ 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");
+ } else if(len>=0) {
+ printf("invalud dvd sub\n");
}
}