[input] Add Spotify input module

This commit is contained in:
ejurgensen
2016-12-29 00:39:23 +01:00
parent c92ebf9dfb
commit 79639c73ed
7 changed files with 161 additions and 202 deletions

View File

@@ -46,11 +46,17 @@
extern struct input_definition input_file;
extern struct input_definition input_http;
#ifdef HAVE_SPOTIFY_H
extern struct input_definition input_spotify;
#endif
// Must be in sync with enum input_types
static struct input_definition *inputs[] = {
&input_file,
&input_http,
#ifdef HAVE_SPOTIFY_H
&input_spotify,
#endif
NULL
};
@@ -124,6 +130,11 @@ map_data_kind(int data_kind)
case DATA_KIND_HTTP:
return INPUT_TYPE_HTTP;
#ifdef HAVE_SPOTIFY_H
case DATA_KIND_SPOTIFY:
return INPUT_TYPE_SPOTIFY;
#endif
default:
return -1;
}
@@ -185,6 +196,15 @@ playback(void *arg)
pthread_exit(NULL);
}
void
input_wait(void)
{
pthread_mutex_lock(&input_buffer.mutex);
pthread_cond_wait(&input_buffer.cond, &input_buffer.mutex);
pthread_mutex_unlock(&input_buffer.mutex);
}
// Called by input modules from within the playback loop
int
input_write(struct evbuffer *evbuf, short flags)
@@ -333,6 +353,7 @@ input_pause(struct player_source *ps)
pthread_cond_signal(&input_buffer.cond);
pthread_mutex_unlock(&input_buffer.mutex);
// TODO What if input thread is hanging waiting for source? Kill thread?
ret = pthread_join(tid_input, NULL);
if (ret != 0)
{