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

ubitux ubitux at gmail.com
Sun Apr 11 20:52:02 CEST 2010


On Sun, Apr 11, 2010 at 06:46:28PM +0000, Carl Eugen Hoyos wrote:
> ubitux <ubitux <at> gmail.com> writes:
> 
> > Here is a patch to get the switch audio control working in OGG files,
> > without the need of the lavf demuxer. I anyone can review it...
> 
> The braces look unneeded and the default case should not be changed as part of
> the patch.
> 

The braces are needed because there is local declarations for this
specific case.

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

> Carl Eugen
> 
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng

-- 
ubitux
-------------- next part --------------
Index: libmpdemux/demux_ogg.c
===================================================================
--- libmpdemux/demux_ogg.c	(revision 31029)
+++ libmpdemux/demux_ogg.c	(working copy)
@@ -1568,6 +1568,27 @@
 	    *(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