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

tahn at svn.annodex.net tahn at svn.annodex.net
Wed Jun 27 19:08:06 PDT 2007


Author: tahn
Date: 2007-06-27 19:08:06 -0700 (Wed, 27 Jun 2007)
New Revision: 3103

Modified:
   liboggplay/trunk/plugin/nsILibOggPlugin.idl
   liboggplay/trunk/plugin/plugin.cpp
   liboggplay/trunk/plugin/plugin.h
   liboggplay/trunk/plugin/support/nsScriptablePeer.cpp
   liboggplay/trunk/plugin/test/test.html
Log:
Added RemoveMovieAt Javascript API function.


Modified: liboggplay/trunk/plugin/nsILibOggPlugin.idl
===================================================================
--- liboggplay/trunk/plugin/nsILibOggPlugin.idl	2007-06-28 01:42:58 UTC (rev 3102)
+++ liboggplay/trunk/plugin/nsILibOggPlugin.idl	2007-06-28 02:08:06 UTC (rev 3103)
@@ -86,6 +86,7 @@
   boolean setMovieAt(in long position, in string url);
   void appendMovie(in string url);
   boolean insertMovieBefore(in long position, in string url);
+  boolean removeMovieAt(in long position);
   long getPlayPositionWithinMovie();
   boolean setPlayPositionWithinMovie(in long milliseconds);
   string retrieveAnnotationsAt(in long position);

Modified: liboggplay/trunk/plugin/plugin.cpp
===================================================================
--- liboggplay/trunk/plugin/plugin.cpp	2007-06-28 01:42:58 UTC (rev 3102)
+++ liboggplay/trunk/plugin/plugin.cpp	2007-06-28 02:08:06 UTC (rev 3103)
@@ -737,6 +737,12 @@
   return TRUE;
 }
 
+bool
+nsPluginInstance::removeMovieAt(long position) {
+//!todo
+  return TRUE;
+}
+
 long
 nsPluginInstance::getPlayPositionWithinMovie() {
 //!todo

Modified: liboggplay/trunk/plugin/plugin.h
===================================================================
--- liboggplay/trunk/plugin/plugin.h	2007-06-28 01:42:58 UTC (rev 3102)
+++ liboggplay/trunk/plugin/plugin.h	2007-06-28 02:08:06 UTC (rev 3103)
@@ -115,6 +115,7 @@
   bool    setMovieAt(long position, const char *url);
   void    appendMovie(const char *url);
   bool    insertMovieBefore(long position, const char *url);
+  bool    removeMovieAt(long position);
   long    getPlayPositionWithinMovie();
   bool    setPlayPositionWithinMovie(long milliseconds);
   char  * retrieveAnnotationsAt(long position);

Modified: liboggplay/trunk/plugin/support/nsScriptablePeer.cpp
===================================================================
--- liboggplay/trunk/plugin/support/nsScriptablePeer.cpp	2007-06-28 01:42:58 UTC (rev 3102)
+++ liboggplay/trunk/plugin/support/nsScriptablePeer.cpp	2007-06-28 02:08:06 UTC (rev 3103)
@@ -290,6 +290,13 @@
   return NS_OK;
 }
 
+NS_IMETHODIMP nsScriptablePeer::RemoveMovieAt(PRInt32 position, PRBool *_retval) {
+  *_retval = FALSE;
+  if (mPlugin)
+    *_retval = mPlugin->removeMovieAt(position);
+  return NS_OK;
+}
+
 NS_IMETHODIMP nsScriptablePeer::GetPlayPositionWithinMovie(PRInt32 *_retval) {
   *_retval = -1;
   if (mPlugin)

Modified: liboggplay/trunk/plugin/test/test.html
===================================================================
--- liboggplay/trunk/plugin/test/test.html	2007-06-28 01:42:58 UTC (rev 3102)
+++ liboggplay/trunk/plugin/test/test.html	2007-06-28 02:08:06 UTC (rev 3103)
@@ -83,6 +83,7 @@
 </td><td>
 <tt>e </tt><input type="button" value="Append movie" onclick='AppendMovie()'/><br>
 <tt>i </tt><input type="button" value="Insert movie before" onclick='InsertMovieBefore()'/><br>
+<tt>x </tt><input type="button" value="Remove movie at" onclick='RemoveMovieAt()'/><br>
 <tt>n </tt><input type="button" value="Get play pos in movie" onclick='GetPlayPositionWithinMovie()'/><br>
 <tt>N </tt><input type="button" value="Set play pos in movie" onclick='SetPlayPositionWithinMovie()'/><br>
 <tt>A </tt><input type="button" value="Retrieve annotations at" onclick='RetrieveAnnotationsAt()'/><br>
@@ -241,6 +242,12 @@
   addOutput("Inserted " + movie + " before " + i);
 }
 
+function RemoveMovieAt() {
+  var i = getInput();
+  addOutput("Removed movie at " + i + " - " +
+            (plugin.removeMovieAt(i) ? "succeeded" : "failed"));
+}
+
 function GetPlayPositionWithinMovie() {
   addOutput("Current position in movie: " + plugin.getPlayPositionWithinMovie());
 }
@@ -379,6 +386,7 @@
     case "o": SetMovieAt();  break;
     case "e": AppendMovie();  break;
     case "i": InsertMovieBefore();  break;
+    case "x": RemoveMovieAt();  break;
     case "n": GetPlayPositionWithinMovie();  break;
     case "N": SetPlayPositionWithinMovie();  break;
     case "A": RetrieveAnnotationsAt();  break;
@@ -407,9 +415,9 @@
 function skip(dir) {
   var i = getInput();
   if (i <= 0) i = 1000;
-  i = plugin.getPlayPosition() + i * dir;
-  addOutput("Skipping to " + i + " ms - " +
-            (plugin.setPlayPosition(i) ? "succeeded" : "failed"));
+  var t = plugin.getPlayPosition() + i * dir;
+  addOutput("Skipping by " + i + " to " + t + " ms - " +
+            (plugin.setPlayPosition(t) ? "succeeded" : "failed"));
 }
 
 function changeVolume(dir) {



More information about the commits mailing list