[Mplayer-cvslog] CVS: main/Gui interface.c,1.17,1.18 interface.h,1.11,1.12

Zoltan Ponekker pontscho at mplayerhq.hu
Tue Jul 2 15:35:05 CEST 2002


Update of /cvsroot/mplayer/main/Gui
In directory mail:/var/tmp.root/cvs-serv11296/Gui

Modified Files:
	interface.c interface.h 
Log Message:
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix

Index: interface.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/interface.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- interface.c	3 Jun 2002 15:06:31 -0000	1.17
+++ interface.c	2 Jul 2002 13:35:01 -0000	1.18
@@ -7,6 +7,7 @@
 #include "ws.h"
 #include "mplayer/play.h"
 #include "interface.h"
+#include "skin/skin.h"
 
 #include "../mplayer.h"
 #include "mplayer/widgets.h"
@@ -15,6 +16,7 @@
 #include "../libvo/x11_common.h"
 #include "../libvo/video_out.h"
 #include "../input/input.h"
+#include "../libao2/audio_out.h"
 
 #include <inttypes.h>
 #include <sys/types.h>
@@ -65,12 +67,15 @@
  int disp_w,disp_h;
 } tmp_sh_video_t;
 
+extern ao_functions_t * audio_out;
+
 void guiGetEvent( int type,char * arg )
 {
  stream_t * stream = (stream_t *) arg;
 #ifdef USE_DVDREAD
  dvd_priv_t * dvdp = (dvd_priv_t *) arg;
 #endif 
+
  switch ( type )
   {
    case guiXEvent:
@@ -172,12 +177,38 @@
 	if ( (unsigned int)arg & guiVCD ) guiIntfStruct.VCDTracks=0;
 #endif
 	break;
+   case guiReDraw:
+//        if ( audio_out )
+//         {
+//	  float l,r;
+ //	  mixer_getvolume( &l,&r );
+//	  guiIntfStruct.Volume=(r>l?r:l);
+//	  printf( "!!! guiIntfStruct.Volume: %.2f   \n",guiIntfStruct.Volume );
+//	 }
+	mplEventHandling( evRedraw,0 );
+	break;
+   case guiSetVolume:
+        if ( audio_out )
+	{
+	 float l,r;
+	 mixer_getvolume( &l,&r );
+	 guiIntfStruct.Volume=(r>l?r:l);
+	 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
+	   else guiIntfStruct.Balance=0.0f;
+	 btnModify( evSetVolume,guiIntfStruct.Volume );
+	 btnModify( evSetBalance,guiIntfStruct.Balance );
+	}
+        break;
   }
 }
 
+extern unsigned int GetTimerMS( void );
+extern int mplTimer;
+
 void guiEventHandling( void )
 {
- if ( ( use_gui && !guiIntfStruct.Playing )||( guiIntfStruct.AudioOnly ) ) wsHandleEvents();
+ if ( !guiIntfStruct.Playing || guiIntfStruct.AudioOnly ) wsHandleEvents();
  gtkEventHandling();
- mplTimerHandler(); // handle GUI timer events
+ mplTimer=GetTimerMS() / 20;
+// if ( !( GetTimerMS()%2 ) ) 
 }

Index: interface.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/interface.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- interface.h	3 Jun 2002 15:06:31 -0000	1.11
+++ interface.h	2 Jul 2002 13:35:01 -0000	1.12
@@ -10,7 +10,6 @@
  #include "../libmpdemux/stream.h"
 #endif
 
-
 typedef struct
 {
  int x;
@@ -74,9 +73,7 @@
    int    MovieHeight;
 
    float  Volume;
-   int    VolumeChanged;
    float  Balance;
-   int    Mute;
 
    int    Track;
    int    AudioType;
@@ -111,6 +108,8 @@
 #define guiSetShVideo       8
 #define guiSetStream        9
 #define guiClearStruct      10
+#define guiReDraw	    11
+#define guiSetVolume        12
 
 #define guiSetStop  0
 #define guiSetPlay  1




More information about the MPlayer-cvslog mailing list