2
* test_player.c -- Test utility for the MediaPlayer system.
4
* Copyright (C) 2007-2008 Johannes H. Jensen <joh@pseudoberries.com>
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
* Johannes H. Jensen <joh@pseudoberries.com>
28
void state_changed (MediaPlayer *player, MediaPlayerState state, gchar *data)
30
g_debug ("State changed to %s [%d], data is '%s'",
31
(state == MEDIA_PLAYER_PLAYING) ? "PLAYING" : "STOPPED",
35
void error_handler (MediaPlayer *player, GError *error, gchar *data)
37
g_debug ("Error occured: %s, data is '%s'", error->message, data);
40
int main (int argc, char **argv)
43
g_print ("Usage: %s <uri>\n", argv[0]);
50
player = media_player_new(argv[1], FALSE,
51
state_changed, "test data",
52
error_handler, "test error");
54
media_player_start (player);
56
loop = g_main_loop_new (g_main_context_default(), TRUE);
58
g_main_loop_run (loop);
60
media_player_free(player);