[MPlayer-dev-eng] Re: [PATCH] GUI: fix audio/video id in gtk/menu.c
Stanislav Maslovski
stanislav.maslovski at gmail.com
Tue Apr 11 22:19:09 CEST 2006
On Tue, Apr 11, 2006 at 11:57:10AM +0200, Nico Sabbi wrote:
[...]
> >>Isn't precisely -aid a counter example? On DVDs, "aid" starts at 128,
> >>and on some dvb streams I've had on hand, it started at 130...
> >>
> >
> >Well, as i said i have checked only mkv and ogg demuxers ;) So, there is no
> >standard for -aids and similar in mplayer?
> >
> >The GUI code treats DVD case in a different manner: the part of the code
> >the
> >patch affects is simply skipped for a DVD (see line 23710 of gtk/menu.c).
> >
> >Where a dvb stream gets demuxed? I can add a special case for it.
> >
>
> demux_ts.c. No special cases, please: they are evil
Okay, in the third patch I tried to be as little specific as possible.
The menu implementation that is currently in CVS (i.e. the old one, not mine)
works correctly only for demuxers that have demux_aid_vid_mismatch set to 0.
I check this in the patch now and keep the old functionality for this case.
The demuxers that have demux_aid_vid_mismatch set to 1 are currently only
OGG, MATROSKA and TS. From demux_ts.c I see that it does not
enumerate audio and video streams on opening (contrary to OGG and MATROSKA
demuxers that do), hence for TS there is no sense in swithing the streams
dynamically from the gui menu.
The OGG and MATROSKA demuxers are handled in a new manner, respectively to
how they enumerate the streams.
The patch with removed cosmetics (i.e. with bad identation) is attached.
Tell me when you need the patch that keeps good identation.
Please check it against MATROSKA movies, I do not have MSV movies that have
several audio/video streams. It works for OGGs I have.
--
Stanislav
-------------- next part --------------
Index: Gui/mplayer/gtk/menu.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/gtk/menu.c,v
retrieving revision 1.36
diff -u -b -w -B -r1.36 menu.c
--- Gui/mplayer/gtk/menu.c 15 Dec 2005 20:39:59 -0000 1.36
+++ Gui/mplayer/gtk/menu.c 11 Apr 2006 19:34:46 -0000
@@ -61,6 +61,7 @@
#endif
extern mixer_t mixer; // mixer from mplayer.c
+extern int demux_aid_vid_mismatch; // from demuxer.c
void ActivateMenuItem( int Item )
{
@@ -537,31 +538,36 @@
if ( guiIntfStruct.Playing && guiIntfStruct.demuxer && guiIntfStruct.StreamType != STREAMTYPE_DVD )
{
+ int ogg_or_mkv = (guiIntfStruct.FileFormat == DEMUXER_TYPE_OGG) ||
+ (guiIntfStruct.FileFormat == DEMUXER_TYPE_MATROSKA);
+ /* treat only the cases we know how to deal with */
+ if ( !demux_aid_vid_mismatch || ogg_or_mkv )
+ {
int i,c = 0;
-
+ /* count audio streams */
for ( i=0;i < MAX_A_STREAMS;i++ )
if ( ((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i] ) c++;
-
+ /* audio streams submenu */
if ( c > 1 )
{
SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_AudioTrack );
- for ( i=0;i < MAX_A_STREAMS;i++ )
- if ( ((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i] )
+ for ( i=0;i < ( ogg_or_mkv? c : MAX_A_STREAMS );i++ )
+ if ( ogg_or_mkv || ((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i] )
{
char tmp[32];
snprintf( tmp,32,MSGTR_MENU_Track,i );
AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( i << 16 ) + evSetAudio );
}
}
-
+ /* count video streams */
for ( c=0,i=0;i < MAX_V_STREAMS;i++ )
if ( ((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i] ) c++;
-
+ /* video streams submenu */
if ( c > 1 )
{
SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_VideoTrack );
- for ( i=0;i < MAX_V_STREAMS;i++ )
- if ( ((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i] )
+ for ( i=0;i < ( ogg_or_mkv? c : MAX_V_STREAMS );i++ )
+ if ( ogg_or_mkv || ((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i] )
{
char tmp[32];
snprintf( tmp,32,MSGTR_MENU_Track,i );
@@ -569,6 +575,7 @@
}
}
}
+ }
AddSeparator( Menu );
MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer.muted,evMute );
More information about the MPlayer-dev-eng
mailing list