diff --git a/examples/opusfile_example.c b/examples/opusfile_example.c index 1f143d4..5b3f864 100644 --- a/examples/opusfile_example.c +++ b/examples/opusfile_example.c @@ -24,6 +24,14 @@ #endif #include +#if defined(OP_FIXED_POINT) +typedef opus_int16 op_sample; +# define op_read_native_stereo op_read_stereo +#else +typedef float op_sample; +# define op_read_native_stereo op_read_float_stereo +#endif + int main(int _argc,const char **_argv){ OggOpusFile *of; ogg_int64_t pcm_offset; @@ -85,9 +93,9 @@ int main(int _argc,const char **_argv){ } for(;;){ ogg_int64_t next_pcm_offset; - float pcm[120*48*2]; + op_sample pcm[120*48*2]; int li; - ret=op_read_float_stereo(of,pcm,sizeof(pcm)/sizeof(*pcm)); + ret=op_read_native_stereo(of,pcm,sizeof(pcm)/sizeof(*pcm)); if(ret<0){ fprintf(stderr,"Error decoding '%s': %i\n",_argv[1],ret); ret=EXIT_FAILURE; diff --git a/examples/seeking_example.c b/examples/seeking_example.c index a6cfeaa..df7fc9b 100644 --- a/examples/seeking_example.c +++ b/examples/seeking_example.c @@ -26,7 +26,9 @@ #include /*Use shorts, they're smaller.*/ -#define OP_FIXED_POINT (1) +#if !defined(OP_FIXED_POINT) +# define OP_FIXED_POINT (1) +#endif #if defined(OP_FIXED_POINT) @@ -436,8 +438,8 @@ int main(int _argc,const char **_argv){ fprintf(stderr,")...\n"); max_seeks=0; for(i=0;i65535U))return OP_EINVAL; last_host=NULL; + /*We shouldn't have to initialize last_port, but gcc is too dumb to figure + out that last_host!=NULL implies we've already taken one trip through the + loop.*/ + last_port=0; ret=op_parse_url(&_stream->url,_url); if(OP_UNLIKELY(ret<0))return ret; for(nredirs=0;nredirsos.serialno; cur_page_gp=-1; + op_count=0; + /*We shouldn't have to initialize total_duration, but gcc is too dumb to + figure out that op_count>0 implies we've been through the whole loop at + least once.*/ + total_duration=0; do{ /*We should get a page unless the file is truncated or mangled. Otherwise there are no audio data packets in the whole logical stream.*/ @@ -2553,6 +2558,7 @@ static int op_short2float_filter(OggOpusFile *_of,void *_dst,int _dst_sz, op_sample *_src,int _nsamples,int _nchannels){ float *dst; int i; + _of=_of; dst=(float *)_dst; if(OP_UNLIKELY(_nsamples*_nchannels>_dst_sz))_nsamples=_dst_sz/_nchannels; _dst_sz=_nsamples*_nchannels; @@ -2586,7 +2592,7 @@ static int op_short2float_stereo_filter(OggOpusFile *_of, return op_short2float_filter(_of,dst,_dst_sz,_src,_nsamples,2); } -int op_read_stereo_float(OggOpusFile *_of,opus_int16 *_pcm,int _buf_size){ +int op_read_float_stereo(OggOpusFile *_of,float *_pcm,int _buf_size){ return op_read_native_filter(_of,_pcm,_buf_size, op_short2float_stereo_filter,NULL); }