mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-11 14:30:20 -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:
@@ -1120,7 +1120,7 @@ static struct airplay_master_session *
|
||||
master_session_make(struct media_quality *quality)
|
||||
{
|
||||
struct airplay_master_session *rms;
|
||||
struct decode_ctx *decode_ctx;
|
||||
struct transcode_encode_setup_args encode_args = { .profile = XCODE_ALAC, .quality = quality };
|
||||
int ret;
|
||||
|
||||
// First check if we already have a suitable session
|
||||
@@ -1146,15 +1146,15 @@ master_session_make(struct media_quality *quality)
|
||||
goto error;
|
||||
}
|
||||
|
||||
decode_ctx = transcode_decode_setup_raw(XCODE_PCM16, quality);
|
||||
if (!decode_ctx)
|
||||
encode_args.src_ctx = transcode_decode_setup_raw(XCODE_PCM16, quality);
|
||||
if (!encode_args.src_ctx)
|
||||
{
|
||||
DPRINTF(E_LOG, L_AIRPLAY, "Could not create decoding context\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
rms->encode_ctx = transcode_encode_setup(XCODE_ALAC, quality, decode_ctx, 0, 0);
|
||||
transcode_decode_cleanup(&decode_ctx);
|
||||
rms->encode_ctx = transcode_encode_setup(encode_args);
|
||||
transcode_decode_cleanup(&encode_args.src_ctx);
|
||||
if (!rms->encode_ctx)
|
||||
{
|
||||
DPRINTF(E_LOG, L_AIRPLAY, "Will not be able to stream AirPlay 2, ffmpeg has no ALAC encoder\n");
|
||||
|
||||
@@ -2362,7 +2362,7 @@ cast_metadata_send(struct output_metadata *metadata)
|
||||
static int
|
||||
cast_init(void)
|
||||
{
|
||||
struct decode_ctx *decode_ctx;
|
||||
struct transcode_encode_setup_args encode_args = { .profile = XCODE_OPUS, .quality = &cast_quality_default };
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
@@ -2386,15 +2386,15 @@ cast_init(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
decode_ctx = transcode_decode_setup_raw(XCODE_PCM16, &cast_quality_default);
|
||||
if (!decode_ctx)
|
||||
encode_args.src_ctx = transcode_decode_setup_raw(XCODE_PCM16, &cast_quality_default);
|
||||
if (!encode_args.src_ctx)
|
||||
{
|
||||
DPRINTF(E_LOG, L_CAST, "Could not create decoding context\n");
|
||||
goto out_tls_deinit;
|
||||
}
|
||||
|
||||
cast_encode_ctx = transcode_encode_setup(XCODE_OPUS, &cast_quality_default, decode_ctx, 0, 0);
|
||||
transcode_decode_cleanup(&decode_ctx);
|
||||
cast_encode_ctx = transcode_encode_setup(encode_args);
|
||||
transcode_decode_cleanup(&encode_args.src_ctx);
|
||||
if (!cast_encode_ctx)
|
||||
{
|
||||
DPRINTF(E_LOG, L_CAST, "Will not be able to stream Chromecast, libav does not support Opus encoding\n");
|
||||
|
||||
@@ -1855,7 +1855,7 @@ static struct raop_master_session *
|
||||
master_session_make(struct media_quality *quality, bool encrypt)
|
||||
{
|
||||
struct raop_master_session *rms;
|
||||
struct decode_ctx *decode_ctx;
|
||||
struct transcode_encode_setup_args encode_args = { .profile = XCODE_ALAC, .quality = quality };
|
||||
int ret;
|
||||
|
||||
// First check if we already have a suitable session
|
||||
@@ -1883,15 +1883,15 @@ master_session_make(struct media_quality *quality, bool encrypt)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
decode_ctx = transcode_decode_setup_raw(XCODE_PCM16, quality);
|
||||
if (!decode_ctx)
|
||||
encode_args.src_ctx = transcode_decode_setup_raw(XCODE_PCM16, quality);
|
||||
if (!encode_args.src_ctx)
|
||||
{
|
||||
DPRINTF(E_LOG, L_RAOP, "Could not create decoding context\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
rms->encode_ctx = transcode_encode_setup(XCODE_ALAC, quality, decode_ctx, 0, 0);
|
||||
transcode_decode_cleanup(&decode_ctx);
|
||||
rms->encode_ctx = transcode_encode_setup(encode_args);
|
||||
transcode_decode_cleanup(&encode_args.src_ctx);
|
||||
if (!rms->encode_ctx)
|
||||
{
|
||||
DPRINTF(E_LOG, L_RAOP, "Will not be able to stream AirPlay 2, ffmpeg has no ALAC encoder\n");
|
||||
|
||||
@@ -115,17 +115,17 @@ extern struct event_base *evbase_player;
|
||||
static struct encode_ctx *
|
||||
encoder_setup(enum player_format format, struct media_quality *quality)
|
||||
{
|
||||
struct decode_ctx *decode_ctx = NULL;
|
||||
struct transcode_encode_setup_args encode_args = { .profile = XCODE_MP3, .quality = quality };
|
||||
struct encode_ctx *encode_ctx = NULL;
|
||||
|
||||
if (quality->bits_per_sample == 16)
|
||||
decode_ctx = transcode_decode_setup_raw(XCODE_PCM16, quality);
|
||||
encode_args.src_ctx = transcode_decode_setup_raw(XCODE_PCM16, quality);
|
||||
else if (quality->bits_per_sample == 24)
|
||||
decode_ctx = transcode_decode_setup_raw(XCODE_PCM24, quality);
|
||||
encode_args.src_ctx = transcode_decode_setup_raw(XCODE_PCM24, quality);
|
||||
else if (quality->bits_per_sample == 32)
|
||||
decode_ctx = transcode_decode_setup_raw(XCODE_PCM32, quality);
|
||||
encode_args.src_ctx = transcode_decode_setup_raw(XCODE_PCM32, quality);
|
||||
|
||||
if (!decode_ctx)
|
||||
if (!encode_args.src_ctx)
|
||||
{
|
||||
DPRINTF(E_LOG, L_STREAMING, "Error setting up decoder for quality sr %d, bps %d, ch %d, cannot encode\n",
|
||||
quality->sample_rate, quality->bits_per_sample, quality->channels);
|
||||
@@ -133,7 +133,7 @@ encoder_setup(enum player_format format, struct media_quality *quality)
|
||||
}
|
||||
|
||||
if (format == PLAYER_FORMAT_MP3)
|
||||
encode_ctx = transcode_encode_setup(XCODE_MP3, quality, decode_ctx, 0, 0);
|
||||
encode_ctx = transcode_encode_setup(encode_args);
|
||||
|
||||
if (!encode_ctx)
|
||||
{
|
||||
@@ -143,7 +143,7 @@ encoder_setup(enum player_format format, struct media_quality *quality)
|
||||
}
|
||||
|
||||
out:
|
||||
transcode_decode_cleanup(&decode_ctx);
|
||||
transcode_decode_cleanup(&encode_args.src_ctx);
|
||||
return encode_ctx;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user