Commit e228caac authored by Max Kellermann's avatar Max Kellermann

Merge branch 'v0.16.x'

Conflicts: src/decoder/ffmpeg_decoder_plugin.c
parents 9ac8f89b 4b4aa642
......@@ -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)
......
......@@ -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;
......
......@@ -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 *
......
......@@ -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 {
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment