comparison src/audacious/playback_evlisteners.c @ 3152:c9471f83944c trunk

Add playback_eof(). Plugins should use this instead of playback->eof = 1. Add event listening scheme for playlist eof, similar to the work of Daniel Drake <dsd@gentoo.org>.
author William Pitcock <nenolod@atheme-project.org>
date Mon, 23 Jul 2007 16:42:30 -0500
parents
children
comparison
equal deleted inserted replaced
3151:6494bb1f23a4 3152:c9471f83944c
1 /*
2 * Audacious
3 * Copyright (c) 2006-2007 Audacious development team.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; under version 3 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses>.
16 *
17 * The Audacious team does not consider modular code linking to
18 * Audacious or using our public API to be a derived work.
19 */
20
21 #include <glib.h>
22 #include "hook.h"
23 #include "playback.h"
24 #include "playlist.h"
25 #include "playback_evlisteners.h"
26
27 static void
28 playback_evlistener_playback_eof(gpointer hook_data, gpointer user_data)
29 {
30 Playlist *playlist = (Playlist *) hook_data;
31
32 g_return_if_fail(playlist != NULL);
33
34 playlist_eof_reached(playlist);
35 }
36
37 void
38 playback_evlistener_init(void)
39 {
40 static int pb_evinit_done = 0;
41
42 if (pb_evinit_done)
43 return;
44
45 hook_associate("playback eof", playback_evlistener_playback_eof, NULL);
46
47 pb_evinit_done = 1;
48 }