forked from enlightenment/efl
emotion/generic/vlc: die when parent dies.
nasty fix for a nasty emotion behavior :-/ SVN revision: 63080
This commit is contained in:
parent
acda54440e
commit
5965cf014f
|
@ -14,6 +14,9 @@
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
|
||||||
|
#include <sys/prctl.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include <vlc/vlc.h>
|
#include <vlc/vlc.h>
|
||||||
#include <Emotion_Generic_Plugin.h>
|
#include <Emotion_Generic_Plugin.h>
|
||||||
|
|
||||||
|
@ -616,7 +619,7 @@ main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
struct _App app;
|
struct _App app;
|
||||||
Emotion_Generic_Video_Shared *vs;
|
Emotion_Generic_Video_Shared *vs;
|
||||||
struct pollfd fds[2]; // watching on 2 file descriptors
|
struct pollfd fds[3];
|
||||||
int tpipe[2]; // pipe for comunicating events from threads
|
int tpipe[2]; // pipe for comunicating events from threads
|
||||||
char shmname[256];
|
char shmname[256];
|
||||||
char cwidth[64], cheight[64], cpitch[64], chroma[64];
|
char cwidth[64], cheight[64], cpitch[64], chroma[64];
|
||||||
|
@ -642,6 +645,17 @@ main(int argc, const char *argv[])
|
||||||
snprintf(cpitch, sizeof(cpitch), "%d", DEFAULTWIDTH * 4);
|
snprintf(cpitch, sizeof(cpitch), "%d", DEFAULTWIDTH * 4);
|
||||||
snprintf(chroma, sizeof(chroma), "RV32");
|
snprintf(chroma, sizeof(chroma), "RV32");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Naughty xattr in emotion uses ecore_thread to run its thing, this
|
||||||
|
* may leave emotion's reference count high and it won't kill us...
|
||||||
|
* letting us play the video in the background. not good.
|
||||||
|
*
|
||||||
|
* prctl(PR_SET_PDEATHSIG) is a linux only thing. Need to find ways
|
||||||
|
* to do it on other platforms. Until then leave it breaking on
|
||||||
|
* such platforms so people port it instead of ignoring.
|
||||||
|
*/
|
||||||
|
prctl(PR_SET_PDEATHSIG, SIGHUP);
|
||||||
|
|
||||||
app.libvlc = libvlc_new(vlc_argc, vlc_argv);
|
app.libvlc = libvlc_new(vlc_argc, vlc_argv);
|
||||||
app.mp = NULL;
|
app.mp = NULL;
|
||||||
app.filename = NULL;
|
app.filename = NULL;
|
||||||
|
@ -672,17 +686,34 @@ main(int argc, const char *argv[])
|
||||||
fds[0].events = POLLIN;
|
fds[0].events = POLLIN;
|
||||||
fds[1].fd = app.fd_read;
|
fds[1].fd = app.fd_read;
|
||||||
fds[1].events = POLLIN;
|
fds[1].events = POLLIN;
|
||||||
|
fds[2].fd = STDERR_FILENO;
|
||||||
|
fds[2].events = 0;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = poll(fds, 2, 30);
|
r = poll(fds, 3, -1);
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
continue;
|
continue;
|
||||||
else if (r < 0)
|
else if (r < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "an error ocurred on poll().\n");
|
fprintf(stderr,
|
||||||
|
"emotion_generic_vlc: an error ocurred on poll(): %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fds[0].revents & (POLLERR | POLLHUP | POLLNVAL))
|
||||||
|
{
|
||||||
|
fputs("emotion_generic_vlc: error communicating with stdin\n",
|
||||||
|
stderr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (fds[1].revents & (POLLERR | POLLHUP | POLLNVAL))
|
||||||
|
{
|
||||||
|
fputs("emotion_generic_vlc: error communicating with thread\n",
|
||||||
|
stderr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -690,6 +721,8 @@ main(int argc, const char *argv[])
|
||||||
_process_emotion_commands(&app);
|
_process_emotion_commands(&app);
|
||||||
if (fds[1].revents & POLLIN)
|
if (fds[1].revents & POLLIN)
|
||||||
_process_thread_events(&app);
|
_process_thread_events(&app);
|
||||||
|
if (fds[2].revents & (POLLERR | POLLHUP | POLLNVAL))
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
libvlc_release(app.libvlc);
|
libvlc_release(app.libvlc);
|
||||||
|
|
Loading…
Reference in New Issue