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

shans at svn.annodex.net shans at svn.annodex.net
Tue Jun 12 21:52:25 PDT 2007


Author: shans
Date: 2007-06-12 21:52:23 -0700 (Tue, 12 Jun 2007)
New Revision: 2896

Modified:
   liboggplay/trunk/plugin/plugin.cpp
Log:
Added CMML handler and C wrapper for same



Modified: liboggplay/trunk/plugin/plugin.cpp
===================================================================
--- liboggplay/trunk/plugin/plugin.cpp	2007-06-13 01:37:53 UTC (rev 2895)
+++ liboggplay/trunk/plugin/plugin.cpp	2007-06-13 04:52:23 UTC (rev 2896)
@@ -234,7 +234,8 @@
   mWindow(NULL),
   mScriptablePeer(NULL),
   mOggHandle(NULL),
-  mGuiHandle(NULL)
+  mGuiHandle(NULL),
+  mCallback(NULL)
 #if defined(XP_MACOSX)
   ,
   mOutputCleared(FALSE)
@@ -337,11 +338,30 @@
 }
 
 void 
-nsPluginInstance::setCMMLCallback(const char * callback) {
-  char * callback_target = strdup(callback);
-  set_cmml_callback(mToolsHandle, callback_target);
+nsPluginInstance::setCallbackObject(nsILibOggCallback *cbObj) {
+
+  mCallback = cbObj;
+  NS_ADDREF(cbObj);
 }
 
+void
+nsPluginInstance::onCMMLData(char **cmml_data, int cmml_size) {
+
+  int i;
+
+  if (mCallback != NULL) {
+    for (i = 0; i < cmml_size; i++) {
+      mCallback->CmmlCallback(cmml_data[i]);
+    }
+  }
+
+}
+
+extern "C" void 
+onCMMLData(nsPluginInstance *i, char **cmml_data, int cmml_size) {
+  i->onCMMLData(cmml_data, cmml_size);
+}
+
 char *
 nsPluginInstance::retrieveAllAnnotations() {
   return NULL;
@@ -419,8 +439,7 @@
     // when to shut down the old handle after a new media source has been
     // provided.
     mOggHandle = initialise_oggplay(mSource);
-    mToolsHandle = initialise_tools(mInstance);
-    mGuiHandle = initialise_gui(aWindow, mOggHandle, mToolsHandle);
+    mGuiHandle = initialise_gui(this, aWindow, mOggHandle);
     mWindow = aWindow;
     mWindowInitialised = TRUE;
 



More information about the commits mailing list