[MPlayer-cvslog] r37055 - in trunk/gui: app/app.c app/app.h interface.c

ib subversion at mplayerhq.hu
Mon Mar 24 11:48:55 CET 2014


Author: ib
Date: Mon Mar 24 11:48:55 2014
New Revision: 37055

Log:
Utilize item defaults given in the skin configuration as start values.

Do so for movie position, volume and balance (and hence show these
values before playback).

Add new btnValue() to retrieve the value and replace the btnModify()
calls with btnValue() calls. (The btnModify() calls will be performed
in the windows' draw handler prior to rendering anyway.)

Initialize last_balance with -1 in order to be able to initialize
balance (and volume) with the start values prior to playback (in
GUI_SET_AUDIO).

Modified:
   trunk/gui/app/app.c
   trunk/gui/app/app.h
   trunk/gui/interface.c

Modified: trunk/gui/app/app.c
==============================================================================
--- trunk/gui/app/app.c	Mon Mar 24 11:26:33 2014	(r37054)
+++ trunk/gui/app/app.c	Mon Mar 24 11:48:55 2014	(r37055)
@@ -231,3 +231,21 @@ void btnSet(int event, int state)
             if (hasButton(guiApp.playbarItems[i]))
                 guiApp.playbarItems[i].pressed = state;
 }
+
+/**
+ * @brief Retrieve the value of the (main) item belonging to an event.
+ *
+ * @param event event
+ * @param value pointer to a variable to store the value (if event has been found)
+ */
+void btnValue(int event, float *value)
+{
+    int i;
+
+    for (i = 0; i <= guiApp.IndexOfMainItems; i++)
+        if (guiApp.mainItems[i].message == event)
+            if (hasValue(guiApp.mainItems[i]) && hasButton(guiApp.mainItems[i])) {
+                *value = guiApp.mainItems[i].value;
+                return;
+            }
+}

Modified: trunk/gui/app/app.h
==============================================================================
--- trunk/gui/app/app.h	Mon Mar 24 11:26:33 2014	(r37054)
+++ trunk/gui/app/app.h	Mon Mar 24 11:48:55 2014	(r37055)
@@ -182,5 +182,6 @@ int appFindMessage(const char *name);
 void appFreeStruct(void);
 void btnModify(int event, float value);
 void btnSet(int event, int state);
+void btnValue(int event, float *value);
 
 #endif /* MPLAYER_GUI_APP_H */

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Mon Mar 24 11:26:33 2014	(r37054)
+++ trunk/gui/interface.c	Mon Mar 24 11:48:55 2014	(r37055)
@@ -186,9 +186,12 @@ void guiInit(void)
 
     WinID = (Window)guiApp.videoWindow.WindowID;
 
-    btnModify(evSetVolume, guiInfo.Volume);
-    btnModify(evSetBalance, guiInfo.Balance);
-    btnModify(evSetMoviePosition, guiInfo.Position);
+    btnValue(evSetVolume, &guiInfo.Volume);
+    btnValue(evSetBalance, &guiInfo.Balance);
+    btnValue(evSetMoviePosition, &guiInfo.Position);
+
+    if (guiInfo.Position)
+        uiEvent(evSetMoviePosition, guiInfo.Position);
 
     wsWindowVisibility(&guiApp.mainWindow, wsShowWindow);
 
@@ -317,7 +320,7 @@ static void add_vf(char *str)
  */
 int gui(int what, void *data)
 {
-    static float last_balance = 50.0f;
+    static float last_balance = -1.0f;
 #ifdef CONFIG_DVDREAD
     dvd_priv_t *dvd;
 #endif
@@ -709,6 +712,15 @@ int gui(int what, void *data)
             guiInfo.VideoHeight = 0;
         }
 
+        if (last_balance < 0.0f) {
+            uiEvent(ivSetVolume, guiInfo.Volume);
+
+            if (guiInfo.AudioChannels >= 2)
+                uiEvent(ivSetBalance, guiInfo.Balance);
+
+            last_balance = guiInfo.Balance;
+        }
+
         if (gtkEnableAudioEqualizer) {
             equalizer_t eq;
             unsigned int i, j;


More information about the MPlayer-cvslog mailing list