mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-12 06:50:19 -05:00
[xcode] Change the signature of transcode_setup/transcode_en/decode_setup()
Should make it easier to add/remove parameters without changing all calls to the functions throughout the code. Also adds an interface through which to call make_mp4_header().
This commit is contained in:
@@ -36,9 +36,11 @@
|
||||
static int
|
||||
setup(struct input_source *source)
|
||||
{
|
||||
struct transcode_decode_setup_args decode_args = { .profile = XCODE_PCM_NATIVE, .path = source->path, .len_ms = source->len_ms };
|
||||
struct transcode_encode_setup_args encode_args = { .profile = XCODE_PCM_NATIVE, };
|
||||
struct transcode_ctx *ctx;
|
||||
|
||||
ctx = transcode_setup(XCODE_PCM_NATIVE, NULL, source->data_kind, source->path, source->len_ms);
|
||||
ctx = transcode_setup(decode_args, encode_args);
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -295,6 +295,8 @@ metadata_prepare(struct input_source *source)
|
||||
static int
|
||||
setup(struct input_source *source)
|
||||
{
|
||||
struct transcode_decode_setup_args decode_args = { .profile = XCODE_PCM_NATIVE, .is_http = true, .len_ms = source->len_ms };
|
||||
struct transcode_encode_setup_args encode_args = { .profile = XCODE_PCM_NATIVE, };
|
||||
struct transcode_ctx *ctx;
|
||||
char *url;
|
||||
|
||||
@@ -303,8 +305,9 @@ setup(struct input_source *source)
|
||||
|
||||
free(source->path);
|
||||
source->path = url;
|
||||
decode_args.path = url;
|
||||
|
||||
ctx = transcode_setup(XCODE_PCM_NATIVE, NULL, source->data_kind, source->path, source->len_ms);
|
||||
ctx = transcode_setup(decode_args, encode_args);
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -391,21 +391,18 @@ download_seek(void *arg, int64_t offset, enum transcode_seek_type type)
|
||||
static int
|
||||
download_xcode_setup(struct download_ctx *download)
|
||||
{
|
||||
struct transcode_ctx *xcode;
|
||||
struct transcode_decode_setup_args decode_args = { .profile = XCODE_OGG, .len_ms = download->len_ms };
|
||||
struct transcode_encode_setup_args encode_args = { .profile = XCODE_PCM16, };
|
||||
struct transcode_evbuf_io xcode_evbuf_io = { 0 };
|
||||
|
||||
CHECK_NULL(L_SPOTIFY, xcode = malloc(sizeof(struct transcode_ctx)));
|
||||
struct transcode_ctx *xcode;
|
||||
|
||||
xcode_evbuf_io.evbuf = download->read_buf;
|
||||
xcode_evbuf_io.seekfn = download_seek;
|
||||
xcode_evbuf_io.seekfn_arg = download;
|
||||
decode_args.evbuf_io = &xcode_evbuf_io;
|
||||
|
||||
xcode->decode_ctx = transcode_decode_setup(XCODE_OGG, NULL, DATA_KIND_SPOTIFY, NULL, &xcode_evbuf_io, download->len_ms);
|
||||
if (!xcode->decode_ctx)
|
||||
goto error;
|
||||
|
||||
xcode->encode_ctx = transcode_encode_setup(XCODE_PCM16, NULL, xcode->decode_ctx, 0, 0);
|
||||
if (!xcode->encode_ctx)
|
||||
xcode = transcode_setup(decode_args, encode_args);
|
||||
if (!xcode)
|
||||
goto error;
|
||||
|
||||
download->xcode = xcode;
|
||||
|
||||
Reference in New Issue
Block a user