[xiph-commits] r3269 - liboggplay/trunk/plugin
shans at svn.annodex.net
shans at svn.annodex.net
Tue Nov 6 20:59:21 PST 2007
Author: shans
Date: 2007-11-06 20:59:21 -0800 (Tue, 06 Nov 2007)
New Revision: 3269
Modified:
liboggplay/trunk/plugin/plugin.cpp
liboggplay/trunk/plugin/plugin.h
liboggplay/trunk/plugin/plugin_c.h
liboggplay/trunk/plugin/plugin_oggplay.c
liboggplay/trunk/plugin/plugin_oggplay.h
Log:
Movie downloaded notification routed to plugin.cpp.
Modified: liboggplay/trunk/plugin/plugin.cpp
===================================================================
--- liboggplay/trunk/plugin/plugin.cpp 2007-11-06 06:47:45 UTC (rev 3268)
+++ liboggplay/trunk/plugin/plugin.cpp 2007-11-07 04:59:21 UTC (rev 3269)
@@ -378,7 +378,7 @@
// code is responsible for destroying it, because only the gui code knows
// when to shut down the old handle after a new media source has been
// provided.
- mOggHandle = initialise_oggplay(curMovie(), mProxyHost, mProxyPort);
+ mOggHandle = initialise_oggplay(this, curMovie(), mProxyHost, mProxyPort);
mGuiHandle = initialise_gui(this, aWindow, mOggHandle);
mWindow = aWindow;
mWindowInitialised = TRUE;
@@ -585,7 +585,7 @@
nsPluginInstance::restart() {
if (curMovie() != NULL) {
mPlaylistFrozen = FALSE;
- mOggHandle = initialise_oggplay(curMovie(), mProxyHost, mProxyPort);
+ mOggHandle = initialise_oggplay(this, curMovie(), mProxyHost, mProxyPort);
update_gui_with_new_oggplay(mGuiHandle, mOggHandle);
gui_play(mGuiHandle);
}
@@ -740,7 +740,7 @@
// We can just discard our reference to the old oggplay handle; the gui
// code will destroy it before swapping over to the new one.
mPlaylistFrozen = FALSE;
- mOggHandle = initialise_oggplay(curMovie(), mProxyHost, mProxyPort);
+ mOggHandle = initialise_oggplay(this, curMovie(), mProxyHost, mProxyPort);
update_gui_with_new_oggplay(mGuiHandle, mOggHandle);
}
return TRUE;
@@ -919,6 +919,11 @@
SEM_SIGNAL(mCrossThreadSem);
}
+void
+nsPluginInstance::onMovieDownload() {
+ printf("Movie Downloaded\n");
+}
+
// C hooks for the callback notification functions
extern "C" {
void
@@ -931,6 +936,10 @@
i->onEndOfMovie();
}
+void
+onMovieDownload(nsPluginInstance *i) {
+ i->onMovieDownload();
+}
} // extern "C"
Modified: liboggplay/trunk/plugin/plugin.h
===================================================================
--- liboggplay/trunk/plugin/plugin.h 2007-11-06 06:47:45 UTC (rev 3268)
+++ liboggplay/trunk/plugin/plugin.h 2007-11-07 04:59:21 UTC (rev 3269)
@@ -121,6 +121,7 @@
void registerPlaylistCallback(nsILibOggCallbackNoArg *cbObj);
void onCMMLData(char **cmml_data, int cmml_size, int async);
void onEndOfMovie();
+ void onMovieDownload();
// This is only public so the Windows "heartbeat" function can
// access it. If you're not PluginCallbackProc, don't touch!
Modified: liboggplay/trunk/plugin/plugin_c.h
===================================================================
--- liboggplay/trunk/plugin/plugin_c.h 2007-11-06 06:47:45 UTC (rev 3268)
+++ liboggplay/trunk/plugin/plugin_c.h 2007-11-07 04:59:21 UTC (rev 3269)
@@ -1,3 +1,6 @@
+#ifndef _PLUGIN_C_H
+#define _PLUGIN_C_H
+
struct nsPluginInstance;
typedef struct nsPluginInstance nsPluginInstance;
@@ -6,3 +9,8 @@
void
onEndOfMovie(nsPluginInstance *i);
+
+void
+onMovieDownload(nsPluginInstance *i);
+
+#endif
Modified: liboggplay/trunk/plugin/plugin_oggplay.c
===================================================================
--- liboggplay/trunk/plugin/plugin_oggplay.c 2007-11-06 06:47:45 UTC (rev 3268)
+++ liboggplay/trunk/plugin/plugin_oggplay.c 2007-11-07 04:59:21 UTC (rev 3269)
@@ -84,6 +84,8 @@
int reference_track;
int duration;
int available;
+ int finished;
+ nsPluginInstance *pluginInstance;
} PluginPointers;
int get_audio_rate(void *ptrs) {
@@ -223,6 +225,8 @@
pointers->video_rate / 65536.0, pointers->audio_rate,
pointers->audio_channels, pointers->callback_period/65536.0);
+ pointers->finished = 0;
+
while (1) {
OggPlayErrorCode r;
@@ -234,6 +238,16 @@
r = oggplay_step_decoding(pointers->player);
pointers->available = oggplay_get_available(pointers->player);
+ if
+ (
+ pointers->finished == 0
+ &&
+ oggplay_media_finished_retrieving(pointers->player)
+ )
+ {
+ pointers->finished = 1;
+ onMovieDownload(pointers->pluginInstance);
+ }
if (pointers->seek_flag) {
SEM_WAIT(pointers->seek_sem);
@@ -273,13 +287,15 @@
}
void *
-initialise_oggplay(char *location, char *proxy, int proxy_port) {
+initialise_oggplay(nsPluginInstance *instance, char *location, char *proxy,
+ int proxy_port) {
#if defined(XP_WIN)
int dec_id;
#endif
PluginPointers * pointers = (PluginPointers*)malloc(sizeof(PluginPointers));
-
+
+ pointers->pluginInstance = instance;
pointers->player = NULL;
pointers->location = strdup(location);
pointers->proxy = (proxy != NULL) ? strdup(proxy) : NULL;
Modified: liboggplay/trunk/plugin/plugin_oggplay.h
===================================================================
--- liboggplay/trunk/plugin/plugin_oggplay.h 2007-11-06 06:47:45 UTC (rev 3268)
+++ liboggplay/trunk/plugin/plugin_oggplay.h 2007-11-07 04:59:21 UTC (rev 3269)
@@ -34,6 +34,8 @@
#ifndef _PLUGIN_OGGPLAY_H
#define _PLUGIN_OGGPLAY_H
+#include <npapi.h>
+#include "plugin_c.h"
#include <oggplay/oggplay_enums.h>
typedef enum {
@@ -64,7 +66,8 @@
} PluginOggFrame;
void *
-initialise_oggplay(char *location, char *proxy, int proxy_port);
+initialise_oggplay(nsPluginInstance *instance, char *location, char *proxy,
+ int proxy_port);
void
shut_oggplay(void *handle);
More information about the commits
mailing list