mp3splt-gtk
snackamp_control.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include "player.h"
#include "snackamp_control.h"
Include dependency graph for snackamp_control.c:

Go to the source code of this file.

Functions

gint connect_snackamp (gint port)
gchar * cut_begin_end (gchar *result)
gint disconnect_snackamp ()
gint get_integer_from_string (gchar *result)
void snackamp_add_files (GList *list)
gchar * snackamp_get_filename ()
gint snackamp_get_playlist_number ()
gint snackamp_get_playlist_pos ()
void snackamp_get_song_infos (gchar *total_infos)
gint snackamp_get_time_elapsed ()
gchar * snackamp_get_title_song ()
gint snackamp_get_total_time ()
gint snackamp_get_volume ()
gboolean snackamp_is_connected ()
gint snackamp_is_paused ()
gint snackamp_is_playing ()
gint snackamp_is_running ()
void snackamp_jump (gint position)
void snackamp_next ()
void snackamp_pause ()
void snackamp_play ()
void snackamp_play_last_file ()
void snackamp_prev ()
void snackamp_select_last_file ()
void snackamp_set_playlist_pos (gint pos)
void snackamp_set_volume (gint volume)
gchar * snackamp_socket_send_message (gchar *message)
void snackamp_start ()
void snackamp_start_with_songs (GList *list)
void snackamp_stop ()

Variables

gboolean connected = FALSE
FILE * in
FILE * out
gint socket_id

Detailed Description


Snackamp control

this file contains functions to control the snackamp player

Definition in file snackamp_control.c.


Function Documentation

gint connect_snackamp ( gint  port)

connecting to the player to the port port

Might possibley return an error

Definition at line 79 of file snackamp_control.c.

References disconnect_snackamp().

Referenced by connect_button_event(), and snackamp_is_running().

Here is the call graph for this function:

Here is the caller graph for this function:

disconnecting with the player possibly returns an error

Definition at line 183 of file snackamp_control.c.

Referenced by connect_snackamp(), disconnect_button_event(), sigpipe_handler(), and snackamp_socket_send_message().

Here is the caller graph for this function:

gint get_integer_from_string ( gchar *  result)

gets an integer from the string

Definition at line 247 of file snackamp_control.c.

Referenced by snackamp_get_playlist_number(), snackamp_get_playlist_pos(), snackamp_get_time_elapsed(), snackamp_get_total_time(), and snackamp_get_volume().

Here is the caller graph for this function:

void snackamp_add_files ( GList *  list)

add files to the snackamp playlist

Definition at line 499 of file snackamp_control.c.

References snackamp_socket_send_message().

Referenced by player_add_files(), player_add_files_and_select(), and snackamp_start_with_songs().

Here is the call graph for this function:

Here is the caller graph for this function:

returns the filename

The result of this query must be freed after use.

Definition at line 356 of file snackamp_control.c.

References snackamp_get_playlist_pos(), and snackamp_socket_send_message().

Referenced by player_get_filename().

Here is the call graph for this function:

Here is the caller graph for this function:

returns the number of songs of the playlist

Definition at line 395 of file snackamp_control.c.

References get_integer_from_string(), snackamp_socket_send_message(), and snackamp_stop().

Referenced by player_get_playlist_number(), and snackamp_select_last_file().

Here is the call graph for this function:

Here is the caller graph for this function:

returns current song position in the playlist

Definition at line 375 of file snackamp_control.c.

References get_integer_from_string(), and snackamp_socket_send_message().

Referenced by snackamp_get_filename(), snackamp_get_title_song(), and snackamp_prev().

Here is the call graph for this function:

Here is the caller graph for this function:

void snackamp_get_song_infos ( gchar *  total_infos)

gets informations about the song

Definition at line 273 of file snackamp_control.c.

References snackamp_socket_send_message().

Referenced by player_get_song_infos().

Here is the call graph for this function:

Here is the caller graph for this function:

returns elapsed time

Definition at line 432 of file snackamp_control.c.

References get_integer_from_string(), and snackamp_socket_send_message().

Referenced by player_get_elapsed_time().

Here is the call graph for this function:

Here is the caller graph for this function:

returns the title of the song

The return value must be g_free'd after use.

Definition at line 416 of file snackamp_control.c.

References snackamp_get_playlist_pos(), and snackamp_socket_send_message().

Referenced by player_get_title().

Here is the call graph for this function:

Here is the caller graph for this function:

returns total time of the current song

Definition at line 639 of file snackamp_control.c.

References get_integer_from_string(), and snackamp_socket_send_message().

Referenced by player_get_total_time().

Here is the call graph for this function:

Here is the caller graph for this function:

returns volume

Definition at line 535 of file snackamp_control.c.

References get_integer_from_string(), and snackamp_socket_send_message().

Referenced by player_get_volume().

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean snackamp_is_connected ( )

Test if we are connected to snackamp.

Definition at line 267 of file snackamp_control.c.

Referenced by snackamp_is_paused(), and snackamp_is_playing().

Here is the caller graph for this function:

returns TRUE if snackamp is paused, else FALSE

not yet implemented in snackamp

Definition at line 676 of file snackamp_control.c.

References snackamp_is_connected(), and snackamp_socket_send_message().

Referenced by player_is_paused().

Here is the call graph for this function:

Here is the caller graph for this function:

returns TRUE if snackamp is playing, else FALSE

Definition at line 652 of file snackamp_control.c.

References snackamp_is_connected(), and snackamp_socket_send_message().

Referenced by player_is_playing().

Here is the call graph for this function:

Here is the caller graph for this function:

returns TRUE if snackamp is running; if not, FALSE

Definition at line 554 of file snackamp_control.c.

References connect_snackamp().

Referenced by player_is_running(), and snackamp_start().

Here is the call graph for this function:

Here is the caller graph for this function:

void snackamp_jump ( gint  position)

jump to time

Definition at line 612 of file snackamp_control.c.

References snackamp_socket_send_message().

Referenced by player_jump().

Here is the call graph for this function:

Here is the caller graph for this function:

void snackamp_next ( )

changes to next song

Definition at line 585 of file snackamp_control.c.

References snackamp_socket_send_message().

Referenced by player_add_play_files(), and player_next().

Here is the call graph for this function:

Here is the caller graph for this function:

void snackamp_pause ( )

pause a song

Definition at line 577 of file snackamp_control.c.

References snackamp_socket_send_message().

Referenced by player_pause().

Here is the call graph for this function:

Here is the caller graph for this function:

void snackamp_play ( )

plays a song

Definition at line 484 of file snackamp_control.c.

References snackamp_socket_send_message().

Referenced by player_play(), and snackamp_play_last_file().

Here is the call graph for this function:

Here is the caller graph for this function:

plays the last file of the playlist

Definition at line 492 of file snackamp_control.c.

References snackamp_play(), and snackamp_select_last_file().

Referenced by player_start_play_with_songs(), and snackamp_prev().

Here is the call graph for this function:

Here is the caller graph for this function:

void snackamp_prev ( )

changes to previous song

Definition at line 593 of file snackamp_control.c.

References snackamp_get_playlist_pos(), snackamp_play_last_file(), and snackamp_socket_send_message().

Referenced by player_prev().

Here is the call graph for this function:

Here is the caller graph for this function:

selects the last file in the playlist

Definition at line 476 of file snackamp_control.c.

References snackamp_get_playlist_number(), and snackamp_set_playlist_pos().

Referenced by player_add_files_and_select(), and snackamp_play_last_file().

Here is the call graph for this function:

Here is the caller graph for this function:

void snackamp_set_playlist_pos ( gint  pos)

jumps to the position pos in the playlist

Definition at line 465 of file snackamp_control.c.

References snackamp_socket_send_message().

Referenced by snackamp_select_last_file().

Here is the call graph for this function:

Here is the caller graph for this function:

void snackamp_set_volume ( gint  volume)

sets volume

Definition at line 523 of file snackamp_control.c.

References snackamp_socket_send_message().

Referenced by player_set_volume().

Here is the call graph for this function:

Here is the caller graph for this function:

gchar* snackamp_socket_send_message ( gchar *  message)

send a message to snackamp through the socket interface

Returns:
the result; must be g_freed after use
Todo:
rewrite this function

Definition at line 199 of file snackamp_control.c.

References disconnect_snackamp().

Referenced by snackamp_add_files(), snackamp_get_filename(), snackamp_get_playlist_number(), snackamp_get_playlist_pos(), snackamp_get_song_infos(), snackamp_get_time_elapsed(), snackamp_get_title_song(), snackamp_get_total_time(), snackamp_get_volume(), snackamp_is_paused(), snackamp_is_playing(), snackamp_jump(), snackamp_next(), snackamp_pause(), snackamp_play(), snackamp_prev(), snackamp_set_playlist_pos(), snackamp_set_volume(), and snackamp_stop().

Here is the call graph for this function:

Here is the caller graph for this function:

void snackamp_start ( )

starts snackamp

Definition at line 444 of file snackamp_control.c.

References snackamp_is_running().

Referenced by player_start(), and snackamp_start_with_songs().

Here is the call graph for this function:

Here is the caller graph for this function:

void snackamp_start_with_songs ( GList *  list)

starts snackamp with songs

Definition at line 547 of file snackamp_control.c.

References snackamp_add_files(), and snackamp_start().

Referenced by player_start_add_files(), and player_start_play_with_songs().

Here is the call graph for this function:

Here is the caller graph for this function:

void snackamp_stop ( )

stops playing a song

Definition at line 387 of file snackamp_control.c.

References snackamp_socket_send_message().

Referenced by player_stop(), and snackamp_get_playlist_number().

Here is the call graph for this function:

Here is the caller graph for this function: