[Mplayer-cvslog] CVS: main spudec.c,1.28,1.29 mplayer.c,1.506,1.507

Atmosfear atmos4 at mplayerhq.hu
Sat May 25 19:40:42 CEST 2002


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv13077

Modified Files:
	spudec.c mplayer.c 
Log Message:
Bounding box and partial update patch for vob/dvdsub by Hephooey.


Index: spudec.c
===================================================================
RCS file: /cvsroot/mplayer/main/spudec.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- spudec.c	17 May 2002 23:47:21 -0000	1.28
+++ spudec.c	25 May 2002 17:40:40 -0000	1.29
@@ -3,7 +3,7 @@
    1: aproximate
    2: full (slowest, best looking)
  */
-#define ANTIALIASING_ALGORITHM 1
+#define ANTIALIASING_ALGORITHM 2
 
 /* SPUdec.c
    Skeleton of function spudec_process_controll() is from xine sources.
@@ -69,6 +69,7 @@
   vo_functions_t *hw_spu;
 } spudec_handle_t;
 
+static int spu_changed = 0;
 
 static inline unsigned int get_be16(const unsigned char *p)
 {
@@ -347,8 +348,14 @@
     spudec_process_control(this, pts100);
     spudec_process_data(this);
   }
+  spu_changed = 1;
 }
 
+int spudec_changed(void * this)
+{
+    spudec_handle_t * spu = (spudec_handle_t*)this;
+    return (spu_changed|(spu->now_pts > spu->end_pts));
+}
 
 void spudec_assemble(void *this, unsigned char *packet, unsigned int len, unsigned int pts100)
 {
@@ -445,6 +452,27 @@
 		   spu->image, spu->aimage, spu->stride);
 }
 
+void spudec_calc_bbox(void *me, unsigned int dxs, unsigned int dys, unsigned int* bbox)
+{
+  spudec_handle_t *spu;
+  spu = (spudec_handle_t *)me;
+  if (spu->orig_frame_width == 0 || spu->orig_frame_height == 0
+  || (spu->orig_frame_width == dxs && spu->orig_frame_height == dys)) {
+    bbox[0] = spu->start_col;
+    bbox[1] = spu->start_col + spu->width;
+    bbox[2] = spu->start_row;
+    bbox[3] = spu->start_row + spu->height;
+  }
+  else if (spu->scaled_frame_width != dxs || spu->scaled_frame_height != dys) {
+    unsigned int scalex = 0x100 * dxs / spu->orig_frame_width;
+    unsigned int scaley = 0x100 * dys / spu->orig_frame_height;
+    bbox[0] = spu->start_col * scalex / 0x100;
+    bbox[1] = spu->start_col * scalex / 0x100 + spu->width * scalex / 0x100;
+    bbox[2] = spu->start_row * scaley / 0x100;
+    bbox[3] = spu->start_row * scaley / 0x100 + spu->height * scaley / 0x100;
+  }
+}
+
 /* transform mplayer's alpha value into an opacity value that is linear */
 static inline int canon_alpha(int alpha)
 {
@@ -718,9 +746,11 @@
 	  spu->scaled_frame_height = dys;
 	}
       }
-      if (spu->scaled_image)
+      if (spu->scaled_image){
 	draw_alpha(spu->scaled_start_col, spu->scaled_start_row, spu->scaled_width, spu->scaled_height,
 		   spu->scaled_image, spu->scaled_aimage, spu->scaled_stride);
+	spu_changed = 0;
+      }
     }
   }
   else

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.506
retrieving revision 1.507
diff -u -r1.506 -r1.507
--- mplayer.c	25 May 2002 11:40:29 -0000	1.506
+++ mplayer.c	25 May 2002 17:40:40 -0000	1.507
@@ -2960,8 +2960,9 @@
       spudec_assemble(vo_spudec,packet,len,timestamp);
   }
   
-  /* Don't know how to detect wether the sub has changed or not */
-  vo_osd_changed(OSDTYPE_SPU);
+  /* detect wether the sub has changed or not */
+  if(spudec_changed(vo_spudec))
+    vo_osd_changed(OSDTYPE_SPU);
   current_module=NULL;
 }
   




More information about the MPlayer-cvslog mailing list