develop.uap-core.de/git
/
uwplayer.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
shutdown existing player when a new file is opened
[uwplayer.git]
/
application
/
player.c
diff --git
a/application/player.c
b/application/player.c
index
213d184
..
8e03fbc
100644
(file)
--- a/
application/player.c
+++ b/
application/player.c
@@
-28,6
+28,7
@@
#include <sys/fcntl.h>
#include <spawn.h>
#include <sys/wait.h>
#include <sys/fcntl.h>
#include <spawn.h>
#include <sys/wait.h>
+#include <signal.h>
#include <pthread.h>
#include <pthread.h>
@@
-36,6
+37,7
@@
extern char **environ;
#define WID_ARG_BUFSIZE 24
static void* start_player(void *data);
#define WID_ARG_BUFSIZE 24
static void* start_player(void *data);
+static void* player_io_thread(void *data);
void PlayerOpenFile(MainWindow *win) {
pthread_t tid;
void PlayerOpenFile(MainWindow *win) {
pthread_t tid;
@@
-98,15
+100,33
@@
static void* start_player(void *data) {
close(pin[0]);
close(pout[1]);
player->process = player_pid;
close(pin[0]);
close(pout[1]);
player->process = player_pid;
+ player->isactive = TRUE;
if(win->player) {
PlayerDestroy(win->player);
}
win->player = player;
if(win->player) {
PlayerDestroy(win->player);
}
win->player = player;
+ // start thread for mplayer IO
+ pthread_t tid;
+ if(pthread_create(&tid, NULL, player_io_thread, player)) {
+ perror("pthread_create");
+ }
+
return NULL;
}
void PlayerDestroy(Player *p) {
return NULL;
}
void PlayerDestroy(Player *p) {
+ if(p->isactive) {
+ close(p->in);
+ close(p->out);
+ kill(p->process, SIGTERM);
+ }
free(p);
}
free(p);
}
+
+static void* player_io_thread(void *data) {
+ Player *player = data;
+
+ return NULL;
+}