[MPlayer-dev-eng] [PATCH] goto next audio stream & goto next video stream & alles wird gut patch
Rüdiger Kuhlmann
mplayer-list-UGa6JdjLujS2 at ruediger-kuhlmann.de
Tue Dec 10 14:40:58 CET 2002
Hi there,
here's a new version of my patch to implement an event that loads the next
audio resp. video stream from the current movie file. It also includes all
patches that till now have been ignored.
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.624
diff -u -r1.624 mplayer.c
--- mplayer.c 5 Dec 2002 00:18:56 -0000 1.624
+++ mplayer.c 10 Dec 2002 13:52:44 -0000
@@ -201,6 +201,8 @@
// streaming:
int audio_id=-1;
int video_id=-1;
+int gui_audio_id = -1;
+int gui_video_id = -1;
int dvdsub_id=-1;
int vobsub_id=-1;
static char* audio_lang=NULL;
@@ -2892,6 +2894,9 @@
} else
break;
}
+
+audio_id = gui_audio_id;
+video_id = gui_video_id;
#ifdef HAVE_NEW_GUI
if( use_gui && !playtree_iter )
Index: mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.h,v
retrieving revision 1.23
diff -u -r1.23 mplayer.h
--- mplayer.h 28 Nov 2002 23:17:09 -0000 1.23
+++ mplayer.h 10 Dec 2002 13:52:44 -0000
@@ -48,8 +48,8 @@
extern int auto_quality;
-extern int audio_id;
-extern int video_id;
+extern int audio_id, gui_audio_id;
+extern int video_id, gui_video_id;
extern int dvdsub_id;
extern void exit_player(char* how);
Index: Gui/app.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/app.c,v
retrieving revision 1.18
diff -u -r1.18 app.c
--- Gui/app.c 29 Nov 2002 00:58:22 -0000 1.18
+++ Gui/app.c 10 Dec 2002 13:52:44 -0000
@@ -63,7 +63,9 @@
{ evLoadAudioFile, "evLoadAudioFile" },
{ evDropSubtitle, "evDropSubtitle" },
{ evSetAspect, "evSetAspect" },
- { evSetAudio, "evSetAudio" }
+ { evSetAudio, "evSetAudio" },
+ { evAudioNext, "evAudioNext" },
+ { evVideoNext, "evVideoNext" }
};
int evBoxs = sizeof( evNames ) / sizeof( evName );
Index: Gui/app.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/app.h,v
retrieving revision 1.14
diff -u -r1.14 app.h
--- Gui/app.h 5 Dec 2002 23:54:14 -0000 1.14
+++ Gui/app.h 10 Dec 2002 13:52:44 -0000
@@ -61,6 +61,9 @@
#define evSetVideo 46
// 47 ...
+#define evAudioNext 99
+#define evVideoNext 100
+
#define evExit 1000
// --- General events ---
Index: Gui/mplayer/mw.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mw.c,v
retrieving revision 1.96
diff -u -r1.96 mw.c
--- Gui/mplayer/mw.c 5 Dec 2002 23:54:15 -0000 1.96
+++ Gui/mplayer/mw.c 10 Dec 2002 13:52:44 -0000
@@ -121,11 +121,14 @@
case 'v': sprintf( tmp,"%3.2f%%",guiIntfStruct.Volume ); strcat( trbuf,tmp ); break;
case 'V': sprintf( tmp,"%3.1f",guiIntfStruct.Volume ); strcat( trbuf,tmp ); break;
case 'b': sprintf( tmp,"%3.2f%%",guiIntfStruct.Balance ); strcat( trbuf,tmp ); break;
+ case 'A': if (audio_id == -1) sprintf (tmp, "a"); else sprintf (tmp, "%d", audio_id); strcat (trbuf, tmp); break;
+ case 'W': if (video_id == -1) sprintf (tmp, "a"); else sprintf (tmp, "%d", video_id); strcat (trbuf, tmp); break;
case 'B': sprintf( tmp,"%3.1f",guiIntfStruct.Balance ); strcat( trbuf,tmp ); break;
case 'd': sprintf( tmp,"%d",guiIntfStruct.FrameDrop ); strcat( trbuf,tmp ); break;
case 'x': sprintf( tmp,"%d",guiIntfStruct.MovieWidth ); strcat( trbuf,tmp ); break;
case 'y': sprintf( tmp,"%d",guiIntfStruct.MovieHeight ); strcat( trbuf,tmp ); break;
- case 'C': sprintf( tmp,"%s", guiIntfStruct.sh_video? ((sh_video_t *)guiIntfStruct.sh_video)->codec->name : "");
+ case 'C': sprintf( tmp,"%s", guiIntfStruct.sh_video && ((sh_video_t *)guiIntfStruct.sh_video)->codec
+ ? ((sh_video_t *)guiIntfStruct.sh_video)->codec->name : "");
strcat( trbuf,tmp ); break;
case 's': if ( guiIntfStruct.Playing == 0 ) strcat( trbuf,"s" ); break;
case 'l': if ( guiIntfStruct.Playing == 1 ) strcat( trbuf,"p" ); break;
@@ -188,7 +191,7 @@
{
wItem * item;
txSample * image = NULL;
- int i, type;
+ int i;
if ( appMPlayer.mainWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit );
@@ -251,7 +254,7 @@
void mplEventHandling( int msg,float param )
{
- int j;
+ int j, iparam = (int) param;
switch( msg )
{
@@ -269,23 +272,53 @@
gtkShow( evPlayNetwork,NULL );
break;
+ case evAudioNext:
+ if (!guiIntfStruct.demuxer) break;
+ if (gui_audio_id == -1)
+ {
+ for (gui_audio_id = 0; gui_audio_id < MAX_A_STREAMS; gui_audio_id++)
+ if (((demuxer_t *)guiIntfStruct.demuxer)->a_streams[gui_audio_id])
+ break;
+ gui_audio_id %= MAX_A_STREAMS;
+ }
+ for (j = gui_audio_id + 1; j < gui_audio_id + MAX_A_STREAMS; j++)
+ if (((demuxer_t *)guiIntfStruct.demuxer)->a_streams[j % MAX_A_STREAMS])
+ break;
+ iparam = j % MAX_A_STREAMS;
+ /* fall-through */
case evSetAudio:
if ( !guiIntfStruct.demuxer ) break;
- audio_id=(int)param;
+ if (audio_id == iparam) break;
+ audio_id = gui_audio_id = iparam;
if ( guiIntfStruct.StreamType == STREAMTYPE_DVD ) goto play;
guiIntfStruct.FilenameChanged=1;
break;
+ case evVideoNext:
+ if (!guiIntfStruct.demuxer) break;
+ if (gui_video_id == -1)
+ {
+ for (gui_video_id = 0; gui_video_id < MAX_A_STREAMS; gui_video_id++)
+ if (((demuxer_t *)guiIntfStruct.demuxer)->v_streams[gui_video_id])
+ break;
+ gui_video_id %= MAX_A_STREAMS;
+ }
+ for (j = gui_video_id + 1; j < gui_video_id + MAX_A_STREAMS; j++)
+ if (((demuxer_t *)guiIntfStruct.demuxer)->v_streams[j % MAX_A_STREAMS])
+ break;
+ iparam = j % MAX_A_STREAMS;
+ /* fall-through */
case evSetVideo:
if ( !guiIntfStruct.demuxer ) break;
- video_id=(int)param;
+ if (video_id == iparam) break;
+ video_id = gui_video_id = iparam;
if ( guiIntfStruct.StreamType == STREAMTYPE_DVD ) goto play;
guiIntfStruct.FilenameChanged=1;
break;
#ifdef HAVE_VCD
case evSetVCDTrack:
- guiIntfStruct.Track=(int)param;
+ guiIntfStruct.Track = iparam;
case evPlayVCD:
gtkSet( gtkClearStruct,0,(void *)guiALL );
guiIntfStruct.StreamType=STREAMTYPE_VCD;
@@ -362,19 +395,19 @@
break;
#ifdef USE_DVDREAD
case evSetDVDSubtitle:
- dvdsub_id=(int)param;
+ dvdsub_id = iparam;
goto play_dvd_2;
break;
case evSetDVDAudio:
- audio_id=(int)param;
+ audio_id = iparam;
goto play_dvd_2;
break;
case evSetDVDChapter:
- guiIntfStruct.DVD.current_chapter=(int)param;
+ guiIntfStruct.DVD.current_chapter = iparam;
goto play_dvd_2;
break;
case evSetDVDTitle:
- guiIntfStruct.DVD.current_title=(int)param;
+ guiIntfStruct.DVD.current_title = iparam;
guiIntfStruct.DVD.current_chapter=1;
guiIntfStruct.DVD.current_angle=1;
goto play_dvd_2;
@@ -448,7 +481,7 @@
case evIconify:
- switch ( (int)param )
+ switch ( iparam )
{
case 0: wsIconify( appMPlayer.mainWindow ); break;
case 1: wsIconify( appMPlayer.subWindow ); break;
@@ -489,7 +522,7 @@
break;
case evSetAspect:
- switch ( (int)param )
+ switch ( iparam )
{
case 2: movie_aspect=16.0f / 9.0f; break;
case 3: movie_aspect=4.0f / 3.0f; break;
Index: Gui/skin/skin.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/skin/skin.c,v
retrieving revision 1.21
diff -u -r1.21 skin.c
--- Gui/skin/skin.c 28 Nov 2002 19:01:50 -0000 1.21
+++ Gui/skin/skin.c 10 Dec 2002 13:52:44 -0000
@@ -234,7 +234,7 @@
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy );
if ( ( defList->Items[ defList->NumberOfItems ].msg=appFindMessage( msg ) ) == -1 )
- { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 1; }
+ { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 0; }
defList->Items[ defList->NumberOfItems ].pressed=btnReleased;
if ( defList->Items[ defList->NumberOfItems ].msg == evPauseSwitchToPlay ) defList->Items[ defList->NumberOfItems ].pressed=btnDisabled;
defList->Items[ defList->NumberOfItems ].tmp=1;
Index: libmpdemux/demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.124
diff -u -r1.124 demuxer.c
--- libmpdemux/demuxer.c 7 Dec 2002 01:07:11 -0000 1.124
+++ libmpdemux/demuxer.c 10 Dec 2002 13:52:46 -0000
@@ -1257,6 +1257,8 @@
case DEMUXER_TYPE_ASF:
return demux_asf_control(demuxer,cmd,arg);
case DEMUXER_TYPE_AVI:
+ case DEMUXER_TYPE_AVI_NI:
+ case DEMUXER_TYPE_AVI_NINI:
return demux_avi_control(demuxer,cmd,arg);
default:
Also, I made a screenshot of my KDE theme:
http://www.stud.uni-karlsruhe.de/~uck4/Krams/KDE_screenshot.png
http://www.stud.uni-karlsruhe.de/~uck4/Krams/KDE.tgz
Did I already mention that I'd like to have it in the list of skins as well?
--
100 DM = 51 € 13 ¢.
100 € = 195 DM 58 pf.
mailto:ruediger at ruediger-kuhlmann.de
http://www.ruediger-kuhlmann.de/
More information about the MPlayer-dev-eng
mailing list