From cf33c343cf60b3f0f24c1b29bb084e77d8fe2b2c Mon Sep 17 00:00:00 2001 From: pontscho Date: Mon, 17 Dec 2001 00:07:20 +0000 Subject: [PATCH] some small sub bug fix git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3544 b3059339-0415-0410-9bf9-f77b7e298cf2 --- find_sub.c | 3 +++ mplayer.c | 24 ++++++++++++++++++------ subreader.c | 13 ++++++++++++- subreader.h | 1 + 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/find_sub.c b/find_sub.c index 1c022efc4c..06e396c6d0 100644 --- a/find_sub.c +++ b/find_sub.c @@ -25,6 +25,9 @@ static int nosub_range_end=-1; void find_sub(subtitle* subtitles,int key){ int i,j; + + if ( !subtitles ) return; + if(vo_sub){ if(key>=vo_sub->start && key<=vo_sub->end) return; // OK! } else { diff --git a/mplayer.c b/mplayer.c index fb688e2d27..57b2907620 100644 --- a/mplayer.c +++ b/mplayer.c @@ -663,13 +663,17 @@ play_next_file: usleep(20000); EventHandling(); } - if(mplShMem->FilenameChanged){ - filename=mplShMem->Filename; - } + #ifdef USE_SUB - sub_name=NULL; - if ( mplShMem->SubtitleChanged ) sub_name=mplShMem->Subtitlename; + if ( mplShMem->SubtitleChanged || !mplShMem->FilenameChanged ) + { sub_name=mplShMem->Subtitlename; mplShMem->SubtitleChanged=0; } #endif + + if ( mplShMem->FilenameChanged || !filename ) + { + filename=mplShMem->Filename; + mplShMem->FilenameChanged=0; + } } #endif @@ -2178,7 +2182,15 @@ if(use_gui || ++curr_filenamelines;i++ ) free( subs->text[i] ); + free( subs ); + subs=NULL; +} #ifdef DUMPSUBS int main(int argc, char **argv) { // for testing diff --git a/subreader.h b/subreader.h index f73ed3983f..b3c7fc8c0b 100644 --- a/subreader.h +++ b/subreader.h @@ -37,5 +37,6 @@ typedef struct { subtitle* sub_read_file (char *filename); char * sub_filename(char *path, char * fname ); void list_sub_file(subtitle* subs); +void sub_free( subtitle * subs ); #endif