Commit e4f129bf authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

amem: call cleanup() if setup() succeeded but format is unsupported

parent d9cf7d2f
...@@ -148,6 +148,15 @@ static int SoftMuteSet (audio_output_t *aout, bool mute) ...@@ -148,6 +148,15 @@ static int SoftMuteSet (audio_output_t *aout, bool mute)
return 0; return 0;
} }
static void Stop (audio_output_t *aout)
{
aout_sys_t *sys = aout->sys;
if (sys->cleanup != NULL)
sys->cleanup (sys->opaque);
sys->ready = false;
}
static int Start (audio_output_t *aout, audio_sample_format_t *fmt) static int Start (audio_output_t *aout, audio_sample_format_t *fmt)
{ {
aout_sys_t *sys = aout->sys; aout_sys_t *sys = aout->sys;
...@@ -173,14 +182,14 @@ static int Start (audio_output_t *aout, audio_sample_format_t *fmt) ...@@ -173,14 +182,14 @@ static int Start (audio_output_t *aout, audio_sample_format_t *fmt)
if (sys->set_volume != NULL) if (sys->set_volume != NULL)
sys->set_volume(sys->opaque, sys->volume, sys->mute); sys->set_volume(sys->opaque, sys->volume, sys->mute);
/* Ensure that format is supported */
if (fmt->i_rate == 0 || fmt->i_rate > 192000 if (fmt->i_rate == 0 || fmt->i_rate > 192000
|| channels == 0 || channels > AOUT_CHAN_MAX) || channels == 0 || channels > AOUT_CHAN_MAX
return VLC_EGENERIC; || strcmp(format, "S16N") /* TODO: amem-format */)
/* TODO: amem-format */
if (strcmp(format, "S16N"))
{ {
msg_Err (aout, "format not supported"); msg_Err (aout, "format not supported: %s, %u channel(s), %u Hz",
format, channels, fmt->i_rate);
Stop (aout);
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -223,15 +232,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *fmt) ...@@ -223,15 +232,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *fmt)
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static void Stop (audio_output_t *aout)
{
aout_sys_t *sys = aout->sys;
if (sys->cleanup != NULL)
sys->cleanup (sys->opaque);
sys->ready = false;
}
static int Open (vlc_object_t *obj) static int Open (vlc_object_t *obj)
{ {
audio_output_t *aout = (audio_output_t *)obj; audio_output_t *aout = (audio_output_t *)obj;
......
Markdown is supported
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