1 --- a/src/wrapper_mplayer.c Sun Jul 06 11:27:48 2008 +0200
2 +++ b/src/wrapper_mplayer.c Sun Jul 06 12:51:42 2008 +0200
3 @@ -131,7 +131,7 @@
4 [SLAVE_QUIT] = {"quit", ITEM_ENABLE, ITEM_DISABLE},
5 [SLAVE_SEEK] = {"seek", ITEM_ENABLE, ITEM_DISABLE},
6 [SLAVE_SET_PROPERTY] = {"set_property", ITEM_ENABLE, ITEM_DISABLE},
7 - [SLAVE_STOP] = {"stop", ITEM_HACK, ITEM_DISABLE},
8 + [SLAVE_STOP] = {"stop", ITEM_ENABLE|ITEM_HACK, ITEM_DISABLE},
9 [SLAVE_SUB_LOAD] = {"sub_load", ITEM_ENABLE, ITEM_DISABLE},
10 [SLAVE_UNKNOWN] = {NULL, ITEM_DISABLE, ITEM_DISABLE}
11 };
12 @@ -349,6 +349,26 @@
13 pthread_mutex_unlock (&mplayer->mutex_search);
14
15 if (strstr (buffer, "EOF code:") == buffer) {
16 + if (strchr (buffer, '4'))
17 + {
18 + item_state_t state;
19 + get_cmd (SLAVE_STOP, &state);
20 +
21 + if (state == ITEM_ENABLE)
22 + {
23 + pthread_mutex_lock (&mplayer->mutex_status);
24 + if (mplayer->status == MPLAYER_IS_IDLE)
25 + {
26 + pthread_mutex_unlock (&mplayer->mutex_status);
27 + sem_post (&mplayer->sem);
28 + }
29 + else
30 + pthread_mutex_unlock (&mplayer->mutex_status);
31 +
32 + continue;
33 + }
34 + }
35 +
36 pthread_mutex_lock (&mplayer->mutex_status);
37 /* when the stream is ended without stop action */
38 if (mplayer->status == MPLAYER_IS_PLAYING) {
39 @@ -670,6 +690,8 @@
40 case SLAVE_STOP:
41 if (state_cmd == ITEM_HACK)
42 send_to_slave (mplayer, "loadfile \"\"");
43 + else if (state_cmd == ITEM_ENABLE)
44 + send_to_slave (mplayer, command);
45
46 /* wait that the thread will found the EOF */
47 sem_wait (&mplayer->sem);