Unverified Commit 2161dec6 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

make sampling rate, page sizes, and packet sizes 32-bit values

parent e339b93b
...@@ -85,11 +85,11 @@ extern "C" { ...@@ -85,11 +85,11 @@ extern "C" {
#define OPE_SET_PACKET_CALLBACK(x,u) OPE_SET_PACKET_CALLBACK_REQUEST, (x), (u) #define OPE_SET_PACKET_CALLBACK(x,u) OPE_SET_PACKET_CALLBACK_REQUEST, (x), (u)
#define OPE_GET_PACKET_CALLBACK(x,u) OPE_GET_PACKET_CALLBACK_REQUEST, (x), (u) #define OPE_GET_PACKET_CALLBACK(x,u) OPE_GET_PACKET_CALLBACK_REQUEST, (x), (u)
typedef int (*ope_write_func)(void *user_data, const unsigned char *ptr, int len); typedef int (*ope_write_func)(void *user_data, const unsigned char *ptr, opus_int32 len);
typedef int (*ope_close_func)(void *user_data); typedef int (*ope_close_func)(void *user_data);
typedef int (*ope_packet_func)(void *user_data, const unsigned char *packet_ptr, int packet_len, opus_uint32 flags); typedef int (*ope_packet_func)(void *user_data, const unsigned char *packet_ptr, opus_int32 packet_len, opus_uint32 flags);
/** Callback functions for accessing the stream. */ /** Callback functions for accessing the stream. */
typedef struct { typedef struct {
...@@ -125,14 +125,14 @@ OPE_EXPORT int ope_comments_add_picture(OggOpusComments *comments, const char *s ...@@ -125,14 +125,14 @@ OPE_EXPORT int ope_comments_add_picture(OggOpusComments *comments, const char *s
/** Create a new OggOpus file. */ /** Create a new OggOpus file. */
OPE_EXPORT OggOpusEnc *ope_encoder_create_file(const char *path, const OggOpusComments *comments, int rate, int channels, int family, int *error); OPE_EXPORT OggOpusEnc *ope_encoder_create_file(const char *path, const OggOpusComments *comments, opus_int32 rate, int channels, int family, int *error);
/** Create a new OggOpus file (callback-based). */ /** Create a new OggOpus file (callback-based). */
OPE_EXPORT OggOpusEnc *ope_encoder_create_callbacks(const OpusEncCallbacks *callbacks, void *user_data, OPE_EXPORT OggOpusEnc *ope_encoder_create_callbacks(const OpusEncCallbacks *callbacks, void *user_data,
const OggOpusComments *comments, int rate, int channels, int family, int *error); const OggOpusComments *comments, opus_int32 rate, int channels, int family, int *error);
/** Create a new OggOpus stream, pulling one page at a time. */ /** Create a new OggOpus stream, pulling one page at a time. */
OPE_EXPORT OggOpusEnc *ope_encoder_create_pull(const OggOpusComments *comments, int rate, int channels, int family, int *error); OPE_EXPORT OggOpusEnc *ope_encoder_create_pull(const OggOpusComments *comments, opus_int32 rate, int channels, int family, int *error);
/** Add/encode any number of float samples to the file. */ /** Add/encode any number of float samples to the file. */
OPE_EXPORT int ope_encoder_write_float(OggOpusEnc *enc, const float *pcm, int samples_per_channel); OPE_EXPORT int ope_encoder_write_float(OggOpusEnc *enc, const float *pcm, int samples_per_channel);
...@@ -141,7 +141,7 @@ OPE_EXPORT int ope_encoder_write_float(OggOpusEnc *enc, const float *pcm, int sa ...@@ -141,7 +141,7 @@ OPE_EXPORT int ope_encoder_write_float(OggOpusEnc *enc, const float *pcm, int sa
OPE_EXPORT int ope_encoder_write(OggOpusEnc *enc, const opus_int16 *pcm, int samples_per_channel); OPE_EXPORT int ope_encoder_write(OggOpusEnc *enc, const opus_int16 *pcm, int samples_per_channel);
/** Get the next page from the stream. Returns 1 if there is a page available, 0 if not. */ /** Get the next page from the stream. Returns 1 if there is a page available, 0 if not. */
OPE_EXPORT int ope_encoder_get_page(OggOpusEnc *enc, unsigned char **page, int *len, int flush); OPE_EXPORT int ope_encoder_get_page(OggOpusEnc *enc, unsigned char **page, opus_int32 *len, int flush);
/** Finalizes the stream, but does not deallocate the object. */ /** Finalizes the stream, but does not deallocate the object. */
OPE_EXPORT int ope_encoder_drain(OggOpusEnc *enc); OPE_EXPORT int ope_encoder_drain(OggOpusEnc *enc);
......
...@@ -241,7 +241,7 @@ static void oe_flush_page(OggOpusEnc *enc) { ...@@ -241,7 +241,7 @@ static void oe_flush_page(OggOpusEnc *enc) {
#endif #endif
int stdio_write(void *user_data, const unsigned char *ptr, int len) { int stdio_write(void *user_data, const unsigned char *ptr, opus_int32 len) {
struct StdioObject *obj = (struct StdioObject*)user_data; struct StdioObject *obj = (struct StdioObject*)user_data;
return fwrite(ptr, 1, len, obj->file) != (size_t)len; return fwrite(ptr, 1, len, obj->file) != (size_t)len;
} }
...@@ -260,7 +260,7 @@ static const OpusEncCallbacks stdio_callbacks = { ...@@ -260,7 +260,7 @@ static const OpusEncCallbacks stdio_callbacks = {
}; };
/* Create a new OggOpus file. */ /* Create a new OggOpus file. */
OggOpusEnc *ope_encoder_create_file(const char *path, const OggOpusComments *comments, int rate, int channels, int family, int *error) { OggOpusEnc *ope_encoder_create_file(const char *path, const OggOpusComments *comments, opus_int32 rate, int channels, int family, int *error) {
OggOpusEnc *enc; OggOpusEnc *enc;
struct StdioObject *obj; struct StdioObject *obj;
obj = malloc(sizeof(*obj)); obj = malloc(sizeof(*obj));
...@@ -309,7 +309,7 @@ static void stream_destroy(EncStream *stream) { ...@@ -309,7 +309,7 @@ static void stream_destroy(EncStream *stream) {
/* Create a new OggOpus file (callback-based). */ /* Create a new OggOpus file (callback-based). */
OggOpusEnc *ope_encoder_create_callbacks(const OpusEncCallbacks *callbacks, void *user_data, OggOpusEnc *ope_encoder_create_callbacks(const OpusEncCallbacks *callbacks, void *user_data,
const OggOpusComments *comments, int rate, int channels, int family, int *error) { const OggOpusComments *comments, opus_int32 rate, int channels, int family, int *error) {
OpusMSEncoder *st=NULL; OpusMSEncoder *st=NULL;
OggOpusEnc *enc=NULL; OggOpusEnc *enc=NULL;
int ret; int ret;
...@@ -395,7 +395,7 @@ fail: ...@@ -395,7 +395,7 @@ fail:
} }
/* Create a new OggOpus stream, pulling one page at a time. */ /* Create a new OggOpus stream, pulling one page at a time. */
OPE_EXPORT OggOpusEnc *ope_encoder_create_pull(const OggOpusComments *comments, int rate, int channels, int family, int *error) { OPE_EXPORT OggOpusEnc *ope_encoder_create_pull(const OggOpusComments *comments, opus_int32 rate, int channels, int family, int *error) {
OggOpusEnc *enc = ope_encoder_create_callbacks(NULL, NULL, comments, rate, channels, family, error); OggOpusEnc *enc = ope_encoder_create_callbacks(NULL, NULL, comments, rate, channels, family, error);
enc->pull_api = 1; enc->pull_api = 1;
return enc; return enc;
...@@ -685,7 +685,7 @@ int ope_encoder_write(OggOpusEnc *enc, const opus_int16 *pcm, int samples_per_ch ...@@ -685,7 +685,7 @@ int ope_encoder_write(OggOpusEnc *enc, const opus_int16 *pcm, int samples_per_ch
} }
/* Get the next page from the stream. Returns 1 if there is a page available, 0 if not. */ /* Get the next page from the stream. Returns 1 if there is a page available, 0 if not. */
OPE_EXPORT int ope_encoder_get_page(OggOpusEnc *enc, unsigned char **page, int *len, int flush) { OPE_EXPORT int ope_encoder_get_page(OggOpusEnc *enc, unsigned char **page, opus_int32 *len, int flush) {
if (enc->unrecoverable) return OPE_UNRECOVERABLE; if (enc->unrecoverable) return OPE_UNRECOVERABLE;
if (!enc->pull_api) return 0; if (!enc->pull_api) return 0;
else { else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment