mp3splt-gtk 0.9.2
Loading...
Searching...
No Matches
player_control.c
Go to the documentation of this file.
1/**********************************************************
2 *
3 * mp3splt-gtk -- utility based on mp3splt,
4 * for mp3/ogg splitting without decoding
5 *
6 * Copyright: (C) 2005-2014 Alexandru Munteanu
7 * Contact: m@ioalex.net
8 *
9 *
10 * http://mp3splt.sourceforge.net/
11 *
12 *********************************************************/
13
14/**********************************************************
15 *
16 * This program is free software; you ca nredistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
29 * USA.
30 *
31 *********************************************************/
32
33/*!********************************************************
34 * \file
35 * Functions to access the currently selected player
36 *
37 * this file is used to play for the appropriate player,
38 * for example if we choose snackamp, the player will use
39 * snackamp
40 **********************************************************/
41
42#include "player_control.h"
43
46{
47 if (ui->infos->selected_player == PLAYER_SNACKAMP)
48 {
50 }
51 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
52 {
53#ifndef __WIN32__
54#ifndef NO_AUDACIOUS
56#endif
57#endif
58 }
59 else
60 {
61#ifndef NO_GSTREAMER
63#endif
64 }
65
66 return 0;
67}
68
71{
72 if (ui->infos->selected_player == PLAYER_SNACKAMP)
73 {
74 return snackamp_get_total_time(ui);
75 }
76 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
77 {
78#ifndef __WIN32__
79#ifndef NO_AUDACIOUS
81#endif
82#endif
83 }
84 else
85 {
86#ifndef NO_GSTREAMER
87 return gstreamer_get_total_time(ui);
88#endif
89 }
90
91 return 0;
92}
93
96{
97 if (ui->infos->selected_player == PLAYER_SNACKAMP)
98 {
99 return snackamp_is_running(ui);
100 }
101 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
102 {
103#ifndef __WIN32__
104#ifndef NO_AUDACIOUS
105 return myaudacious_is_running(ui);
106#endif
107#endif
108 }
109 else
110 {
111#ifndef NO_GSTREAMER
112 return gstreamer_is_running(ui);
113#endif
114 }
115
116 return 0;
117}
118
121{
122 if (ui->infos->selected_player == PLAYER_SNACKAMP)
123 {
124 snackamp_start(ui);
125 }
126 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
127 {
128#ifndef __WIN32__
129#ifndef NO_AUDACIOUS
131#endif
132#endif
133 }
134 else
135 {
136#ifndef NO_GSTREAMER
137 gstreamer_start(ui);
138#endif
139 }
140}
141
143void player_start_add_files(GList *list, ui_state *ui)
144{
145 if (ui->infos->selected_player == PLAYER_SNACKAMP)
146 {
148 }
149 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
150 {
151#ifndef __WIN32__
152#ifndef NO_AUDACIOUS
154#endif
155#endif
156 }
157 else
158 {
159#ifndef NO_GSTREAMER
161#endif
162 }
163}
164
166void player_add_files(GList *list, ui_state *ui)
167{
168 if (ui->infos->selected_player == PLAYER_SNACKAMP)
169 {
170 snackamp_add_files(list, ui);
171 }
172 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
173 {
174#ifndef __WIN32__
175#ifndef NO_AUDACIOUS
176 myaudacious_add_files(list, ui);
177#endif
178#endif
179 }
180 else
181 {
182#ifndef NO_GSTREAMER
183 gstreamer_add_files(list, ui);
184#endif
185 }
186}
187
190{
191 if (ui->infos->selected_player == PLAYER_SNACKAMP)
192 {
193 snackamp_add_files(list, ui);
195 }
196 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
197 {
198#ifndef __WIN32__
199#ifndef NO_AUDACIOUS
200 myaudacious_add_files(list, ui);
202#endif
203#endif
204 }
205 else
206 {
207#ifndef NO_GSTREAMER
208 gstreamer_add_files(list, ui);
210#endif
211 }
212}
213
215void player_add_play_files(GList *list, ui_state *ui)
216{
217 player_add_files(list, ui);
218
219 if (ui->infos->selected_player == PLAYER_SNACKAMP)
220 {
221 snackamp_next(ui);
222 }
223 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
224 {
225#ifndef __WIN32__
226#ifndef NO_AUDACIOUS
228#endif
229#endif
230 }
231 else
232 {
233#ifndef NO_GSTREAMER
235#endif
236 }
237}
238
241{
242 if (ui->infos->selected_player == PLAYER_SNACKAMP)
243 {
246 }
247 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
248 {
249#ifndef __WIN32__
250#ifndef NO_AUDACIOUS
253#endif
254#endif
255 }
256 else
257 {
258#ifndef NO_GSTREAMER
261#endif
262 }
263}
264
267{
268 if (ui->infos->selected_player == PLAYER_SNACKAMP)
269 {
270 snackamp_play(ui);
271 }
272 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
273 {
274#ifndef __WIN32__
275#ifndef NO_AUDACIOUS
277#endif
278#endif
279 }
280 else
281 {
282#ifndef NO_GSTREAMER
283 gstreamer_play(ui);
284#endif
285 }
286}
287
290{
291 if (ui->infos->selected_player == PLAYER_SNACKAMP)
292 {
293 snackamp_stop(ui);
294 }
295 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
296 {
297#ifndef __WIN32__
298#ifndef NO_AUDACIOUS
300#endif
301#endif
302 }
303 else
304 {
305#ifndef NO_GSTREAMER
306 gstreamer_stop(ui);
307#endif
308 }
309}
310
313{
314 if (ui->infos->selected_player == PLAYER_SNACKAMP)
315 {
316 snackamp_pause(ui);
317 }
318 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
319 {
320#ifndef __WIN32__
321#ifndef NO_AUDACIOUS
323#endif
324#endif
325 }
326 else
327 {
328#ifndef NO_GSTREAMER
329 gstreamer_pause(ui);
330#endif
331 }
332}
333
336{
337 if (ui->infos->selected_player == PLAYER_SNACKAMP)
338 {
339 snackamp_next(ui);
340 }
341 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
342 {
343#ifndef __WIN32__
344#ifndef NO_AUDACIOUS
346#endif
347#endif
348 }
349 else
350 {
351#ifndef NO_GSTREAMER
352 gstreamer_next(ui);
353#endif
354 }
355}
356
359{
360 if (ui->infos->selected_player == PLAYER_SNACKAMP)
361 {
362 snackamp_prev(ui);
363 }
364 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
365 {
366#ifndef __WIN32__
367#ifndef NO_AUDACIOUS
369#endif
370#endif
371 }
372 else
373 {
374#ifndef NO_GSTREAMER
375 gstreamer_prev(ui);
376#endif
377 }
378}
379
381void player_seek(gint position, ui_state *ui)
382{
383 clear_previous_distances(ui);
384
385 if (ui->infos->selected_player == PLAYER_SNACKAMP)
386 {
387 snackamp_jump(position, ui);
388 }
389 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
390 {
391#ifndef __WIN32__
392#ifndef NO_AUDACIOUS
393 myaudacious_jump(position, ui);
394#endif
395#endif
396 }
397 else
398 {
399#ifndef NO_GSTREAMER
400 gstreamer_jump(position, ui);
401#endif
402 }
403}
404
409void player_get_song_infos(gchar *total_infos, ui_state *ui)
410{
411 if (ui->infos->selected_player == PLAYER_SNACKAMP)
412 {
413 snackamp_get_song_infos(total_infos, ui);
414 }
415 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
416 {
417#ifndef __WIN32__
418#ifndef NO_AUDACIOUS
419 myaudacious_get_song_infos(total_infos, ui);
420#endif
421#endif
422 }
423 else
424 {
425#ifndef NO_GSTREAMER
426 gstreamer_get_song_infos(total_infos, ui);
427#endif
428 }
429}
430
433{
434 if (ui->infos->selected_player == PLAYER_SNACKAMP)
435 {
436 return snackamp_is_playing(ui);
437 }
438 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
439 {
440#ifndef __WIN32__
441#ifndef NO_AUDACIOUS
442 return myaudacious_is_playing(ui);
443#endif
444#endif
445 }
446 else
447 {
448#ifndef NO_GSTREAMER
449 return gstreamer_is_playing(ui);
450#endif
451 }
452
453 return FALSE;
454}
455
458{
459 if (ui->infos->selected_player == PLAYER_SNACKAMP)
460 {
461 return snackamp_is_paused(ui);
462 }
463 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
464 {
465#ifndef __WIN32__
466#ifndef NO_AUDACIOUS
467 return myaudacious_is_paused(ui);
468#endif
469#endif
470 }
471 else
472 {
473#ifndef NO_GSTREAMER
474 return gstreamer_is_paused(ui);
475#endif
476 }
477
478 return 0;
479}
480
486{
487 if (ui->infos->selected_player == PLAYER_SNACKAMP)
488 {
489 return snackamp_get_filename(ui);
490 }
491 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
492 {
493#ifndef __WIN32__
494#ifndef NO_AUDACIOUS
495 return myaudacious_get_filename(ui);
496#endif
497#endif
498 }
499 else
500 {
501#ifndef NO_GSTREAMER
502 return gstreamer_get_filename(ui);
503#endif
504 }
505
506 return 0;
507}
508
514{
515 if (ui->infos->selected_player == PLAYER_SNACKAMP)
516 {
517 return snackamp_get_title_song(ui);
518 }
519 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
520 {
521#ifndef __WIN32__
522#ifndef NO_AUDACIOUS
524#endif
525#endif
526 }
527 else
528 {
529#ifndef NO_GSTREAMER
530 return gstreamer_get_title_song(ui);
531#endif
532 }
533
534 return 0;
535}
536
539{
540 if (ui->infos->selected_player == PLAYER_SNACKAMP)
541 {
542 return snackamp_get_volume(ui);
543 }
544 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
545 {
546#ifndef __WIN32__
547#ifndef NO_AUDACIOUS
548 return myaudacious_get_volume(ui);
549#endif
550#endif
551 }
552 else
553 {
554#ifndef NO_GSTREAMER
555 return gstreamer_get_volume(ui);
556#endif
557 }
558
559 return 0;
560}
561
563void player_set_volume(gint volume, ui_state *ui)
564{
565 if (ui->infos->selected_player == PLAYER_SNACKAMP)
566 {
567 snackamp_set_volume(volume, ui);
568 }
569 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
570 {
571#ifndef __WIN32__
572#ifndef NO_AUDACIOUS
573 myaudacious_set_volume(volume, ui);
574#endif
575#endif
576 }
577 else
578 {
579#ifndef NO_GSTREAMER
580 gstreamer_set_volume(volume, ui);
581#endif
582 }
583}
584
587{
588 if (ui->infos->selected_player == PLAYER_SNACKAMP)
589 {
591 }
592 else if (ui->infos->selected_player == PLAYER_AUDACIOUS)
593 {
594#ifndef __WIN32__
595#ifndef NO_AUDACIOUS
597#endif
598#endif
599 }
600 else
601 {
602#ifndef NO_GSTREAMER
604#endif
605 }
606
607 return 0;
608}
609
612{
613 if (ui->infos->selected_player == PLAYER_GSTREAMER)
614 {
615#ifndef NO_GSTREAMER
616 gstreamer_quit(ui);
617#endif
618 }
619
620 return 0;
621}
622
void myaudacious_get_song_infos(gchar *total_infos, ui_state *ui)
Acquires informations about the song.
void myaudacious_select_last_file(ui_state *ui)
selects the last file in the playlist
void myaudacious_add_files(GList *list, ui_state *ui)
add files to the audacious playlist
void myaudacious_start_with_songs(GList *list, ui_state *ui)
starts audacious with songs
gint myaudacious_is_paused(ui_state *ui)
returns TRUE if audacious is paused, if not, FALSE
gint myaudacious_get_total_time(ui_state *ui)
returns the total duration of the current song
void myaudacious_play_last_file(ui_state *ui)
plays the last file of the playlist
gint myaudacious_is_playing(ui_state *ui)
returns TRUE if audacious is playing, else FALSE
void myaudacious_set_volume(gint volume, ui_state *ui)
sets the volume level
gchar * myaudacious_get_filename(ui_state *ui)
returns the filename
void myaudacious_jump(gint position, ui_state *ui)
jump to time
void myaudacious_next(ui_state *ui)
Switch to the next song.
gint myaudacious_get_playlist_number(ui_state *ui)
returns the number of songs in the playlist
void myaudacious_start(ui_state *ui)
starts audacious
gint myaudacious_get_volume(ui_state *ui)
returns volume level
void myaudacious_prev(ui_state *ui)
Switch to the previous song.
void myaudacious_pause(ui_state *ui)
Pause playing the current song.
void myaudacious_stop(ui_state *ui)
Stop playing the current song.
void myaudacious_play(ui_state *ui)
Start playing the current song.
gint myaudacious_is_running(ui_state *ui)
returns TRUE if audacious is running; if not, FALSE
gchar * myaudacious_get_title_song(ui_state *ui)
returns the title of the song
gint myaudacious_get_time_elapsed(ui_state *ui)
returns elapsed time
void gstreamer_select_last_file(ui_state *ui)
selects the last file in the playlist
void gstreamer_prev(ui_state *ui)
changes to previous song
void gstreamer_add_files(GList *list, ui_state *ui)
add files to the gstreamer playlist
gint gstreamer_get_time_elapsed(ui_state *ui)
returns elapsed time
void gstreamer_stop(ui_state *ui)
stops a song
void gstreamer_get_song_infos(gchar *total_infos, ui_state *ui)
Gets information about the song.
gint gstreamer_get_total_time(ui_state *ui)
returns total time of the current song
gint gstreamer_is_paused(ui_state *ui)
returns TRUE if gstreamer is paused, if not, FALSE
void gstreamer_jump(gint position, ui_state *ui)
jump to time
void gstreamer_quit(ui_state *ui)
quits player
void gstreamer_pause(ui_state *ui)
pause a song
void gstreamer_play(ui_state *ui)
plays a song
gint gstreamer_is_playing(ui_state *ui)
returns TRUE if gstreamer is playing, else FALSE
void gstreamer_next(ui_state *ui)
changes to next song
void gstreamer_play_last_file(ui_state *ui)
plays the last file of the playlist
gint gstreamer_is_running(ui_state *ui)
returns TRUE if gstreamer is running; if not, FALSE
void gstreamer_start(ui_state *ui)
starts gstreamer
void gstreamer_start_with_songs(GList *list, ui_state *ui)
starts gstreamer with songs
gchar * gstreamer_get_filename(ui_state *ui)
returns the filename
gint gstreamer_get_volume(ui_state *ui)
returns volume
gchar * gstreamer_get_title_song(ui_state *ui)
returns the title of the song
void gstreamer_set_volume(gint volume, ui_state *ui)
sets volume
gint gstreamer_get_playlist_number(ui_state *ui)
returns the number of songs of the playlist
void player_add_files(GList *list, ui_state *ui)
add files to playlist
gint player_is_paused(ui_state *ui)
Check if the player is paused.
void player_play(ui_state *ui)
plays the song
gint player_get_total_time(ui_state *ui)
returns total time of the song
void player_stop(ui_state *ui)
stops the song
void player_start_add_files(GList *list, ui_state *ui)
start player and add files to playlist
gchar * player_get_title(ui_state *ui)
Get the title of the song.
void player_start_play_with_songs(GList *list, ui_state *ui)
starts the player
void player_get_song_infos(gchar *total_infos, ui_state *ui)
get infos about the song
void player_add_files_and_select(GList *list, ui_state *ui)
add files to playlist
gint player_quit(ui_state *ui)
quits the player
void player_set_volume(gint volume, ui_state *ui)
sets the volume of the player
void player_prev(ui_state *ui)
pass to the previous song
gint player_get_playlist_number(ui_state *ui)
returns the number of songs in the playlist
void player_seek(gint position, ui_state *ui)
jumps to a position in the song
gchar * player_get_filename(ui_state *ui)
gets the filename of the current song
void player_start(ui_state *ui)
starts the player
gint player_is_running(ui_state *ui)
returns FALSE if the player is not running, else TRUE
gint player_is_playing(ui_state *ui)
returns TRUE if the player is playing, else FALSE
gint player_get_elapsed_time(ui_state *ui)
returns the elapsed time of the player
gint player_get_volume(ui_state *ui)
gets the volume of the player
void player_next(ui_state *ui)
pass to the next song
void player_pause(ui_state *ui)
pause the song
void player_add_play_files(GList *list, ui_state *ui)
add files to playlist
void snackamp_jump(gint position, ui_state *ui)
jump to time
gint snackamp_get_volume(ui_state *ui)
returns volume
void snackamp_start(ui_state *ui)
starts snackamp
void snackamp_set_volume(gint volume, ui_state *ui)
sets volume
void snackamp_prev(ui_state *ui)
changes to previous song
gchar * snackamp_get_filename(ui_state *ui)
returns the filename
void snackamp_start_with_songs(GList *list, ui_state *ui)
starts snackamp with songs
void snackamp_next(ui_state *ui)
changes to next song
gint snackamp_is_running(ui_state *ui)
returns TRUE if snackamp is running; if not, FALSE
gchar * snackamp_get_title_song(ui_state *ui)
returns the title of the song
void snackamp_get_song_infos(gchar *total_infos, ui_state *ui)
gets informations about the song
gint snackamp_get_playlist_number(ui_state *ui)
returns the number of songs of the playlist
void snackamp_pause(ui_state *ui)
pause a song
gint snackamp_is_paused(ui_state *ui)
returns TRUE if snackamp is paused, else FALSE
gint snackamp_is_playing(ui_state *ui)
returns TRUE if snackamp is playing, else FALSE
void snackamp_play(ui_state *ui)
plays a song
void snackamp_play_last_file(ui_state *ui)
plays the last file of the playlist
void snackamp_stop(ui_state *ui)
stops playing a song
void snackamp_add_files(GList *list, ui_state *ui)
add files to the snackamp playlist
gint snackamp_get_time_elapsed(ui_state *ui)
returns elapsed time
void snackamp_select_last_file(ui_state *ui)
selects the last file in the playlist
gint snackamp_get_total_time(ui_state *ui)
returns total time of the current song