}
}
}
- if( i_channels_src != p_context->channels )
+ if( i_channels_src != p_enc->fmt_out.audio.i_channels )
msg_Err( p_enc, "Channel layout not understood" );
p_sys->i_channels_to_reorder =
if( ret )
{
if( p_enc->fmt_in.i_cat != AUDIO_ES ||
- (p_context->channels <= 2 && i_codec_id != AV_CODEC_ID_MP2
+ (p_enc->fmt_out.audio.i_channels <= 2 && i_codec_id != AV_CODEC_ID_MP2
&& i_codec_id != AV_CODEC_ID_MP3) )
errmsg:
{
goto error;
}
- if( p_context->channels > 2 )
+ if( p_enc->fmt_out.audio.i_channels > 2 )
{
p_context->channels = 2;
p_context->channel_layout = channel_mask[p_context->channels][1];
p_context->frame_size :
AV_INPUT_BUFFER_MIN_SIZE;
p_sys->i_buffer_out = av_samples_get_buffer_size(NULL,
- p_sys->p_context->channels, p_sys->i_frame_size,
+ p_enc->fmt_out.audio.i_channels, p_sys->i_frame_size,
p_sys->p_context->sample_fmt, DEFAULT_ALIGN);
p_sys->p_buffer = av_malloc( p_sys->i_buffer_out );
if ( unlikely( p_sys->p_buffer == NULL ) )
{
block_t *p_block = NULL;
//How much we need to copy from new packet
- const size_t leftover = leftover_samples * p_sys->p_context->channels * p_sys->i_sample_bytes;
+ const size_t leftover = leftover_samples * p_enc->fmt_out.audio.i_channels * p_sys->i_sample_bytes;
av_frame_unref( p_sys->frame );
p_sys->frame->format = p_sys->p_context->sample_fmt;
// We need to deinterleave from p_aout_buf to p_buffer the leftover bytes
if( p_sys->b_planar )
aout_Deinterleave( p_sys->p_interleave_buf, p_sys->p_buffer,
- p_sys->i_frame_size, p_sys->p_context->channels, p_enc->fmt_in.i_codec );
+ p_sys->i_frame_size, p_enc->fmt_out.audio.i_channels, p_enc->fmt_in.i_codec );
else
memcpy( p_sys->p_buffer + buffer_delay, p_aout_buf->p_buffer, leftover);
memset( p_sys->p_buffer + (leftover+buffer_delay), 0, padding_size );
buffer_delay += padding_size;
}
- if( avcodec_fill_audio_frame( p_sys->frame, p_sys->p_context->channels,
+ if( avcodec_fill_audio_frame( p_sys->frame, p_enc->fmt_out.audio.i_channels,
p_sys->p_context->sample_fmt, p_sys->b_planar ? p_sys->p_interleave_buf : p_sys->p_buffer,
p_sys->i_buffer_out,
DEFAULT_ALIGN) < 0 )
//i_bytes_left is amount of bytes we get
i_samples_left = p_aout_buf ? p_aout_buf->i_nb_samples : 0;
- buffer_delay = p_sys->i_samples_delay * p_sys->i_sample_bytes * p_sys->p_context->channels;
+ buffer_delay = p_sys->i_samples_delay * p_sys->i_sample_bytes * p_enc->fmt_out.audio.i_channels;
//p_sys->i_buffer_out = p_sys->i_frame_size * chan * p_sys->i_sample_bytes
//Calculate how many bytes we would need from current buffer to fill frame
p_sys->frame->channels = p_sys->p_context->channels;
const int in_bytes = p_sys->frame->nb_samples *
- p_sys->p_context->channels * p_sys->i_sample_bytes;
+ p_enc->fmt_out.audio.i_channels* p_sys->i_sample_bytes;
if( p_sys->b_planar )
{
aout_Deinterleave( p_sys->p_buffer, p_aout_buf->p_buffer,
- p_sys->frame->nb_samples, p_sys->p_context->channels, p_enc->fmt_in.i_codec );
+ p_sys->frame->nb_samples, p_enc->fmt_out.audio.i_channels, p_enc->fmt_in.i_codec );
}
else
memcpy(p_sys->p_buffer, p_aout_buf->p_buffer, in_bytes);
}
- if( avcodec_fill_audio_frame( p_sys->frame, p_sys->p_context->channels,
+ if( avcodec_fill_audio_frame( p_sys->frame, p_enc->fmt_out.audio.i_channels,
p_sys->p_context->sample_fmt,
p_sys->p_buffer,
p_sys->i_buffer_out,
if( p_aout_buf->i_nb_samples > 0 )
{
memcpy( p_sys->p_buffer + buffer_delay, p_aout_buf->p_buffer,
- p_aout_buf->i_nb_samples * p_sys->i_sample_bytes * p_sys->p_context->channels);
+ p_aout_buf->i_nb_samples * p_sys->i_sample_bytes * p_enc->fmt_out.audio.i_channels);
p_sys->i_samples_delay += p_aout_buf->i_nb_samples;
}