From 7566e72f775941c0a0ff3234e0e718cf36d91f56 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 5 Nov 2009 20:59:46 +0000 Subject: Change dvdnav_reset_stream to not disable subtitles, since that breaks selecting the subtitle via -slang or -sid. It is quite possible that removing it will cause other issues, though I could not see any with the DVDs I had available for testing. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29827 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 90ecea84a5..3ac29d322e 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1894,8 +1894,6 @@ static void mp_dvdnav_reset_stream (MPContext *ctx) { resync_audio_stream(ctx->sh_audio); } - if (ctx->d_sub) dvdsub_id = -2; - audio_delay = 0.0f; /// clear all EOF related flags -- cgit v1.2.3 From fefbdf991b0427c3b32d9333fedccdaf91a9a50e Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 6 Nov 2009 15:56:30 +0000 Subject: Disable audio when initializing the filter chain fails (can happen e.g. when the hwmpa decoder is used but the hardware does not support hardware MPEG audio). Otherwise this will lead to a crash later on when the decode code tries to access the audio filter chain. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29836 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 3ac29d322e..52b5fd3285 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1642,10 +1642,7 @@ if(mpctx->sh_audio){ ao_data.format,0))){ // FAILED: mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CannotInitAO); - uninit_player(INITIALIZED_ACODEC); // close codec - mpctx->sh_audio=mpctx->d_audio->sh=NULL; // -> nosound - mpctx->d_audio->id = -2; - return; + goto init_error; } else { // SUCCESS: initialized_flags|=INITIALIZED_AO; @@ -1663,15 +1660,19 @@ if(mpctx->sh_audio){ current_module="af_init"; if(!build_afilter_chain(mpctx->sh_audio, &ao_data)) { mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_NoMatchingFilter); -// mp_msg(MSGT_CPLAYER,MSGL_ERR,"Couldn't find matching filter / ao format! -> NOSOUND\n"); -// uninit_player(INITIALIZED_ACODEC|INITIALIZED_AO); // close codec & ao -// sh_audio=mpctx->d_audio->sh=NULL; // -> nosound + goto init_error; } #endif } mpctx->mixer.audio_out = mpctx->audio_out; mpctx->mixer.volstep = volstep; } +return; + +init_error: + uninit_player(INITIALIZED_ACODEC|INITIALIZED_AO); // close codec and possibly AO + mpctx->sh_audio=mpctx->d_audio->sh=NULL; // -> nosound + mpctx->d_audio->id = -2; } -- cgit v1.2.3 From f4926132f80a160ee64fbdfe2468f12d6b829076 Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 6 Nov 2009 15:59:42 +0000 Subject: Use an early return instead of a {} block over the whole function in reinit_audio_chain git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29837 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 52b5fd3285..b9d3c990eb 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1606,7 +1606,8 @@ static void update_osd_msg(void) { void reinit_audio_chain(void) { -if(mpctx->sh_audio){ + if (!mpctx->sh_audio) + return; current_module="init_audio_codec"; mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); if(!init_best_audio_codec(mpctx->sh_audio,audio_codec_list,audio_fm_list)){ @@ -1666,7 +1667,6 @@ if(mpctx->sh_audio){ } mpctx->mixer.audio_out = mpctx->audio_out; mpctx->mixer.volstep = volstep; -} return; init_error: -- cgit v1.2.3 From 9edfe2046e8898a8eefd6b98b9a7c2f7ae5ed4aa Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 6 Nov 2009 16:04:39 +0000 Subject: Remove some unnecessary else blocks git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29838 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index b9d3c990eb..467afae297 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1614,7 +1614,7 @@ void reinit_audio_chain(void) { mpctx->sh_audio=mpctx->d_audio->sh=NULL; // failed to init :( mpctx->d_audio->id = -2; return; - } else + } initialized_flags|=INITIALIZED_ACODEC; mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); @@ -1644,7 +1644,7 @@ void reinit_audio_chain(void) { // FAILED: mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CannotInitAO); goto init_error; - } else { + } // SUCCESS: initialized_flags|=INITIALIZED_AO; mp_msg(MSGT_CPLAYER,MSGL_INFO,"AO: [%s] %dHz %dch %s (%d bytes per sample)\n", @@ -1664,7 +1664,6 @@ void reinit_audio_chain(void) { goto init_error; } #endif - } mpctx->mixer.audio_out = mpctx->audio_out; mpctx->mixer.volstep = volstep; return; -- cgit v1.2.3 From bf80f3595889328ce777792531f092673853e931 Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 6 Nov 2009 16:06:33 +0000 Subject: Simplify: use &= instead of a = b & a; git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29839 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 467afae297..be05ddd420 100644 --- a/mplayer.c +++ b/mplayer.c @@ -564,7 +564,7 @@ static void mp_dvdnav_context_free(MPContext *ctx){ #endif void uninit_player(unsigned int mask){ - mask=initialized_flags&mask; + mask &= initialized_flags; mp_msg(MSGT_CPLAYER,MSGL_DBG2,"\n*** uninit(0x%X)\n",mask); -- cgit v1.2.3 From e83addcbfa94015783d80f2979acce7aae512df8 Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 6 Nov 2009 16:08:00 +0000 Subject: Reuse the init_error exit path also for init_best_audio_codec errors. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29840 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index be05ddd420..6768d2ec28 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1611,9 +1611,7 @@ void reinit_audio_chain(void) { current_module="init_audio_codec"; mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); if(!init_best_audio_codec(mpctx->sh_audio,audio_codec_list,audio_fm_list)){ - mpctx->sh_audio=mpctx->d_audio->sh=NULL; // failed to init :( - mpctx->d_audio->id = -2; - return; + goto init_error; } initialized_flags|=INITIALIZED_ACODEC; mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); -- cgit v1.2.3 From 477057dbb5c2b3e395f52be95e2182eaa368cfdd Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 6 Nov 2009 16:10:19 +0000 Subject: Split assignment from error value check to avoid overcomplicated if () condition. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29841 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 6768d2ec28..48d76f43a7 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1634,11 +1634,12 @@ void reinit_audio_chain(void) { } #endif current_module="ao2_init"; - if(!(mpctx->audio_out=init_best_audio_out(audio_driver_list, + mpctx->audio_out = init_best_audio_out(audio_driver_list, 0, // plugin flag ao_data.samplerate, ao_data.channels, - ao_data.format,0))){ + ao_data.format,0); + if(!mpctx->audio_out){ // FAILED: mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CannotInitAO); goto init_error; -- cgit v1.2.3 From 89c9b3b769e0affe2fa6d176440d85aa3d62a680 Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 6 Nov 2009 16:11:58 +0000 Subject: Remove some useless comments/commented-out code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29842 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 48d76f43a7..277cb5f3d1 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1617,7 +1617,6 @@ void reinit_audio_chain(void) { mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); - //const ao_info_t *info=audio_out->info; current_module="af_preinit"; ao_data.samplerate=force_srate; ao_data.channels=0; @@ -1640,11 +1639,9 @@ void reinit_audio_chain(void) { ao_data.channels, ao_data.format,0); if(!mpctx->audio_out){ - // FAILED: mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CannotInitAO); goto init_error; } - // SUCCESS: initialized_flags|=INITIALIZED_AO; mp_msg(MSGT_CPLAYER,MSGL_INFO,"AO: [%s] %dHz %dch %s (%d bytes per sample)\n", mpctx->audio_out->info->short_name, -- cgit v1.2.3 From b963af59f1d30704c2e47979bfe9d544eadc0d6b Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 6 Nov 2009 16:16:22 +0000 Subject: Whitespace cosmetics: reindent reinit_audio_chain function git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29843 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 86 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 277cb5f3d1..87f5b0b6ab 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1606,63 +1606,63 @@ static void update_osd_msg(void) { void reinit_audio_chain(void) { - if (!mpctx->sh_audio) - return; - current_module="init_audio_codec"; - mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); - if(!init_best_audio_codec(mpctx->sh_audio,audio_codec_list,audio_fm_list)){ - goto init_error; - } + if (!mpctx->sh_audio) + return; + current_module="init_audio_codec"; + mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); + if(!init_best_audio_codec(mpctx->sh_audio,audio_codec_list,audio_fm_list)){ + goto init_error; + } initialized_flags|=INITIALIZED_ACODEC; - mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); + mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); - current_module="af_preinit"; - ao_data.samplerate=force_srate; - ao_data.channels=0; - ao_data.format=audio_output_format; + current_module="af_preinit"; + ao_data.samplerate=force_srate; + ao_data.channels=0; + ao_data.format=audio_output_format; #if 1 - // first init to detect best values - if(!init_audio_filters(mpctx->sh_audio, // preliminary init - // input: - mpctx->sh_audio->samplerate, - // output: - &ao_data.samplerate, &ao_data.channels, &ao_data.format)){ - mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError); - exit_player(EXIT_ERROR); - } -#endif - current_module="ao2_init"; - mpctx->audio_out = init_best_audio_out(audio_driver_list, - 0, // plugin flag - ao_data.samplerate, - ao_data.channels, - ao_data.format,0); - if(!mpctx->audio_out){ - mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CannotInitAO); - goto init_error; - } + // first init to detect best values + if(!init_audio_filters(mpctx->sh_audio, // preliminary init + // input: + mpctx->sh_audio->samplerate, + // output: + &ao_data.samplerate, &ao_data.channels, &ao_data.format)){ + mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError); + exit_player(EXIT_ERROR); + } +#endif + current_module="ao2_init"; + mpctx->audio_out = init_best_audio_out(audio_driver_list, + 0, // plugin flag + ao_data.samplerate, + ao_data.channels, + ao_data.format, 0); + if(!mpctx->audio_out){ + mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CannotInitAO); + goto init_error; + } initialized_flags|=INITIALIZED_AO; mp_msg(MSGT_CPLAYER,MSGL_INFO,"AO: [%s] %dHz %dch %s (%d bytes per sample)\n", - mpctx->audio_out->info->short_name, - ao_data.samplerate, ao_data.channels, - af_fmt2str_short(ao_data.format), - af_fmt2bits(ao_data.format)/8 ); + mpctx->audio_out->info->short_name, + ao_data.samplerate, ao_data.channels, + af_fmt2str_short(ao_data.format), + af_fmt2bits(ao_data.format)/8 ); mp_msg(MSGT_CPLAYER,MSGL_V,"AO: Description: %s\nAO: Author: %s\n", - mpctx->audio_out->info->name, mpctx->audio_out->info->author); + mpctx->audio_out->info->name, mpctx->audio_out->info->author); if(strlen(mpctx->audio_out->info->comment) > 0) - mp_msg(MSGT_CPLAYER,MSGL_V,"AO: Comment: %s\n", mpctx->audio_out->info->comment); + mp_msg(MSGT_CPLAYER,MSGL_V,"AO: Comment: %s\n", mpctx->audio_out->info->comment); // init audio filters: #if 1 current_module="af_init"; if(!build_afilter_chain(mpctx->sh_audio, &ao_data)) { - mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_NoMatchingFilter); - goto init_error; + mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_NoMatchingFilter); + goto init_error; } #endif - mpctx->mixer.audio_out = mpctx->audio_out; - mpctx->mixer.volstep = volstep; -return; + mpctx->mixer.audio_out = mpctx->audio_out; + mpctx->mixer.volstep = volstep; + return; init_error: uninit_player(INITIALIZED_ACODEC|INITIALIZED_AO); // close codec and possibly AO -- cgit v1.2.3 From 36a0a355987f8619a6a93be5797b3ef9d0141903 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 7 Nov 2009 11:12:56 +0000 Subject: Use switch_program property from mplayer.c to set ts_prog. This seems to leave the ts demuxer unaffected, but fixes -tsprog with the lavf demuxer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29846 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 87f5b0b6ab..038d981b00 100644 --- a/mplayer.c +++ b/mplayer.c @@ -3339,6 +3339,10 @@ mpctx->d_audio=mpctx->demuxer->audio; mpctx->d_video=mpctx->demuxer->video; mpctx->d_sub=mpctx->demuxer->sub; +if (ts_prog) { + int tmp = ts_prog; + mp_property_do("switch_program", M_PROPERTY_SET, &tmp, mpctx); +} // select audio stream select_audio(mpctx->demuxer, audio_id, audio_lang); -- cgit v1.2.3 From d1e5bdf365db1a480bcbaccddcd79912c4eae998 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 11 Nov 2009 11:19:50 +0000 Subject: Factor out code that decides which subtitle to play. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29896 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 038d981b00..73b787f072 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1835,6 +1835,33 @@ static float timing_sleep(float time_frame) return time_frame; } +static void select_subtitle(MPContext *mpctx) { + // find the best sub to use + int vobsub_index_id = vobsub_get_index_by_id(vo_vobsub, vobsub_id); + mpctx->global_sub_pos = -1; // no subs by default + if (vobsub_index_id >= 0) { + // if user asks for a vobsub id, use that first. + mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_VOBSUB] + vobsub_index_id; + } else if (dvdsub_id >= 0 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) { + // if user asks for a dvd sub id, use that next. + mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id; + } else if (mpctx->global_sub_indices[SUB_SOURCE_SUBS] >= 0) { + // if there are text subs to use, use those. (autosubs come last here) + mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_SUBS]; + } else if (dvdsub_id == -1 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) { + // finally select subs by language and container hints + if (dvdsub_id == -1 && dvdsub_lang) + dvdsub_id = demuxer_sub_track_by_lang(mpctx->demuxer, dvdsub_lang); + if (dvdsub_id == -1) + dvdsub_id = demuxer_default_sub_track(mpctx->demuxer); + if (dvdsub_id >= 0) + mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id; + } + // rather than duplicate code, use the SUB_SELECT handler to init the right one. + mpctx->global_sub_pos--; + mp_property_do("sub",M_PROPERTY_STEP_UP,NULL, mpctx); +} + #ifdef CONFIG_DVDNAV #ifndef FF_B_TYPE #define FF_B_TYPE 3 @@ -3475,30 +3502,7 @@ if(1 || mpctx->sh_video) { } if (mpctx->global_sub_size) { - // find the best sub to use - int vobsub_index_id = vobsub_get_index_by_id(vo_vobsub, vobsub_id); - mpctx->global_sub_pos = -1; // no subs by default - if (vobsub_index_id >= 0) { - // if user asks for a vobsub id, use that first. - mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_VOBSUB] + vobsub_index_id; - } else if (dvdsub_id >= 0 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) { - // if user asks for a dvd sub id, use that next. - mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id; - } else if (mpctx->global_sub_indices[SUB_SOURCE_SUBS] >= 0) { - // if there are text subs to use, use those. (autosubs come last here) - mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_SUBS]; - } else if (dvdsub_id == -1 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) { - // finally select subs by language and container hints - if (dvdsub_id == -1 && dvdsub_lang) - dvdsub_id = demuxer_sub_track_by_lang(mpctx->demuxer, dvdsub_lang); - if (dvdsub_id == -1) - dvdsub_id = demuxer_default_sub_track(mpctx->demuxer); - if (dvdsub_id >= 0) - mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id; - } - // rather than duplicate code, use the SUB_SELECT handler to init the right one. - mpctx->global_sub_pos--; - mp_property_do("sub",M_PROPERTY_STEP_UP,NULL, mpctx); + select_subtitle(mpctx); if(subdata) switch (stream_dump_type) { case 3: list_sub_file(subdata); break; -- cgit v1.2.3 From 254b4855b1002f5f3d0912622bdccb8a771baa4f Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 11 Nov 2009 11:22:12 +0000 Subject: Remember which subtitle was auto-selected for dvdnav due to -slang and if it is unchanged re-apply -slang on stream reset. This makes -slang work when used with menu navigation or in general when the subtitle is not available for parts of the playback or the subtitle stream ID changes during playback. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29897 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 73b787f072..69c3e15fef 100644 --- a/mplayer.c +++ b/mplayer.c @@ -254,6 +254,10 @@ extern char *sub_demuxer_name; // override sub demuxer int audio_id=-1; int video_id=-1; int dvdsub_id=-1; +// this dvdsub_id was selected via slang +// use this to allow dvdnav to follow -slang across stream resets, +// in particular the subtitle ID for a language changes +int dvdsub_lang_id; int vobsub_id=-1; char* audio_lang=NULL; char* dvdsub_lang=NULL; @@ -1918,6 +1922,13 @@ static void mp_dvdnav_reset_stream (MPContext *ctx) { } audio_delay = 0.0f; + if (dvdsub_lang && dvdsub_id == dvdsub_lang_id) { + dvdsub_lang_id = mp_dvdnav_sid_from_lang(ctx->stream, dvdsub_lang); + if (dvdsub_lang_id != dvdsub_id) { + dvdsub_id = dvdsub_lang_id; + select_subtitle(ctx); + } + } /// clear all EOF related flags ctx->d_video->eof = ctx->d_audio->eof = ctx->stream->eof = 0; @@ -3237,7 +3248,9 @@ if(mpctx->stream->type==STREAMTYPE_DVD){ if(mpctx->stream->type==STREAMTYPE_DVDNAV){ current_module="dvdnav lang->id"; if(audio_id==-1) audio_id=mp_dvdnav_aid_from_lang(mpctx->stream,audio_lang); - if(dvdsub_lang && dvdsub_id==-1) dvdsub_id=mp_dvdnav_sid_from_lang(mpctx->stream,dvdsub_lang); + dvdsub_lang_id = -3; + if(dvdsub_lang && dvdsub_id==-1) + dvdsub_lang_id=dvdsub_id=mp_dvdnav_sid_from_lang(mpctx->stream,dvdsub_lang); // setup global sub numbering mpctx->global_sub_indices[SUB_SOURCE_DEMUX] = mpctx->global_sub_size; // the global # of the first demux-specific sub. mpctx->global_sub_size += mp_dvdnav_number_of_subs(mpctx->stream); -- cgit v1.2.3 From 376aa9416fa6e1d6244e0a821b45282875e73afb Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 11 Nov 2009 11:31:36 +0000 Subject: Do not call resume on unpausing if we have already reached eof while being paused (e.g. because of a "pausing_keep_force pt_step 1"). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29898 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 69c3e15fef..d79a74db44 100644 --- a/mplayer.c +++ b/mplayer.c @@ -2443,6 +2443,9 @@ static void pause_loop(void) } mpctx->osd_function=OSD_PLAY; if (mpctx->audio_out && mpctx->sh_audio) + if (mpctx->eof) // do not play remaining audio if we e.g. switch to the next file + mpctx->audio_out->reset(); + else mpctx->audio_out->resume(); // resume audio if (mpctx->video_out && mpctx->sh_video && vo_config_count) mpctx->video_out->control(VOCTRL_RESUME, NULL); // resume video -- cgit v1.2.3 From a63f28b99add9a1ce706d3299b391642e633c5ee Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 11 Nov 2009 11:35:28 +0000 Subject: Whitespace cosmetics: fix pause_loop indentation/remove inconsistently used tabs. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29899 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 74 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index d79a74db44..4ef2ac2df7 100644 --- a/mplayer.c +++ b/mplayer.c @@ -2394,68 +2394,68 @@ static void pause_loop(void) // Small hack to display the pause message on the OSD line. // The pause string is: "\n == PAUSE == \r" so we need to // take the first and the last char out - if (term_osd && !mpctx->sh_video) { - char msg[128] = MSGTR_Paused; - int mlen = strlen(msg); - msg[mlen-1] = '\0'; - set_osd_msg(OSD_MSG_PAUSE, 1, 0, "%s", msg+1); - update_osd_msg(); - } else - mp_msg(MSGT_CPLAYER,MSGL_STATUS,MSGTR_Paused); + if (term_osd && !mpctx->sh_video) { + char msg[128] = MSGTR_Paused; + int mlen = strlen(msg); + msg[mlen-1] = '\0'; + set_osd_msg(OSD_MSG_PAUSE, 1, 0, "%s", msg+1); + update_osd_msg(); + } else + mp_msg(MSGT_CPLAYER,MSGL_STATUS,MSGTR_Paused); mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_PAUSED\n"); } #ifdef CONFIG_GUI if (use_gui) - guiGetEvent(guiCEvent, (char *)guiSetPause); + guiGetEvent(guiCEvent, (char *)guiSetPause); #endif if (mpctx->video_out && mpctx->sh_video && vo_config_count) - mpctx->video_out->control(VOCTRL_PAUSE, NULL); + mpctx->video_out->control(VOCTRL_PAUSE, NULL); if (mpctx->audio_out && mpctx->sh_audio) - mpctx->audio_out->pause(); // pause audio, keep data if possible + mpctx->audio_out->pause(); // pause audio, keep data if possible while ( (cmd = mp_input_get_cmd(20, 1, 1)) == NULL || cmd->pausing == 4) { - if (cmd) { - cmd = mp_input_get_cmd(0,1,0); - run_command(mpctx, cmd); - mp_cmd_free(cmd); - continue; - } - if (mpctx->sh_video && mpctx->video_out && vo_config_count) - mpctx->video_out->check_events(); + if (cmd) { + cmd = mp_input_get_cmd(0,1,0); + run_command(mpctx, cmd); + mp_cmd_free(cmd); + continue; + } + if (mpctx->sh_video && mpctx->video_out && vo_config_count) + mpctx->video_out->check_events(); #ifdef CONFIG_GUI - if (use_gui) { - guiEventHandling(); - guiGetEvent(guiReDraw, NULL); - if (guiIntfStruct.Playing!=2 || (rel_seek_secs || abs_seek_pos)) - break; - } + if (use_gui) { + guiEventHandling(); + guiGetEvent(guiReDraw, NULL); + if (guiIntfStruct.Playing!=2 || (rel_seek_secs || abs_seek_pos)) + break; + } #endif #ifdef CONFIG_MENU - if (vf_menu) - vf_menu_pause_update(vf_menu); + if (vf_menu) + vf_menu_pause_update(vf_menu); #endif - usec_sleep(20000); + usec_sleep(20000); } if (cmd && cmd->id == MP_CMD_PAUSE) { - cmd = mp_input_get_cmd(0,1,0); - mp_cmd_free(cmd); + cmd = mp_input_get_cmd(0,1,0); + mp_cmd_free(cmd); } mpctx->osd_function=OSD_PLAY; if (mpctx->audio_out && mpctx->sh_audio) if (mpctx->eof) // do not play remaining audio if we e.g. switch to the next file mpctx->audio_out->reset(); else - mpctx->audio_out->resume(); // resume audio + mpctx->audio_out->resume(); // resume audio if (mpctx->video_out && mpctx->sh_video && vo_config_count) - mpctx->video_out->control(VOCTRL_RESUME, NULL); // resume video - (void)GetRelativeTime(); // ignore time that passed during pause + mpctx->video_out->control(VOCTRL_RESUME, NULL); // resume video + (void)GetRelativeTime(); // ignore time that passed during pause #ifdef CONFIG_GUI if (use_gui) { - if (guiIntfStruct.Playing == guiSetStop) - mpctx->eof = 1; - else - guiGetEvent(guiCEvent, (char *)guiSetPlay); + if (guiIntfStruct.Playing == guiSetStop) + mpctx->eof = 1; + else + guiGetEvent(guiCEvent, (char *)guiSetPlay); } #endif } -- cgit v1.2.3 From ab4bdb64e1010be0b408012a79629d05a663b7a1 Mon Sep 17 00:00:00 2001 From: ptt Date: Thu, 12 Nov 2009 09:21:53 +0000 Subject: Added -name, -title and -use-filename-title options and implementation in X11 vos git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29904 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 4ef2ac2df7..ee58b03660 100644 --- a/mplayer.c +++ b/mplayer.c @@ -349,6 +349,7 @@ edl_record_ptr next_edl_record = NULL; ///< only for traversing edl_records short edl_decision = 0; ///< 1 when an EDL operation has been made. FILE* edl_fd = NULL; ///< fd to write to when in -edlout mode. int use_filedir_conf; +int use_filename_title; static unsigned int initialized_flags=0; #include "mpcommon.h" @@ -3089,9 +3090,12 @@ while (player_idle_mode && !filename) { } //--------------------------------------------------------------------------- - if(filename) + if(filename) { mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_Playing, filename_recode(filename)); + if(use_filename_title && vo_wintitle == NULL) + vo_wintitle = strdup ( mp_basename2 (filename)); + } if (edl_filename) { if (edl_records) free_edl(edl_records); -- cgit v1.2.3 From fd35beaf0a51a45dc0df3e748edd196b56918283 Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 13 Nov 2009 13:21:59 +0000 Subject: Check that mpctx->audio_out is not NULL when trying to uninit it. Make audio uninit consistent with e.g. the demuxer uninit code and also avoids a possible crash. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29908 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index ee58b03660..91de264af0 100644 --- a/mplayer.c +++ b/mplayer.c @@ -649,7 +649,8 @@ void uninit_player(unsigned int mask){ initialized_flags&=~INITIALIZED_AO; current_module="uninit_ao"; if (mpctx->edl_muted) mixer_mute(&mpctx->mixer); - mpctx->audio_out->uninit(mpctx->eof?0:1); mpctx->audio_out=NULL; + if (mpctx->audio_out) mpctx->audio_out->uninit(mpctx->eof?0:1); + mpctx->audio_out=NULL; } #ifdef CONFIG_GUI -- cgit v1.2.3