summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gui/interface.c20
-rw-r--r--Gui/interface.h2
-rw-r--r--Gui/mplayer/common.c5
-rw-r--r--Gui/mplayer/gtk/menu.c9
-rw-r--r--Gui/mplayer/mw.c10
-rw-r--r--access_mpcontext.h4
-rw-r--r--mplayer.c16
7 files changed, 49 insertions, 17 deletions
diff --git a/Gui/interface.c b/Gui/interface.c
index 33f06b5ff8..eb461bc7f7 100644
--- a/Gui/interface.c
+++ b/Gui/interface.c
@@ -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 @@ extern af_cfg_t af_cfg;
#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 @@ int guiCMDArray[] =
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 @@ static void remove_vf( char * str )
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 @@ int guiGetEvent( int type,char * arg )
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 @@ int guiGetEvent( int type,char * arg )
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 @@ int guiGetEvent( int type,char * arg )
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;
diff --git a/Gui/interface.h b/Gui/interface.h
index 4e5475aaf1..2b14ba2362 100644
--- a/Gui/interface.h
+++ b/Gui/interface.h
@@ -57,6 +57,7 @@ typedef struct
guiVideoStruct videodata;
guiUnknownErrorStruct error;
+ struct MPContext * mpcontext;
void * sh_video;
void * afilter;
void * demuxer;
@@ -131,6 +132,7 @@ extern guiInterface_t guiIntfStruct;
#define guiSetDemuxer 15
#define guiSetParameters 16
#define guiSetAfilter 17
+#define guiSetContext 18
#define guiSetStop 0
#define guiSetPlay 1
diff --git a/Gui/mplayer/common.c b/Gui/mplayer/common.c
index 40bbc3f98b..e337981e2a 100644
--- a/Gui/mplayer/common.c
+++ b/Gui/mplayer/common.c
@@ -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 @@ inline void TranslateFilename( int c,char * tmp,size_t tmplen )
/* 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 @@ calclengthmmmmss:
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;
diff --git a/Gui/mplayer/gtk/menu.c b/Gui/mplayer/gtk/menu.c
index 10b8bb6bce..df4ed1d35c 100644
--- a/Gui/mplayer/gtk/menu.c
+++ b/Gui/mplayer/gtk/menu.c
@@ -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 @@ const char * GetLanguage( int language )
return NULL;
}
-extern int global_sub_size;
GtkWidget * DVDSubMenu;
GtkWidget * DVDTitleMenu;
@@ -400,6 +398,9 @@ GtkWidget * create_PopUpMenu( void )
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 @@ GtkWidget * create_PopUpMenu( void )
}
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 );
diff --git a/Gui/mplayer/mw.c b/Gui/mplayer/mw.c
index 96445298bf..ec00f2e09c 100644
--- a/Gui/mplayer/mw.c
+++ b/Gui/mplayer/mw.c
@@ -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 @@ static unsigned last_redraw_time = 0;
void mplEventHandling( int msg,float param )
{
int iparam = (int)param;
+ mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
switch( msg )
{
@@ -108,7 +108,7 @@ void mplEventHandling( int msg,float param )
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 @@ NoPause:
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 @@ set_volume:
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 )
{
diff --git a/access_mpcontext.h b/access_mpcontext.h
index 515b7c9a46..7937ce6099 100644
--- a/access_mpcontext.h
+++ b/access_mpcontext.h
@@ -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);
diff --git a/mplayer.c b/mplayer.c
index 8d7d1b6636..5ffd223fcd 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -386,11 +386,26 @@ void *mpctx_get_video_out(MPContext *mpctx)
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 @@ current_module = NULL;
#ifdef HAVE_NEW_GUI
if(use_gui){
guiInit();
+ guiGetEvent(guiSetContext, mpctx);
inited_flags|=INITED_GUI;
guiGetEvent( guiCEvent,(char *)((gui_no_filename) ? 0 : 1) );
}