changeset 22286:a7e5b99ac083

Fix GUI compilation
author uau
date Wed, 21 Feb 2007 19:14:49 +0000
parents 5d12a6e96930
children 53f0cbf238cf
files Gui/interface.c Gui/interface.h Gui/mplayer/common.c Gui/mplayer/gtk/menu.c Gui/mplayer/mw.c access_mpcontext.h mplayer.c
diffstat 7 files changed, 49 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/interface.c	Wed Feb 21 19:08:00 2007 +0000
+++ b/Gui/interface.c	Wed Feb 21 19:14:49 2007 +0000
@@ -16,6 +16,7 @@
 #include "mplayer/play.h"
 
 #include "mplayer.h"
+#include "access_mpcontext.h"
 #include "app.h"
 #include "cfg.h"
 #include "help_mp.h"
@@ -49,7 +50,6 @@
 #include "m_config.h"
 #include "m_option.h"
 
-extern mixer_t mixer; // mixer from mplayer.c
 
 guiInterface_t guiIntfStruct;
 int guiWinID=-1;
@@ -418,8 +418,6 @@
   evSkinBrowser
  };
 
-extern ao_functions_t * audio_out;
-extern vo_functions_t * video_out;
 extern int    		frame_dropping;
 extern int              stream_dump_type;
 extern int  		vcd_track;
@@ -550,11 +548,21 @@
 
 int guiGetEvent( int type,char * arg )
 {
+  ao_functions_t *audio_out = NULL;
+  vo_functions_t *video_out = NULL;
+  mixer_t *mixer = NULL;
+
  stream_t * stream = (stream_t *) arg;
 #ifdef USE_DVDREAD
  dvd_priv_t * dvdp = (dvd_priv_t *) arg;
 #endif 
 
+ if (guiIntfStruct.mpcontext) {
+   audio_out = mpctx_get_audio_out(guiIntfStruct.mpcontext);
+   video_out = mpctx_get_video_out(guiIntfStruct.mpcontext);
+   mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
+ }
+
  switch ( type )
   {
    case guiXEvent:
@@ -588,6 +596,8 @@
 	if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); }
 	  else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
 	break;
+   case guiSetContext:
+	guiIntfStruct.mpcontext=(void *)arg;
    case guiSetDemuxer:
 	guiIntfStruct.demuxer=(void *)arg;
 	break;
@@ -672,7 +682,7 @@
         if ( audio_out )
 	{
 	 float l,r;
-	 mixer_getvolume( &mixer,&l,&r );
+	 mixer_getvolume( mixer,&l,&r );
 	 guiIntfStruct.Volume=(r>l?r:l);
 	 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
 	   else guiIntfStruct.Balance=50.0f;
@@ -701,7 +711,7 @@
         if ( audio_out )
 	{
 	 float l,r;
-	 mixer_getvolume( &mixer,&l,&r );
+	 mixer_getvolume( mixer,&l,&r );
 	 guiIntfStruct.Volume=(r>l?r:l);
 	 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
 	   else guiIntfStruct.Balance=50.0f;
--- a/Gui/interface.h	Wed Feb 21 19:08:00 2007 +0000
+++ b/Gui/interface.h	Wed Feb 21 19:14:49 2007 +0000
@@ -57,6 +57,7 @@
    guiVideoStruct        videodata;
    guiUnknownErrorStruct error;
    
+   struct MPContext * mpcontext;
    void * sh_video;
    void * afilter;
    void * demuxer;
@@ -131,6 +132,7 @@
 #define guiSetDemuxer       15
 #define guiSetParameters    16
 #define guiSetAfilter       17
+#define guiSetContext       18
 
 #define guiSetStop  0
 #define guiSetPlay  1
--- a/Gui/mplayer/common.c	Wed Feb 21 19:08:00 2007 +0000
+++ b/Gui/mplayer/common.c	Wed Feb 21 19:14:49 2007 +0000
@@ -30,8 +30,6 @@
 #include "play.h"
 #include "widgets.h"
 
-extern mixer_t mixer; // mixer from mplayer.c
-
 extern unsigned int GetTimerMS( void );
 
 inline void TranslateFilename( int c,char * tmp,size_t tmplen )
@@ -83,6 +81,7 @@
 /* Unsafe!  Pass only null-terminated strings as (char *)str. */
 char * Translate( char * str )
 {
+ mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
  static char   trbuf[512];
         char   tmp[512];
         int    i,c;
@@ -145,7 +144,7 @@
        case 'l': if ( guiIntfStruct.Playing == 1 ) strlcat( trbuf,"p",sizeof( trbuf ) ); break;
        case 'e': if ( guiIntfStruct.Playing == 2 ) strlcat( trbuf,"e",sizeof( trbuf ) ); break;
        case 'a':
-            if ( mixer.muted ) { strlcat( trbuf,"n",sizeof( trbuf ) ); break; }
+            if ( mixer->muted ) { strlcat( trbuf,"n",sizeof( trbuf ) ); break; }
             switch ( guiIntfStruct.AudioType )
              {
               case 0: strlcat( trbuf,"n",sizeof( trbuf ) ); break;
--- a/Gui/mplayer/gtk/menu.c	Wed Feb 21 19:08:00 2007 +0000
+++ b/Gui/mplayer/gtk/menu.c	Wed Feb 21 19:14:49 2007 +0000
@@ -6,6 +6,7 @@
 #include "../../config.h"
 #include "../../help_mp.h"
 #include "../../mplayer.h"
+#include "../../access_mpcontext.h"
 #include "../../mixer.h"
 
 #include "../app.h"
@@ -61,8 +62,6 @@
 #include "../pixmaps/playvcd.xpm"
 #endif
 
-extern mixer_t mixer; // mixer from mplayer.c
-
 void ActivateMenuItem( int Item )
 {
 // fprintf( stderr,"[menu] item: %d.%d\n",Item&0xffff,Item>>16 );
@@ -378,7 +377,6 @@
  return NULL;
 }
 
-extern int global_sub_size;
 
 GtkWidget * DVDSubMenu;
 GtkWidget * DVDTitleMenu;
@@ -400,6 +398,9 @@
  Menu=gtk_menu_new();
  gtk_widget_realize (Menu);
  window1 = gtk_widget_get_toplevel(Menu);
+ mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
+ int global_sub_size = mpctx_get_global_sub_size(guiIntfStruct.mpcontext);
+
 
   AddMenuItem( window1, (const char*)ab_xpm, Menu,MSGTR_MENU_AboutMPlayer"     ", evAbout );
   AddSeparator( Menu );
@@ -590,7 +591,7 @@
    }
 
   AddSeparator( Menu );
-  MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer.muted,evMute );
+  MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer->muted,evMute );
   if ( !guiIntfStruct.AudioType ) gtk_widget_set_sensitive( MenuItem,FALSE );
   AddMenuItem( window1, (const char*)pl_xpm, Menu,MSGTR_MENU_PlayList, evPlayList );
   AddMenuItem( window1, (const char*)skin_xpm, Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser );
--- a/Gui/mplayer/mw.c	Wed Feb 21 19:08:00 2007 +0000
+++ b/Gui/mplayer/mw.c	Wed Feb 21 19:14:49 2007 +0000
@@ -21,6 +21,7 @@
 #include "../mixer.h"
 #include "../libvo/sub.h"
 #include "../mplayer.h"
+#include "../access_mpcontext.h"
 
 #include "../libmpdemux/demuxer.h"
 #include "../libmpdemux/stheader.h"
@@ -33,8 +34,6 @@
 #include "play.h"
 #include "widgets.h"
 
-extern mixer_t mixer; // mixer from mplayer.c
-
 extern unsigned int GetTimerMS( void );
 
 unsigned char * mplDrawBuffer = NULL;
@@ -80,6 +79,7 @@
 void mplEventHandling( int msg,float param )
 {
  int iparam = (int)param;
+ mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
 
  switch( msg )
   {
@@ -108,7 +108,7 @@
 	goto play;
 
    case evSetSubtitle:
-	mp_property_do("sub",M_PROPERTY_SET,&iparam); 
+        mp_property_do("sub",M_PROPERTY_SET,&iparam,guiIntfStruct.mpcontext); 
 	break;
 
 #ifdef HAVE_VCD
@@ -247,7 +247,7 @@
 
    case evIncVolume:  vo_x11_putkey( wsGrayMul ); break;
    case evDecVolume:  vo_x11_putkey( wsGrayDiv ); break;
-   case evMute:       mixer_mute( &mixer ); break;
+   case evMute:       mixer_mute( mixer ); break;
 
    case evSetVolume:
         guiIntfStruct.Volume=param;
@@ -261,7 +261,7 @@
 	 if ( l > guiIntfStruct.Volume ) l=guiIntfStruct.Volume;
 	 if ( r > guiIntfStruct.Volume ) r=guiIntfStruct.Volume;
 //	 printf( "!!! v: %.2f b: %.2f -> %.2f x %.2f\n",guiIntfStruct.Volume,guiIntfStruct.Balance,l,r );
-         mixer_setvolume( &mixer,l,r );
+         mixer_setvolume( mixer,l,r );
 	}
 	if ( osd_level )
 	 {
--- a/access_mpcontext.h	Wed Feb 21 19:08:00 2007 +0000
+++ b/access_mpcontext.h	Wed Feb 21 19:14:49 2007 +0000
@@ -1,2 +1,6 @@
+struct MPContext;
 void *mpctx_get_video_out(struct MPContext *mpctx);
+void *mpctx_get_audio_out(struct MPContext *mpctx);
 void *mpctx_get_playtree_iter(struct MPContext *mpctx);
+void *mpctx_get_mixer(struct MPContext *mpctx);
+int mpctx_get_global_sub_size(struct MPContext *mpctx);
--- a/mplayer.c	Wed Feb 21 19:08:00 2007 +0000
+++ b/mplayer.c	Wed Feb 21 19:14:49 2007 +0000
@@ -386,11 +386,26 @@
     return mpctx->video_out;
 }
 
+void *mpctx_get_audio_out(MPContext *mpctx)
+{
+    return mpctx->video_out;
+}
+
 void *mpctx_get_playtree_iter(MPContext *mpctx)
 {
     return mpctx->playtree_iter;
 }
 
+void *mpctx_get_mixer(MPContext *mpctx)
+{
+    return &mpctx->mixer;
+}
+
+void *mpctx_get_global_sub_size(MPContext *mpctx)
+{
+    return mpctx->global_sub_size;
+}
+
 static int is_valid_metadata_type (metadata_t type) {
   switch (type)
   {
@@ -2546,6 +2561,7 @@
 #ifdef HAVE_NEW_GUI
   if(use_gui){
        guiInit();
+       guiGetEvent(guiSetContext, mpctx);
        inited_flags|=INITED_GUI;
        guiGetEvent( guiCEvent,(char *)((gui_no_filename) ? 0 : 1) );
   }