annotate src/crossfade/player.c @ 3150:062f42c3737e

Fix possible crash in scrobbler plugin
author Tomasz Mon <desowin@gmail.com>
date Tue, 12 May 2009 08:30:43 +0200
parents 85b7dcee821f
children 4af16959f9d3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3059
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
1 /*
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
2 * XMMS Crossfade Plugin
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
3 * Copyright (C) 2000-2007 Peter Eisenlohr <peter@eisenlohr.org>
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
4 *
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
5 * based on the original OSS Output Plugin
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
6 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
7 *
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
11 * (at your option) any later version.
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
12 *
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
16 * GNU General Public License for more details.
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
17 *
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
21 * USA.
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
22 */
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
23
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
24 #include <audacious/plugin.h>
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
25 #include "player.h"
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
26
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
27 gboolean xfplayer_input_playing() {
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
28 return audacious_drct_get_playing();
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
29 }
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
30
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
31 gint xfplaylist_get_position() {
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
32 Playlist *playlist = aud_playlist_get_active();
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
33 return aud_playlist_get_position(playlist);
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
34 }
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
35
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
36 gchar *xfplaylist_get_filename(gint pos) {
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
37 Playlist *playlist = aud_playlist_get_active();
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
38 char *uri = aud_playlist_get_filename(playlist, pos);
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
39 return g_filename_from_uri(uri, NULL, NULL);
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
40 }
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
41
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
42 gchar *xfplaylist_get_songtitle(gint pos) {
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
43 Playlist *playlist = aud_playlist_get_active();
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
44 return aud_playlist_get_songtitle(playlist, pos);
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
45 }
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
46
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
47 gint xfplaylist_current_length() {
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
48 Playlist *playlist = aud_playlist_get_active();
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
49 return aud_playlist_get_current_length(playlist);
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
50 }
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
51
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
52 GList *xfplayer_get_output_list() {
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
53 return aud_get_output_list();
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
54 }
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
55
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
56 gboolean xfplayer_check_realtime_priority() {
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
57 return FALSE;
2e241e90494a Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
58 }