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

Merge aout_output_t into aout_instance_t

This prepares for a possible cleanup of the audio output object,
especially hiding more stuff into the core.
parent 335bbdfe
......@@ -164,31 +164,9 @@ struct aout_fifo_t
/* FIXME to remove once aout.h is cleaned a bit more */
#include <vlc_block.h>
/** an output stream for the audio output */
typedef struct aout_output_t
{
audio_sample_format_t output;
/* Indicates whether the audio output is currently starving, to avoid
* printing a 1,000 "output is starving" messages. */
bool b_starving;
/* post-filters */
filter_t * pp_filters[AOUT_MAX_FILTERS];
int i_nb_filters;
aout_fifo_t fifo;
struct module_t * p_module;
struct aout_sys_t * p_sys;
void (*pf_play)( aout_instance_t * );
void (* pf_pause)( aout_instance_t *, bool, mtime_t );
int (* pf_volume_set )( aout_instance_t *, float, bool );
int i_nb_samples;
} aout_output_t;
struct aout_mixer_t;
/** audio output thread descriptor */
/** Audio output object */
struct aout_instance_t
{
VLC_COMMON_MEMBERS
......@@ -205,8 +183,27 @@ struct aout_instance_t
float mixer_multiplier;
struct aout_mixer_t *p_mixer;
/* Output plug-in */
aout_output_t output;
audio_sample_format_t format; /**< Output format (plugin can modify it
only when succesfully probed and not afterward) */
/* Indicates whether the audio output is currently starving, to avoid
* printing a 1,000 "output is starving" messages. */
bool b_starving;
/* post-filters */
filter_t * pp_filters[AOUT_MAX_FILTERS];
int i_nb_filters;
aout_fifo_t fifo;
struct module_t *module; /**< Output plugin */
struct aout_sys_t *sys; /**< Output plugin private data */
void (*pf_play)( aout_instance_t * ); /**< Audio buffer callback */
void (* pf_pause)( aout_instance_t *, bool, mtime_t ); /**< Pause/resume
callback (optional, may be NULL) */
int (* pf_volume_set )(aout_instance_t *, float, bool); /**< Volume setter
(optional, may be NULL) */
int i_nb_samples;
};
/**
......
......@@ -184,7 +184,7 @@ static int Open (vlc_object_t *obj)
return VLC_ENOMEM;
snd_pcm_format_t pcm_format; /* ALSA sample format */
vlc_fourcc_t fourcc = p_aout->output.output.i_format;
vlc_fourcc_t fourcc = p_aout->format.i_format;
bool spdif = false;
switch (fourcc)
......@@ -242,7 +242,7 @@ static int Open (vlc_object_t *obj)
pcm_format = SND_PCM_FORMAT_U8;
break;
default:
if (AOUT_FMT_NON_LINEAR(&p_aout->output.output))
if (AOUT_FMT_NON_LINEAR(&p_aout->format))
spdif = var_InheritBool (p_aout, "spdif");
if (HAVE_FPU)
{
......@@ -263,7 +263,7 @@ static int Open (vlc_object_t *obj)
{
unsigned aes3;
switch (p_aout->output.output.i_rate)
switch (p_aout->format.i_rate)
{
#define FS(freq) \
case freq: aes3 = IEC958_AES3_CON_FS_ ## freq; break;
......@@ -293,7 +293,7 @@ static int Open (vlc_object_t *obj)
free (psz_device);
return VLC_ENOMEM;
}
p_aout->output.p_sys = p_sys;
p_aout->sys = p_sys;
#ifdef ALSA_DEBUG
snd_output_stdio_attach( &p_sys->p_snd_stderr, stderr, 0 );
......@@ -349,24 +349,24 @@ static int Open (vlc_object_t *obj)
pcm_format = SND_PCM_FORMAT_S16;
i_channels = 2;
p_aout->output.i_nb_samples = i_period_size = ALSA_SPDIF_PERIOD_SIZE;
p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
p_aout->output.output.i_frame_length = A52_FRAME_NB;
p_aout->i_nb_samples = i_period_size = ALSA_SPDIF_PERIOD_SIZE;
p_aout->format.i_bytes_per_frame = AOUT_SPDIF_SIZE;
p_aout->format.i_frame_length = A52_FRAME_NB;
aout_VolumeNoneInit( p_aout );
}
else
{
i_buffer_size = ALSA_DEFAULT_BUFFER_SIZE;
i_channels = aout_FormatNbChannels( &p_aout->output.output );
i_channels = aout_FormatNbChannels( &p_aout->format );
p_aout->output.i_nb_samples = i_period_size = ALSA_DEFAULT_PERIOD_SIZE;
p_aout->i_nb_samples = i_period_size = ALSA_DEFAULT_PERIOD_SIZE;
aout_VolumeSoftInit( p_aout );
}
p_aout->output.pf_play = Play;
p_aout->output.pf_pause = NULL;
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
snd_pcm_hw_params_t *p_hw;
snd_pcm_sw_params_t *p_sw;
......@@ -391,7 +391,7 @@ static int Open (vlc_object_t *obj)
goto error;
}
p_aout->output.output.i_format = fourcc;
p_aout->format.i_format = fourcc;
val = snd_pcm_hw_params_set_access( p_sys->p_snd_pcm, p_hw,
SND_PCM_ACCESS_RW_INTERLEAVED );
......@@ -412,9 +412,9 @@ static int Open (vlc_object_t *obj)
}
/* Set rate. */
unsigned old_rate = p_aout->output.output.i_rate;
unsigned old_rate = p_aout->format.i_rate;
val = snd_pcm_hw_params_set_rate_near (p_sys->p_snd_pcm, p_hw,
&p_aout->output.output.i_rate,
&p_aout->format.i_rate,
NULL);
if (val < 0)
{
......@@ -422,9 +422,9 @@ static int Open (vlc_object_t *obj)
snd_strerror (val));
goto error;
}
if (p_aout->output.output.i_rate != old_rate)
if (p_aout->format.i_rate != old_rate)
msg_Warn (p_aout, "resampling from %d Hz to %d Hz", old_rate,
p_aout->output.output.i_rate);
p_aout->format.i_rate);
/* Set period size. */
val = snd_pcm_hw_params_set_period_size_near( p_sys->p_snd_pcm, p_hw,
......@@ -435,7 +435,7 @@ static int Open (vlc_object_t *obj)
snd_strerror( val ) );
goto error;
}
p_aout->output.i_nb_samples = i_period_size;
p_aout->i_nb_samples = i_period_size;
/* Set buffer size. */
val = snd_pcm_hw_params_set_buffer_size_near( p_sys->p_snd_pcm, p_hw,
......@@ -469,7 +469,7 @@ static int Open (vlc_object_t *obj)
snd_pcm_sw_params_current( p_sys->p_snd_pcm, p_sw );
snd_pcm_sw_params_set_avail_min( p_sys->p_snd_pcm, p_sw,
p_aout->output.i_nb_samples );
p_aout->i_nb_samples );
/* start playing when one period has been written */
val = snd_pcm_sw_params_set_start_threshold( p_sys->p_snd_pcm, p_sw,
ALSA_DEFAULT_PERIOD_SIZE);
......@@ -529,13 +529,13 @@ static void PlayIgnore( aout_instance_t *p_aout )
*****************************************************************************/
static void Play( aout_instance_t *p_aout )
{
p_aout->output.pf_play = PlayIgnore;
p_aout->pf_play = PlayIgnore;
/* get the playing date of the first aout buffer */
p_aout->output.p_sys->start_date = aout_FifoFirstDate( &p_aout->output.fifo );
p_aout->sys->start_date = aout_FifoFirstDate( &p_aout->fifo );
/* wake up the audio output thread */
sem_post( &p_aout->output.p_sys->wait );
sem_post( &p_aout->sys->wait );
}
/*****************************************************************************
......@@ -544,7 +544,7 @@ static void Play( aout_instance_t *p_aout )
static void Close (vlc_object_t *obj)
{
aout_instance_t *p_aout = (aout_instance_t *)obj;
struct aout_sys_t * p_sys = p_aout->output.p_sys;
struct aout_sys_t * p_sys = p_aout->sys;
/* Make sure that the thread will stop once it is waken up */
vlc_cancel( p_sys->thread );
......@@ -565,7 +565,7 @@ static void Close (vlc_object_t *obj)
static void* ALSAThread( void *data )
{
aout_instance_t * p_aout = data;
struct aout_sys_t * p_sys = p_aout->output.p_sys;
struct aout_sys_t * p_sys = p_aout->sys;
/* Wait for the exact time to start playing (avoids resampling) */
vlc_sem_wait( &p_sys->wait );
......@@ -583,7 +583,7 @@ static void* ALSAThread( void *data )
*****************************************************************************/
static void ALSAFill( aout_instance_t * p_aout )
{
struct aout_sys_t * p_sys = p_aout->output.p_sys;
struct aout_sys_t * p_sys = p_aout->sys;
snd_pcm_t *p_pcm = p_sys->p_snd_pcm;
snd_pcm_status_t * p_status;
int i_snd_rc;
......@@ -635,9 +635,9 @@ static void ALSAFill( aout_instance_t * p_aout )
size_t i_bytes = snd_pcm_frames_to_bytes( p_pcm, delay );
mtime_t delay_us = CLOCK_FREQ * i_bytes
/ p_aout->output.output.i_bytes_per_frame
/ p_aout->output.output.i_rate
* p_aout->output.output.i_frame_length;
/ p_aout->format.i_bytes_per_frame
/ p_aout->format.i_rate
* p_aout->format.i_frame_length;
#ifdef ALSA_DEBUG
snd_pcm_state_t state = snd_pcm_status_get_state( p_status );
......@@ -646,16 +646,16 @@ static void ALSAFill( aout_instance_t * p_aout )
msg_Dbg( p_aout, "Delay is %ld frames (%zu bytes)", delay, i_bytes );
msg_Dbg( p_aout, "Bytes per frame: %d", p_aout->output.output.i_bytes_per_frame );
msg_Dbg( p_aout, "Rate: %d", p_aout->output.output.i_rate );
msg_Dbg( p_aout, "Frame length: %d", p_aout->output.output.i_frame_length );
msg_Dbg( p_aout, "Bytes per frame: %d", p_aout->format.i_bytes_per_frame );
msg_Dbg( p_aout, "Rate: %d", p_aout->format.i_rate );
msg_Dbg( p_aout, "Frame length: %d", p_aout->format.i_frame_length );
msg_Dbg( p_aout, "Next date: in %"PRId64" microseconds", delay_us );
#endif
next_date = mdate() + delay_us;
}
block_t *p_buffer = aout_OutputNextBuffer( p_aout, next_date,
(p_aout->output.output.i_format == VLC_CODEC_SPDIFL) );
(p_aout->format.i_format == VLC_CODEC_SPDIFL) );
/* Audio output buffer shortage -> stop the fill process and wait */
if( p_buffer == NULL )
......
......@@ -61,10 +61,10 @@ struct aout_sys_t
static void Play (aout_instance_t *aout)
{
aout_sys_t *sys = aout->output.p_sys;
aout_sys_t *sys = aout->sys;
block_t *block;
while ((block = aout_FifoPop(&aout->output.fifo)) != NULL)
while ((block = aout_FifoPop(&aout->fifo)) != NULL)
{
sys->play (sys->opaque, block->p_buffer, block->i_nb_samples,
block->i_pts);
......@@ -74,7 +74,7 @@ static void Play (aout_instance_t *aout)
static int VolumeSet (aout_instance_t *aout, float vol, bool mute)
{
aout_sys_t *sys = aout->output.p_sys;
aout_sys_t *sys = aout->sys;
return sys->set_volume (sys->opaque, vol, mute) ? -1 : 0;
}
......@@ -88,7 +88,7 @@ static int Open (vlc_object_t *obj)
if (unlikely(sys == NULL))
return VLC_ENOMEM;
aout->output.p_sys = sys;
aout->sys = sys;
sys->opaque = var_InheritAddress (obj, "amem-data");
sys->play = var_InheritAddress (obj, "amem-play");
sys->set_volume = var_InheritAddress (obj, "amem-set-volume");
......@@ -102,8 +102,8 @@ static int Open (vlc_object_t *obj)
if (setup != NULL)
{
rate = aout->output.output.i_rate;
channels = aout_FormatNbChannels(&aout->output.output);
rate = aout->format.i_rate;
channels = aout_FormatNbChannels(&aout->format);
if (setup (&sys->opaque, format, &rate, &channels))
goto error;
......@@ -122,18 +122,18 @@ static int Open (vlc_object_t *obj)
/* TODO: amem-format */
/* FIXME/TODO channel mapping */
if (strcmp(format, "S16N") || aout->output.output.i_channels != channels)
if (strcmp(format, "S16N") || aout->format.i_channels != channels)
{
msg_Err (aout, "format not supported");
goto error;
}
aout->output.output.i_format = VLC_CODEC_S16N;
aout->output.output.i_rate = rate;
aout->format.i_format = VLC_CODEC_S16N;
aout->format.i_rate = rate;
aout->output.pf_play = Play;
aout->output.pf_pause = NULL;
aout->pf_play = Play;
aout->pf_pause = NULL;
if (sys->set_volume != NULL)
aout->output.pf_volume_set = VolumeSet;
aout->pf_volume_set = VolumeSet;
else
aout_VolumeSoftInit (aout);
return VLC_SUCCESS;
......@@ -146,7 +146,7 @@ error:
static void Close (vlc_object_t *obj)
{
aout_instance_t *aout = (aout_instance_t *)obj;
aout_sys_t *sys = aout->output.p_sys;
aout_sys_t *sys = aout->sys;
if (sys->cleanup != NULL)
sys->cleanup (sys->opaque);
......
......@@ -78,7 +78,7 @@ static int Open ( vlc_object_t *p_this )
{
aout_instance_t *p_aout = (aout_instance_t *)p_this;
struct aout_sys_t *p_sys = malloc(sizeof(aout_sys_t));
p_aout->output.p_sys = p_sys;
p_aout->sys = p_sys;
OSStatus status = 0;
......@@ -118,12 +118,12 @@ static int Open ( vlc_object_t *p_this )
/* Volume is entirely done in software. */
aout_VolumeSoftInit( p_aout );
p_aout->output.output.i_format = VLC_CODEC_S16L;
p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
p_aout->output.output.i_rate = 44100;
p_aout->output.i_nb_samples = FRAME_SIZE;
p_aout->output.pf_play = Play;
p_aout->output.pf_pause = NULL;
p_aout->format.i_format = VLC_CODEC_S16L;
p_aout->format.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
p_aout->format.i_rate = 44100;
p_aout->format.i_nb_samples = FRAME_SIZE;
p_aout->format.pf_play = Play;
p_aout->format.pf_pause = NULL;
msg_Dbg(p_aout, "Starting AudioQueue (status = %i)", status);
status = AudioQueueStart(p_sys->audioQueue, NULL);
......@@ -145,7 +145,7 @@ static void Play( aout_instance_t * p_aout )
static void Close ( vlc_object_t *p_this )
{
aout_instance_t *p_aout = (aout_instance_t *)p_this;
struct aout_sys_t * p_sys = p_aout->output.p_sys;
struct aout_sys_t * p_sys = p_aout->sys;
msg_Dbg(p_aout, "Stopping AudioQueue");
AudioQueueStop(p_sys->audioQueue, false);
......@@ -160,7 +160,7 @@ void AudioQueueCallback(void * inUserData, AudioQueueRef inAQ, AudioQueueBufferR
if (p_aout) {
vlc_mutex_lock( &p_aout->lock );
p_buffer = aout_FifoPop( &p_aout->output.fifo );
p_buffer = aout_FifoPop( &p_aout->fifo );
vlc_mutex_unlock( &p_aout->lock );
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -146,24 +146,24 @@ static int Open( vlc_object_t * p_this )
}
/* Allocate structure */
p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->output.p_sys == NULL )
p_aout->sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->sys == NULL )
return VLC_ENOMEM;
if( !strcmp( psz_name, "-" ) )
p_aout->output.p_sys->p_file = stdout;
p_aout->sys->p_file = stdout;
else
p_aout->output.p_sys->p_file = vlc_fopen( psz_name, "wb" );
p_aout->sys->p_file = vlc_fopen( psz_name, "wb" );
free( psz_name );
if ( p_aout->output.p_sys->p_file == NULL )
if ( p_aout->sys->p_file == NULL )
{
free( p_aout->output.p_sys );
free( p_aout->sys );
return VLC_EGENERIC;
}
p_aout->output.pf_play = Play;
p_aout->output.pf_pause = NULL;
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
/* Audio format */
psz_format = var_CreateGetString( p_this, "audiofile-format" );
......@@ -181,25 +181,25 @@ static int Open( vlc_object_t * p_this )
{
msg_Err( p_aout, "cannot understand the format string (%s)",
psz_format );
if( p_aout->output.p_sys->p_file != stdout )
fclose( p_aout->output.p_sys->p_file );
free( p_aout->output.p_sys );
if( p_aout->sys->p_file != stdout )
fclose( p_aout->sys->p_file );
free( p_aout->sys );
free( psz_format );
return VLC_EGENERIC;
}
free( psz_format );
p_aout->output.output.i_format = format_int[i];
if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) )
p_aout->format.i_format = format_int[i];
if ( AOUT_FMT_NON_LINEAR( &p_aout->format ) )
{
p_aout->output.i_nb_samples = A52_FRAME_NB;
p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
p_aout->output.output.i_frame_length = A52_FRAME_NB;
p_aout->i_nb_samples = A52_FRAME_NB;
p_aout->format.i_bytes_per_frame = AOUT_SPDIF_SIZE;
p_aout->format.i_frame_length = A52_FRAME_NB;
aout_VolumeNoneInit( p_aout );
}
else
{
p_aout->output.i_nb_samples = FRAME_SIZE;
p_aout->i_nb_samples = FRAME_SIZE;
aout_VolumeSoftInit( p_aout );
}
......@@ -208,22 +208,22 @@ static int Open( vlc_object_t * p_this )
if( i_channels > 0 && i_channels <= CHANNELS_MAX )
{
p_aout->output.output.i_physical_channels =
p_aout->format.i_physical_channels =
pi_channels_maps[i_channels];
}
/* WAV header */
p_aout->output.p_sys->b_add_wav_header = var_CreateGetBool( p_this,
p_aout->sys->b_add_wav_header = var_CreateGetBool( p_this,
"audiofile-wav" );
if( p_aout->output.p_sys->b_add_wav_header )
if( p_aout->sys->b_add_wav_header )
{
/* Write wave header */
WAVEHEADER *wh = &p_aout->output.p_sys->waveh;
WAVEHEADER *wh = &p_aout->sys->waveh;
memset( wh, 0, sizeof(*wh) );
switch( p_aout->output.output.i_format )
switch( p_aout->format.i_format )
{
case VLC_CODEC_FL32:
wh->Format = WAVE_FORMAT_IEEE_FLOAT;
......@@ -246,8 +246,8 @@ static int Open( vlc_object_t * p_this )
wh->SubChunkID = VLC_FOURCC('f', 'm', 't', ' ');
wh->SubChunkLength = 16;
wh->Modus = aout_FormatNbChannels( &p_aout->output.output );
wh->SampleFreq = p_aout->output.output.i_rate;
wh->Modus = aout_FormatNbChannels( &p_aout->format );
wh->SampleFreq = p_aout->format.i_rate;
wh->BytesPerSample = wh->Modus * ( wh->BitsPerSample / 8 );
wh->BytesPerSec = wh->BytesPerSample * wh->SampleFreq;
......@@ -264,7 +264,7 @@ static int Open( vlc_object_t * p_this )
SetDWLE( &wh->BytesPerSec, wh->BytesPerSec );
if( fwrite( wh, sizeof(WAVEHEADER), 1,
p_aout->output.p_sys->p_file ) != 1 )
p_aout->sys->p_file ) != 1 )
{
msg_Err( p_aout, "write error (%m)" );
}
......@@ -282,34 +282,34 @@ static void Close( vlc_object_t * p_this )
msg_Dbg( p_aout, "closing audio file" );
if( p_aout->output.p_sys->b_add_wav_header )
if( p_aout->sys->b_add_wav_header )
{
/* Update Wave Header */
p_aout->output.p_sys->waveh.Length =
p_aout->output.p_sys->waveh.DataLength + sizeof(WAVEHEADER) - 4;
p_aout->sys->waveh.Length =
p_aout->sys->waveh.DataLength + sizeof(WAVEHEADER) - 4;
/* Write Wave Header */
if( fseek( p_aout->output.p_sys->p_file, 0, SEEK_SET ) )
if( fseek( p_aout->sys->p_file, 0, SEEK_SET ) )
{
msg_Err( p_aout, "seek error (%m)" );
}
/* Header -> little endian format */
SetDWLE( &p_aout->output.p_sys->waveh.Length,
p_aout->output.p_sys->waveh.Length );
SetDWLE( &p_aout->output.p_sys->waveh.DataLength,
p_aout->output.p_sys->waveh.DataLength );
SetDWLE( &p_aout->sys->waveh.Length,
p_aout->sys->waveh.Length );
SetDWLE( &p_aout->sys->waveh.DataLength,
p_aout->sys->waveh.DataLength );
if( fwrite( &p_aout->output.p_sys->waveh, sizeof(WAVEHEADER), 1,
p_aout->output.p_sys->p_file ) != 1 )
if( fwrite( &p_aout->sys->waveh, sizeof(WAVEHEADER), 1,
p_aout->sys->p_file ) != 1 )
{
msg_Err( p_aout, "write error (%m)" );
}
}
if( p_aout->output.p_sys->p_file != stdout )
fclose( p_aout->output.p_sys->p_file );
free( p_aout->output.p_sys );
if( p_aout->sys->p_file != stdout )
fclose( p_aout->sys->p_file );
free( p_aout->sys );
}
/*****************************************************************************
......@@ -319,18 +319,18 @@ static void Play( aout_instance_t * p_aout )
{
aout_buffer_t * p_buffer;
p_buffer = aout_FifoPop( &p_aout->output.fifo );
p_buffer = aout_FifoPop( &p_aout->fifo );
if( fwrite( p_buffer->p_buffer, p_buffer->i_buffer, 1,
p_aout->output.p_sys->p_file ) != 1 )
p_aout->sys->p_file ) != 1 )
{
msg_Err( p_aout, "write error (%m)" );
}
if( p_aout->output.p_sys->b_add_wav_header )
if( p_aout->sys->b_add_wav_header )
{
/* Update Wave Header */
p_aout->output.p_sys->waveh.DataLength += p_buffer->i_buffer;
p_aout->sys->waveh.DataLength += p_buffer->i_buffer;
}
aout_BufferFree( p_buffer );
......
......@@ -113,7 +113,7 @@ static int Open( vlc_object_t *p_this )
status = VLC_ENOMEM;
goto error_out;
}
p_aout->output.p_sys = p_sys;
p_aout->sys = p_sys;
p_sys->latency = 0;
/* Connect to the JACK server */
......@@ -133,17 +133,17 @@ static int Open( vlc_object_t *p_this )
jack_set_process_callback( p_sys->p_jack_client, Process, p_aout );
jack_set_graph_order_callback ( p_sys->p_jack_client, GraphChange, p_aout );
p_aout->output.pf_play = Play;
p_aout->output.pf_pause = NULL;
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
aout_VolumeSoftInit( p_aout );
/* JACK only supports fl32 format */
p_aout->output.output.i_format = VLC_CODEC_FL32;
p_aout->format.i_format = VLC_CODEC_FL32;
// TODO add buffer size callback
p_aout->output.i_nb_samples = jack_get_buffer_size( p_sys->p_jack_client );
p_aout->output.output.i_rate = jack_get_sample_rate( p_sys->p_jack_client );
p_aout->i_nb_samples = jack_get_buffer_size( p_sys->p_jack_client );
p_aout->format.i_rate = jack_get_sample_rate( p_sys->p_jack_client );
p_sys->i_channels = aout_FormatNbChannels( &p_aout->output.output );
p_sys->i_channels = aout_FormatNbChannels( &p_aout->format );
p_sys->p_jack_ports = malloc( p_sys->i_channels *
sizeof(jack_port_t *) );
......@@ -225,7 +225,7 @@ static int Open( vlc_object_t *p_this )
msg_Dbg( p_aout, "JACK audio output initialized (%d channels, buffer "
"size=%d, rate=%d)", p_sys->i_channels,
p_aout->output.i_nb_samples, p_aout->output.output.i_rate );
p_aout->i_nb_samples, p_aout->format.i_rate );
error_out:
/* Clean up, if an error occurred */
......@@ -251,7 +251,7 @@ int Process( jack_nframes_t i_frames, void *p_arg )
{
unsigned int i, j, i_nb_samples = 0;
aout_instance_t *p_aout = (aout_instance_t*) p_arg;
struct aout_sys_t *p_sys = p_aout->output.p_sys;
struct aout_sys_t *p_sys = p_aout->sys;
jack_sample_t *p_src = NULL;
jack_nframes_t dframes = p_sys->latency
......@@ -312,7 +312,7 @@ int Process( jack_nframes_t i_frames, void *p_arg )
static int GraphChange( void *p_arg )
{
aout_instance_t *p_aout = (aout_instance_t*) p_arg;
struct aout_sys_t *p_sys = p_aout->output.p_sys;
struct aout_sys_t *p_sys = p_aout->sys;
unsigned int i;
jack_nframes_t port_latency;
......@@ -345,7 +345,7 @@ static void Close( vlc_object_t *p_this )
{
int i_error;
aout_instance_t *p_aout = (aout_instance_t *)p_this;
struct aout_sys_t *p_sys = p_aout->output.p_sys;
struct aout_sys_t *p_sys = p_aout->sys;
i_error = jack_deactivate( p_sys->p_jack_client );
if( i_error )
......
......@@ -139,11 +139,11 @@ static int Open( vlc_object_t * p_this )
SLresult result;
/* Allocate structure */
p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) );
if( unlikely( p_aout->output.p_sys == NULL ) )
p_aout->sys = malloc( sizeof( aout_sys_t ) );
if( unlikely( p_aout->sys == NULL ) )
return VLC_ENOMEM;
aout_sys_t * p_sys = p_aout->output.p_sys;
aout_sys_t * p_sys = p_aout->sys;
p_sys->playerObject = NULL;
p_sys->engineObject = NULL;
......@@ -204,7 +204,7 @@ static int Open( vlc_object_t * p_this )
SLDataFormat_PCM format_pcm;
format_pcm.formatType = SL_DATAFORMAT_PCM;
format_pcm.numChannels = 2;
format_pcm.samplesPerSec = ((SLuint32) p_aout->output.output.i_rate * 1000) ;
format_pcm.samplesPerSec = ((SLuint32) p_aout->format.i_rate * 1000) ;
format_pcm.bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16;
format_pcm.containerSize = SL_PCMSAMPLEFORMAT_FIXED_16;
format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
......@@ -256,13 +256,13 @@ static int Open( vlc_object_t * p_this )
CHECK_OPENSL_ERROR( result, "Failed to switch to playing state" );
// we want 16bit signed data little endian.
p_aout->output.output.i_format = VLC_CODEC_S16L;
p_aout->output.i_nb_samples = 2048;
p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
p_aout->output.pf_play = Play;
p_aout->output.pf_pause = NULL;
p_aout->format.i_format = VLC_CODEC_S16L;
p_aout->i_nb_samples = 2048;
p_aout->format.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
aout_FormatPrepare( &p_aout->output.output );
aout_FormatPrepare( &p_aout->format );
return VLC_SUCCESS;
error:
......@@ -276,7 +276,7 @@ error:
static void Close( vlc_object_t * p_this )
{
aout_instance_t *p_aout = (aout_instance_t *)p_this;
aout_sys_t *p_sys = p_aout->output.p_sys;
aout_sys_t *p_sys = p_aout->sys;
msg_Dbg( p_aout, "Closing OpenSLES" );
......@@ -292,12 +292,12 @@ static void Close( vlc_object_t * p_this )
*****************************************************************************/
static void Play( aout_instance_t * p_aout )
{
aout_sys_t * p_sys = p_aout->output.p_sys;
aout_sys_t * p_sys = p_aout->sys;
aout_buffer_t *p_buffer;
SLresult result;
p_buffer = aout_FifoPop(&p_aout->output.fifo);
p_buffer = aout_FifoPop(&p_aout->fifo);
if( p_buffer != NULL )
{
for (;;)
......
This diff is collapsed.
......@@ -181,9 +181,9 @@ static int Open( vlc_object_t * p_this )
return VLC_ENOMEM;
p_sys->p_aout = p_aout;
p_sys->p_stream = 0;
p_aout->output.p_sys = p_sys;
p_aout->output.pf_play = Play;
p_aout->output.pf_pause = NULL;
p_aout->sys = p_sys;
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
/* Retrieve output device id from config */
p_sys->i_device_id = var_CreateGetInteger( p_aout, "portaudio-audio-device" );
......@@ -283,7 +283,7 @@ static int Open( vlc_object_t * p_this )
static void Close ( vlc_object_t *p_this )
{
aout_instance_t *p_aout = (aout_instance_t *)p_this;
aout_sys_t *p_sys = p_aout->output.p_sys;
aout_sys_t *p_sys = p_aout->sys;
msg_Dbg( p_aout, "closing portaudio");
......@@ -332,7 +332,7 @@ static void Close ( vlc_object_t *p_this )
static int PAOpenDevice( aout_instance_t *p_aout )
{
aout_sys_t *p_sys = p_aout->output.p_sys;
aout_sys_t *p_sys = p_aout->sys;
const PaDeviceInfo *p_pdi;
PaError i_err;
vlc_value_t val, text;
......@@ -439,7 +439,7 @@ static int PAOpenDevice( aout_instance_t *p_aout )
}
/* Audio format is paFloat32 (always supported by portaudio v19) */
p_aout->output.output.i_format = VLC_CODEC_FL32;
p_aout->format.i_format = VLC_CODEC_FL32;
return VLC_SUCCESS;
......@@ -453,7 +453,7 @@ static int PAOpenDevice( aout_instance_t *p_aout )
static int PAOpenStream( aout_instance_t *p_aout )
{
aout_sys_t *p_sys = p_aout->output.p_sys;
aout_sys_t *p_sys = p_aout->sys;
const PaHostErrorInfo* paLastHostErrorInfo = Pa_GetLastHostErrorInfo();
PaStreamParameters paStreamParameters;
vlc_value_t val;
......@@ -467,54 +467,54 @@ static int PAOpenStream( aout_instance_t *p_aout )
if( val.i_int == AOUT_VAR_5_1 )
{
p_aout->output.output.i_physical_channels
p_aout->format.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
| AOUT_CHAN_LFE;
}
else if( val.i_int == AOUT_VAR_3F2R )
{
p_aout->output.output.i_physical_channels
p_aout->format.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
}
else if( val.i_int == AOUT_VAR_2F2R )
{
p_aout->output.output.i_physical_channels
p_aout->format.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
}
else if( val.i_int == AOUT_VAR_MONO )
{
p_aout->output.output.i_physical_channels = AOUT_CHAN_CENTER;
p_aout->format.i_physical_channels = AOUT_CHAN_CENTER;
}
else
{
p_aout->output.output.i_physical_channels
p_aout->format.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
}
i_channels = aout_FormatNbChannels( &p_aout->output.output );
i_channels = aout_FormatNbChannels( &p_aout->format );
msg_Dbg( p_aout, "nb_channels requested = %d", i_channels );
i_channel_mask = p_aout->output.output.i_physical_channels;
i_channel_mask = p_aout->format.i_physical_channels;
/* Calculate the frame size in bytes */
p_sys->i_sample_size = 4 * i_channels;
p_aout->output.i_nb_samples = FRAME_SIZE;
aout_FormatPrepare( &p_aout->output.output );
p_aout->i_nb_samples = FRAME_SIZE;
aout_FormatPrepare( &p_aout->format );
aout_VolumeSoftInit( p_aout );
/* Check for channel reordering */
p_aout->output.p_sys->i_channel_mask = i_channel_mask;
p_aout->output.p_sys->i_bits_per_sample = 32; /* forced to paFloat32 */
p_aout->output.p_sys->i_channels = i_channels;
p_aout->sys->i_channel_mask = i_channel_mask;
p_aout->sys->i_bits_per_sample = 32; /* forced to paFloat32 */
p_aout->sys->i_channels = i_channels;
p_aout->output.p_sys->b_chan_reorder =
p_aout->sys->b_chan_reorder =
aout_CheckChannelReorder( NULL, pi_channels_out,
i_channel_mask, i_channels,
p_aout->output.p_sys->pi_chan_table );
p_aout->sys->pi_chan_table );
if( p_aout->output.p_sys->b_chan_reorder )
if( p_aout->sys->b_chan_reorder )
{
msg_Dbg( p_aout, "channel reordering needed" );
}
......@@ -527,7 +527,7 @@ static int PAOpenStream( aout_instance_t *p_aout )
paStreamParameters.hostApiSpecificStreamInfo = NULL;
i_err = Pa_OpenStream( &p_sys->p_stream, NULL /* no input */,
&paStreamParameters, (double)p_aout->output.output.i_rate,
&paStreamParameters, (double)p_aout->format.i_rate,
FRAME_SIZE, paClipOff, paCallback, p_sys );
if( i_err != paNoError )
{
......@@ -586,7 +586,7 @@ static void* PORTAUDIOThread( void *data )
pa_thread->b_signal = false;
p_aout = pa_thread->p_aout;
p_sys = p_aout->output.p_sys;
p_sys = p_aout->sys;
if( PAOpenDevice( p_aout ) != VLC_SUCCESS )
{
......
......@@ -93,7 +93,7 @@ static void sink_info_cb(pa_context *c, const pa_sink_info *i, int eol,
void *userdata)
{
aout_instance_t *aout = userdata;
aout_sys_t *sys = aout->output.p_sys;
aout_sys_t *sys = aout->sys;
if (eol)
return;
......@@ -114,8 +114,8 @@ static void sink_info_cb(pa_context *c, const pa_sink_info *i, int eol,
/*** Stream helpers ***/
static void stream_reset_sync(pa_stream *s, aout_instance_t *aout)
{
aout_sys_t *sys = aout->output.p_sys;
const unsigned rate = aout->output.output.i_rate;
aout_sys_t *sys = aout->sys;
const unsigned rate = aout->format.i_rate;
sys->pts = VLC_TS_INVALID;
sys->desync = 0;
......@@ -143,7 +143,7 @@ static void stream_state_cb(pa_stream *s, void *userdata)
static void stream_latency_cb(pa_stream *s, void *userdata)
{
aout_instance_t *aout = userdata;
aout_sys_t *sys = aout->output.p_sys;
aout_sys_t *sys = aout->sys;
mtime_t delta, change;
if (sys->pts == VLC_TS_INVALID)
......@@ -179,7 +179,7 @@ static void stream_latency_cb(pa_stream *s, void *userdata)
msg_Warn(aout, "too early by %"PRId64" us", delta);
/* Compute playback sample rate */
const unsigned inrate = aout->output.output.i_rate;
const unsigned inrate = aout->format.i_rate;
#define ADJUST_FACTOR 4
#define ADJUST_MAX 1000 /* Hz (max rate variation per call) */
......@@ -222,7 +222,7 @@ static void stream_latency_cb(pa_stream *s, void *userdata)
static void stream_moved_cb(pa_stream *s, void *userdata)
{
aout_instance_t *aout = userdata;
aout_sys_t *sys = aout->output.p_sys;
aout_sys_t *sys = aout->sys;
pa_operation *op;
uint32_t idx = pa_stream_get_device_index(s);
......@@ -325,11 +325,11 @@ static void *data_convert(block_t **pp)
*/
static void Play(aout_instance_t *aout)
{
aout_sys_t *sys = aout->output.p_sys;
aout_sys_t *sys = aout->sys;
pa_stream *s = sys->stream;
/* This function is called exactly once per block in the output FIFO. */
block_t *block = aout_FifoPop(&aout->output.fifo);
block_t *block = aout_FifoPop(&aout->fifo);
assert (block != NULL);
const void *ptr = data_convert(&block);
......@@ -367,8 +367,8 @@ static void Play(aout_instance_t *aout)
advance -= latency;
if (advance > 0) {
size_t nb = (advance * aout->output.output.i_rate) / CLOCK_FREQ;
size_t size = aout->output.output.i_bytes_per_frame;
size_t nb = (advance * aout->format.i_rate) / CLOCK_FREQ;
size_t size = aout->format.i_bytes_per_frame;
float *zeroes = calloc (nb, size);
msg_Dbg(aout, "prepending %zu zeroes", nb);
......@@ -413,7 +413,7 @@ static void Play(aout_instance_t *aout)
*/
static void Pause(aout_instance_t *aout, bool b_paused, mtime_t i_date)
{
aout_sys_t *sys = aout->output.p_sys;
aout_sys_t *sys = aout->sys;
pa_stream *s = sys->stream;
if (!b_paused)
......@@ -432,7 +432,7 @@ static void Pause(aout_instance_t *aout, bool b_paused, mtime_t i_date)
static int VolumeSet(aout_instance_t *aout, float vol, bool mute)
{
aout_sys_t *sys = aout->output.p_sys;
aout_sys_t *sys = aout->sys;
pa_operation *op;
uint32_t idx = pa_stream_get_index(sys->stream);
......@@ -461,7 +461,7 @@ static int StreamMove(vlc_object_t *obj, const char *varname, vlc_value_t old,
vlc_value_t val, void *userdata)
{
aout_instance_t *aout = (aout_instance_t *)obj;
aout_sys_t *sys = aout->output.p_sys;
aout_sys_t *sys = aout->sys;
pa_stream *s = userdata;
pa_operation *op;
uint32_t idx = pa_stream_get_index(s);
......@@ -494,20 +494,20 @@ static int Open(vlc_object_t *obj)
/* Sample format specification */
struct pa_sample_spec ss;
switch(aout->output.output.i_format)
switch(aout->format.i_format)
{
case VLC_CODEC_F64B:
aout->output.output.i_format = VLC_CODEC_F32B;
aout->format.i_format = VLC_CODEC_F32B;
case VLC_CODEC_F32B:
ss.format = PA_SAMPLE_FLOAT32BE;
break;
case VLC_CODEC_F64L:
aout->output.output.i_format = VLC_CODEC_F32L;
aout->format.i_format = VLC_CODEC_F32L;
case VLC_CODEC_F32L:
ss.format = PA_SAMPLE_FLOAT32LE;
break;
case VLC_CODEC_FI32:
aout->output.output.i_format = VLC_CODEC_FL32;
aout->format.i_format = VLC_CODEC_FL32;
ss.format = PA_SAMPLE_FLOAT32NE;
break;
case VLC_CODEC_S32B:
......@@ -529,26 +529,26 @@ static int Open(vlc_object_t *obj)
ss.format = PA_SAMPLE_S16LE;
break;
case VLC_CODEC_S8:
aout->output.output.i_format = VLC_CODEC_U8;
aout->format.i_format = VLC_CODEC_U8;
case VLC_CODEC_U8:
ss.format = PA_SAMPLE_U8;
break;
default:
if (HAVE_FPU)
{
aout->output.output.i_format = VLC_CODEC_FL32;
aout->format.i_format = VLC_CODEC_FL32;
ss.format = PA_SAMPLE_FLOAT32NE;
}
else
{
aout->output.output.i_format = VLC_CODEC_S16N;
aout->format.i_format = VLC_CODEC_S16N;
ss.format = PA_SAMPLE_S16NE;
}
break;
}
ss.rate = aout->output.output.i_rate;
ss.channels = aout_FormatNbChannels(&aout->output.output);
ss.rate = aout->format.i_rate;
ss.channels = aout_FormatNbChannels(&aout->format);
if (!pa_sample_spec_valid(&ss)) {
msg_Err(aout, "unsupported sample specification");
return VLC_EGENERIC;
......@@ -558,28 +558,28 @@ static int Open(vlc_object_t *obj)
struct pa_channel_map map;
map.channels = 0;
if (aout->output.output.i_physical_channels & AOUT_CHAN_LEFT)
if (aout->format.i_physical_channels & AOUT_CHAN_LEFT)
map.map[map.channels++] = PA_CHANNEL_POSITION_FRONT_LEFT;
if (aout->output.output.i_physical_channels & AOUT_CHAN_RIGHT)
if (aout->format.i_physical_channels & AOUT_CHAN_RIGHT)
map.map[map.channels++] = PA_CHANNEL_POSITION_FRONT_RIGHT;
if (aout->output.output.i_physical_channels & AOUT_CHAN_MIDDLELEFT)
if (aout->format.i_physical_channels & AOUT_CHAN_MIDDLELEFT)
map.map[map.channels++] = PA_CHANNEL_POSITION_SIDE_LEFT;
if (aout->output.output.i_physical_channels & AOUT_CHAN_MIDDLERIGHT)
if (aout->format.i_physical_channels & AOUT_CHAN_MIDDLERIGHT)
map.map[map.channels++] = PA_CHANNEL_POSITION_SIDE_RIGHT;
if (aout->output.output.i_physical_channels & AOUT_CHAN_REARLEFT)
if (aout->format.i_physical_channels & AOUT_CHAN_REARLEFT)
map.map[map.channels++] = PA_CHANNEL_POSITION_REAR_LEFT;
if (aout->output.output.i_physical_channels & AOUT_CHAN_REARRIGHT)
if (aout->format.i_physical_channels & AOUT_CHAN_REARRIGHT)
map.map[map.channels++] = PA_CHANNEL_POSITION_REAR_RIGHT;
if (aout->output.output.i_physical_channels & AOUT_CHAN_REARCENTER)
if (aout->format.i_physical_channels & AOUT_CHAN_REARCENTER)
map.map[map.channels++] = PA_CHANNEL_POSITION_REAR_CENTER;
if (aout->output.output.i_physical_channels & AOUT_CHAN_CENTER)
if (aout->format.i_physical_channels & AOUT_CHAN_CENTER)
{
if (ss.channels == 1)
map.map[map.channels++] = PA_CHANNEL_POSITION_MONO;
else
map.map[map.channels++] = PA_CHANNEL_POSITION_FRONT_CENTER;
}
if (aout->output.output.i_physical_channels & AOUT_CHAN_LFE)
if (aout->format.i_physical_channels & AOUT_CHAN_LFE)
map.map[map.channels++] = PA_CHANNEL_POSITION_LFE;
for (unsigned i = 0; map.channels < ss.channels; i++) {
......@@ -626,7 +626,7 @@ static int Open(vlc_object_t *obj)
return VLC_EGENERIC;
}
aout->output.p_sys = sys;
aout->sys = sys;
sys->stream = NULL;
sys->context = ctx;
sys->pts = VLC_TS_INVALID;
......@@ -664,7 +664,7 @@ static int Open(vlc_object_t *obj)
"prebuf=%u, minreq=%u",
pba->maxlength, pba->tlength, pba->prebuf, pba->minreq);
aout->output.i_nb_samples = pba->minreq / pa_frame_size(&ss);
aout->i_nb_samples = pba->minreq / pa_frame_size(&ss);
var_Create(aout, "audio-device", VLC_VAR_INTEGER|VLC_VAR_HASCHOICE);
var_Change(aout, "audio-device", VLC_VAR_SETTEXT,
......@@ -678,9 +678,9 @@ static int Open(vlc_object_t *obj)
stream_moved_cb(s, aout);
vlc_pa_unlock();
aout->output.pf_play = Play;
aout->output.pf_pause = Pause;
aout->output.pf_volume_set = VolumeSet;
aout->pf_play = Play;
aout->pf_pause = Pause;
aout->pf_volume_set = VolumeSet;
return VLC_SUCCESS;
fail:
......@@ -695,7 +695,7 @@ fail:
static void Close (vlc_object_t *obj)
{
aout_instance_t *aout = (aout_instance_t *)obj;
aout_sys_t *sys = aout->output.p_sys;
aout_sys_t *sys = aout->sys;
pa_context *ctx = sys->context;
pa_stream *s = sys->stream;
......
......@@ -110,24 +110,24 @@ static int Open ( vlc_object_t *p_this )
/* The user has selected an audio device. */
if ( val.i_int == AOUT_VAR_STEREO )
{
p_aout->output.output.i_physical_channels
p_aout->format.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
}
else if ( val.i_int == AOUT_VAR_MONO )
{
p_aout->output.output.i_physical_channels = AOUT_CHAN_CENTER;
p_aout->format.i_physical_channels = AOUT_CHAN_CENTER;
}
}
i_nb_channels = aout_FormatNbChannels( &p_aout->output.output );
i_nb_channels = aout_FormatNbChannels( &p_aout->format );
if ( i_nb_channels > 2 )
{
/* SDL doesn't support more than two channels. */
i_nb_channels = 2;
p_aout->output.output.i_physical_channels
p_aout->format.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
}
desired.freq = p_aout->output.output.i_rate;
desired.freq = p_aout->format.i_rate;
desired.format = AUDIO_S16SYS;
desired.channels = i_nb_channels;
desired.callback = SDLCallback;
......@@ -146,24 +146,24 @@ static int Open ( vlc_object_t *p_this )
switch ( obtained.format )
{
case AUDIO_S16LSB:
p_aout->output.output.i_format = VLC_CODEC_S16L; break;
p_aout->format.i_format = VLC_CODEC_S16L; break;
case AUDIO_S16MSB:
p_aout->output.output.i_format = VLC_CODEC_S16B; break;
p_aout->format.i_format = VLC_CODEC_S16B; break;
case AUDIO_U16LSB:
p_aout->output.output.i_format = VLC_CODEC_U16L; break;
p_aout->format.i_format = VLC_CODEC_U16L; break;
case AUDIO_U16MSB:
p_aout->output.output.i_format = VLC_CODEC_U16B; break;
p_aout->format.i_format = VLC_CODEC_U16B; break;
case AUDIO_S8:
p_aout->output.output.i_format = VLC_CODEC_S8; break;
p_aout->format.i_format = VLC_CODEC_S8; break;
case AUDIO_U8:
p_aout->output.output.i_format = VLC_CODEC_U8; break;
p_aout->format.i_format = VLC_CODEC_U8; break;
}
/* Volume is entirely done in software. */
aout_VolumeSoftInit( p_aout );
if ( obtained.channels != i_nb_channels )
{
p_aout->output.output.i_physical_channels = (obtained.channels == 2 ?
p_aout->format.i_physical_channels = (obtained.channels == 2 ?
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT :
AOUT_CHAN_CENTER);
......@@ -212,10 +212,10 @@ static int Open ( vlc_object_t *p_this )
var_TriggerCallback( p_aout, "intf-change" );
p_aout->output.output.i_rate = obtained.freq;
p_aout->output.i_nb_samples = obtained.samples;
p_aout->output.pf_play = Play;
p_aout->output.pf_pause = NULL;
p_aout->format.i_rate = obtained.freq;
p_aout->i_nb_samples = obtained.samples;
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
return VLC_SUCCESS;
}
......@@ -252,7 +252,7 @@ static void SDLCallback( void * _p_aout, uint8_t * p_stream, int i_len )
* it at SDL's face. Nah. */
vlc_mutex_lock( &p_aout->lock );
p_buffer = aout_FifoPop( &p_aout->output.fifo );
p_buffer = aout_FifoPop( &p_aout->fifo );
vlc_mutex_unlock( &p_aout->lock );
if ( p_buffer != NULL )
......
This diff is collapsed.
......@@ -50,21 +50,20 @@ int OpenAudio ( vlc_object_t * p_this )
{
aout_instance_t * p_aout = (aout_instance_t *)p_this;
p_aout->output.pf_play = Play;
p_aout->output.pf_pause = NULL;
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
aout_VolumeSoftInit( p_aout );
if( AOUT_FMT_NON_LINEAR( &p_aout->output.output )
if( AOUT_FMT_NON_LINEAR( &p_aout->format )
&& var_InheritBool( p_this, "spdif" ) )
{
p_aout->output.output.i_format = VLC_CODEC_SPDIFL;
p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
p_aout->output.output.i_frame_length = A52_FRAME_NB;
p_aout->format.i_format = VLC_CODEC_SPDIFL;
p_aout->format.i_bytes_per_frame = AOUT_SPDIF_SIZE;
p_aout->format.i_frame_length = A52_FRAME_NB;
}
else
p_aout->output.output.i_format =
HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_S16N;
p_aout->output.i_nb_samples = A52_FRAME_NB;
p_aout->format.i_format = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_S16N;
p_aout->i_nb_samples = A52_FRAME_NB;
/* Create the variable for the audio-device */
var_Create( p_aout, "audio-device", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
......@@ -77,7 +76,7 @@ int OpenAudio ( vlc_object_t * p_this )
*****************************************************************************/
static void Play( aout_instance_t * p_aout )
{
aout_buffer_t * p_buffer = aout_FifoPop( &p_aout->output.fifo );
aout_buffer_t * p_buffer = aout_FifoPop( &p_aout->fifo );
aout_BufferFree( p_buffer );
}
......@@ -64,8 +64,8 @@ aout_instance_t *aout_New( vlc_object_t * p_parent )
p_aout->p_input = NULL;
p_aout->mixer_multiplier = 1.0;
p_aout->p_mixer = NULL;
p_aout->output.b_starving = 1;
p_aout->output.p_module = NULL;
p_aout->b_starving = true;
p_aout->module = NULL;
var_Create( p_aout, "intf-change", VLC_VAR_VOID );
......
......@@ -91,7 +91,7 @@ static int commitVolume (vlc_object_t *obj, aout_instance_t *aout,
aout_lock (aout);
#warning FIXME: wrong test. Need to check that aout_output is ready.
if (aout->p_mixer != NULL)
ret = aout->output.pf_volume_set (aout, vol, mute);
ret = aout->pf_volume_set (aout, vol, mute);
aout_unlock (aout);
if (ret == 0)
......@@ -255,7 +255,7 @@ void aout_VolumeSoftInit (aout_instance_t *aout)
audio_volume_t volume = var_InheritInteger (aout, "volume");
bool mute = var_InheritBool (aout, "mute");
aout->output.pf_volume_set = aout_VolumeSoftSet;
aout->pf_volume_set = aout_VolumeSoftSet;
aout_VolumeSoftSet (aout, volume / (float)AOUT_VOLUME_DEFAULT, mute);
}
......@@ -273,7 +273,7 @@ static int aout_VolumeNoneSet (aout_instance_t *aout, float volume, bool mute)
/* Meant to be called by the output plug-in's Open(). */
void aout_VolumeNoneInit( aout_instance_t * p_aout )
{
p_aout->output.pf_volume_set = aout_VolumeNoneSet;
p_aout->pf_volume_set = aout_VolumeNoneSet;
}
......
......@@ -96,7 +96,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
aout_mixer_input_t *p_input = p_mixer->input;
aout_fifo_t *p_fifo = &p_input->fifo;
mtime_t now = mdate();
const unsigned samples = p_aout->output.i_nb_samples;
const unsigned samples = p_aout->i_nb_samples;
/* FIXME: Remove this silly constraint. Just pass buffers as they come to
* "smart" audio outputs. */
assert( samples > 0 );
......@@ -104,7 +104,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
vlc_assert_locked( &p_aout->lock );
/* Retrieve the date of the next buffer. */
date_t exact_start_date = p_aout->output.fifo.end_date;
date_t exact_start_date = p_aout->fifo.end_date;
mtime_t start_date = date_Get( &exact_start_date );
if( start_date != 0 && start_date < now )
......@@ -114,7 +114,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
* happen :). */
msg_Warn( p_mixer, "output PTS is out of range (%"PRId64"), clearing out",
mdate() - start_date );
aout_FifoSet( &p_aout->output.fifo, 0 );
aout_FifoSet( &p_aout->fifo, 0 );
date_Set( &exact_start_date, 0 );
start_date = 0;
}
......@@ -187,7 +187,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
if( delta < 0 )
{
/* Is it really the best way to do it ? */
aout_FifoSet( &p_aout->output.fifo, 0 );
aout_FifoSet( &p_aout->fifo, 0 );
date_Set( &exact_start_date, 0 );
return -1;
}
......
This diff is collapsed.
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