[MPlayer-cvslog] CVS: main/libmpdemux demux_mkv.c,1.38,1.39

Guillaume Poirier CVS syncmail at mplayerhq.hu
Thu Apr 14 00:33:22 CEST 2005


CVS change done by Guillaume Poirier CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv1600/libmpdemux

Modified Files:
	demux_mkv.c 
Log Message:
Online audio switching now supports Matroska too


Index: demux_mkv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- demux_mkv.c	27 Feb 2005 18:11:16 -0000	1.38
+++ demux_mkv.c	13 Apr 2005 22:33:19 -0000	1.39
@@ -3340,6 +3340,32 @@
       *((int *) arg) = (int) (100 * mkv_d->last_pts / mkv_d->duration);
       return DEMUXER_CTRL_OK; 
 
+    case DEMUXER_CTRL_SWITCH_AUDIO:
+      if (demuxer->audio && demuxer->audio->sh) {
+        int i;
+        demux_stream_t *d_audio = demuxer->audio;
+        sh_audio_t *sh_audio = d_audio->sh;
+        int idx = d_audio->id - 1; // track ids are 1 based
+        int num = mkv_d->num_tracks;
+        mkv_track_t *otrack = mkv_d->tracks[idx];
+        for (i = 1; i < num; i++) {
+          mkv_track_t *track = mkv_d->tracks[(idx+i)%num];
+          if ((track->type == MATROSKA_TRACK_AUDIO) &&
+              !strcmp(track->codec_id, otrack->codec_id) &&
+              (track->a_channels == otrack->a_channels) &&
+              (track->a_bps == otrack->a_bps) &&
+              (track->a_sfreq == otrack->a_sfreq)) {
+            break;
+          }
+        }
+        if (i < num) {
+          d_audio->id = (idx+i)%num + 1;
+          ds_free_packs(d_audio);
+        }
+        *((int *)arg)=(int)d_audio->id;
+      }
+      return DEMUXER_CTRL_OK;
+
     default:
       return DEMUXER_CTRL_NOTIMPL;
     }




More information about the MPlayer-cvslog mailing list