[MPlayer-cvslog] r26122 - in trunk: mencoder.c mpcommon.c mpcommon.h mplayer.c

eugeni subversion at mplayerhq.hu
Fri Feb 29 18:25:50 CET 2008


Author: eugeni
Date: Fri Feb 29 18:25:50 2008
New Revision: 26122

Log:
Select audio stream in mplayer and mencoder, overriding demuxer decision.


Modified:
   trunk/mencoder.c
   trunk/mpcommon.c
   trunk/mpcommon.h
   trunk/mplayer.c

Modified: trunk/mencoder.c
==============================================================================
--- trunk/mencoder.c	(original)
+++ trunk/mencoder.c	Fri Feb 29 18:25:50 2008
@@ -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);

Modified: trunk/mpcommon.c
==============================================================================
--- trunk/mpcommon.c	(original)
+++ trunk/mpcommon.c	Fri Feb 29 18:25:50 2008
@@ -190,3 +190,16 @@ void update_teletext(sh_video_t *sh_vide
     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;
+}

Modified: trunk/mpcommon.h
==============================================================================
--- trunk/mpcommon.h	(original)
+++ trunk/mpcommon.h	Fri Feb 29 18:25:50 2008
@@ -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 */

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	(original)
+++ trunk/mplayer.c	Fri Feb 29 18:25:50 2008
@@ -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;



More information about the MPlayer-cvslog mailing list