From 86504ee2a778f4117875e4ba963891f896062e37 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Mon, 17 May 2010 21:49:35 +0200 Subject: close input file after finished writing vorbis tag --- plugins/vorbis/vorbis.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index 37ca2263..90eb7c01 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -593,13 +593,15 @@ cvorbis_write_metadata (DB_playItem_t *it) { err = 0; error: + if (fp) { + fclose (fp); + } if (out) { fclose (out); } if (state) { vcedit_clear (state); } - while (preserved_fields) { struct field *next = preserved_fields->next; free (preserved_fields); -- cgit v1.2.3 From 646c94fcd5a45e0f0c7d845889f72cabe8878fd0 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Mon, 17 May 2010 22:21:06 +0200 Subject: fixed bug in id3v2 "extra size" field parser --- junklib.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/junklib.c b/junklib.c index 89ba6306..c2873f57 100644 --- a/junklib.c +++ b/junklib.c @@ -173,11 +173,11 @@ junk_iconv (const char *in, int inlen, char *out, int outlen, const char *cs_in, int err = errno; iconv_close (cd); -// trace ("iconv -f %s -t %s '%s': returned %d, inbytes %d/%d, outbytes %d/%d, errno=%d\n", cs_in, cs_out, in, res, inlen, inbytesleft, outlen, outbytesleft, err); + //trace ("iconv -f %s -t %s '%s': returned %d, inbytes %d/%d, outbytes %d/%d, errno=%d\n", cs_in, cs_out, in, res, inlen, inbytesleft, outlen, outbytesleft, err); if (res == -1) { return -1; } -// trace ("iconv out: %s\n", out); + //trace ("iconv out: %s (len=%d)\n", out, pout - out); return pout - out; } @@ -2340,8 +2340,9 @@ int junk_load_comm_frame (int version_major, playItem_t *it, uint8_t *readptr, int synched_size) { uint8_t enc = readptr[0]; char lang[4] = {readptr[1], readptr[2], readptr[3], 0}; - trace ("COMM enc is: %d\n", (int)enc); - trace ("COMM language is: %s\n", lang); + trace ("COMM enc: %d\n", (int)enc); + trace ("COMM language: %s\n", lang); + trace ("COMM data size: %d\n", synched_size); char *descr = convstr_id3v2 (version_major, enc, readptr+4, synched_size-4); if (!descr) { @@ -2349,6 +2350,7 @@ junk_load_comm_frame (int version_major, playItem_t *it, uint8_t *readptr, int s return -1; } + trace ("COMM raw data: %s\n", descr); // find value char *value = descr; while (*value && *value != '\n') { @@ -2659,7 +2661,7 @@ junk_id3v2_read_full (playItem_t *it, DB_id3v2_tag_t *tag_store, DB_FILE *fp) { if (flags2 & 0x02) { // unsync, just do nothing } if (flags2 & 0x01) { // data size - synched_size = extract_i32 (readptr); + synched_size = (readptr[3] << 0) | (readptr[2] << 7) | (readptr[1] << 14) | (readptr[0] << 21); trace ("frame has extra size field = %d\n", synched_size); readptr += 4; sz -= 4; -- cgit v1.2.3 From d49a7298a12ac9f5dcb9f718dbe18b434d3eaadb Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Tue, 18 May 2010 19:10:10 +0200 Subject: fix division by zero in flac plugin --- plugins/flac/flac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c index 43b1b1c0..c841a08f 100644 --- a/plugins/flac/flac.c +++ b/plugins/flac/flac.c @@ -246,8 +246,8 @@ cflac_init (DB_fileinfo_t *_info, DB_playItem_t *it) { _info->plugin = &plugin; _info->readpos = 0; - if (_info->samplerate == -1) { // not a FLAC stream - trace ("cflac_init not a flac stream\n"); + if (_info->samplerate <= 0) { // not a FLAC stream + fprintf (stderr, "corrupted/invalid flac stream\n"); return -1; } -- cgit v1.2.3 From 2a2e9db029ef27286b5253acad1955bbf23cc1f8 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Tue, 18 May 2010 19:35:56 +0200 Subject: gtk warning fix --- plugins/gtkui/prefwin.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c index 7100e3b9..384e02eb 100644 --- a/plugins/gtkui/prefwin.c +++ b/plugins/gtkui/prefwin.c @@ -235,7 +235,6 @@ prefwin_add_hotkeys_tab (GtkWidget *prefwin) { GtkWidget *hbuttonbox3; GtkWidget *addhotkey; GtkWidget *removehotkey; - GtkWidget *applyhotkeys; GtkWidget *label66; GtkWidget *notebook2 = lookup_widget (prefwin, "notebook"); @@ -277,10 +276,8 @@ prefwin_add_hotkeys_tab (GtkWidget *prefwin) { gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), npages-1), label66); GLADE_HOOKUP_OBJECT (prefwin, hotkeystree, "hotkeystree"); -// GLADE_HOOKUP_OBJECT (prefwin, hbuttonbox3, "hbuttonbox3"); GLADE_HOOKUP_OBJECT (prefwin, addhotkey, "addhotkey"); GLADE_HOOKUP_OBJECT (prefwin, removehotkey, "removehotkey"); - GLADE_HOOKUP_OBJECT (prefwin, applyhotkeys, "applyhotkeys"); GtkTreeView *hktree = GTK_TREE_VIEW (lookup_widget (prefwin, "hotkeystree")); GtkListStore *hkstore = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); -- cgit v1.2.3 From 82eb9922ef5c1da1f2f1375ddbf8eb7a6f0ea1f3 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Tue, 18 May 2010 19:36:02 +0200 Subject: gtkui debugging line --- plugins/gtkui/gtkui.c | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index 05e600d7..81464e13 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -783,6 +783,7 @@ gtkui_thread (void *ctx) { const char **argv = alloca (sizeof (char *) * argc); argv[0] = "deadbeef"; argv[1] = "--sync"; + //argv[1] = "--g-fatal-warnings"; if (!deadbeef->conf_get_int ("gtkui.sync", 0)) { argc = 1; } -- cgit v1.2.3 From 4737a19e441f963b4925a724507079081c10fa46 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Tue, 18 May 2010 20:02:01 +0200 Subject: added kode54 website reference to dumb plugin --- plugins/dumb/cdumb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/dumb/cdumb.c b/plugins/dumb/cdumb.c index 465a00e3..84aa4fe4 100644 --- a/plugins/dumb/cdumb.c +++ b/plugins/dumb/cdumb.c @@ -15,6 +15,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ + +// based on fb2k dumb plugin from http://kode54.foobar2000.org + #include #include #include -- cgit v1.2.3 From fcc3040f10598f477f2251609a65062cb96d9d8c Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Wed, 19 May 2010 19:56:47 +0200 Subject: fixed crash on unexpected end of mp3 stream --- plugins/mpgmad/mpgmad.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c index 5c9e1ea3..982daf7c 100644 --- a/plugins/mpgmad/mpgmad.c +++ b/plugins/mpgmad/mpgmad.c @@ -790,6 +790,10 @@ cmp3_stream_frame (mpgmad_info_t *info) { // read more MPEG data if needed if(info->stream.buffer==NULL || info->stream.error==MAD_ERROR_BUFLEN) { // copy part of last frame to beginning + if (info->stream.next_frame && info->stream.bufend <= info->stream.next_frame) { + eof = 1; + break; + } if (info->stream.next_frame != NULL) { info->buffer.remaining = info->stream.bufend - info->stream.next_frame; memmove (info->buffer.input, info->stream.next_frame, info->buffer.remaining); @@ -826,13 +830,14 @@ cmp3_stream_frame (mpgmad_info_t *info) { { #if 0 if(info->stream.error!=MAD_ERROR_LOSTSYNC) { - trace ("mpgmad: recoverable frame level error (%s)\n", MadErrorString(&stream)); + trace ("mpgmad: recoverable frame level error (%s)\n", MadErrorString(&info->stream)); } #endif continue; } else { if(info->stream.error==MAD_ERROR_BUFLEN) { +// trace ("mpgmad: recoverable frame level error (%s)\n", MadErrorString(&info->stream)); continue; } else -- cgit v1.2.3 From 894a4eb9aac531199ecd89f20437468d7f5c8113 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Wed, 19 May 2010 20:24:11 +0200 Subject: don't printf "loading legacy default playlist" --- playlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playlist.c b/playlist.c index ba318f4f..3478ffaf 100644 --- a/playlist.c +++ b/playlist.c @@ -2194,7 +2194,7 @@ pl_load_all (void) { char path[1024]; DB_conf_item_t *it = conf_find ("playlist.tab.", NULL); if (!it) { - fprintf (stderr, "INFO: loading legacy default playlist\n"); +// fprintf (stderr, "INFO: loading legacy default playlist\n"); // legacy (0.3.3 and earlier) char defpl[1024]; // $HOME/.config/deadbeef/default.dbpl if (snprintf (defpl, sizeof (defpl), "%s/deadbeef/default.dbpl", confdir) > sizeof (defpl)) { -- cgit v1.2.3 From 2bc9b07371f4f1c388cc9fea5ca59ea0aa33f4ee Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Wed, 19 May 2010 20:24:38 +0200 Subject: ensure playitem is properly unreferenced in mpeg plugin --- plugins/mpgmad/mpgmad.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c index 982daf7c..43cf4aff 100644 --- a/plugins/mpgmad/mpgmad.c +++ b/plugins/mpgmad/mpgmad.c @@ -913,10 +913,10 @@ cmp3_decode_float32 (mpgmad_info_t *info) { static void cmp3_free (DB_fileinfo_t *_info) { mpgmad_info_t *info = (mpgmad_info_t *)_info; + if (info->buffer.it) { + deadbeef->pl_item_unref (info->buffer.it); + } if (info->buffer.file) { - if (info->buffer.it) { - deadbeef->pl_item_unref (info->buffer.it); - } deadbeef->fclose (info->buffer.file); info->buffer.file = NULL; info->info.file = NULL; -- cgit v1.2.3 From 2e0f6bc395f9d4ffed2df17e2394a362ebbaa217 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Wed, 19 May 2010 20:25:12 +0200 Subject: ensure playitem is properly unreferenced in vorbis plugin --- plugins/vorbis/vorbis.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index 90eb7c01..6704f8fe 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -232,10 +232,10 @@ static void cvorbis_free (DB_fileinfo_t *_info) { ogg_info_t *info = (ogg_info_t *)_info; if (info) { + if (info->ptrack) { + deadbeef->pl_item_unref (info->ptrack); + } if (info->info.file) { - if (info->ptrack) { - deadbeef->pl_item_unref (info->ptrack); - } ov_clear (&info->vorbis_file); //fclose (file); //-- ov_clear closes it } -- cgit v1.2.3 From 78475a5a791b11218c2ecd9253d0a839256ba5fb Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Wed, 19 May 2010 20:26:29 +0200 Subject: typo fix in streamer tracing --- streamer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamer.c b/streamer.c index 8349c7d9..1d4b11d1 100644 --- a/streamer.c +++ b/streamer.c @@ -542,7 +542,7 @@ streamer_set_current (playItem_t *it) { } // code below breaks seekbar drawing during transition between tracks - trace ("streamer_set_current %p, buns=%d\n", it); + trace ("streamer_set_current %p, buns=%d\n", it, bytes_until_next_song); mutex_lock (decodemutex); if (fileinfo) { fileinfo->plugin->free (fileinfo); -- cgit v1.2.3 From 7dedf440d149b7f7394c7810d9ca6e42ee89b7bd Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Wed, 19 May 2010 20:31:33 +0200 Subject: limit to 100 max playlists; fixed playlist name corruption/shuffling --- playlist.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/playlist.c b/playlist.c index 3478ffaf..f5a667c1 100644 --- a/playlist.c +++ b/playlist.c @@ -187,7 +187,7 @@ plt_gen_conf (void) { playlist_t *p = playlists_head; for (i = 0; i < cnt; i++, p = p->next) { char s[100]; - snprintf (s, sizeof (s), "playlist.tab.%d", i); + snprintf (s, sizeof (s), "playlist.tab.%02d", i); conf_set_str (s, p->title); } PLT_UNLOCK; @@ -245,6 +245,10 @@ int plt_add (int before, const char *title) { assert (before >= 0); trace ("plt_add\n"); + if (plt_get_count () >= 100) { + 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->title = strdup (title); @@ -2201,7 +2205,9 @@ pl_load_all (void) { fprintf (stderr, "error: cannot make string with default playlist path\n"); return -1; } - plt_add (plt_get_count (), "Default"); + if (plt_add (plt_get_count (), "Default") < 0) { + return -1; + } return pl_load (defpl); } trace ("pl_load_all started\n"); @@ -2211,7 +2217,9 @@ pl_load_all (void) { while (it) { fprintf (stderr, "INFO: loading playlist %s\n", it->value); if (!err) { - plt_add (plt_get_count (), it->value); + if (plt_add (plt_get_count (), it->value) < 0) { + return -1; + } plt_set_curr (plt_get_count () - 1); } err = 0; -- cgit v1.2.3