[xiph-commits] r3136 - in liboggplay/trunk/plugin: . support test

tahn at svn.annodex.net tahn at svn.annodex.net
Thu Jun 28 17:47:24 PDT 2007


Author: tahn
Date: 2007-06-28 17:47:23 -0700 (Thu, 28 Jun 2007)
New Revision: 3136

Modified:
   liboggplay/trunk/plugin/nsILibOggPlugin.idl
   liboggplay/trunk/plugin/plugin.cpp
   liboggplay/trunk/plugin/plugin.h
   liboggplay/trunk/plugin/plugin_cmml.c
   liboggplay/trunk/plugin/support/nsScriptablePeer.cpp
   liboggplay/trunk/plugin/test/test.html
Log:
Annotation API functions now return bool (they can fail if you're already waiting for out-of-band annotation retrieval).


Modified: liboggplay/trunk/plugin/nsILibOggPlugin.idl
===================================================================
--- liboggplay/trunk/plugin/nsILibOggPlugin.idl	2007-06-29 00:46:22 UTC (rev 3135)
+++ liboggplay/trunk/plugin/nsILibOggPlugin.idl	2007-06-29 00:47:23 UTC (rev 3136)
@@ -73,7 +73,7 @@
   long getWindowHeight();
   long getBufferedTime();
   long getMovieLength();
-  void retrieveAnnotations(in nsILibOggCallbackString callback);
+  boolean retrieveAnnotations(in nsILibOggCallbackString callback);
   void registerCMMLCallback(in nsILibOggCallbackString callback);
   void registerEndPlayCallback(in nsILibOggCallbackNoArg callback);
 
@@ -90,7 +90,7 @@
   void appendMovie(in string url);
   boolean insertMovieBefore(in long position, in string url);
   boolean removeMovieAt(in long position);
-  void retrieveAnnotationsAt(in long position, 
+  boolean retrieveAnnotationsAt(in long position, 
                       in nsILibOggCallbackString callback);
   long getMovieLengthAt(in long position);
   void registerPlaylistCallback(in nsILibOggCallbackNoArg callback);

Modified: liboggplay/trunk/plugin/plugin.cpp
===================================================================
--- liboggplay/trunk/plugin/plugin.cpp	2007-06-29 00:46:22 UTC (rev 3135)
+++ liboggplay/trunk/plugin/plugin.cpp	2007-06-29 00:47:23 UTC (rev 3136)
@@ -315,6 +315,9 @@
   if (mPlaylistCallback != NULL) {
     NS_RELEASE(mPlaylistCallback);
   }
+  if (mAsyncCmmlCallback != NULL) {
+    NS_RELEASE(mAsyncCmmlCallback);
+  }
 
   for (unsigned int i = 0; i < mPlaylist.size(); i++) {
     free(mPlaylist[i]);
@@ -651,9 +654,9 @@
   return get_oggplay_duration(mOggHandle);
 }
 
-void
+bool
 nsPluginInstance::retrieveAnnotations(nsILibOggCallbackString * callback) {
-  retrieveAnnotationsAt(mPlaylistPos, callback);
+  return retrieveAnnotationsAt(mPlaylistPos, callback);
 }
 
 ////////////////////////////////////////
@@ -786,20 +789,21 @@
   return TRUE;
 }
 
-void
+bool
 nsPluginInstance::retrieveAnnotationsAt(long position, 
                     nsILibOggCallbackString * callback) {
   if (!playlistIndexOk(position)) {
-    return;
+    return FALSE;
   }
   
   if (mAsyncCmmlCallback != NULL)
-    return;
+    return FALSE;
 
   mAsyncCmmlCallback = callback;
   NS_ADDREF(callback);
   
   start_cmml_thread(this, mPlaylist[position], mProxyHost, mProxyPort);
+  return TRUE;
 }
 
 long

Modified: liboggplay/trunk/plugin/plugin.h
===================================================================
--- liboggplay/trunk/plugin/plugin.h	2007-06-29 00:46:22 UTC (rev 3135)
+++ liboggplay/trunk/plugin/plugin.h	2007-06-29 00:47:23 UTC (rev 3136)
@@ -98,7 +98,7 @@
   long    getWindowHeight();
   long    getBufferedTime();
   long    getMovieLength();
-  void    retrieveAnnotations(nsILibOggCallbackString *cbObj);
+  bool    retrieveAnnotations(nsILibOggCallbackString *cbObj);
 
   void    freezePlaylistProgression();
   void    unfreezePlaylistProgression();
@@ -112,7 +112,7 @@
   void    appendMovie(const char *url);
   bool    insertMovieBefore(long position, const char *url);
   bool    removeMovieAt(long position);
-  void    retrieveAnnotationsAt(long position,
+  bool    retrieveAnnotationsAt(long position,
                                       nsILibOggCallbackString *cbObj);
   long    getMovieLengthAt(long position);
 

Modified: liboggplay/trunk/plugin/plugin_cmml.c
===================================================================
--- liboggplay/trunk/plugin/plugin_cmml.c	2007-06-29 00:46:22 UTC (rev 3135)
+++ liboggplay/trunk/plugin/plugin_cmml.c	2007-06-29 00:47:23 UTC (rev 3136)
@@ -234,7 +234,7 @@
 
 }
 
-char *
+static char *
 get_all_cmml(char *location, char *proxy, int proxy_port) {
 
   char              * host;

Modified: liboggplay/trunk/plugin/support/nsScriptablePeer.cpp
===================================================================
--- liboggplay/trunk/plugin/support/nsScriptablePeer.cpp	2007-06-29 00:46:22 UTC (rev 3135)
+++ liboggplay/trunk/plugin/support/nsScriptablePeer.cpp	2007-06-29 00:47:23 UTC (rev 3136)
@@ -218,11 +218,11 @@
   return NS_OK;
 }
 
-NS_IMETHODIMP nsScriptablePeer::RetrieveAnnotations
-                                            (nsILibOggCallbackString *callback)
-{
+NS_IMETHODIMP nsScriptablePeer::RetrieveAnnotations(nsILibOggCallbackString *callback,
+                                    PRBool *_retval) {
+  *_retval = FALSE;
   if (mPlugin)
-    mPlugin->retrieveAnnotations(callback);
+    *_retval = mPlugin->retrieveAnnotations(callback);
   return NS_OK;
 }
 
@@ -320,9 +320,10 @@
 }
 
 NS_IMETHODIMP nsScriptablePeer::RetrieveAnnotationsAt(PRInt32 position, 
-                                      nsILibOggCallbackString * callback) {
+                                  nsILibOggCallbackString * callback, PRBool *_retval) {
+  *_retval = FALSE;
   if (mPlugin)
-    mPlugin->retrieveAnnotationsAt(position, callback);
+    *_retval = mPlugin->retrieveAnnotationsAt(position, callback);
   return NS_OK;
 }
 

Modified: liboggplay/trunk/plugin/test/test.html
===================================================================
--- liboggplay/trunk/plugin/test/test.html	2007-06-29 00:46:22 UTC (rev 3135)
+++ liboggplay/trunk/plugin/test/test.html	2007-06-29 00:47:23 UTC (rev 3136)
@@ -219,10 +219,12 @@
 }
 
 function RetrieveAnnotations() {
-  plugin.retrieveAnnotations(
+  r = plugin.retrieveAnnotations(
         {
-          call: function(s) { setOutput("-- Annotations -- \n" + s); }
-        });
+          call: function(s) { setOutput("-- Annotations --\n" + s); }
+        }
+      );
+  addOutput("RetrieveAnnotations() " + (r ? "succeeded" : "failed"));
 }
 
 function FreezePlaylistProgression() {
@@ -302,11 +304,12 @@
 
 function RetrieveAnnotationsAt() {
   i = getInput();
-  plugin.retrieveAnnotationsAt(i, 
+  r = plugin.retrieveAnnotationsAt(i, 
         {
-          call: function(s) { 
-              setOutput("-- Annotations at -- \n" + s); }
-        });
+          call: function(s) { setOutput("-- Annotations at --\n" + s); }
+        }
+      );
+  addOutput("RetrieveAnnotationsAt(" + i + ") " + (r ? "succeeded" : "failed"));
 }
 
 function GetMovieLengthAt() {



More information about the commits mailing list