[Mplayer-cvslog] CVS: main vobsub.c,1.6,1.7

Atmosfear atmos4 at mplayer.dev.hu
Thu Apr 11 18:50:55 CEST 2002


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

Modified Files:
	vobsub.c 
Log Message:
Sorry, fix vobsub duration the arpi way.
Also added origin parsing, those values are to adjust subtitle placement, they should be added to start_row and end_row and start_col and end_col, but haven't yet found the proper place to hook them in.


Index: vobsub.c
===================================================================
RCS file: /cvsroot/mplayer/main/vobsub.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- vobsub.c	29 Mar 2002 03:17:57 -0000	1.6
+++ vobsub.c	11 Apr 2002 16:50:52 -0000	1.7
@@ -410,6 +410,7 @@
     void *spudec;
     unsigned int palette[16];
     unsigned int orig_frame_width, orig_frame_height;
+    unsigned int origin_x, origin_y;
     /* index */
     packet_queue_t *spu_streams;
     unsigned int spu_streams_size;
@@ -481,7 +482,7 @@
     if (packet_queue_grow(queue) >= 0) {
 	pkt = queue->packets + (queue->packets_size - 1);
 	pkt->filepos = filepos;
-	pkt->pts100 = ms / 10;
+	pkt->pts100 = ms * 90;
 	return 0;
     }
     return -1;
@@ -588,6 +589,23 @@
 }
 
 static int
+vobsub_parse_origin(vobsub_t *vob, const char *line)
+{
+    // org: X,Y
+    char *p;
+    while (isspace(*line))
+	++line;
+    if (!isdigit(*line))
+	return -1;
+    vob->origin_x = strtoul(line, &p, 10);
+    if (*p != ',')
+	return -1;
+    ++p;
+    vob->origin_y = strtoul(p, NULL, 10);
+    return 0;
+}
+
+static int
 vobsub_parse_palette(vobsub_t *vob, const char *line)
 {
     // palette: XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX
@@ -634,6 +652,8 @@
 	    res = vobsub_parse_palette(vob, line + 8);
 	else if (strncmp("size:", line, 5) == 0)
 	    res = vobsub_parse_size(vob, line + 5);
+	else if (strncmp("org:", line, 4) == 0)
+	    res = vobsub_parse_origin(vob, line + 4);
 	else if (strncmp("timestamp:", line, 10) == 0)
 	    res = vobsub_parse_timestamp(vob, line + 10);
 	else {
@@ -822,15 +842,16 @@
 void vobsub_draw(void *this, int dxs, int dys, void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride))
 {
     vobsub_t *vob = (vobsub_t *)this;
-    if (vob->spudec)
+    if (vob->spudec) {
 	spudec_draw_scaled(vob->spudec, dxs, dys, draw_alpha);
+    }	
 }
 
 void
 vobsub_process(void *vobhandle, float pts)
 {
     vobsub_t *vob = (vobsub_t *)vobhandle;
-    unsigned int pts100 = 100 * pts;
+    unsigned int pts100 = 90000 * pts;
     if (vob->spudec) {
 	spudec_heartbeat(vob->spudec, pts100);
 	if (vob->spu_streams && 0 <= vobsub_id && (unsigned) vobsub_id < vob->spu_streams_size) {




More information about the MPlayer-cvslog mailing list