[Xfce4-commits] <parole:master> Return -1 in the WriteReady when we have the data saved.

Ali Abdallah noreply at xfce.org
Fri Nov 27 10:04:01 CET 2009


Updating branch refs/heads/master
         to 8a3d5d2a72b309aa8d2e4c5c56848ce4b335e68d (commit)
       from ce2b8cfa71b936f086b7dec5cbc0495febf6c036 (commit)

commit 8a3d5d2a72b309aa8d2e4c5c56848ce4b335e68d
Author: Ali Abdallah <ali at ali-xfce.org>
Date:   Thu Nov 26 23:23:31 2009 +0100

    Return -1 in the WriteReady when we have the data saved.

 browser-plugin/parole-plugin.c |   18 +++++++++++-------
 browser-plugin/parole-plugin.h |    2 +-
 browser-plugin/plugin.cpp      |    2 +-
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/browser-plugin/parole-plugin.c b/browser-plugin/parole-plugin.c
index 038beef..3201ab7 100644
--- a/browser-plugin/parole-plugin.c
+++ b/browser-plugin/parole-plugin.c
@@ -47,6 +47,7 @@ struct _ParolePlugin
     DBusGConnection *bus;
     DBusGProxy      *proxy;
     
+    NPP 	     Instance;
     Window	     window;
     gchar           *url;
     gchar           *tmp_file;
@@ -322,10 +323,11 @@ parole_plugin_send_play (ParolePlugin *plugin, const gchar *url)
 }
 
 ParolePlugin *
-parole_plugin_new (void)
+parole_plugin_new (NPP Instance)
 {
     ParolePlugin *plugin = NULL;
     plugin = g_object_new (PAROLE_TYPE_PLUGIN, NULL);
+    plugin->Instance = Instance;
     return plugin;
 }
 
@@ -359,11 +361,7 @@ NPError	parole_plugin_new_stream (ParolePlugin *plugin, NPStream *stream, NPMIME
 
 NPError	parole_plugin_destroy_stream (ParolePlugin *plugin, NPStream * stream, NPError reason)
 {
-    if ( reason != NPRES_DONE )
-    {
-	g_debug ("Destroy stream %s reason %i ", stream->url, reason);
-	parole_plugin_shut (plugin);
-    }
+    g_debug ("Destroy stream %s reason %i", stream->url, reason);
     
     return NPERR_NO_ERROR;
 }
@@ -402,6 +400,12 @@ int32 parole_plugin_write_ready	(ParolePlugin *plugin, NPStream *stream)
 {
     g_debug ("WriteReady url=%s", stream->url);
     
+    if (plugin->checked)
+    {
+	NPN_DestroyStream (plugin->Instance, stream, NPRES_DONE);
+	return -1;
+    }
+    
     return  plugin->player_ready ? STREAMBUFSIZE  : 0;
 }
 								 
@@ -460,5 +464,5 @@ int32 parole_plugin_write (ParolePlugin *plugin,
 	return len;
     }
     
-    return 0;
+    return wrotebytes;
 }
diff --git a/browser-plugin/parole-plugin.h b/browser-plugin/parole-plugin.h
index 85e1afd..75aee42 100644
--- a/browser-plugin/parole-plugin.h
+++ b/browser-plugin/parole-plugin.h
@@ -38,7 +38,7 @@ typedef struct _ParolePlugin 	  ParolePlugin;
 
 GType        			parole_plugin_get_type        	(void) G_GNUC_CONST;
 
-ParolePlugin   		       *parole_plugin_new             	(void);
+ParolePlugin   		       *parole_plugin_new             	(NPP Instance);
 
 NPError				parole_plugin_set_window	(ParolePlugin *plugin,
 								 NPWindow * aWindow);
diff --git a/browser-plugin/plugin.cpp b/browser-plugin/plugin.cpp
index 0ae98f0..ccde40d 100644
--- a/browser-plugin/plugin.cpp
+++ b/browser-plugin/plugin.cpp
@@ -70,7 +70,7 @@ CPlugin::CPlugin (NPP pNPInstance)
 {
     g_debug ("Constructor");
     
-    plugin = parole_plugin_new ();
+    plugin = parole_plugin_new (pNPInstance);
     
     mInstance = pNPInstance;
     mInitialized = TRUE;



More information about the Xfce4-commits mailing list