playlist_list: moved input_stream.ready loop to calling function
Merged both loops into playlist_list_open_stream(). This is needed because playlist_list_open_stream() needs to know the MIME type, which is only known after the stream has become "ready".
This commit is contained in:
parent
cd21cfc115
commit
68f75955d8
|
@ -192,22 +192,11 @@ playlist_list_open_uri(const char *uri)
|
||||||
static struct playlist_provider *
|
static struct playlist_provider *
|
||||||
playlist_list_open_stream_mime(struct input_stream *is)
|
playlist_list_open_stream_mime(struct input_stream *is)
|
||||||
{
|
{
|
||||||
GError* error = NULL;
|
|
||||||
struct playlist_provider *playlist;
|
struct playlist_provider *playlist;
|
||||||
|
|
||||||
assert(is != NULL);
|
assert(is != NULL);
|
||||||
assert(is->mime != NULL);
|
assert(is->mime != NULL);
|
||||||
|
|
||||||
while (!is->ready) {
|
|
||||||
int ret = input_stream_buffer(is, &error);
|
|
||||||
if (ret < 0) {
|
|
||||||
input_stream_close(is);
|
|
||||||
g_warning("%s", error->message);
|
|
||||||
g_error_free(error);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned i = 0; playlist_plugins[i] != NULL; ++i) {
|
for (unsigned i = 0; playlist_plugins[i] != NULL; ++i) {
|
||||||
const struct playlist_plugin *plugin = playlist_plugins[i];
|
const struct playlist_plugin *plugin = playlist_plugins[i];
|
||||||
|
|
||||||
|
@ -231,22 +220,11 @@ playlist_list_open_stream_mime(struct input_stream *is)
|
||||||
static struct playlist_provider *
|
static struct playlist_provider *
|
||||||
playlist_list_open_stream_suffix(struct input_stream *is, const char *suffix)
|
playlist_list_open_stream_suffix(struct input_stream *is, const char *suffix)
|
||||||
{
|
{
|
||||||
GError* error = NULL;
|
|
||||||
struct playlist_provider *playlist;
|
struct playlist_provider *playlist;
|
||||||
|
|
||||||
assert(is != NULL);
|
assert(is != NULL);
|
||||||
assert(suffix != NULL);
|
assert(suffix != NULL);
|
||||||
|
|
||||||
while (!is->ready) {
|
|
||||||
int ret = input_stream_buffer(is, &error);
|
|
||||||
if (ret < 0) {
|
|
||||||
input_stream_close(is);
|
|
||||||
g_warning("%s", error->message);
|
|
||||||
g_error_free(error);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned i = 0; playlist_plugins[i] != NULL; ++i) {
|
for (unsigned i = 0; playlist_plugins[i] != NULL; ++i) {
|
||||||
const struct playlist_plugin *plugin = playlist_plugins[i];
|
const struct playlist_plugin *plugin = playlist_plugins[i];
|
||||||
|
|
||||||
|
@ -273,6 +251,17 @@ playlist_list_open_stream(struct input_stream *is, const char *uri)
|
||||||
const char *suffix;
|
const char *suffix;
|
||||||
struct playlist_provider *playlist;
|
struct playlist_provider *playlist;
|
||||||
|
|
||||||
|
GError *error = NULL;
|
||||||
|
while (!is->ready) {
|
||||||
|
int ret = input_stream_buffer(is, &error);
|
||||||
|
if (ret < 0) {
|
||||||
|
input_stream_close(is);
|
||||||
|
g_warning("%s", error->message);
|
||||||
|
g_error_free(error);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is->mime != NULL) {
|
if (is->mime != NULL) {
|
||||||
playlist = playlist_list_open_stream_mime(is);
|
playlist = playlist_list_open_stream_mime(is);
|
||||||
if (playlist != NULL)
|
if (playlist != NULL)
|
||||||
|
|
Loading…
Reference in New Issue