Update of /cvsroot/xine/xine-plugin/src In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21072
Modified Files: plugin.c Log Message: Enable cancelation during xine_open() to avoid blocking the browser. Index: plugin.c =================================================================== RCS file: /cvsroot/xine/xine-plugin/src/plugin.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- plugin.c 19 Dec 2006 11:18:28 -0000 1.46 +++ plugin.c 19 Dec 2006 14:14:11 -0000 1.47 @@ -223,12 +223,15 @@ static void *player_thread (void *data) { xine_plugin_t *this = data; + + pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); while (this->track && this->playing) { playlist_entry_t *track = this->track; const char *error; char buf[4096]; int len = 0; + int ret; if (!strstr (track->mrl, "://") && access (track->mrl, F_OK)) len = snprintf (buf, sizeof(buf), "%s", this->base); @@ -239,14 +242,12 @@ log ("opening \"%s\"...", buf); NPN_Status (this->instance, "xine-plugin: opening stream..."); - if (xine_open (this->stream, buf)) { + pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL); + ret = xine_open (this->stream, buf); + pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); + if (ret) { log ("... stream opened ..."); NPN_Status (this->instance, "xine-plugin: ... stream opened ..."); - - if (!this->playing) { - xine_close (this->stream); - return (void *) 0; - } if (xine_play (this->stream, 0, track->start)) { log ("... playback started."); @@ -264,8 +265,6 @@ this->track = track->next; playlist_remove (&this->list, track); pthread_mutex_unlock (&this->mutex); - - xine_usec_sleep (1000); } while (this->playing) { @@ -298,8 +297,11 @@ } pthread_mutex_unlock (&this->mutex); - if (this->playing) + if (this->playing) { + pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL); xine_usec_sleep (5000); + pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); + } continue; } @@ -510,6 +512,9 @@ if (this->playing) { log ("stopping player..."); this->playing = 0; + pthread_mutex_lock (&this->mutex); + pthread_cancel (this->thread); + pthread_mutex_unlock (&this->mutex); pthread_join (this->thread, NULL); log ("...player stopped."); } ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Xine-cvslog mailing list Xine-cvslog@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xine-cvslog