[MPlayer-dev-eng] [PATCH] Switch audio control in OGG demuxer

ubitux ubitux at gmail.com
Sun Apr 11 20:54:27 CEST 2010


> Sorry for the indent change to default, here is a new patch.
> 

Oups I just removed the braces but I shouldn't. Here is the correct one,
sorry for the flood.

-- 
ubitux
-------------- next part --------------
Index: libmpdemux/demux_ogg.c
===================================================================
--- libmpdemux/demux_ogg.c	(revision 31029)
+++ libmpdemux/demux_ogg.c	(working copy)
@@ -1568,6 +1568,29 @@
 	    *(int *)arg=((os->lastpos - ogg_d->initial_granulepos)*100) / ogg_d->duration;
 	    return DEMUXER_CTRL_OK;
 
+        case DEMUXER_CTRL_SWITCH_AUDIO:
+        {
+            int current_stream_id = demuxer->audio->id;
+            int next_stream_id = current_stream_id;
+            int n;
+
+            for (n = 0; n < ogg_d->num_sub; n++) {
+                ogg_stream_t *ostream;
+
+                next_stream_id++;
+                if (next_stream_id == ogg_d->num_sub)
+                    next_stream_id = 0;
+                ostream = &ogg_d->subs[next_stream_id];
+                if (ostream->vorbis || ostream->flac || ostream->speex)
+                    break;
+            }
+
+            if (current_stream_id != next_stream_id)
+                demuxer->audio->id = next_stream_id;
+
+            return DEMUXER_CTRL_OK;
+        }
+
 	default:
 	    return DEMUXER_CTRL_NOTIMPL;
     }


More information about the MPlayer-dev-eng mailing list