diff options
author | Max Kellermann <max@duempel.org> | 2014-02-22 13:40:08 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-02-22 13:40:11 +0100 |
commit | 240a697f6ca447f824c0ee549bb0286445311fc5 (patch) | |
tree | 6df372437566f35b97d209a7b2ffdc913c08aefa /src/encoder/plugins/OpusEncoderPlugin.cxx | |
parent | 5a0dc808fd5f7aea7519a227486a43796fec5538 (diff) | |
download | mpd-240a697f6ca447f824c0ee549bb0286445311fc5.tar.gz mpd-240a697f6ca447f824c0ee549bb0286445311fc5.tar.xz mpd-240a697f6ca447f824c0ee549bb0286445311fc5.zip |
encoder/opus: use xalloc() instead of g_malloc()
Diffstat (limited to '')
-rw-r--r-- | src/encoder/plugins/OpusEncoderPlugin.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/encoder/plugins/OpusEncoderPlugin.cxx b/src/encoder/plugins/OpusEncoderPlugin.cxx index 2d3194c26..5cb65e4f2 100644 --- a/src/encoder/plugins/OpusEncoderPlugin.cxx +++ b/src/encoder/plugins/OpusEncoderPlugin.cxx @@ -24,6 +24,7 @@ #include "../EncoderAPI.hxx" #include "AudioFormat.hxx" #include "config/ConfigError.hxx" +#include "util/Alloc.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" #include "system/ByteOrder.hxx" @@ -31,8 +32,6 @@ #include <opus.h> #include <ogg/ogg.h> -#include <glib.h> - #include <assert.h> #include <stdlib.h> @@ -188,7 +187,7 @@ opus_encoder_open(Encoder *_encoder, encoder->buffer_frames = audio_format.sample_rate / 50; encoder->buffer_size = encoder->frame_size * encoder->buffer_frames; encoder->buffer_position = 0; - encoder->buffer = (unsigned char *)g_malloc(encoder->buffer_size); + encoder->buffer = (unsigned char *)xalloc(encoder->buffer_size); encoder->stream.Initialize(GenerateOggSerial()); encoder->packetno = 0; @@ -202,7 +201,7 @@ opus_encoder_close(Encoder *_encoder) struct opus_encoder *encoder = (struct opus_encoder *)_encoder; encoder->stream.Deinitialize(); - g_free(encoder->buffer); + free(encoder->buffer); opus_encoder_destroy(encoder->enc); } @@ -366,7 +365,7 @@ opus_encoder_generate_tags(struct opus_encoder *encoder) size_t version_length = strlen(version); size_t comments_size = 8 + 4 + version_length + 4; - unsigned char *comments = (unsigned char *)g_malloc(comments_size); + unsigned char *comments = (unsigned char *)xalloc(comments_size); memcpy(comments, "OpusTags", 8); *(uint32_t *)(comments + 8) = ToLE32(version_length); memcpy(comments + 12, version, version_length); @@ -382,7 +381,7 @@ opus_encoder_generate_tags(struct opus_encoder *encoder) encoder->stream.PacketIn(packet); encoder->stream.Flush(); - g_free(comments); + free(comments); } static size_t |