From c75cb67c4406648314ce2a15daf8b632374d7913 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 29 Jul 2013 08:10:10 +0200 Subject: pcm_buffer: convert to C++ --- src/encoder/FlacEncoderPlugin.cxx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/encoder') diff --git a/src/encoder/FlacEncoderPlugin.cxx b/src/encoder/FlacEncoderPlugin.cxx index 3694c5327..a7f551422 100644 --- a/src/encoder/FlacEncoderPlugin.cxx +++ b/src/encoder/FlacEncoderPlugin.cxx @@ -22,7 +22,7 @@ #include "encoder_api.h" #include "encoder_plugin.h" #include "audio_format.h" -#include "pcm/pcm_buffer.h" +#include "pcm/PcmBuffer.hxx" #include "util/fifo_buffer.h" extern "C" { @@ -46,7 +46,7 @@ struct flac_encoder { FLAC__StreamEncoder *fse; - struct pcm_buffer expand_buffer; + PcmBuffer expand_buffer; /** * This buffer will hold encoded data from libFLAC until it is @@ -160,7 +160,7 @@ flac_encoder_close(struct encoder *_encoder) FLAC__stream_encoder_delete(encoder->fse); - pcm_buffer_deinit(&encoder->expand_buffer); + encoder->expand_buffer.Clear(); fifo_buffer_free(encoder->output_buffer); } @@ -205,8 +205,6 @@ flac_encoder_open(struct encoder *_encoder, struct audio_format *audio_format, return false; } - pcm_buffer_init(&encoder->expand_buffer); - encoder->output_buffer = growing_fifo_new(); /* this immediately outputs data through callback */ @@ -275,14 +273,14 @@ flac_encoder_write(struct encoder *_encoder, switch (encoder->audio_format.format) { case SAMPLE_FORMAT_S8: - exbuffer = pcm_buffer_get(&encoder->expand_buffer, length*4); + exbuffer = encoder->expand_buffer.Get(length * 4); pcm8_to_flac((int32_t *)exbuffer, (const int8_t *)data, num_samples); buffer = exbuffer; break; case SAMPLE_FORMAT_S16: - exbuffer = pcm_buffer_get(&encoder->expand_buffer, length*2); + exbuffer = encoder->expand_buffer.Get(length * 2); pcm16_to_flac((int32_t *)exbuffer, (const int16_t *)data, num_samples); buffer = exbuffer; -- cgit v1.2.3