diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | src/decoder/ffmpeg_decoder_plugin.c | 9 | ||||
-rw-r--r-- | src/directory.h | 3 | ||||
-rw-r--r-- | src/playlist_song.c | 9 | ||||
-rw-r--r-- | src/playlist_vector.h | 6 |
5 files changed, 30 insertions, 2 deletions
@@ -21,6 +21,11 @@ ver 0.17 (2011/??/??) ver 0.16.3 (2011/??/??) * fix assertion failure in audio format mask parser +* fix NULL pointer dereference in playlist parser +* fix playlist files in base music directory +* database: allow directories with just playlists +* decoder: + - ffmpeg: support libavcodec 0.7 ver 0.16.2 (2011/03/18) diff --git a/src/decoder/ffmpeg_decoder_plugin.c b/src/decoder/ffmpeg_decoder_plugin.c index 757442a3b..5f11683a0 100644 --- a/src/decoder/ffmpeg_decoder_plugin.c +++ b/src/decoder/ffmpeg_decoder_plugin.c @@ -71,6 +71,11 @@ mpd_ffmpeg_log_callback(G_GNUC_UNUSED void *ptr, int level, } } + +#ifndef AV_VERSION_INT +#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) +#endif + struct mpd_ffmpeg_stream { struct decoder *decoder; struct input_stream *input; @@ -154,7 +159,11 @@ ffmpeg_find_audio_stream(const AVFormatContext *format_context) { for (unsigned i = 0; i < format_context->nb_streams; ++i) if (format_context->streams[i]->codec->codec_type == +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 64, 0) + AVMEDIA_TYPE_AUDIO) +#else CODEC_TYPE_AUDIO) +#endif return i; return -1; diff --git a/src/directory.h b/src/directory.h index 98cc5f169..a3ad0ffa3 100644 --- a/src/directory.h +++ b/src/directory.h @@ -62,7 +62,8 @@ directory_free(struct directory *directory); static inline bool directory_is_empty(const struct directory *directory) { - return directory->children.nr == 0 && directory->songs.nr == 0; + return directory->children.nr == 0 && directory->songs.nr == 0 && + playlist_vector_is_empty(&directory->playlists); } static inline const char * diff --git a/src/playlist_song.c b/src/playlist_song.c index 38750ec63..8c966d549 100644 --- a/src/playlist_song.c +++ b/src/playlist_song.c @@ -106,6 +106,13 @@ playlist_check_translate_song(struct song *song, const char *base_uri, } } + if (base_uri != NULL && strcmp(base_uri, ".") == 0) + /* g_path_get_dirname() returns "." when there is no + directory name in the given path; clear that now, + because it would break the database lookup + functions */ + base_uri = NULL; + if (g_path_is_absolute(uri)) { /* XXX fs_charset vs utf8? */ char *prefix = base_uri != NULL @@ -131,7 +138,7 @@ playlist_check_translate_song(struct song *song, const char *base_uri, else uri = g_strdup(uri); - if (uri_has_scheme(base_uri)) { + if (uri_has_scheme(uri)) { dest = song_remote_new(uri); g_free(uri); } else { diff --git a/src/playlist_vector.h b/src/playlist_vector.h index a16ab7c5d..8aa19a4e0 100644 --- a/src/playlist_vector.h +++ b/src/playlist_vector.h @@ -51,6 +51,12 @@ playlist_vector_init(struct playlist_vector *pv) void playlist_vector_deinit(struct playlist_vector *pv); +static inline bool +playlist_vector_is_empty(const struct playlist_vector *pv) +{ + return pv->head == NULL; +} + struct playlist_metadata * playlist_vector_find(struct playlist_vector *pv, const char *name); |