summaryrefslogtreecommitdiffstats
path: root/mpcommon.c
diff options
context:
space:
mode:
authoreugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-02-29 17:25:50 +0000
committereugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-02-29 17:25:50 +0000
commit22465e56cc97476636edd72c7d23f0c5cc692277 (patch)
tree8f4f2c2fc64288627eea7da0c08dfa72208f5f08 /mpcommon.c
parent377d745ae9816be0fc1f618dc8de7d83235df1c9 (diff)
downloadmpv-22465e56cc97476636edd72c7d23f0c5cc692277.tar.bz2
mpv-22465e56cc97476636edd72c7d23f0c5cc692277.tar.xz
Select audio stream in mplayer and mencoder, overriding demuxer decision.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26122 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mpcommon.c')
-rw-r--r--mpcommon.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/mpcommon.c b/mpcommon.c
index b9e9296d2a..332d8e1cf4 100644
--- a/mpcommon.c
+++ b/mpcommon.c
@@ -190,3 +190,16 @@ void update_teletext(sh_video_t *sh_video, demuxer_t *demuxer, int reset)
tvh->functions->control(tvh->priv,TV_VBI_CONTROL_MARK_UNCHANGED,NULL);
#endif
}
+
+int select_audio(demuxer_t* demuxer, int audio_id, char* audio_lang)
+{
+ if (audio_id == -1 && audio_lang)
+ audio_id = demuxer_audio_track_by_lang(demuxer, audio_lang);
+ if (audio_id != -1) // -1 (automatic) is the default behaviour of demuxers
+ demuxer_switch_audio(demuxer, audio_id);
+ if (audio_id == -2) { // some demuxers don't yet know how to switch to no sound
+ demuxer->audio->id = -2;
+ demuxer->audio->sh = NULL;
+ }
+ return demuxer->audio->id;
+}