encoder/{Vorbis,Opus}: use new/delete
This commit is contained in:
parent
7071126770
commit
4808c7ef39
@ -67,6 +67,10 @@ struct opus_encoder {
|
|||||||
ogg_int64_t packetno;
|
ogg_int64_t packetno;
|
||||||
|
|
||||||
ogg_int64_t granulepos;
|
ogg_int64_t granulepos;
|
||||||
|
|
||||||
|
opus_encoder() {
|
||||||
|
encoder_struct_init(&encoder, &opus_encoder_plugin);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
gcc_const
|
gcc_const
|
||||||
@ -123,15 +127,12 @@ opus_encoder_configure(struct opus_encoder *encoder,
|
|||||||
static struct encoder *
|
static struct encoder *
|
||||||
opus_encoder_init(const struct config_param *param, GError **error)
|
opus_encoder_init(const struct config_param *param, GError **error)
|
||||||
{
|
{
|
||||||
struct opus_encoder *encoder;
|
opus_encoder *encoder = new opus_encoder();
|
||||||
|
|
||||||
encoder = g_new(struct opus_encoder, 1);
|
|
||||||
encoder_struct_init(&encoder->encoder, &opus_encoder_plugin);
|
|
||||||
|
|
||||||
/* load configuration from "param" */
|
/* load configuration from "param" */
|
||||||
if (!opus_encoder_configure(encoder, param, error)) {
|
if (!opus_encoder_configure(encoder, param, error)) {
|
||||||
/* configuration has failed, roll back and return error */
|
/* configuration has failed, roll back and return error */
|
||||||
g_free(encoder);
|
delete encoder;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +146,7 @@ opus_encoder_finish(struct encoder *_encoder)
|
|||||||
|
|
||||||
/* the real libopus cleanup was already performed by
|
/* the real libopus cleanup was already performed by
|
||||||
opus_encoder_close(), so no real work here */
|
opus_encoder_close(), so no real work here */
|
||||||
g_free(encoder);
|
delete encoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -55,6 +55,10 @@ struct vorbis_encoder {
|
|||||||
vorbis_info vi;
|
vorbis_info vi;
|
||||||
|
|
||||||
OggStream stream;
|
OggStream stream;
|
||||||
|
|
||||||
|
vorbis_encoder() {
|
||||||
|
encoder_struct_init(&encoder, &vorbis_encoder_plugin);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline GQuark
|
static inline GQuark
|
||||||
@ -120,13 +124,12 @@ vorbis_encoder_configure(struct vorbis_encoder *encoder,
|
|||||||
static struct encoder *
|
static struct encoder *
|
||||||
vorbis_encoder_init(const struct config_param *param, GError **error)
|
vorbis_encoder_init(const struct config_param *param, GError **error)
|
||||||
{
|
{
|
||||||
struct vorbis_encoder *encoder = g_new(struct vorbis_encoder, 1);
|
vorbis_encoder *encoder = new vorbis_encoder();
|
||||||
encoder_struct_init(&encoder->encoder, &vorbis_encoder_plugin);
|
|
||||||
|
|
||||||
/* load configuration from "param" */
|
/* load configuration from "param" */
|
||||||
if (!vorbis_encoder_configure(encoder, param, error)) {
|
if (!vorbis_encoder_configure(encoder, param, error)) {
|
||||||
/* configuration has failed, roll back and return error */
|
/* configuration has failed, roll back and return error */
|
||||||
g_free(encoder);
|
delete encoder;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +143,7 @@ vorbis_encoder_finish(struct encoder *_encoder)
|
|||||||
|
|
||||||
/* the real libvorbis/libogg cleanup was already performed by
|
/* the real libvorbis/libogg cleanup was already performed by
|
||||||
vorbis_encoder_close(), so no real work here */
|
vorbis_encoder_close(), so no real work here */
|
||||||
g_free(encoder);
|
delete encoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
Loading…
Reference in New Issue
Block a user