[Mplayer-cvslog] CVS: main/Gui/mplayer mplayer.c,1.26,1.27 mplayer.h,1.6,1.7 mw.h,1.65,1.66 sw.h,1.31,1.32

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


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

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

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mplayer.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- mplayer.c	3 Jun 2002 15:06:32 -0000	1.26
+++ mplayer.c	2 Jul 2002 13:35:03 -0000	1.27
@@ -35,13 +35,6 @@
 #include "sw.h"
 #include "widgets.h"
 
-void mplTimerHandler( void )
-{
- mplTimer++;
- mplRedrawTimer--;
- if ( mplRedrawTimer == 0 ) mplEventHandling( evRedraw,0 );
-}
-
 void mplInit( void * disp )
 {
  int i;

Index: mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mplayer.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- mplayer.h	28 May 2002 11:55:16 -0000	1.6
+++ mplayer.h	2 Jul 2002 13:35:03 -0000	1.7
@@ -14,6 +14,5 @@
 
 extern void mplInit( void * disp );
 extern void mplEventHandling( int msg,float param );
-extern void mplTimerHandler( void );
 
 #endif

Index: mw.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mw.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- mw.h	24 Jun 2002 08:55:00 -0000	1.65
+++ mw.h	2 Jul 2002 13:35:03 -0000	1.66
@@ -3,6 +3,8 @@
 
 #include "../../libmpdemux/stream.h"
 #include "../../mixer.h"
+#include "../../libvo/sub.h"
+#include "../../mplayer.h"
 
 unsigned char * mplDrawBuffer = NULL;
 int             mplMainRender = 1;
@@ -100,7 +102,7 @@
        case 'l': if ( guiIntfStruct.Playing == 1 ) strcat( trbuf,"p" ); break;
        case 'e': if ( guiIntfStruct.Playing == 2 ) strcat( trbuf,"e" ); break;
        case 'a':
-//            if ( guiIntfStruct.Mute ) { strcat( trbuf,"n" ); break; }
+            if ( muted ) { strcat( trbuf,"n" ); break; }
             switch ( guiIntfStruct.AudioType )
              {
               case 0: strcat( trbuf,"n" ); break;
@@ -214,6 +216,7 @@
 extern char * dvd_device;
 extern int vcd_track;
 extern char * cdrom_device;
+extern int osd_visible;
 
 void mplEventHandling( int msg,float param )
 {
@@ -261,11 +264,11 @@
          {
 	  case STREAMTYPE_STREAM:
 	  case STREAMTYPE_FILE:
-	       guiGetEvent( guiClearStruct,guiALL );
+	       guiGetEvent( guiClearStruct,(char *)guiALL );
 	       break;
 #ifdef HAVE_VCD
           case STREAMTYPE_VCD:
-	       guiGetEvent( guiClearStruct,guiALL - guiVCD );
+	       guiGetEvent( guiClearStruct,(char *)(guiALL - guiVCD ) );
 	       if ( !cdrom_device )
 	        {
 		 cdrom_device=DEFAULT_CDROM_DEVICE;
@@ -285,7 +288,7 @@
 #endif
 #ifdef USE_DVDREAD
           case STREAMTYPE_DVD:
-	       guiGetEvent( guiClearStruct,guiALL - guiDVD );
+	       guiGetEvent( guiClearStruct,(char *)(guiALL - guiDVD ) );
 	       if ( !dvd_device ) 
 	        {
 	         dvd_device=DEFAULT_DVD_DEVICE;
@@ -375,9 +378,32 @@
 
    case evIncVolume:  vo_x11_putkey( wsGrayMul ); break;
    case evDecVolume:  vo_x11_putkey( wsGrayDiv ); break;
-   case evMute:       mixer_mute(); guiIntfStruct.Mute=muted; break;
+   case evMute:       mixer_mute(); break;
+
    case evSetVolume:
-   case evSetBalance: guiIntfStruct.VolumeChanged=1; break;
+        guiIntfStruct.Volume=param;
+	goto set_volume;
+   case evSetBalance: 
+        guiIntfStruct.Balance=param;
+set_volume:
+        {
+	 float l = guiIntfStruct.Volume * ( ( 100.0 - guiIntfStruct.Balance ) / 50.0 );
+	 float r = guiIntfStruct.Volume * ( ( guiIntfStruct.Balance ) / 50.0 );
+	 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( l,r );
+	}
+#ifdef USE_OSD
+	if ( osd_level )
+	 {
+	  osd_visible=vo_mouse_timer_const;
+	  vo_osd_progbar_type=OSD_VOLUME;
+	  vo_osd_progbar_value=( ( guiIntfStruct.Volume ) * 256.0 ) / 100.0;
+	  vo_osd_changed( OSDTYPE_PROGBAR );
+	 }
+#endif
+        break;
 
 
    case evIconify:
@@ -426,7 +452,6 @@
    case evRedraw:
         mplMainRender=1;
         wsPostRedisplay( &appMPlayer.mainWindow );
-        XFlush( wsDisplay );
         mplRedrawTimer=mplRedrawTimerConst;
         break;
 // --- system events
@@ -499,13 +524,7 @@
             case itPotmeter:
             case itHPotmeter:
                  btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f );
-                 switch ( item->msg )
-                  {
-                   case evSetVolume:
-                        guiIntfStruct.VolumeChanged=1;
-                        guiIntfStruct.Volume=item->value;
-                        break;
-                  }
+		 mplEventHandling( item->msg,item->value );
                  value=item->value;
                  break;
            }
@@ -527,13 +546,6 @@
            {
             item->value+=value;
             btnModify( item->msg,item->value );
-            switch ( item->msg )
-             {
-              case evSetVolume:
-                   guiIntfStruct.VolumeChanged=1;
-                   guiIntfStruct.Volume=item->value;
-                   break;
-             }
             mplEventHandling( item->msg,item->value );
             mplMainRender=1;
            }
@@ -559,20 +571,12 @@
 potihandled:
                  if ( item->value > 100.0f ) item->value=100.0f;
                  if ( item->value < 0.0f ) item->value=0.0f;
-                 switch ( item->msg )
-                  {
-                   case evSetVolume:
-                        guiIntfStruct.VolumeChanged=1;
-                        guiIntfStruct.Volume=item->value;
-                        break;
-                  }
                  mplEventHandling( item->msg,item->value );
-                 mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
                  break;
            }
           break;
   }
- if ( Button != wsMoveMouse ) wsPostRedisplay( &appMPlayer.mainWindow );
+// if ( Button != wsMoveMouse ) wsPostRedisplay( &appMPlayer.mainWindow );
 }
 
 int keyPressed = 0;

Index: sw.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/sw.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- sw.h	20 May 2002 13:56:15 -0000	1.31
+++ sw.h	2 Jul 2002 13:35:03 -0000	1.32
@@ -18,7 +18,6 @@
  if ( mplSubRender )
   {
    if ( appMPlayer.sub.Bitmap.Image ) wsPutImage( &appMPlayer.subWindow );
-//   XFlush( wsDisplay );
   }
  appMPlayer.subWindow.State=0;
 }




More information about the MPlayer-cvslog mailing list