[Cvs-annodex] commit (annodex):
liboggplay/trunk/include/oggplay/oggplay.h
liboggplay/trunk/plugin/plugin.cpp
liboggplay/trunk/plugin/plugin_gui.c
liboggplay/trunk/plugin/plugin_gui.h
liboggplay/trunk/plugin/plugin_oggplay.c
liboggplay/trunk/plugin/plugin_oggplay.h
shans
nobody at lists.annodex.net
Wed Feb 14 04:36:54 UTC 2007
Update of /var/local/lib/svn/annodex (new revision 2606)
Modified files:
liboggplay/trunk/include/oggplay/oggplay.h
liboggplay/trunk/plugin/plugin.cpp
liboggplay/trunk/plugin/plugin_gui.c
liboggplay/trunk/plugin/plugin_gui.h
liboggplay/trunk/plugin/plugin_oggplay.c
liboggplay/trunk/plugin/plugin_oggplay.h
Log Message:
Shutdown code included. There's still a segfault on unload, due to the order in which threads are cancelled. We'll need some synchronisation to get this to happen cleanly.
Modified: liboggplay/trunk/include/oggplay/oggplay.h
===================================================================
--- liboggplay/trunk/include/oggplay/oggplay.h 2007-02-14 00:02:59 UTC (rev 2605)
+++ liboggplay/trunk/include/oggplay/oggplay.h 2007-02-14 04:36:54 UTC (rev 2606)
@@ -97,7 +97,7 @@
OggPlayCallbackInfo **
oggplay_buffer_retrieve_next(OggPlay *player);
-void
+OggPlayErrorCode
oggplay_buffer_release_next(OggPlay *player);
#endif
Modified: liboggplay/trunk/plugin/plugin.cpp
===================================================================
--- liboggplay/trunk/plugin/plugin.cpp 2007-02-14 00:02:59 UTC (rev 2605)
+++ liboggplay/trunk/plugin/plugin.cpp 2007-02-14 04:36:54 UTC (rev 2606)
@@ -168,8 +168,8 @@
void nsPluginInstance::shut()
{
- shut_oggplay(handle);
shut_gui(gui_handle);
+ //shut_oggplay(handle);
mInitialized = FALSE;
}
@@ -212,7 +212,6 @@
handle = initialise_oggplay(
"http://media.aidabrowser.com/medium/CSIRO/viccu/index.anx");
-
initialised = true;
}
initialise_gui(&(gui_handle), (Window)aWindow->window,
Modified: liboggplay/trunk/plugin/plugin_gui.c
===================================================================
--- liboggplay/trunk/plugin/plugin_gui.c 2007-02-14 00:02:59 UTC (rev 2605)
+++ liboggplay/trunk/plugin/plugin_gui.c 2007-02-14 04:36:54 UTC (rev 2606)
@@ -57,6 +57,9 @@
int height;
get_frame(info->handle, &frame, &width, &height);
+ if (frame == NULL) {
+ return TRUE;
+ }
Imlib_Image image = imlib_create_image_using_data(width, height,
(unsigned int *)frame);
@@ -65,7 +68,6 @@
imlib_free_image_and_decache();
free_frame(info->handle, frame);
-
return TRUE;
}
@@ -74,10 +76,15 @@
display_thread(void *_info) {
windowInfo * info = (windowInfo *)_info;
-
+
gtk_widget_show(GTK_WIDGET(info->window));
g_timeout_add(40, update_frame, (gpointer)info);
-
+
+ /*
+ * is this dangerous?
+ */
+ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+
gtk_main();
return NULL;
@@ -128,3 +135,16 @@
GDK_WINDOW_XWINDOW((*info)->window->window), window, 0, 0);
}
+
+void
+shut_gui(void *handle) {
+
+ windowInfo *info = (windowInfo *)handle;
+
+ pthread_cancel(info->thread);
+ shut_oggplay(info->handle);
+
+ free(info);
+
+}
+
Modified: liboggplay/trunk/plugin/plugin_gui.h
===================================================================
--- liboggplay/trunk/plugin/plugin_gui.h 2007-02-14 00:02:59 UTC (rev 2605)
+++ liboggplay/trunk/plugin/plugin_gui.h 2007-02-14 04:36:54 UTC (rev 2606)
@@ -39,4 +39,7 @@
initialise_gui(void **_info, Window window, int width, int height,
void *handle);
+void *
+shut_gui(void *handle);
+
#endif
Modified: liboggplay/trunk/plugin/plugin_oggplay.c
===================================================================
--- liboggplay/trunk/plugin/plugin_oggplay.c 2007-02-14 00:02:59 UTC (rev 2605)
+++ liboggplay/trunk/plugin/plugin_oggplay.c 2007-02-14 04:36:54 UTC (rev 2606)
@@ -42,14 +42,18 @@
#include <oggplay/oggplay.h>
typedef struct {
- OggPlay *player;
- sem_t sem;
+ OggPlay * player;
+ sem_t sem;
+ pthread_t thread;
} PluginPointers;
void *decoding_thread(void *_pointers) {
PluginPointers *pointers = (PluginPointers *)_pointers;
-
+
+ /* is this dangerous? */
+ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+
while (1) {
OggPlayErrorCode r;
@@ -68,7 +72,6 @@
OggPlayReader * reader = oggplay_tcp_reader_new();
OggPlay * player = oggplay_open_with_reader(reader, location);
int i;
- pthread_t thread;
PluginPointers * pointers = malloc(sizeof(PluginPointers));
pointers->player = player;
@@ -88,19 +91,20 @@
oggplay_use_buffer(player, 20);
sem_init(&(pointers->sem), 1, 20);
- pthread_create(&thread, NULL, decoding_thread, (void *)pointers);
+ pthread_create(&(pointers->thread), NULL, decoding_thread, (void *)pointers);
return pointers;
}
+void
shut_oggplay(void *handle) {
PluginPointers * pointers = (PluginPointers *)handle;
//oggplay_delete(pointers->player);
sem_destroy(&(pointers->sem));
-
+
free(pointers);
}
Modified: liboggplay/trunk/plugin/plugin_oggplay.h
===================================================================
--- liboggplay/trunk/plugin/plugin_oggplay.h 2007-02-14 00:02:59 UTC (rev 2605)
+++ liboggplay/trunk/plugin/plugin_oggplay.h 2007-02-14 04:36:54 UTC (rev 2606)
@@ -43,6 +43,9 @@
initialise_oggplay(char *location);
void
+shut_oggplay(void *handle);
+
+void
get_frame(void *pointers, unsigned char **frame, int *width, int *height);
void
--
shans
More information about the cvs-annodex
mailing list