return -1;
}
- if( p_format->i_rate > 192000 )
+ if( p_format->i_rate > 352800 )
{
msg_Err( p_aout, "excessive audio sample frequency (%u)",
p_format->i_rate );
atomic_store (&owner->restart, 0);
owner->input_format = *p_format;
owner->mixer_format = owner->input_format;
+ owner->request_vout = *p_request_vout;
if (aout_OutputNew (p_aout, &owner->mixer_format))
goto error;
aout_volume_SetFormat (owner->volume, owner->mixer_format.i_format);
/* Create the audio filtering "input" pipeline */
- if (aout_FiltersNew (p_aout, p_format, &owner->mixer_format,
- p_request_vout))
+ owner->filters = aout_FiltersNew (p_aout, p_format, &owner->mixer_format,
+ &owner->request_vout);
+ if (owner->filters == NULL)
{
aout_OutputDelete (p_aout);
error:
aout_OutputLock (aout);
if (owner->mixer_format.i_format)
{
- aout_FiltersDelete (aout);
+ aout_FiltersDelete (aout, owner->filters);
aout_OutputDelete (aout);
}
aout_volume_Delete (owner->volume);
int restart = atomic_exchange (&owner->restart, 0);
if (unlikely(restart))
{
- const aout_request_vout_t request_vout = owner->request_vout;
-
if (owner->mixer_format.i_format)
- aout_FiltersDelete (aout);
+ aout_FiltersDelete (aout, owner->filters);
if (restart & AOUT_RESTART_OUTPUT)
{ /* Reinitializes the output */
owner->sync.end = VLC_TS_INVALID;
owner->sync.resamp_type = AOUT_RESAMPLING_NONE;
- if (owner->mixer_format.i_format
- && aout_FiltersNew (aout, &owner->input_format, &owner->mixer_format,
- &request_vout))
+ if (owner->mixer_format.i_format)
{
- aout_OutputDelete (aout);
- owner->mixer_format.i_format = 0;
+ owner->filters = aout_FiltersNew (aout, &owner->input_format,
+ &owner->mixer_format,
+ &owner->request_vout);
+ if (owner->filters == NULL)
+ {
+ aout_OutputDelete (aout);
+ owner->mixer_format.i_format = 0;
+ }
}
+ /* TODO: This would be a good time to call clean up any video output
+ * left over by an audio visualization:
+ input_resource_TerminatVout(MAGIC HERE); */
}
return (owner->mixer_format.i_format) ? 0 : -1;
}
* Buffer management
*/
-/*****************************************************************************
- * aout_DecNewBuffer : ask for a new empty buffer
- *****************************************************************************/
-block_t *aout_DecNewBuffer (audio_output_t *aout, size_t samples)
-{
- /* NOTE: the caller is responsible for serializing input change */
- aout_owner_t *owner = aout_owner (aout);
-
- size_t length = samples * owner->input_format.i_bytes_per_frame
- / owner->input_format.i_frame_length;
- block_t *block = block_Alloc( length );
- if( likely(block != NULL) )
- {
- block->i_nb_samples = samples;
- block->i_pts = block->i_length = 0;
- }
- return block;
-}
-
-/*****************************************************************************
- * aout_DecDeleteBuffer : destroy an undecoded buffer
- *****************************************************************************/
-void aout_DecDeleteBuffer (audio_output_t *aout, block_t *block)
-{
- (void) aout;
- block_Release (block);
-}
-
static void aout_StopResampling (audio_output_t *aout)
{
aout_owner_t *owner = aout_owner (aout);
owner->sync.resamp_type = AOUT_RESAMPLING_NONE;
- aout_FiltersAdjustResampling (aout, 0);
+ aout_FiltersAdjustResampling (owner->filters, 0);
}
static void aout_DecSilence (audio_output_t *aout, mtime_t length, mtime_t pts)
* value, then it is time to switch back the resampling direction. */
adj *= -1;
- if (!aout_FiltersAdjustResampling (aout, adj))
+ if (!aout_FiltersAdjustResampling (owner->filters, adj))
{ /* Everything is back to normal: stop resampling. */
owner->sync.resamp_type = AOUT_RESAMPLING_NONE;
msg_Dbg (aout, "resampling stopped (drift: %"PRId64" us)", drift);
if (block->i_flags & BLOCK_FLAG_DISCONTINUITY)
owner->sync.discontinuity = true;
- block = aout_FiltersPlay (aout, block, input_rate);
+ block = aout_FiltersPlay (owner->filters, block, input_rate);
if (block == NULL)
goto lost;