diff options
author | waker <wakeroid@gmail.com> | 2012-10-19 17:42:18 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-10-19 17:42:18 +0200 |
commit | 9371c5953b51235388fb657fba288b9a99005ad1 (patch) | |
tree | c20e1f98d15ba90597f5fc5f44a144a763e784de /plugins | |
parent | 73a6c7eea6ccf48f0d2872997b93c6ee5b78fac4 (diff) | |
parent | cf99fd6ea3cd728fa643e7d34e6edbf026f0feb5 (diff) |
Merge branch 'master' into devel
Conflicts:
configure.ac
streamer.c
streamer.h
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/aac/Makefile.am | 3 | ||||
-rw-r--r-- | plugins/aac/aac.c | 6 | ||||
-rw-r--r-- | plugins/artwork/Makefile.am | 1 | ||||
-rw-r--r-- | plugins/converter/Makefile.am | 21 | ||||
-rw-r--r-- | plugins/converter/convgui.c | 18 | ||||
-rw-r--r-- | plugins/gtkui/Makefile.am | 24 | ||||
-rw-r--r-- | plugins/gtkui/ddblistview.h | 3 | ||||
-rw-r--r-- | plugins/gtkui/plcommon.c | 34 | ||||
-rw-r--r-- | plugins/mms/libmms/mms.c | 16 | ||||
-rw-r--r-- | plugins/mms/libmms/mms.h | 2 | ||||
-rw-r--r-- | plugins/mms/libmms/mmsh.c | 7 | ||||
-rw-r--r-- | plugins/mms/libmms/mmsh.h | 2 | ||||
-rw-r--r-- | plugins/mms/libmms/mmsio.h | 2 | ||||
-rw-r--r-- | plugins/mms/libmms/mmsx.c | 6 | ||||
-rw-r--r-- | plugins/mms/mmsplug.c | 48 | ||||
-rw-r--r-- | plugins/mpgmad/mpgmad.c | 2 | ||||
-rw-r--r-- | plugins/shellexecui/Makefile.am | 21 | ||||
-rw-r--r-- | plugins/vorbis/vorbis.c | 3 | ||||
-rw-r--r-- | plugins/wavpack/wavpack.c | 10 |
19 files changed, 182 insertions, 47 deletions
diff --git a/plugins/aac/Makefile.am b/plugins/aac/Makefile.am index deab8c8f..5a532d8f 100644 --- a/plugins/aac/Makefile.am +++ b/plugins/aac/Makefile.am @@ -1,4 +1,5 @@ if HAVE_AAC +aacpath=@top_srcdir@/plugins/aac aacdir = $(libdir)/$(PACKAGE) pkglib_LTLIBRARIES = aac.la aac_la_SOURCES = aac.c aac_parser.c aac_parser.h\ @@ -15,6 +16,6 @@ aac_la_SOURCES = aac.c aac_parser.c aac_parser.h\ aac_la_LDFLAGS = -module aac_la_LIBADD = $(LDADD) $(FAAD2_LIBS) -AM_CFLAGS = $(CFLAGS) -std=c99 -DUSE_MP4FF -DUSE_TAGGING -I../libmp4ff +AM_CFLAGS = $(CFLAGS) -std=c99 -DUSE_MP4FF -DUSE_TAGGING -I$(aacpath)/../libmp4ff endif diff --git a/plugins/aac/aac.c b/plugins/aac/aac.c index a7abece0..ca0f391e 100644 --- a/plugins/aac/aac.c +++ b/plugins/aac/aac.c @@ -1185,8 +1185,14 @@ aac_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { } mp4ff_close (mp4); if (i < ntracks) { + deadbeef->fclose (fp); return after; } + if (ntracks > 0) { + // mp4 container found, but no valid aac tracks in it + deadbeef->fclose (fp); + return NULL; + } } } trace ("aac: mp4 container failed, trying raw aac\n"); diff --git a/plugins/artwork/Makefile.am b/plugins/artwork/Makefile.am index 74155a1c..dc46f7d9 100644 --- a/plugins/artwork/Makefile.am +++ b/plugins/artwork/Makefile.am @@ -10,6 +10,7 @@ ARTWORK_DEPS=$(IMLIB2_DEPS_LIBS) ARTWORK_CFLAGS=-DUSE_IMLIB2 else ARTWORK_DEPS=$(JPEG_DEPS_LIBS) $(PNG_DEPS_LIBS) +ARTWORK_CFLAGS=$(JPEG_DEPS_CFLAGS) $(PNG_DEPS_CFLAGS) endif if HAVE_FLAC diff --git a/plugins/converter/Makefile.am b/plugins/converter/Makefile.am index e9b5b964..d14d3f40 100644 --- a/plugins/converter/Makefile.am +++ b/plugins/converter/Makefile.am @@ -30,15 +30,10 @@ AM_CFLAGS = $(CFLAGS) -std=c99 -fPIC converter_la_SOURCES = converter.c converter.h converter_la_LDFLAGS = -module + if HAVE_GTK2 converter_gtk2_la_SOURCES = convgui.c interface.c support.c callbacks.h converter.h interface.h support.h converter_gtk2_la_LDFLAGS = -module -endif -if HAVE_GTK3 -converter_gtk3_la_SOURCES = convgui.c interface.c support.c callbacks.h converter.h interface.h support.h -converter_gtk3_la_LDFLAGS = -module -endif - if STATICLINK GTK_ROOT=@top_srcdir@/$(LIB)/gtk-2.12.12/usr @@ -46,15 +41,25 @@ converter_gtk2_la_LIBADD = $(LDADD) -L$(GTK_ROOT)/lib $(GTK_ROOT)/lib/libgtk-x11 converter_gtk2_la_CFLAGS = -std=c99 -I $(GTK_ROOT)/include -I $(GTK_ROOT)/lib/gtk-2.0/include -I $(GTK_ROOT)/include/glib-2.0 -I $(GTK_ROOT)/include/gtk-2.0 -I $(GTK_ROOT)/include/cairo -I $(GTK_ROOT)/lib/glib-2.0/include/ -I $(GTK_ROOT)/include/pango-1.0 -I $(GTK_ROOT)/include/atk-1.0 -DULTRA_COMPATIBLE=1 else -if HAVE_GTK2 converter_gtk2_la_LIBADD = $(LDADD) $(GTK2_DEPS_LIBS) converter_gtk2_la_CFLAGS = -std=c99 $(GTK2_DEPS_CFLAGS) endif +endif + if HAVE_GTK3 +converter_gtk3_la_SOURCES = convgui.c interface.c support.c callbacks.h converter.h interface.h support.h +converter_gtk3_la_LDFLAGS = -module +if STATICLINK +GTK_ROOT_300=@top_srcdir@/$(LIB)/gtk-3.0.0 + +converter_gtk3_la_LIBADD = $(LDADD) -L$(GTK_ROOT_300)/lib -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lfreetype -lfontconfig $(SM_LIBADD) + +converter_gtk3_la_CFLAGS = -std=c99 -I$(GTK_ROOT_300)/include/gtk-3.0 -I$(GTK_ROOT_300)/include/pango-1.0 -I$(GTK_ROOT_300)/include/gio-unix-2.0/ -I$(GTK_ROOT_300)/include/atk-1.0 -I$(GTK_ROOT_300)/include/cairo -I$(GTK_ROOT_300)/include/gdk-pixbuf-2.0 -I$(GTK_ROOT_300)/include/freetype2 -I$(GTK_ROOT_300)/include/glib-2.0 -I$(GTK_ROOT_300)/lib/glib-2.0/include $(SM_CFLAGS) + +else converter_gtk3_la_LIBADD = $(LDADD) $(GTK3_DEPS_LIBS) converter_gtk3_la_CFLAGS = -std=c99 $(GTK3_DEPS_CFLAGS) endif - endif endif diff --git a/plugins/converter/convgui.c b/plugins/converter/convgui.c index e225c74d..89a341f1 100644 --- a/plugins/converter/convgui.c +++ b/plugins/converter/convgui.c @@ -181,8 +181,22 @@ converter_worker (void *ctx) { converter_plugin->get_output_path (conv->convert_items[n], conv->outfolder, conv->outfile, conv->encoder_preset, conv->preserve_folder_structure, root, conv->write_to_source_folder, outpath, sizeof (outpath)); int skip = 0; + + // need to unescape path before passing to stat + char unesc_path[2000]; + char invalid[] = "$\"`\\"; + const char *p = outpath; + char *o = unesc_path; + while (*p) { + if (*p == '\\') { + p++; + } + *o++ = *p++; + } + *o = 0; + struct stat st; - int res = stat(outpath, &st); + int res = stat(unesc_path, &st); if (res == 0) { if (conv->overwrite_action > 1 || conv->overwrite_action < 0) { conv->overwrite_action = 0; @@ -192,7 +206,7 @@ converter_worker (void *ctx) { struct overwrite_prompt_ctx ctl; ctl.mutex = deadbeef->mutex_create (); ctl.cond = deadbeef->cond_create (); - ctl.fname = outpath; + ctl.fname = unesc_path; ctl.result = 0; gdk_threads_add_idle (overwrite_prompt_cb, &ctl); deadbeef->cond_wait (ctl.cond, ctl.mutex); diff --git a/plugins/gtkui/Makefile.am b/plugins/gtkui/Makefile.am index 9cb86c04..b756dbfe 100644 --- a/plugins/gtkui/Makefile.am +++ b/plugins/gtkui/Makefile.am @@ -1,4 +1,3 @@ -if HAVE_GTKUI gtkuidir = $(libdir)/$(PACKAGE) if HAVE_SM @@ -48,7 +47,17 @@ sdk_HEADERS = gtkui_api.h EXTRA_DIST = deadbeef.glade if STATICLINK +if HAVE_GTK2 +if HAVE_GTK3 +pkglib_LTLIBRARIES = ddb_gui_GTK2.la ddb_gui_GTK2.fallback.la ddb_gui_GTK3.la +else pkglib_LTLIBRARIES = ddb_gui_GTK2.la ddb_gui_GTK2.fallback.la +endif +else +if HAVE_GTK3 +pkglib_LTLIBRARIES = ddb_gui_GTK3.la +endif +endif else if HAVE_GTK2 if HAVE_GTK3 @@ -72,7 +81,7 @@ ddb_gui_GTK2_la_LDFLAGS = -module if STATICLINK GTK_ROOT_216=@top_srcdir@/$(LIB)/gtk-2.16.0 -ddb_gui_GTK2_la_LIBADD = $(LDADD) -L$(GTK_ROOT_216)/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 $(SM_LIBADD) +ddb_gui_GTK2_la_LIBADD = $(LDADD) -L$(GTK_ROOT_216)/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 $(SM_LIBADD) ddb_gui_GTK2_la_CFLAGS = -std=c99 -I$(GTK_ROOT_216)/include/gtk-2.0 -I$(GTK_ROOT_216)/lib/gtk-2.0/include -I$(GTK_ROOT_216)/include/atk-1.0 -I$(GTK_ROOT_216)/include/cairo -I$(GTK_ROOT_216)/include/pango-1.0 -I$(GTK_ROOT_216)/include -I$(GTK_ROOT_216)/include/glib-2.0 -I$(GTK_ROOT_216)/lib/glib-2.0/include $(SM_CFLAGS) else @@ -81,12 +90,22 @@ ddb_gui_GTK2_la_CFLAGS = -std=c99 $(GTK2_DEPS_CFLAGS) $(SM_CFLAGS) endif endif + if HAVE_GTK3 ddb_gui_GTK3_la_SOURCES = $(GTKUI_SOURCES) ddb_gui_GTK3_la_LDFLAGS = -module +if STATICLINK +GTK_ROOT_300=@top_srcdir@/$(LIB)/gtk-3.0.0 + +ddb_gui_GTK3_la_LIBADD = $(LDADD) -L$(GTK_ROOT_300)/lib -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lfreetype -lfontconfig $(SM_LIBADD) + +ddb_gui_GTK3_la_CFLAGS = -std=c99 -I$(GTK_ROOT_300)/include/gtk-3.0 -I$(GTK_ROOT_300)/include/pango-1.0 -I$(GTK_ROOT_300)/include/gio-unix-2.0/ -I$(GTK_ROOT_300)/include/atk-1.0 -I$(GTK_ROOT_300)/include/cairo -I$(GTK_ROOT_300)/include/gdk-pixbuf-2.0 -I$(GTK_ROOT_300)/include/freetype2 -I$(GTK_ROOT_300)/include/glib-2.0 -I$(GTK_ROOT_300)/lib/glib-2.0/include $(SM_CFLAGS) + +else ddb_gui_GTK3_la_LIBADD = $(LDADD) $(GTK3_DEPS_LIBS) $(SM_LIBADD) ddb_gui_GTK3_la_CFLAGS = -std=c99 $(GTK3_DEPS_CFLAGS) $(SM_CFLAGS) endif +endif # fallback lib if STATICLINK @@ -101,4 +120,3 @@ ddb_gui_GTK2_fallback_la_CFLAGS = -std=c99 -I $(GTK_ROOT)/include -I $(GTK_ROOT) endif -endif diff --git a/plugins/gtkui/ddblistview.h b/plugins/gtkui/ddblistview.h index 143ef28c..f2ead8ce 100644 --- a/plugins/gtkui/ddblistview.h +++ b/plugins/gtkui/ddblistview.h @@ -266,6 +266,9 @@ ddb_listview_clear_sort (DdbListview *listview); void ddb_listview_lock_columns (DdbListview *lv, gboolean lock); +int +ddb_listview_get_row_pos (DdbListview *listview, int row_idx); + G_END_DECLS #endif // __DDBLISTVIEW_H diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c index 3a00503c..a0117545 100644 --- a/plugins/gtkui/plcommon.c +++ b/plugins/gtkui/plcommon.c @@ -432,6 +432,38 @@ find_popup (GtkWidget *widget, return found_widget; } +#if 0 +// experimental code to position the popup at the item +static void +popup_menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) { + // find 1st selected item + DdbListview *lv = user_data; + int winx, winy; + gdk_window_get_position (gtk_widget_get_window (GTK_WIDGET (lv->list)), &winx, &winy); + DdbListviewIter it = lv->binding->head (); + int idx = 0; + while (it) { + if (lv->binding->is_selected (it)) { + break; + } + DdbListviewIter next = lv->binding->next (it); + lv->binding->unref (it); + it = next; + idx++; + } + if (it) { + // get Y position + *y = ddb_listview_get_row_pos (lv, idx) + winy; + lv->binding->unref (it); + } + else { + *y = winy; // mouse_y + } + *x = winx; // mouse_x + *push_in = TRUE; +} +#endif + void list_context_menu (DdbListview *listview, DdbListviewIter it, int idx) { clicked_idx = deadbeef->pl_get_idx_of (it); @@ -646,7 +678,7 @@ list_context_menu (DdbListview *listview, DdbListviewIter it, int idx) { g_signal_connect ((gpointer) properties1, "activate", G_CALLBACK (main_properties_activate), NULL); - gtk_menu_popup (GTK_MENU (playlist_menu), NULL, NULL, NULL, listview, 0, gtk_get_current_event_time()); + gtk_menu_popup (GTK_MENU (playlist_menu), NULL, NULL, NULL/*popup_menu_position_func*/, listview, 0, gtk_get_current_event_time()); } void diff --git a/plugins/mms/libmms/mms.c b/plugins/mms/libmms/mms.c index ad63e6f8..15c9cca9 100644 --- a/plugins/mms/libmms/mms.c +++ b/plugins/mms/libmms/mms.c @@ -161,8 +161,9 @@ static off_t fallback_io_read(void *data, int socket, char *buf, off_t num, int off_t len = 0, ret; /* lprintf("%d\n", fallback_io_select(data, socket, MMS_IO_READ_READY, 1000)); */ errno = 0; - int nretry = 200; - while (len < num && nretry > 0) + int nretry = 600; + lprintf ("mms: fallback_io_read: need_abort ptr = %p\n", need_abort); + while (len < num && nretry > 0 && (!need_abort || !(*need_abort))) { ret = (off_t)read(socket, buf + len, num - len); if(ret == 0) @@ -191,7 +192,7 @@ static off_t fallback_io_write(void *data, int socket, char *buf, off_t num) return (off_t)write(socket, buf, num); } -static int fallback_io_tcp_connect(void *data, const char *host, int port) +static int fallback_io_tcp_connect(void *data, const char *host, int port, int *need_abort) { struct hostent *h; @@ -225,7 +226,7 @@ static int fallback_io_tcp_connect(void *data, const char *host, int port) time_t t = time (NULL); int error = 0; - for (;;) { + while (!need_abort || !(*need_abort)) { int res = connect(s, (struct sockaddr *)&sin, sizeof(sin)); if (res == -1 && (errno == EINPROGRESS || errno == EALREADY)) { if (time (NULL) - t > 3) { @@ -499,6 +500,7 @@ static int string_utf16(iconv_t url_conv, char *dest, char *src, int dest_len) static int get_packet_header (mms_io_t *io, mms_t *this, mms_packet_header_t *header) { size_t len; int packet_type; + lprintf ("mms: get_packet_header: need_abort ptr = %p\n", this->need_abort); header->packet_len = 0; header->packet_seq = 0; @@ -576,6 +578,7 @@ static int get_answer (mms_io_t *io, mms_t *this) { int command = 0; mms_packet_header_t header; + lprintf ("mms: get_answer: need_abort ptr = %p\n", this->need_abort); switch (get_packet_header (io, this, &header)) { case MMS_PACKET_ERR: break; @@ -879,7 +882,7 @@ static int mms_tcp_connect(mms_io_t *io, mms_t *this) { * try to connect */ lprintf("mms: trying to connect to %s on port %d\n", this->host, this->port); - this->s = io_connect(io, this->host, this->port); + this->s = io_connect(io, this->host, this->port, this->need_abort); if (this->s == -1) { lprintf("mms: failed to connect to %s\n", this->host); return 1; @@ -1039,7 +1042,7 @@ int static mms_choose_best_streams(mms_io_t *io, mms_t *this) { * network timing request */ /* FIXME: got somewhat broken during xine_stream_t->(void*) conversion */ -mms_t *mms_connect (mms_io_t *io, void *data, const char *url, int bandwidth) { +mms_t *mms_connect (mms_io_t *io, void *data, const char *url, int bandwidth, int *need_abort) { iconv_t url_conv = (iconv_t)-1; mms_t *this; int res; @@ -1070,6 +1073,7 @@ mms_t *mms_connect (mms_io_t *io, void *data, const char *url, int bandwidth) { this->bandwidth = bandwidth; this->current_pos = 0; this->eos = 0; + this->need_abort = need_abort; this->guri = gnet_uri_new(this->url); if(!this->guri) { diff --git a/plugins/mms/libmms/mms.h b/plugins/mms/libmms/mms.h index be329eef..e5eb3bb8 100644 --- a/plugins/mms/libmms/mms.h +++ b/plugins/mms/libmms/mms.h @@ -37,7 +37,7 @@ extern "C" { typedef struct mms_s mms_t; -mms_t* mms_connect (mms_io_t *io, void *data, const char *url, int bandwidth); +mms_t* mms_connect (mms_io_t *io, void *data, const char *url, int bandwidth, int *need_abort); int mms_read (mms_io_t *io, mms_t *instance, char *data, int len, int *need_abort); int mms_request_time_seek (mms_io_t *io, mms_t *instance, double time_sec); diff --git a/plugins/mms/libmms/mmsh.c b/plugins/mms/libmms/mmsh.c index a0552f6c..0606ac53 100644 --- a/plugins/mms/libmms/mmsh.c +++ b/plugins/mms/libmms/mmsh.c @@ -248,7 +248,7 @@ static off_t fallback_io_write(void *data, int socket, char *buf, off_t num) return (off_t)write(socket, buf, num); } -static int fallback_io_tcp_connect(void *data, const char *host, int port) +static int fallback_io_tcp_connect(void *data, const char *host, int port, int *need_abort) { struct hostent *h; @@ -822,7 +822,7 @@ static int mmsh_tcp_connect(mms_io_t *io, mmsh_t *this) { */ lprintf("mmsh: try to connect to %s on port %d \n", this->connect_host, this->connect_port); - this->s = io_connect (io, this->connect_host, this->connect_port); + this->s = io_connect (io, this->connect_host, this->connect_port, this->need_abort); if (this->s == -1) { lprintf("mmsh: failed to connect '%s'\n", this->connect_host); @@ -1017,7 +1017,7 @@ fail: return 0; } -mmsh_t *mmsh_connect (mms_io_t *io, void *data, const char *url, int bandwidth) { +mmsh_t *mmsh_connect (mms_io_t *io, void *data, const char *url, int bandwidth, int *need_abort) { mmsh_t *this; GURI *uri = NULL; GURI *proxy_uri = NULL; @@ -1041,6 +1041,7 @@ mmsh_t *mmsh_connect (mms_io_t *io, void *data, const char *url, int bandwidth) this->host_user = NULL; this->host_password = NULL; this->uri = NULL; + this->need_abort = need_abort; this->url = strdup(url); if ((proxy_env = getenv("http_proxy")) != NULL) diff --git a/plugins/mms/libmms/mmsh.h b/plugins/mms/libmms/mmsh.h index 744eefc0..898894bb 100644 --- a/plugins/mms/libmms/mmsh.h +++ b/plugins/mms/libmms/mmsh.h @@ -37,7 +37,7 @@ extern "C" { typedef struct mmsh_s mmsh_t; char* mmsh_connect_common(int *s ,int *port, char *url, char **host, char **path, char **file); -mmsh_t* mmsh_connect (mms_io_t *io, void *data, const char *url_, int bandwidth); +mmsh_t* mmsh_connect (mms_io_t *io, void *data, const char *url_, int bandwidth, int *need_abort); int mmsh_read (mms_io_t *io, mmsh_t *instance, char *data, int len, int *need_abort); int mmsh_time_seek (mms_io_t *io, mmsh_t *instance, double time_sec); diff --git a/plugins/mms/libmms/mmsio.h b/plugins/mms/libmms/mmsio.h index a1cb93bb..376e6736 100644 --- a/plugins/mms/libmms/mmsio.h +++ b/plugins/mms/libmms/mmsio.h @@ -66,7 +66,7 @@ typedef int (*mms_io_select_func)(void *data, int fd, int state, int timeout_mse * * returns a socket descriptor or -1 if an error occured */ -typedef int (*mms_io_tcp_connect_func)(void *data, const char *host, int port); +typedef int (*mms_io_tcp_connect_func)(void *data, const char *host, int port, int *need_abort); typedef struct { diff --git a/plugins/mms/libmms/mmsx.c b/plugins/mms/libmms/mmsx.c index e2c3fd9b..8d206b8f 100644 --- a/plugins/mms/libmms/mmsx.c +++ b/plugins/mms/libmms/mmsx.c @@ -53,17 +53,17 @@ mmsx_t *mmsx_connect(mms_io_t *io, void *data, const char *url, int bandwidth, i handle it. The LIBMMS_TRY_MMS_FIRST environment variable is there for testing the mms code against servers which accept both mmsh and mms. */ if (try_mms_first, 1) { - mmsx->connection = mms_connect(io, data, url, bandwidth); + mmsx->connection = mms_connect(io, data, url, bandwidth, need_abort); if (mmsx->connection) return mmsx; } - mmsx->connection_h = mmsh_connect(io, data, url, bandwidth); + mmsx->connection_h = mmsh_connect(io, data, url, bandwidth, need_abort); if (mmsx->connection_h) return mmsx; if (!try_mms_first, 0) { - mmsx->connection = mms_connect(io, data, url, bandwidth); + mmsx->connection = mms_connect(io, data, url, bandwidth, need_abort); if (mmsx->connection) return mmsx; } diff --git a/plugins/mms/mmsplug.c b/plugins/mms/mmsplug.c index 3d2e3faf..cb339a96 100644 --- a/plugins/mms/mmsplug.c +++ b/plugins/mms/mmsplug.c @@ -26,6 +26,7 @@ static DB_functions_t *deadbeef; typedef struct { DB_vfs_t *vfs; + char *fname; mmsx_t *stream; const mms_io_t *io; int need_abort; @@ -49,35 +50,61 @@ const char * mms_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", static DB_FILE * mms_open (const char *fname) { MMS_FILE *fp = malloc (sizeof (MMS_FILE)); + memset (fp, 0, sizeof (MMS_FILE)); fp->io = mms_get_default_io_impl(); - fp->stream = mmsx_connect ((mms_io_t *)fp->io, fp, fname, 1544000, &fp->need_abort); - if (!fp->stream) { - free (fp); - return NULL; - } + fp->fname = strdup (fname); fp->vfs = &plugin; return (DB_FILE*)fp; } static void mms_close (DB_FILE *stream) { + //fprintf (stderr, "\033[0;32mmms_close was called\033[37;0m\n"); assert (stream); - mmsx_close (((MMS_FILE *)stream)->stream); + MMS_FILE *fp = (MMS_FILE *)stream; + if (fp->stream) { + mmsx_close (fp->stream); + } + if (fp->fname) { + free (fp->fname); + } free (stream); } +static int +mms_ensure_connected (MMS_FILE *fp) { + if (!fp->stream) { + fp->stream = mmsx_connect ((mms_io_t *)fp->io, fp, fp->fname, 1544000, &fp->need_abort); + if (!fp->stream) { + return -1; + } + } + return 0; +} + static size_t mms_read (void *ptr, size_t size, size_t nmemb, DB_FILE *stream) { assert (stream); assert (ptr); + int connect_err = mms_ensure_connected ((MMS_FILE *)stream); + if (connect_err < 0) { + return connect_err; + } MMS_FILE *fp = (MMS_FILE *)stream; int res = mmsx_read ((mms_io_t *)fp->io, fp->stream, ptr, size * nmemb); + if (fp->need_abort) { + return -1; + } return res; } static int mms_seek (DB_FILE *stream, int64_t offset, int whence) { assert (stream); + int connect_err = mms_ensure_connected ((MMS_FILE *)stream); + if (connect_err < 0) { + return connect_err; + } MMS_FILE *fp = (MMS_FILE *)stream; return mmsx_seek ((mms_io_t *)fp->io, fp->stream, offset, whence); } @@ -85,6 +112,10 @@ mms_seek (DB_FILE *stream, int64_t offset, int whence) { static int64_t mms_tell (DB_FILE *stream) { assert (stream); + int connect_err = mms_ensure_connected ((MMS_FILE *)stream); + if (connect_err < 0) { + return connect_err; + } return mmsx_get_current_pos (((MMS_FILE *)stream)->stream); } @@ -98,6 +129,10 @@ mms_rewind (DB_FILE *stream) { static int64_t mms_getlength (DB_FILE *stream) { assert (stream); + int connect_err = mms_ensure_connected ((MMS_FILE *)stream); + if (connect_err < 0) { + return connect_err; + } MMS_FILE *f = (MMS_FILE *)stream; return mmsx_get_length (f->stream); } @@ -121,6 +156,7 @@ mms_is_streaming (void) { static void mms_abort (DB_FILE *fp) { + //fprintf (stderr, "\033[0;35mabort called\033[37;0m\n"); ((MMS_FILE *)fp)->need_abort = 1; } diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c index 132adebc..c8a696ad 100644 --- a/plugins/mpgmad/mpgmad.c +++ b/plugins/mpgmad/mpgmad.c @@ -579,8 +579,6 @@ cmp3_scan_stream (buffer_t *buffer, int sample) { } } if (sample == 0) { - trace ("cmp3_scan_stream: trying to figure out duration from file size\n"); - buffer->samplerate = samplerate; if (buffer->file->vfs->is_streaming ()) { // only suitable for cbr files, used if streaming int sz = deadbeef->fgetlength (buffer->file); diff --git a/plugins/shellexecui/Makefile.am b/plugins/shellexecui/Makefile.am index 688d271f..e8945130 100644 --- a/plugins/shellexecui/Makefile.am +++ b/plugins/shellexecui/Makefile.am @@ -19,12 +19,6 @@ AM_CFLAGS = $(CFLAGS) -std=c99 -fPIC if HAVE_GTK2 shellexecui_gtk2_la_SOURCES = shellexecui.c interface.c support.c callbacks.c interface.h support.h callbacks.h shellexecui_gtk2_la_LDFLAGS = -module -endif -if HAVE_GTK3 -shellexecui_gtk3_la_SOURCES = shellexecui.c interface.c support.c callbacks.c interface.h support.h callbacks.h -shellexecui_gtk3_la_LDFLAGS = -module -endif - if STATICLINK GTK_ROOT=@top_srcdir@/$(LIB)/gtk-2.12.12/usr @@ -32,15 +26,26 @@ shellexecui_gtk2_la_LIBADD = $(LDADD) -L$(GTK_ROOT)/lib $(GTK_ROOT)/lib/libgtk-x shellexecui_gtk2_la_CFLAGS = -std=c99 -I $(GTK_ROOT)/include -I $(GTK_ROOT)/lib/gtk-2.0/include -I $(GTK_ROOT)/include/glib-2.0 -I $(GTK_ROOT)/include/gtk-2.0 -I $(GTK_ROOT)/include/cairo -I $(GTK_ROOT)/lib/glib-2.0/include/ -I $(GTK_ROOT)/include/pango-1.0 -I $(GTK_ROOT)/include/atk-1.0 -DULTRA_COMPATIBLE=1 else -if HAVE_GTK2 shellexecui_gtk2_la_LIBADD = $(LDADD) $(GTK2_DEPS_LIBS) shellexecui_gtk2_la_CFLAGS = -std=c99 $(GTK2_DEPS_CFLAGS) endif +endif + if HAVE_GTK3 +shellexecui_gtk3_la_SOURCES = shellexecui.c interface.c support.c callbacks.c interface.h support.h callbacks.h +shellexecui_gtk3_la_LDFLAGS = -module +if STATICLINK +GTK_ROOT_300=@top_srcdir@/$(LIB)/gtk-3.0.0 + +shellexecui_gtk3_la_LIBADD = $(LDADD) -L$(GTK_ROOT_300)/lib -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lfreetype -lfontconfig $(SM_LIBADD) + +shellexecui_gtk3_la_CFLAGS = -std=c99 -I$(GTK_ROOT_300)/include/gtk-3.0 -I$(GTK_ROOT_300)/include/pango-1.0 -I$(GTK_ROOT_300)/include/gio-unix-2.0/ -I$(GTK_ROOT_300)/include/atk-1.0 -I$(GTK_ROOT_300)/include/cairo -I$(GTK_ROOT_300)/include/gdk-pixbuf-2.0 -I$(GTK_ROOT_300)/include/freetype2 -I$(GTK_ROOT_300)/include/glib-2.0 -I$(GTK_ROOT_300)/lib/glib-2.0/include $(SM_CFLAGS) + +else shellexecui_gtk3_la_LIBADD = $(LDADD) $(GTK3_DEPS_LIBS) shellexecui_gtk3_la_CFLAGS = -std=c99 $(GTK3_DEPS_CFLAGS) endif - endif + endif diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index a121695a..6036d215 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -316,6 +316,9 @@ cvorbis_read (DB_fileinfo_t *_info, char *bytes, int size) { ogg_info_t *info = (ogg_info_t *)_info; // trace ("cvorbis_read %d bytes\n", size); + _info->fmt.channels = info->vi->channels; + _info->fmt.samplerate = info->vi->rate; + int samplesize = _info->fmt.channels * _info->fmt.bps / 8; if (!info->info.file->vfs->is_streaming ()) { diff --git a/plugins/wavpack/wavpack.c b/plugins/wavpack/wavpack.c index 7e81f5e9..c28478c9 100644 --- a/plugins/wavpack/wavpack.c +++ b/plugins/wavpack/wavpack.c @@ -162,7 +162,15 @@ wv_init (DB_fileinfo_t *_info, DB_playItem_t *it) { _info->fmt.channels = WavpackGetNumChannels (info->ctx); _info->fmt.samplerate = WavpackGetSampleRate (info->ctx); _info->fmt.is_float = (WavpackGetMode (info->ctx) & MODE_FLOAT) ? 1 : 0; - _info->fmt.channelmask = WavpackGetChannelMask (info->ctx); + + // FIXME: streamer and maybe output plugins need to be fixed to support + // arbitrary channelmask + + // _info->fmt.channelmask = WavpackGetChannelMask (info->ctx); + + for (int i = 0; i < _info->fmt.channels; i++) { + _info->fmt.channelmask |= 1 << i; + } _info->readpos = 0; if (it->endsample > 0) { info->startsample = it->startsample; |