Logo Search packages:      
Sourcecode: libmpdclient version File versions  Download package

mpd_malloc struct mpd_song* mpd_run_current_song ( struct mpd_connection connection  )  [read]

Shortcut for mpd_send_currentsong() and mpd_recv_song().

Parameters:
connection the connection to MPD
Returns:
the current song, or NULL on error or if there is no current song

Definition at line 46 of file player.c.

References mpd_recv_song(), mpd_response_finish(), mpd_run_current_song(), mpd_send_current_song(), and mpd_song_free().

Referenced by mpd_run_current_song().

{
      struct mpd_song *song;

      if (!mpd_run_check(connection) || !mpd_send_current_song(connection))
            return NULL;

      song = mpd_recv_song(connection);
      if (song == NULL)
            return NULL;

      if (!mpd_response_finish(connection)) {
            mpd_song_free(song);
            return NULL;
      }

      return song;
}


Generated by  Doxygen 1.6.0   Back to index