diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-05-19 20:58:53 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-05-19 20:58:53 +0200 |
commit | 6ce1f73ca437f7bdfb52772ce8422ab909345850 (patch) | |
tree | 3a541ff6022cce7aeed288e6010e801b4af44e0f | |
parent | 86f4222cfe1e30c2de6c7362e31a8ab5b68f7321 (diff) | |
parent | 7dedf440d149b7f7394c7810d9ca6e42ee89b7bd (diff) |
Merge branch 'master' into i18n
Conflicts:
playlist.c
-rw-r--r-- | junklib.c | 12 | ||||
-rw-r--r-- | playlist.c | 16 | ||||
-rw-r--r-- | plugins/dumb/cdumb.c | 3 | ||||
-rw-r--r-- | plugins/flac/flac.c | 4 | ||||
-rw-r--r-- | plugins/gtkui/gtkui.c | 1 | ||||
-rw-r--r-- | plugins/gtkui/prefwin.c | 3 | ||||
-rw-r--r-- | plugins/mpgmad/mpgmad.c | 13 | ||||
-rw-r--r-- | plugins/vorbis/vorbis.c | 10 | ||||
-rw-r--r-- | streamer.c | 2 |
9 files changed, 41 insertions, 23 deletions
@@ -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; @@ -191,7 +191,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; @@ -249,6 +249,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); @@ -2198,14 +2202,16 @@ 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)) { 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"); @@ -2215,7 +2221,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; 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 <http://www.gnu.org/licenses/>. */ + +// based on fb2k dumb plugin from http://kode54.foobar2000.org + #include <stdio.h> #include <stdlib.h> #include <string.h> 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; } diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index cca6f6b9..88bc8557 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -784,6 +784,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; } diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c index e7ae8476..f30d41f5 100644 --- a/plugins/gtkui/prefwin.c +++ b/plugins/gtkui/prefwin.c @@ -239,7 +239,6 @@ prefwin_add_hotkeys_tab (GtkWidget *prefwin) { GtkWidget *hbuttonbox3; GtkWidget *addhotkey; GtkWidget *removehotkey; - GtkWidget *applyhotkeys; GtkWidget *label66; GtkWidget *notebook2 = lookup_widget (prefwin, "notebook"); @@ -281,10 +280,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); diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c index 5c9e1ea3..43cf4aff 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 @@ -908,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; diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index 37ca2263..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 } @@ -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); @@ -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); |