ref: 013735091f819905f9437b2db891b32a6f6ae3a7
parent: ebe189dc51aee17a1f6517ff3013546ac06120df
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Sat Apr 29 20:46:35 EDT 2017
missing const
--- a/include/opusenc.h
+++ b/include/opusenc.h
@@ -63,10 +63,10 @@
int rate, int channels, int family, int *error);
/** Add/encode any number of float samples to the file. */
-int ope_write_float(OggOpusEnc *enc, float *pcm, int samples_per_channel);
+int ope_write_float(OggOpusEnc *enc, const float *pcm, int samples_per_channel);
/** Add/encode any number of int16 samples to the file. */
-int ope_write(OggOpusEnc *enc, opus_int16 *pcm, int samples_per_channel);
+int ope_write(OggOpusEnc *enc, const opus_int16 *pcm, int samples_per_channel);
/** Close/finalize the stream. */
int ope_close_and_free(OggOpusEnc *enc);
@@ -81,10 +81,10 @@
int ope_continue_new_callbacks(OggOpusEnc *enc, void *user_data);
/** Add a comment to the file (can only be called before encoding samples). */
-int ope_add_comment(OggOpusEnc *enc, char *tag, char *val);
+int ope_add_comment(OggOpusEnc *enc, const char *tag, const char *val);
/** Sets the Opus comment vendor string (optional, defaults to library info). */
-int ope_set_vendor_string(OggOpusEnc *enc, char *vendor);
+int ope_set_vendor_string(OggOpusEnc *enc, const char *vendor);
/** Goes straight to the libopus ctl() functions. */
int ope_encoder_ctl(OggOpusEnc *enc, int request, ...);
--- a/src/opus_header.c
+++ b/src/opus_header.c
@@ -200,7 +200,7 @@
*comments=p;
}
-int comment_add(char **comments, int* length, char *tag, char *val)
+int comment_add(char **comments, int* length, const char *tag, const char *val)
{
char* p=*comments;
int vendor_length=readint(p, 8);
--- a/src/opus_header.h
+++ b/src/opus_header.h
@@ -50,7 +50,7 @@
void comment_init(char **comments, int* length, const char *vendor_string);
-int comment_add(char **comments, int* length, char *tag, char *val);
+int comment_add(char **comments, int* length, const char *tag, const char *val);
void comment_pad(char **comments, int* length, int amount);
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -292,7 +292,7 @@
}
/* Add/encode any number of float samples to the file. */
-int ope_write_float(OggOpusEnc *enc, float *pcm, int samples_per_channel) {
+int ope_write_float(OggOpusEnc *enc, const float *pcm, int samples_per_channel) {
int channels = enc->channels;
if (!enc->stream_is_init) init_stream(enc);
/* FIXME: Add resampling support. */
@@ -313,7 +313,7 @@
}
/* Add/encode any number of int16 samples to the file. */
-int ope_write(OggOpusEnc *enc, opus_int16 *pcm, int samples_per_channel) {
+int ope_write(OggOpusEnc *enc, const opus_int16 *pcm, int samples_per_channel) {
int channels = enc->channels;
if (!enc->stream_is_init) init_stream(enc);
/* FIXME: Add resampling support. */
@@ -367,13 +367,13 @@
}
/* Add a comment to the file (can only be called before encoding samples). */
-int ope_add_comment(OggOpusEnc *enc, char *tag, char *val) {
+int ope_add_comment(OggOpusEnc *enc, const char *tag, const char *val) {
if (comment_add(&enc->comment, &enc->comment_length, tag, val)) return OPE_INTERNAL_ERROR;
return OPE_OK;
}
/* Sets the Opus comment vendor string (optional, defaults to library info). */
-int ope_set_vendor_string(OggOpusEnc *enc, char *vendor) {
+int ope_set_vendor_string(OggOpusEnc *enc, const char *vendor) {
(void)enc;
(void)vendor;
return OPE_UNIMPLEMENTED;