Unverified Commit 7a0b70ef authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Remove use of Ogg integer types

parent e7712a68
......@@ -32,7 +32,7 @@
extern "C" {
# endif
#include "opus.h"
#include <opus.h>
#ifndef OPE_EXPORT
# if defined(WIN32)
......
......@@ -69,7 +69,7 @@ typedef struct {
int pos;
} ROPacket;
static int write_uint32(Packet *p, ogg_uint32_t val)
static int write_uint32(Packet *p, opus_uint32 val)
{
if (p->pos>p->maxlen-4)
return 0;
......@@ -81,7 +81,7 @@ static int write_uint32(Packet *p, ogg_uint32_t val)
return 1;
}
static int write_uint16(Packet *p, ogg_uint16_t val)
static int write_uint16(Packet *p, opus_uint16 val)
{
if (p->pos>p->maxlen-2)
return 0;
......
......@@ -29,13 +29,13 @@
#define OPUS_HEADER_H
#include <stdlib.h>
#include <ogg/ogg.h>
#include <opus.h>
typedef struct {
int version;
int channels; /* Number of channels: 1..255 */
int preskip;
ogg_uint32_t input_sample_rate;
opus_uint32 input_sample_rate;
int gain; /* in dB S7.8 should be zero whenever possible */
int channel_mapping;
/* The rest is only used if channel_mapping != 0 */
......
......@@ -38,6 +38,7 @@
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <ogg/ogg.h>
#include <opus_multistream.h>
#include "opusenc.h"
#include "opus_header.h"
......@@ -161,8 +162,8 @@ struct EncStream {
int seen_file_icons;
int close_at_end;
int header_is_frozen;
ogg_int64_t end_granule;
ogg_int64_t granule_offset;
opus_int64 end_granule;
opus_int64 granule_offset;
EncStream *next;
};
......@@ -181,9 +182,9 @@ struct OggOpusEnc {
int decision_delay;
int max_ogg_delay;
int global_granule_offset;
ogg_int64_t curr_granule;
ogg_int64_t write_granule;
ogg_int64_t last_page_granule;
opus_int64 curr_granule;
opus_int64 write_granule;
opus_int64 last_page_granule;
unsigned char *chaining_keyframe;
int chaining_keyframe_length;
OpusEncCallbacks callbacks;
......@@ -408,7 +409,7 @@ static void shift_buffer(OggOpusEnc *enc) {
static void encode_buffer(OggOpusEnc *enc) {
/* Round up when converting the granule pos because the decoder will round down. */
ogg_int64_t end_granule48k = (enc->streams->end_granule*48000 + enc->rate - 1)/enc->rate + enc->global_granule_offset;
opus_int64 end_granule48k = (enc->streams->end_granule*48000 + enc->rate - 1)/enc->rate + enc->global_granule_offset;
while (enc->buffer_end-enc->buffer_start > enc->frame_size + enc->decision_delay) {
int cont;
opus_int32 pred;
......
......@@ -125,14 +125,14 @@ int is_gif(const unsigned char *buf, size_t length){
PNG.
On failure, simply leaves its outputs unmodified.*/
void extract_png_params(const unsigned char *data, size_t data_length,
ogg_uint32_t *width, ogg_uint32_t *height,
ogg_uint32_t *depth, ogg_uint32_t *colors,
opus_uint32 *width, opus_uint32 *height,
opus_uint32 *depth, opus_uint32 *colors,
int *has_palette){
if(is_png(data,data_length)){
size_t offs;
offs=8;
while(data_length-offs>=12){
ogg_uint32_t chunk_len;
opus_uint32 chunk_len;
chunk_len=READ_U32_BE(data+offs);
if(chunk_len>data_length-(offs+12))break;
else if(chunk_len==13&&memcmp(data+offs+4,"IHDR",4)==0){
......@@ -169,8 +169,8 @@ void extract_png_params(const unsigned char *data, size_t data_length,
GIF.
On failure, simply leaves its outputs unmodified.*/
void extract_gif_params(const unsigned char *data, size_t data_length,
ogg_uint32_t *width, ogg_uint32_t *height,
ogg_uint32_t *depth, ogg_uint32_t *colors,
opus_uint32 *width, opus_uint32 *height,
opus_uint32 *depth, opus_uint32 *colors,
int *has_palette){
if(is_gif(data,data_length)&&data_length>=14){
*width=data[6]|data[7]<<8;
......@@ -187,8 +187,8 @@ void extract_gif_params(const unsigned char *data, size_t data_length,
JPEG.
On failure, simply leaves its outputs unmodified.*/
void extract_jpeg_params(const unsigned char *data, size_t data_length,
ogg_uint32_t *width, ogg_uint32_t *height,
ogg_uint32_t *depth, ogg_uint32_t *colors,
opus_uint32 *width, opus_uint32 *height,
opus_uint32 *depth, opus_uint32 *colors,
int *has_palette){
if(is_jpeg(data,data_length)){
size_t offs;
......@@ -349,10 +349,10 @@ char *parse_picture_specification(const char *spec,
memcpy(buf+data_offset,filename,data_length);
}
else{
ogg_uint32_t file_width;
ogg_uint32_t file_height;
ogg_uint32_t file_depth;
ogg_uint32_t file_colors;
opus_uint32 file_width;
opus_uint32 file_height;
opus_uint32 file_depth;
opus_uint32 file_colors;
int has_palette;
/*Complicated case: we have a real file.
Read it in, attempt to parse the media type and image dimensions if
......
#ifndef __PICTURE_H
#define __PICTURE_H
#include <ogg/ogg.h>
#include <opus.h>
typedef enum{
PIC_FORMAT_JPEG,
......@@ -22,16 +22,16 @@ int is_png(const unsigned char *buf, size_t length);
int is_gif(const unsigned char *buf, size_t length);
void extract_png_params(const unsigned char *data, size_t data_length,
ogg_uint32_t *width, ogg_uint32_t *height,
ogg_uint32_t *depth, ogg_uint32_t *colors,
opus_uint32 *width, opus_uint32 *height,
opus_uint32 *depth, opus_uint32 *colors,
int *has_palette);
void extract_gif_params(const unsigned char *data, size_t data_length,
ogg_uint32_t *width, ogg_uint32_t *height,
ogg_uint32_t *depth, ogg_uint32_t *colors,
opus_uint32 *width, opus_uint32 *height,
opus_uint32 *depth, opus_uint32 *colors,
int *has_palette);
void extract_jpeg_params(const unsigned char *data, size_t data_length,
ogg_uint32_t *width, ogg_uint32_t *height,
ogg_uint32_t *depth, ogg_uint32_t *colors,
opus_uint32 *width, opus_uint32 *height,
opus_uint32 *depth, opus_uint32 *colors,
int *has_palette);
char *parse_picture_specification(const char *spec,
......
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