[xiph-commits] r2891 - liboggplay/trunk/plugin

tahn at svn.annodex.net tahn at svn.annodex.net
Mon Jun 11 18:54:02 PDT 2007


Author: tahn
Date: 2007-06-11 18:54:01 -0700 (Mon, 11 Jun 2007)
New Revision: 2891

Modified:
   liboggplay/trunk/plugin/plugin.cpp
   liboggplay/trunk/plugin/plugin_gui.h
   liboggplay/trunk/plugin/plugin_gui_linux.c
   liboggplay/trunk/plugin/plugin_gui_mac.c
   liboggplay/trunk/plugin/plugin_gui_win32.c
Log:
Updated the mac gui to track and return its current state. Also moved the playback state enum back into the header file.


Modified: liboggplay/trunk/plugin/plugin.cpp
===================================================================
--- liboggplay/trunk/plugin/plugin.cpp	2007-06-12 01:52:25 UTC (rev 2890)
+++ liboggplay/trunk/plugin/plugin.cpp	2007-06-12 01:54:01 UTC (rev 2891)
@@ -333,25 +333,20 @@
 
 short 
 nsPluginInstance::getCurrentState() {
-#if !defined(XP_MACOSX)
   return get_gui_current_state(mGuiHandle);
-#else
-  return 0;
-#endif
 }
 
 void 
 nsPluginInstance::setCMMLCallback(const char * callback) {
   char * callback_target = strdup(callback);
-#if !defined(XP_MACOSX)
   set_cmml_callback(mToolsHandle, callback_target);
-#endif
 }
 
 char *
 nsPluginInstance::retrieveAllAnnotations() {
   return NULL;
 }
+
 void 
 nsPluginInstance::setVolume(float volume) {
 }

Modified: liboggplay/trunk/plugin/plugin_gui.h
===================================================================
--- liboggplay/trunk/plugin/plugin_gui.h	2007-06-12 01:52:25 UTC (rev 2890)
+++ liboggplay/trunk/plugin/plugin_gui.h	2007-06-12 01:54:01 UTC (rev 2891)
@@ -42,6 +42,12 @@
 PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
 #endif
 
+typedef enum {
+  PAUSED = 0,
+  PLAYING = 1,
+  FINISHED = 2
+} PluginPlaybackState;
+
 void *
 initialise_gui(NPWindow *np_window, void *oggplay_handle, void *tools_handle);
 

Modified: liboggplay/trunk/plugin/plugin_gui_linux.c
===================================================================
--- liboggplay/trunk/plugin/plugin_gui_linux.c	2007-06-12 01:52:25 UTC (rev 2890)
+++ liboggplay/trunk/plugin/plugin_gui_linux.c	2007-06-12 01:54:01 UTC (rev 2891)
@@ -54,12 +54,6 @@
 #include "sydney_audio.h"
 #endif
 
-typedef enum {
-  PAUSED = 0,
-  PLAYING = 1,
-  FINISHED = 2
-} PluginPlaybackState;
-
 typedef struct {
   int                   width;
   int                   height;

Modified: liboggplay/trunk/plugin/plugin_gui_mac.c
===================================================================
--- liboggplay/trunk/plugin/plugin_gui_mac.c	2007-06-12 01:52:25 UTC (rev 2890)
+++ liboggplay/trunk/plugin/plugin_gui_mac.c	2007-06-12 01:54:01 UTC (rev 2891)
@@ -69,6 +69,7 @@
   void                  * oggplay_handle;
   void                  * new_oggplay_handle;
   semaphore               oggplay_replace_sem;
+  PluginPlaybackState     playback_state;
   PluginStateChange       playback_state_change;
   semaphore               playback_sem;
   void                  * tools_handle;
@@ -570,6 +571,7 @@
   info->display_resized       = 1;
   info->oggplay_handle        = oggplay_handle;
   info->new_oggplay_handle    = NULL;
+  info->playback_state        = PLAYING;
   info->playback_state_change = NO_CHANGE;
   info->tools_handle          = tools_handle;
 
@@ -632,6 +634,7 @@
   PluginWindowInfo  * info = gui_handle;
 
   SEM_WAIT(info->playback_sem);
+  info->playback_state        = PAUSED;
   info->playback_state_change = SET_PAUSE;
   SEM_SIGNAL(info->playback_sem);
 }
@@ -643,15 +646,35 @@
   PluginWindowInfo  * info = gui_handle;
 
   SEM_WAIT(info->playback_sem);
+  info->playback_state        = PLAYING;
   info->playback_state_change = SET_PLAY;
   SEM_SIGNAL(info->playback_sem);
 }
 
 
+short
+get_gui_current_state(void *gui_handle) {
+
+  PluginWindowInfo  * info = gui_handle;
+
+  switch (info->playback_state) {
+    case PAUSED:
+      return 0;
+    case PLAYING:
+      return 1;
+    case FINISHED:
+      return 2;
+    default:
+      /* error state: should never be returned */
+      return -1;
+  }
+}
+
+
 void
 shut_gui(void *gui_handle) {
 
-  PluginWindowInfo *info = gui_handle;
+  PluginWindowInfo  * info = gui_handle;
 
   /*
    * Signal the display thread then wait until it indicates successful

Modified: liboggplay/trunk/plugin/plugin_gui_win32.c
===================================================================
--- liboggplay/trunk/plugin/plugin_gui_win32.c	2007-06-12 01:52:25 UTC (rev 2890)
+++ liboggplay/trunk/plugin/plugin_gui_win32.c	2007-06-12 01:54:01 UTC (rev 2891)
@@ -45,12 +45,6 @@
 #include "plugin_gui.h"
 #include "plugin_oggplay.h"
 
-typedef enum {
-  PAUSED = 0,
-  PLAYING = 1,
-  FINISHED = 2
-} PluginPlaybackState;
-
 /* 
  * INFO: proposition of callback related structures
  *



More information about the commits mailing list