[MPlayer-cvslog] r22202 - trunk/mplayer.c

reimar subversion at mplayerhq.hu
Sun Feb 11 14:23:13 CET 2007


Author: reimar
Date: Sun Feb 11 14:23:13 2007
New Revision: 22202

Modified:
   trunk/mplayer.c

Log:
Clear/update subtitles after seeking backwards.


Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	(original)
+++ trunk/mplayer.c	Sun Feb 11 14:23:13 2007
@@ -418,6 +418,7 @@
 int use_filedir_conf;
 
 static unsigned int inited_flags=0;
+static void update_subtitles(int reset);
 #define INITED_VO 1
 #define INITED_AO 2
 #define INITED_GUI 4
@@ -2364,14 +2365,12 @@
 #ifdef USE_DVDREAD
             if (vo_spudec && stream->type == STREAMTYPE_DVD) {
                 d_dvdsub->id = dvdsub_id;
-                spudec_reset(vo_spudec);
             }
 #endif
 
 #ifdef USE_DVDNAV
             if (vo_spudec && stream->type == STREAMTYPE_DVDNAV) {
                 d_dvdsub->id = dvdsub_id;
-                spudec_reset(vo_spudec);
             }
 #endif
             if (stream->type != STREAMTYPE_DVD && stream->type != STREAMTYPE_DVDNAV) {
@@ -2397,17 +2396,14 @@
 #endif
             }
         }
-    } else { // off
-        vo_osd_changed(OSDTYPE_SUBTITLE);
-        if(vo_spudec) vo_osd_changed(OSDTYPE_SPU);
     }
 #ifdef USE_DVDREAD
     if (vo_spudec && (stream->type == STREAMTYPE_DVD || stream->type == STREAMTYPE_DVDNAV) && dvdsub_id < 0 && reset_spu) {
         dvdsub_id = -2;
         d_dvdsub->id = dvdsub_id;
-        spudec_reset(vo_spudec);
     }
 #endif
+    update_subtitles(1);
 
     return M_PROPERTY_OK;
 }
@@ -2894,16 +2890,28 @@
 	audio_out->get_delay();
 }
 
-static void update_subtitles(void)
+static void update_subtitles(int reset)
 {
     unsigned char *packet=NULL;
     int len;
     char type = d_dvdsub->sh ? ((sh_sub_t *)d_dvdsub->sh)->type : 'v';
+    static subtitle subs;
     if (type == 'a')
 #ifdef USE_ASS
       if (!ass_enabled)
 #endif
       type = 't';
+    if (reset) {
+	sub_clear_text(&subs, MP_NOPTS_VALUE);
+	if (vo_sub) {
+	    vo_sub = NULL;
+	    vo_osd_changed(OSDTYPE_SUBTITLE);
+	}
+	if (vo_spudec) {
+	    spudec_reset(vo_spudec);
+	    vo_osd_changed(OSDTYPE_SPU);
+	}
+    }
     // find sub
     if (subdata) {
 	double pts = sh_video->pts;
@@ -2964,7 +2972,6 @@
 	if (spudec_changed(vo_spudec))
 	    vo_osd_changed(OSDTYPE_SPU);
     } else if (dvdsub_id >= 0 && type == 't') {
-	static subtitle subs;
 	double curpts = sh_video->pts + sub_delay;
 	double endpts;
 	vo_sub = &subs;
@@ -3032,7 +3039,7 @@
 	current_module = "decode video";
 	decoded_frame = decode_video(sh_video, start, in_size, 0, pts);
 	if (decoded_frame) {
-	    update_subtitles();
+	    update_subtitles(0);
 	    update_osd_msg();
 	    current_module = "filter video";
 	    if (filter_video(sh_video, decoded_frame, sh_video->pts))
@@ -3462,7 +3469,7 @@
 		drop_frame = dropped_frames = 0;
 	    ++total_frame_cnt;
 	}
-	update_subtitles();
+	update_subtitles(0);
 	update_osd_msg();
 	current_module = "decode_video";
 	decoded_frame = decode_video(sh_video, start, in_size, drop_frame,
@@ -5629,7 +5636,7 @@
 	audio_time_usage=0; video_time_usage=0; vout_time_usage=0;
 	drop_frame_cnt=0;
 
-        if(vo_spudec) spudec_reset(vo_spudec);
+        update_subtitles(1);
       }
   }
 /*



More information about the MPlayer-cvslog mailing list