summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c3
-rw-r--r--playlist.c43
-rw-r--r--playlist.h3
-rw-r--r--plugins/adplug/adplug-db.cpp2
-rw-r--r--plugins/alsa/alsa.c5
-rw-r--r--plugins/ffap/ffap.c8
-rw-r--r--plugins/gtkui/gtkplaylist.c27
-rw-r--r--plugins/hotkeys/hotkeys.c5
-rw-r--r--plugins/nullout/nullout.c18
9 files changed, 18 insertions, 96 deletions
diff --git a/main.c b/main.c
index d4a50636..33f5f22c 100644
--- a/main.c
+++ b/main.c
@@ -548,8 +548,9 @@ main (int argc, char *argv[]) {
// stop receiving messages from outside
server_close ();
- // stop streaming before unloading plugins
+ // stop streaming and playback before unloading plugins
p_stop ();
+ p_free ();
streamer_free ();
// plugins might still hood references to playitems,
diff --git a/playlist.c b/playlist.c
index 36a47b55..6a29cc93 100644
--- a/playlist.c
+++ b/playlist.c
@@ -165,7 +165,7 @@ pl_process_cue_track (playItem_t *after, const char *fname, playItem_t **prev, c
}
*p = 0;
// check that indexes have valid timestamps
- float f_index00 = index00[0] ? pl_cue_parse_time (index00) : 0;
+ //float f_index00 = index00[0] ? pl_cue_parse_time (index00) : 0;
float f_index01 = index01[0] ? pl_cue_parse_time (index01) : 0;
float f_pregap = pregap[0] ? pl_cue_parse_time (pregap) : 0;
if (*prev) {
@@ -457,7 +457,6 @@ pl_insert_pls (playItem_t *after, const char *fname, int *pabort, int (*cb)(play
char url[1024] = "";
char title[1024] = "";
char length[20] = "";
- int nfile = 1;
while (p < end) {
if (p >= end) {
break;
@@ -769,19 +768,6 @@ pl_get_idx_of (playItem_t *it) {
return idx;
}
-int
-pl_append_item (playItem_t *it) {
- if (!playlist_tail[PL_MAIN]) {
- playlist_tail[PL_MAIN] = playlist_head[PL_MAIN] = it;
- }
- else {
- playlist_tail[PL_MAIN]->next[PL_MAIN] = it;
- it->prev[PL_MAIN] = playlist_tail[PL_MAIN];
- playlist_tail[PL_MAIN] = it;
- }
- pl_count++;
-}
-
playItem_t *
pl_insert_item (playItem_t *after, playItem_t *it) {
if (!after) {
@@ -903,7 +889,6 @@ pl_prevsong (void) {
int rating = playlist_current_ptr->shufflerating;
playItem_t *pmax = NULL; // played maximum
playItem_t *amax = NULL; // absolute maximum
- playItem_t *i = NULL;
for (playItem_t *i = playlist_head[PL_MAIN]; i; i = i->next[PL_MAIN]) {
if (i != playlist_current_ptr && i->played && (!amax || i->shufflerating > amax->shufflerating)) {
amax = i;
@@ -978,7 +963,6 @@ pl_nextsong (int reason) {
if (!curr) {
// find minimal notplayed
playItem_t *pmin = NULL; // notplayed minimum
- playItem_t *i = NULL;
for (playItem_t *i = playlist_head[PL_MAIN]; i; i = i->next[PL_MAIN]) {
if (i->played) {
continue;
@@ -1011,7 +995,6 @@ pl_nextsong (int reason) {
// find minimal notplayed above current
int rating = curr->shufflerating;
playItem_t *pmin = NULL; // notplayed minimum
- playItem_t *i = NULL;
for (playItem_t *i = playlist_head[PL_MAIN]; i; i = i->next[PL_MAIN]) {
if (i->played || i->shufflerating < rating) {
continue;
@@ -1098,7 +1081,6 @@ pl_add_meta (playItem_t *it, const char *key, const char *value) {
char str[256];
if (!value || !*value) {
if (!strcasecmp (key, "title")) {
- int len = 256;
// cut filename without path and extension
const char *pext = it->fname + strlen (it->fname) - 1;
while (pext >= it->fname && *pext != '.') {
@@ -1578,7 +1560,6 @@ pl_format_item_queue (playItem_t *it, char *s, int size) {
break;
}
if (playqueue[i] == it) {
- len;
if (init) {
init = 0;
s[0] = '(';
@@ -1740,7 +1721,6 @@ pl_sort (int iter, int id, const char *format, int ascending) {
do {
sorted = 1;
playItem_t *it;
- playItem_t *next = NULL;
for (it = playlist_head[iter]; it; it = it->next[iter]) {
playItem_t *next = it->next[iter];
if (!next) {
@@ -1782,27 +1762,6 @@ pl_sort (int iter, int id, const char *format, int ascending) {
next->prev[iter] = it_prev;
it = next;
}
-#if 0
- else {
- printf ("%p %p NOT swapping %s and %s\n", it, next, meta1, meta2);
- }
-#endif
-#if 0
- // print list
- int k = 0;
- playItem_t *p = NULL;
- for (playItem_t *i = playlist_head[iter]; i; p = i, i = i->next[iter], k++) {
- printf ("%p ", i);
- if (i->prev[iter] != p) {
- printf ("\n\033[0;33mbroken link, i=%p, i->prev=%p, prev=%p\033[37;0m\n", i, i->prev[iter], p);
- }
- if (k > 20) {
- printf ("\033[0;31mlist corrupted\033[37;0m\n");
- return;
- }
- }
- printf ("\n");
-#endif
}
} while (!sorted);
}
diff --git a/playlist.h b/playlist.h
index 14e6aed7..3758fa03 100644
--- a/playlist.h
+++ b/playlist.h
@@ -74,9 +74,6 @@ playItem_t *
pl_insert_item (playItem_t *after, playItem_t *it);
int
-pl_append_item (playItem_t *it);
-
-int
pl_remove (playItem_t *i);
playItem_t *
diff --git a/plugins/adplug/adplug-db.cpp b/plugins/adplug/adplug-db.cpp
index a76550b9..6c15804d 100644
--- a/plugins/adplug/adplug-db.cpp
+++ b/plugins/adplug/adplug-db.cpp
@@ -124,7 +124,7 @@ adplug_read_int16 (char *bytes, int size) {
}
currentsample += size/4;
adplug_plugin.info.readpos = (float)currentsample / adplug_plugin.info.samplerate;
- return size;
+ return initsize-size;
}
int
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c
index 23470765..22c3e9b3 100644
--- a/plugins/alsa/alsa.c
+++ b/plugins/alsa/alsa.c
@@ -165,7 +165,7 @@ palsa_set_hw_params (int samplerate) {
trace ("Unable to get buffer size for playback: %s\n", snd_strerror(err));
goto error;
}
- trace ("alsa buffer size: %d frames\n", size);
+ trace ("alsa buffer size: %d frames\n", (int)size);
bufsize = size;
if ((err = snd_pcm_hw_params (audio, hw_params)) < 0) {
@@ -227,7 +227,7 @@ palsa_init (void) {
snd_strerror (err));
goto open_error;
}
- trace ("alsa period size: %d frames\n", av);
+ trace ("alsa period size: %d frames\n", (int)av);
if ((err = snd_pcm_sw_params_set_start_threshold (audio, sw_params, 0U)) < 0) {
trace ("cannot set start mode (%s)\n",
@@ -299,6 +299,7 @@ palsa_free (void) {
trace ("palsa_free\n");
if (audio && !alsa_terminate) {
alsa_terminate = 1;
+ printf ("waiting for alsa thread to finish\n");
deadbeef->thread_join (alsa_tid);
alsa_tid = 0;
snd_pcm_close(audio);
diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c
index 5a3bf1f4..e04ca40d 100644
--- a/plugins/ffap/ffap.c
+++ b/plugins/ffap/ffap.c
@@ -609,9 +609,9 @@ static int ape_read_packet(DB_FILE *fp, APEContext *ape_ctx)
// packet_sizeleft -= 8;
// update bitrate
- float sec = (float)nblocks / ape->samplerate;
int bitrate = -1;
- if (sec != 0 && ape->frames[ape->currentframe].size != 0) {
+ if (nblocks != 0 && ape->frames[ape->currentframe].size != 0) {
+ float sec = (float)nblocks / ape->samplerate;
bitrate = ape->frames[ape->currentframe].size / sec * 8;
}
if (bitrate > 0) {
@@ -1664,7 +1664,7 @@ ffap_insert (DB_playItem_t *after, const char *fname) {
it->filetype = "APE";
deadbeef->pl_set_item_duration (it, duration);
- int v2err = deadbeef->junk_read_id3v2 (it, fp);
+ /*int v2err = */deadbeef->junk_read_id3v2 (it, fp);
int v1err = deadbeef->junk_read_id3v1 (it, fp);
if (v1err >= 0) {
deadbeef->fseek (fp, -128, SEEK_END);
@@ -1672,7 +1672,7 @@ ffap_insert (DB_playItem_t *after, const char *fname) {
else {
deadbeef->fseek (fp, 0, SEEK_END);
}
- int apeerr = deadbeef->junk_read_ape (it, fp);
+ /*int apeerr = */deadbeef->junk_read_ape (it, fp);
deadbeef->fclose (fp);
diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c
index dcfabe32..4a112107 100644
--- a/plugins/gtkui/gtkplaylist.c
+++ b/plugins/gtkui/gtkplaylist.c
@@ -284,7 +284,6 @@ gtkpl_setup_hscrollbar (gtkplaylist_t *ps) {
GtkWidget *playlist = ps->playlist;
int w = playlist->allocation.width;
int size = 0;
- int i;
gtkpl_column_t *c;
for (c = ps->columns; c; c = c->next) {
size += c->width;
@@ -348,7 +347,6 @@ gtkpl_draw_pl_row_back (gtkplaylist_t *ps, int row, DB_playItem_t *it) {
GTK_OBJECT_FLAGS (treeview) |= GTK_HAS_FOCUS;
int x = -ps->hscrollpos;
int w = ps->totalwidth;
- GtkWidget *widget = ps->playlist;
gtk_paint_flat_box (treeview->style, ps->backbuf, (it && SELECTED(it)) ? GTK_STATE_SELECTED : GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, treeview, (row & 1) ? "cell_even_ruled" : "cell_odd_ruled", x, row * rowheight - ps->scrollpos * rowheight, w, rowheight);
if (row == deadbeef->pl_get_cursor (ps->iterator)) {
// not all gtk engines/themes render focus rectangle in treeviews
@@ -399,13 +397,11 @@ gtkpl_draw_pl_row (gtkplaylist_t *ps, int row, DB_playItem_t *it) {
char text[1024];
deadbeef->pl_format_title (it, text, sizeof (text), c->id, c->format);
- if (text) {
- if (c->align_right) {
- draw_text (x+5, row * rowheight - ps->scrollpos * rowheight + rowheight/2 - draw_get_font_size ()/2 - 2, c->width-10, 1, text);
- }
- else {
- draw_text (x + 5, row * rowheight - ps->scrollpos * rowheight + rowheight/2 - draw_get_font_size ()/2 - 2, c->width-10, 0, text);
- }
+ if (c->align_right) {
+ draw_text (x+5, row * rowheight - ps->scrollpos * rowheight + rowheight/2 - draw_get_font_size ()/2 - 2, c->width-10, 1, text);
+ }
+ else {
+ draw_text (x + 5, row * rowheight - ps->scrollpos * rowheight + rowheight/2 - draw_get_font_size ()/2 - 2, c->width-10, 0, text);
}
}
x += c->width;
@@ -415,7 +411,6 @@ gtkpl_draw_pl_row (gtkplaylist_t *ps, int row, DB_playItem_t *it) {
void
gtkpl_draw_playlist (gtkplaylist_t *ps, int x, int y, int w, int h) {
- GtkWidget *widget = ps->playlist;
if (!ps->backbuf) {
return;
}
@@ -493,7 +488,6 @@ gtkpl_expose_header (gtkplaylist_t *ps, int x, int y, int w, int h) {
void
gtkpl_select_single (gtkplaylist_t *ps, int sel) {
int idx=0;
- GtkWidget *widget = ps->playlist;
DB_playItem_t *it = PL_HEAD (ps->iterator);
for (; it; it = PL_NEXT (it, ps->iterator), idx++) {
if (idx == sel) {
@@ -540,7 +534,6 @@ gtkpl_mouse1_pressed (gtkplaylist_t *ps, int state, int ex, int ey, double time)
if (cnt == 0) {
return;
}
- GtkWidget *widget = ps->playlist;
// remember mouse coords for doubleclick detection
ps->lastpos[0] = ex;
ps->lastpos[1] = ey;
@@ -754,7 +747,6 @@ gtkpl_mousemove (gtkplaylist_t *ps, GdkEventMotion *event) {
}
}
else if (areaselect) {
- GtkWidget *widget = ps->playlist;
int y = event->y/rowheight + ps->scrollpos;
//if (y != shift_sel_anchor)
{
@@ -817,7 +809,6 @@ gtkpl_handle_scroll_event (gtkplaylist_t *ps, int direction) {
return;
}
// pass event to scrollbar
- GtkAdjustment* adj = gtk_range_get_adjustment (GTK_RANGE (range));
int newscroll = gtk_range_get_value (GTK_RANGE (range));
if (direction == GDK_SCROLL_UP) {
newscroll -= 2;
@@ -877,7 +868,6 @@ gtkpl_hscroll (gtkplaylist_t *ps, int newscroll) {
void
gtkpl_songchanged (gtkplaylist_t *ps, int from, int to) {
if (!dragwait && to != -1) {
- GtkWidget *widget = ps->playlist;
if (deadbeef->conf_get_int ("playlist.scroll.followplayback", 0)) {
if (to < ps->scrollpos || to >= ps->scrollpos + ps->nvisiblefullrows) {
gtk_range_set_value (GTK_RANGE (ps->scrollbar), to - ps->nvisiblerows/2);
@@ -898,7 +888,6 @@ gtkpl_songchanged (gtkplaylist_t *ps, int from, int to) {
void
gtkpl_keypress (gtkplaylist_t *ps, int keyval, int state) {
- GtkWidget *widget = ps->playlist;
GtkWidget *range = ps->scrollbar;
int prev = deadbeef->pl_get_cursor (ps->iterator);
int newscroll = ps->scrollpos;
@@ -953,8 +942,6 @@ gtkpl_keypress (gtkplaylist_t *ps, int keyval, int state) {
if (state & GDK_SHIFT_MASK) {
// select all between shift_sel_anchor and deadbeef->pl_get_cursor (ps->iterator)
if (prev != deadbeef->pl_get_cursor (ps->iterator)) {
- int minvis = ps->scrollpos;
- int maxvis = ps->scrollpos + ps->nvisiblerows-1;
int start = min (deadbeef->pl_get_cursor (ps->iterator), shift_sel_anchor);
int end = max (deadbeef->pl_get_cursor (ps->iterator), shift_sel_anchor);
int idx=0;
@@ -972,8 +959,6 @@ gtkpl_keypress (gtkplaylist_t *ps, int keyval, int state) {
else {
// reset selection, set new single cursor/selection
if (prev != deadbeef->pl_get_cursor (ps->iterator)) {
- int minvis = ps->scrollpos;
- int maxvis = ps->scrollpos + ps->nvisiblerows-1;
shift_sel_anchor = deadbeef->pl_get_cursor (ps->iterator);
int idx=0;
for (DB_playItem_t *it = PL_HEAD (ps->iterator); it; it = PL_NEXT(it, ps->iterator), idx++) {
@@ -1359,8 +1344,6 @@ on_header_motion_notify_event (GtkWidget *widget,
x += cc->width;
}
if (inspos >= 0 && inspos != header_dragging) {
- int c1 = inspos;
- int c2 = header_dragging;
// remove c from list
if (c == ps->columns) {
ps->columns = c->next;
diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c
index 2394634b..7d292f10 100644
--- a/plugins/hotkeys/hotkeys.c
+++ b/plugins/hotkeys/hotkeys.c
@@ -33,7 +33,7 @@ static intptr_t loop_tid;
#define MAX_COMMAND_COUNT 256
typedef struct {
- char *name;
+ const char *name;
KeySym keysym;
} xkey_t;
@@ -66,7 +66,7 @@ get_keycode (Display *disp, const char* name) {
static KeySym* syms;
static int ks_per_kk;
static int first_time = 1;
- int i, j, ks;
+ int i, ks;
if (first_time)
{
@@ -197,7 +197,6 @@ read_config (Display *disp)
char* command = colon+1;
*colon = 0;
- int modifier = 0;
char* key = NULL;
int done = 0;
diff --git a/plugins/nullout/nullout.c b/plugins/nullout/nullout.c
index 5f3dd996..1e08121b 100644
--- a/plugins/nullout/nullout.c
+++ b/plugins/nullout/nullout.c
@@ -55,12 +55,6 @@ static int
pnull_stop (void);
static int
-pnull_isstopped (void);
-
-static int
-pnull_ispaused (void);
-
-static int
pnull_pause (void);
static int
@@ -126,17 +120,6 @@ pnull_stop (void) {
}
int
-pnull_isstopped (void) {
- return (state == OUTPUT_STATE_STOPPED);
-}
-
-int
-pnull_ispaused (void) {
- // return pause state
- return (state == OUTPUT_STATE_PAUSED);
-}
-
-int
pnull_pause (void) {
if (state == OUTPUT_STATE_STOPPED) {
return -1;
@@ -182,7 +165,6 @@ pnull_get_endianness (void) {
static void
pnull_thread (void *context) {
prctl (PR_SET_NAME, "deadbeef-null", 0, 0, 0, 0);
- int err;
for (;;) {
if (null_terminate) {
break;