From 76f14028b56a1cdb6627b0db0e6af0a74a9b76f3 Mon Sep 17 00:00:00 2001 From: waker Date: Fri, 17 Jun 2011 20:54:11 +0200 Subject: merge new APIs for 0.5.2 from devel --- playlist.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'playlist.c') diff --git a/playlist.c b/playlist.c index 312965fc..68accc38 100644 --- a/playlist.c +++ b/playlist.c @@ -327,6 +327,15 @@ plt_get_sel_count (int plt) { return 0; } +playlist_t * +plt_alloc (const char *title) { + playlist_t *plt = malloc (sizeof (playlist_t)); + memset (plt, 0, sizeof (playlist_t)); + plt->refc = 1; + plt->title = strdup (title); + return plt; +} + int plt_add (int before, const char *title) { assert (before >= 0); @@ -335,10 +344,7 @@ plt_add (int before, const char *title) { fprintf (stderr, "can't create more than 100 playlists. sorry.\n"); return -1; } - playlist_t *plt = malloc (sizeof (playlist_t)); - memset (plt, 0, sizeof (playlist_t)); - plt->refc = 1; - plt->title = strdup (title); + playlist_t *plt = plt_alloc (title); plt_modified (plt); LOCK; @@ -398,7 +404,7 @@ plt_add (int before, const char *title) { conf_save (); messagepump_push (DB_EV_PLAYLISTSWITCHED, 0, 0, 0); } - return playlists_count-1; + return before; } // NOTE: caller must ensure that configuration is saved after that call @@ -980,7 +986,7 @@ plt_process_cue_track (playlist_t *playlist, playItem_t *after, const char *fnam pl_set_item_replaygain (it, DDB_REPLAYGAIN_TRACKPEAK, atof (replaygain_track_peak)); } it->_flags |= DDB_IS_SUBTRACK | DDB_TAG_CUESHEET; - after = pl_insert_item (after, it); + after = plt_insert_item (playlist, after, it); pl_item_unref (it); *prev = it; return it; @@ -3904,3 +3910,13 @@ plt_init_shuffle_albums (playlist_t *plt, int r) { } pl_unlock (); } + +void +plt_set_fast_mode (playlist_t *plt, int fast) { + plt->fast_mode = (unsigned)fast; +} + +int +plt_is_fast_mode (playlist_t *plt) { + return plt->fast_mode; +} -- cgit v1.2.3