From: cloudwalk Date: Fri, 16 Oct 2020 22:45:57 +0000 (+0000) Subject: ogg: Use stdint types X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ae621b85bde1c51e8193e5bbc19ad530899e7b9d;p=xonotic%2Fdarkplaces.git ogg: Use stdint types git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13007 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cap_ogg.c b/cap_ogg.c index 42d72b5f..16802dc9 100644 --- a/cap_ogg.c +++ b/cap_ogg.c @@ -16,13 +16,6 @@ static cvar_t cl_capturevideo_ogg_theora_noise_sensitivity = {CF_CLIENT | CF_ARC static cvar_t cl_capturevideo_ogg_theora_sharpness = {CF_CLIENT | CF_ARCHIVE, "cl_capturevideo_ogg_theora_sharpness", "0", "sharpness (0 to 2); lower is sharper"}; static cvar_t cl_capturevideo_ogg_vorbis_quality = {CF_CLIENT | CF_ARCHIVE, "cl_capturevideo_ogg_vorbis_quality", "3", "audio quality (-1 to 10); higher is better"}; -// ogg.h stuff -typedef int16_t ogg_int16_t; -typedef uint16_t ogg_uint16_t; -typedef int32_t ogg_int32_t; -typedef uint32_t ogg_uint32_t; -typedef int64_t ogg_int64_t; - typedef struct { long endbyte; int endbit; @@ -52,7 +45,7 @@ typedef struct { int *lacing_vals; /* The values that will go to the segment table */ - ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact + int64_t *granule_vals; /* granulepos values for headers. Not compact this way, but it is simple coupled to the lacing fifo */ long lacing_storage; @@ -69,12 +62,12 @@ typedef struct { of a logical bitstream */ long serialno; long pageno; - ogg_int64_t packetno; /* sequence number for decode; the framing + int64_t packetno; /* sequence number for decode; the framing knows where there's a hole in the data, but we need coupling so that the codec (which is in a seperate abstraction layer) also knows about the gap */ - ogg_int64_t granulepos; + int64_t granulepos; } ogg_stream_state; @@ -87,9 +80,9 @@ typedef struct { long b_o_s; long e_o_s; - ogg_int64_t granulepos; + int64_t granulepos; - ogg_int64_t packetno; /* sequence number for decode; the framing + int64_t packetno; /* sequence number for decode; the framing knows where there's a hole in the data, but we need coupling so that the codec (which is in a seperate abstraction @@ -117,7 +110,7 @@ static int (*qogg_stream_flush) (ogg_stream_state *os, ogg_page *og); static int (*qogg_stream_init) (ogg_stream_state *os,int serialno); static int (*qogg_stream_clear) (ogg_stream_state *os); -static ogg_int64_t (*qogg_page_granulepos) (ogg_page *og); +static int64_t (*qogg_page_granulepos) (ogg_page *og); // end of ogg.h stuff @@ -171,13 +164,13 @@ typedef struct vorbis_dsp_state{ long nW; long centerW; - ogg_int64_t granulepos; - ogg_int64_t sequence; + int64_t granulepos; + int64_t sequence; - ogg_int64_t glue_bits; - ogg_int64_t time_bits; - ogg_int64_t floor_bits; - ogg_int64_t res_bits; + int64_t glue_bits; + int64_t time_bits; + int64_t floor_bits; + int64_t res_bits; void *backend_state; } vorbis_dsp_state; @@ -194,8 +187,8 @@ typedef struct vorbis_block{ int mode; int eofflag; - ogg_int64_t granulepos; - ogg_int64_t sequence; + int64_t granulepos; + int64_t sequence; vorbis_dsp_state *vd; /* For read-only access of configuration */ /* local storage to avoid remallocing; it's up to the mapping to @@ -268,7 +261,7 @@ static int (*qvorbis_block_init) (vorbis_dsp_state *v, vorbis_block *vb); static int (*qvorbis_block_clear) (vorbis_block *vb); static void (*qvorbis_dsp_clear) (vorbis_dsp_state *v); static double (*qvorbis_granule_time) (vorbis_dsp_state *v, - ogg_int64_t granulepos); + int64_t granulepos); /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/ @@ -362,16 +355,16 @@ typedef enum { * other paramters and good default settings for the encoder parameters. */ typedef struct { - ogg_uint32_t width; /**< encoded frame width */ - ogg_uint32_t height; /**< encoded frame height */ - ogg_uint32_t frame_width; /**< display frame width */ - ogg_uint32_t frame_height; /**< display frame height */ - ogg_uint32_t offset_x; /**< horizontal offset of the displayed frame */ - ogg_uint32_t offset_y; /**< vertical offset of the displayed frame */ - ogg_uint32_t fps_numerator; /**< frame rate numerator **/ - ogg_uint32_t fps_denominator; /**< frame rate denominator **/ - ogg_uint32_t aspect_numerator; /**< pixel aspect ratio numerator */ - ogg_uint32_t aspect_denominator; /**< pixel aspect ratio denominator */ + uint32_t width; /**< encoded frame width */ + uint32_t height; /**< encoded frame height */ + uint32_t frame_width; /**< display frame width */ + uint32_t frame_height; /**< display frame height */ + uint32_t offset_x; /**< horizontal offset of the displayed frame */ + uint32_t offset_y; /**< vertical offset of the displayed frame */ + uint32_t fps_numerator; /**< frame rate numerator **/ + uint32_t fps_denominator; /**< frame rate denominator **/ + uint32_t aspect_numerator; /**< pixel aspect ratio numerator */ + uint32_t aspect_denominator; /**< pixel aspect ratio denominator */ theora_colorspace colorspace; /**< colorspace */ int target_bitrate; /**< nominal bitrate in bits per second */ int quality; /**< Nominal quality setting, 0-63 */ @@ -387,14 +380,14 @@ typedef struct { /* encode only */ int dropframes_p; int keyframe_auto_p; - ogg_uint32_t keyframe_frequency; - ogg_uint32_t keyframe_frequency_force; /* also used for decode init to + uint32_t keyframe_frequency; + uint32_t keyframe_frequency_force; /* also used for decode init to get granpos shift correct */ - ogg_uint32_t keyframe_data_target_bitrate; - ogg_int32_t keyframe_auto_threshold; - ogg_uint32_t keyframe_mindistance; - ogg_int32_t noise_sensitivity; - ogg_int32_t sharpness; + uint32_t keyframe_data_target_bitrate; + int32_t keyframe_auto_threshold; + uint32_t keyframe_mindistance; + int32_t noise_sensitivity; + int32_t sharpness; theora_pixelformat pixelformat; /**< chroma subsampling mode to expect */ @@ -404,7 +397,7 @@ typedef struct { */ typedef struct{ theora_info *i; - ogg_int64_t granulepos; + int64_t granulepos; void *internal_encode; void *internal_decode; @@ -449,7 +442,7 @@ static void (*qtheora_info_clear) (theora_info *c); static void (*qtheora_clear) (theora_state *t); static void (*qtheora_comment_init) (theora_comment *tc); static void (*qtheora_comment_clear) (theora_comment *tc); -static double (*qtheora_granule_time) (theora_state *th,ogg_int64_t granulepos); +static double (*qtheora_granule_time) (theora_state *th,int64_t granulepos); static int (*qtheora_control) (theora_state *th,int req,void *buf,size_t buf_sz); // end of theora.h stuff diff --git a/snd_ogg.c b/snd_ogg.c index 79c1b035..540966d4 100644 --- a/snd_ogg.c +++ b/snd_ogg.c @@ -59,16 +59,10 @@ void OGG_CloseLibrary (void) {} ================================================================= */ -#ifdef _MSC_VER -typedef __int64 ogg_int64_t; -#else -typedef long long ogg_int64_t; -#endif - typedef struct { size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource); - int (*seek_func) (void *datasource, ogg_int64_t offset, int whence); + int (*seek_func) (void *datasource, int64_t offset, int whence); int (*close_func) (void *datasource); long (*tell_func) (void *datasource); } ov_callbacks; @@ -103,7 +97,7 @@ typedef struct long body_fill; long body_returned; int *lacing_vals; - ogg_int64_t *granule_vals; + int64_t *granule_vals; long lacing_storage; long lacing_fill; long lacing_packet; @@ -114,8 +108,8 @@ typedef struct int b_o_s; long serialno; long pageno; - ogg_int64_t packetno; - ogg_int64_t granulepos; + int64_t packetno; + int64_t granulepos; } ogg_stream_state; typedef struct @@ -133,12 +127,12 @@ typedef struct long W; long nW; long centerW; - ogg_int64_t granulepos; - ogg_int64_t sequence; - ogg_int64_t glue_bits; - ogg_int64_t time_bits; - ogg_int64_t floor_bits; - ogg_int64_t res_bits; + int64_t granulepos; + int64_t sequence; + int64_t glue_bits; + int64_t time_bits; + int64_t floor_bits; + int64_t res_bits; void *backend_state; } vorbis_dsp_state; @@ -161,8 +155,8 @@ typedef struct int pcmend; int mode; int eofflag; - ogg_int64_t granulepos; - ogg_int64_t sequence; + int64_t granulepos; + int64_t sequence; vorbis_dsp_state *vd; void *localstore; long localtop; @@ -188,17 +182,17 @@ typedef struct { void *datasource; int seekable; - ogg_int64_t offset; - ogg_int64_t end; + int64_t offset; + int64_t end; ogg_sync_state oy; int links; - ogg_int64_t *offsets; - ogg_int64_t *dataoffsets; + int64_t *offsets; + int64_t *dataoffsets; long *serialnos; - ogg_int64_t *pcmlengths; + int64_t *pcmlengths; vorbis_info *vi; vorbis_comment *vc; - ogg_int64_t pcm_offset; + int64_t pcm_offset; int ready_state; long current_serialno; int current_link; @@ -227,8 +221,8 @@ static char * (*qvorbis_comment_query) (vorbis_comment *vc, const char *tag, int static int (*qov_open_callbacks) (void *datasource, OggVorbis_File *vf, char *initial, long ibytes, ov_callbacks callbacks); -static int (*qov_pcm_seek) (OggVorbis_File *vf,ogg_int64_t pos); -static ogg_int64_t (*qov_pcm_total) (OggVorbis_File *vf,int i); +static int (*qov_pcm_seek) (OggVorbis_File *vf,int64_t pos); +static int64_t (*qov_pcm_total) (OggVorbis_File *vf,int i); static long (*qov_read) (OggVorbis_File *vf,char *buffer,int length, int bigendianp,int word,int sgned,int *bitstream); @@ -342,7 +336,7 @@ void OGG_CloseLibrary (void) typedef struct { unsigned char *buffer; - ogg_int64_t ind, buffsize; + int64_t ind, buffsize; } ov_decode_t; static size_t ovcb_read (void *ptr, size_t size, size_t nb, void *datasource) @@ -361,7 +355,7 @@ static size_t ovcb_read (void *ptr, size_t size, size_t nb, void *datasource) return len / size; } -static int ovcb_seek (void *datasource, ogg_int64_t offset, int whence) +static int ovcb_seek (void *datasource, int64_t offset, int whence) { ov_decode_t *ov_decode = (ov_decode_t*)datasource; @@ -470,7 +464,7 @@ static void OGG_GetSamplesFloat (channel_t *ch, sfx_t *sfx, int firstsampleframe // we expect to decode forward from here so this will be our new buffer start per_ch->buffer_firstframe = firstsampleframe; per_ch->buffer_numframes = 0; - ret = qov_pcm_seek(&per_ch->vf, (ogg_int64_t)firstsampleframe); + ret = qov_pcm_seek(&per_ch->vf, (int64_t)firstsampleframe); if (ret != 0) { // LadyHavoc: we can't Con_Printf here, not thread safe... @@ -678,8 +672,8 @@ qbool OGG_LoadVorbisFile(const char *filename, sfx_t *sfx) { // small sounds are entirely loaded and use the PCM fetcher char *buff; - ogg_int64_t len; - ogg_int64_t done; + int64_t len; + int64_t done; int bs; long ret; if (developer_loading.integer >= 2)