Mercurial > audlegacy-plugins
changeset 469:1256144d2a6e trunk
[svn] - fix crash
- finish shout metadata support
author | nenolod |
---|---|
date | Sun, 21 Jan 2007 02:09:42 -0800 |
parents | 2e4d10f3f9cb |
children | 220515815cf8 |
files | ChangeLog src/curl/curl.c src/mpg123/mpg123.c |
diffstat | 3 files changed, 51 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Jan 21 01:55:08 2007 -0800 +++ b/ChangeLog Sun Jan 21 02:09:42 2007 -0800 @@ -1,3 +1,11 @@ +2007-01-21 09:55:08 +0000 William Pitcock <nenolod@sacredspiral.co.uk> + revision [1022] + - always make sure the returned data is strdup'd + + trunk/src/mpg123/common.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + 2007-01-21 09:49:43 +0000 William Pitcock <nenolod@sacredspiral.co.uk> revision [1020] - implement mpgdec_metadata()
--- a/src/curl/curl.c Sun Jan 21 01:55:08 2007 -0800 +++ b/src/curl/curl.c Sun Jan 21 02:09:42 2007 -0800 @@ -33,8 +33,8 @@ #define DEBUG_HEADERS 0 #define DEBUG_ICY 0 #define DEBUG_ICY_VERBOSE 0 -#define XXXX_FIXED_METADATA 0 -#define DEBUG_METADATA_REPORT 0 +#define XXXX_FIXED_METADATA 1 +#define DEBUG_METADATA_REPORT 1 typedef struct _CurlHandle CurlHandle; @@ -707,9 +707,9 @@ curl_vfs_metadata_impl(VFSFile * file, const gchar * field) { CurlHandle *handle = file->handle; - if (!strcmp(field, "stream-name")) + if (!strcmp(field, "stream-name") && handle->name != NULL) return strdup(handle->name); - if (!strcmp(field, "track-name")) + if (!strcmp(field, "track-name") && handle->title != NULL) return strdup(handle->title); return NULL; }
--- a/src/mpg123/mpg123.c Sun Jan 21 01:55:08 2007 -0800 +++ b/src/mpg123/mpg123.c Sun Jan 21 02:09:42 2007 -0800 @@ -671,6 +671,7 @@ static void * decode_loop(void *arg) { + static gchar *old_title = NULL; gboolean have_xing_header = FALSE, vbr = FALSE; int disp_count = 0; char *filename = arg; @@ -761,7 +762,17 @@ } } else { - mpgdec_title = mpgdec_metadata("stream-name"); + gchar *tmp = mpgdec_metadata("stream-name"); + old_title = mpgdec_metadata("track-name"); + + if (old_title != NULL) + { + mpgdec_title = g_strdup_printf("%s (%s)", old_title, tmp); + g_free(tmp); + } + else + mpgdec_title = tmp; + mpgdec_length = -1; } @@ -848,10 +859,32 @@ mpgdec_bitrate * 1000, mpgdec_frequency, mpgdec_stereo); } + } else disp_count--; play_frame(&fr); + + { + gchar *new_title = mpgdec_metadata("track-name"); + gchar *srv_name = mpgdec_metadata("stream-name"); + + if (old_title == NULL || g_strcasecmp(old_title, new_title)) + { + g_free(mpgdec_title); + mpgdec_title = g_strdup_printf("%s (%s)", + new_title, srv_name); + + g_free(old_title); + old_title = new_title; + + g_free(srv_name); + + mpgdec_ip.set_info(mpgdec_title, mpgdec_length, + mpgdec_bitrate * 1000, + mpgdec_frequency, mpgdec_stereo); + } + } } else { mpgdec_ip.output->buffer_free(); @@ -865,6 +898,11 @@ } } g_free(mpgdec_title); + + if (old_title != NULL) + g_free(old_title); + + old_title = NULL; mpgdec_title = NULL; mpgdec_stream_close(); if (output_opened && !audio_error)