Commit 1b999294 authored by Thomas Guillem's avatar Thomas Guillem
Browse files

pulse: handle DTS-HD

parent 96c67c62
......@@ -690,7 +690,8 @@ static const char *str_map(const char *key, const char *const table[][2],
/**
* Create a PulseAudio playback stream, a.k.a. a sink input.
*/
static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
static int Restart(audio_output_t *aout, audio_sample_format_t *restrict pfmt,
bool force_dts_core)
{
aout_sys_t *sys = aout->sys;
......@@ -734,9 +735,20 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
ss.format = PA_SAMPLE_S16NE;
break;*/
case VLC_CODEC_DTS:
fmt->i_format = VLC_CODEC_SPDIFL;
fmt->i_bytes_per_frame = 4;
fmt->i_frame_length = 1;
if (fmt.i_rate >= 48000 && !force_dts_core)
{
/* Try to configure the output rate (IEC958 rate) at 192kHz.
* Indeed, DTS-HD (and other DTS extensions) can only be
* transmitted at 192kHz minimum. We'll also be able to
* transmit DTS-Core only at this rate. */
/* FIXME: DTS-X and DTS-HDMA @192kHz should be transmitted at
* 768kHz. This is not possible (for now) with pulse audio. */
fmt.i_rate = 192000;
}
fmt.i_format = VLC_CODEC_SPDIFL;
fmt.i_bytes_per_frame = 4;
fmt.i_frame_length = 1;
encoding = PA_ENCODING_DTS_IEC61937;
ss.format = PA_SAMPLE_S16NE;
break;
......@@ -922,8 +934,19 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
cvolume, NULL) < 0
|| stream_wait(s, sys->mainloop)) {
if (encoding != PA_ENCODING_INVALID)
{
if (pfmt->i_format == VLC_CODEC_DTS && fmt.i_rate == 192000
&& !force_dts_core)
{
msg_Warn(aout, "configuring DTS at 192kHz IEC958 rate failed "
"(HDMI), fallback to 48kHz (S/PDIF)");
pa_threaded_mainloop_unlock(sys->mainloop);
Stop(aout);
return Restart(aout, pfmt, true);
}
vlc_pa_error(aout, "digital pass-through stream connection failure",
sys->context);
}
else
vlc_pa_error(aout, "stream connection failure", sys->context);
goto fail;
......@@ -951,6 +974,14 @@ fail:
return VLC_EGENERIC;
}
/**
* Create a PulseAudio playback stream, a.k.a. a sink input.
*/
static int Start(audio_output_t *aout, audio_sample_format_t *restrict pfmt)
{
return Restart(aout, pfmt, false);
}
/**
* Removes a PulseAudio playback stream
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment