0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00

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
This commit is contained in:
eugeni 2008-02-29 17:25:50 +00:00
parent 377d745ae9
commit 22465e56cc
4 changed files with 19 additions and 0 deletions

View File

@ -599,6 +599,8 @@ if(stream->type==STREAMTYPE_DVDNAV){
mp_msg(MSGT_DEMUXER, MSGL_FATAL, MSGTR_CannotOpenDemuxer);
mencoder_exit(1,NULL);
}
select_audio(demuxer, audio_id, audio_lang);
if (dvdsub_id < 0 && dvdsub_lang)
dvdsub_id = demuxer_sub_track_by_lang(demuxer, dvdsub_lang);

View File

@ -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;
}

View File

@ -6,5 +6,6 @@ extern struct ass_track_s *ass_track;
extern subtitle *vo_sub_last;
void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, int reset);
void update_teletext(sh_video_t *sh_video, demuxer_t *demuxer, int reset);
int select_audio(demuxer_t* demuxer, int audio_id, char* audio_lang);
#endif /* MPLAYER_MPCOMMON_H */

View File

@ -3315,6 +3315,9 @@ mpctx->d_audio=mpctx->demuxer->audio;
mpctx->d_video=mpctx->demuxer->video;
mpctx->d_sub=mpctx->demuxer->sub;
// select audio stream
select_audio(mpctx->demuxer, audio_id, audio_lang);
// DUMP STREAMS:
if((stream_dump_type)&&(stream_dump_type<4)){
FILE *f;