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

mpd_malloc struct mpd_playlist* mpd_recv_playlist ( struct mpd_connection connection  )  [read]

Receives the next playlist from the MPD server.

a mpd_playlist object, or NULL on error or if the playlist list is finished

Definition at line 34 of file rplaylist.c.

References mpd_connection::error, mpd_enqueue_pair(), MPD_ERROR_OOM, mpd_playlist_begin(), mpd_playlist_feed(), mpd_playlist_free(), mpd_recv_pair(), mpd_recv_pair_named(), mpd_recv_playlist(), and mpd_return_pair().

Referenced by mpd_recv_playlist().

      struct mpd_pair *pair;
      struct mpd_playlist *playlist;

      pair = mpd_recv_pair_named(connection, "playlist");
      if (pair == NULL)
            return NULL;

      playlist = mpd_playlist_begin(pair);
      mpd_return_pair(connection, pair);
      if (playlist == NULL) {
            mpd_error_code(&connection->error, MPD_ERROR_OOM);
            return NULL;

      while ((pair = mpd_recv_pair(connection)) != NULL &&
             mpd_playlist_feed(playlist, pair))
            mpd_return_pair(connection, pair);

      if (mpd_error_is_defined(&connection->error)) {
            assert(pair == NULL);

            return NULL;

      /* unread this pair for the next mpd_recv_playlist() call */
      mpd_enqueue_pair(connection, pair);

      return playlist;

Generated by  Doxygen 1.6.0   Back to index