[input] Rename player source ->xcode to ->input_ctx, because any input may use it, not just transcode

This commit is contained in:
ejurgensen 2017-02-08 22:23:17 +01:00
parent a183463bb2
commit f27fb53caf
2 changed files with 14 additions and 8 deletions

View File

@ -65,7 +65,13 @@ struct player_source
end of file, until then it is 0. */
uint64_t end;
struct transcode_ctx *xcode;
/* Opaque pointer to data that the input sets up when called with setup(), and
* which is cleaned up by the input with stop()
*/
void *input_ctx;
/* Input has completed setup of the source
*/
int setup_done;
struct player_source *play_next;

View File

@ -31,8 +31,8 @@
static int
setup(struct player_source *ps)
{
ps->xcode = transcode_setup(ps->data_kind, ps->path, ps->len_ms, XCODE_PCM16_NOHEADER, NULL);
if (!ps->xcode)
ps->input_ctx = transcode_setup(ps->data_kind, ps->path, ps->len_ms, XCODE_PCM16_NOHEADER, NULL);
if (!ps->input_ctx)
return -1;
ps->setup_done = 1;
@ -70,7 +70,7 @@ start(struct player_source *ps)
{
// We set "wanted" to 1 because the read size doesn't matter to us
// TODO optimize?
ret = transcode(evbuf, 1, ps->xcode, &icy_timer);
ret = transcode(evbuf, 1, ps->input_ctx, &icy_timer);
if (ret < 0)
break;
@ -90,9 +90,9 @@ start(struct player_source *ps)
static int
stop(struct player_source *ps)
{
transcode_cleanup(ps->xcode);
transcode_cleanup(ps->input_ctx);
ps->xcode = NULL;
ps->input_ctx = NULL;
ps->setup_done = 0;
return 0;
@ -101,7 +101,7 @@ stop(struct player_source *ps)
static int
seek(struct player_source *ps, int seek_ms)
{
return transcode_seek(ps->xcode, seek_ms);
return transcode_seek(ps->input_ctx, seek_ms);
}
static int
@ -110,7 +110,7 @@ metadata_get_http(struct input_metadata *metadata, struct player_source *ps, uin
struct http_icy_metadata *m;
int changed;
m = transcode_metadata(ps->xcode, &changed);
m = transcode_metadata(ps->input_ctx, &changed);
if (!m)
return -1;