Commit b04ae2f8 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

(tremor) Get rid of file I/O paths

parent f7648c27
Pipeline #68623 passed with stages
in 19 minutes and 46 seconds
......@@ -86,19 +86,11 @@ typedef struct OggVorbis_File {
} OggVorbis_File;
extern int ov_clear(OggVorbis_File *vf);
extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
const char *initial, long ibytes, ov_callbacks callbacks);
extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
const char *initial, long ibytes, ov_callbacks callbacks);
extern int ov_test_open(OggVorbis_File *vf);
extern long ov_bitrate(OggVorbis_File *vf,int i);
extern long ov_bitrate_instant(OggVorbis_File *vf);
extern long ov_streams(OggVorbis_File *vf);
extern long ov_seekable(OggVorbis_File *vf);
extern long ov_serialnumber(OggVorbis_File *vf,int i);
extern int64_t ov_raw_total(OggVorbis_File *vf,int i);
......
......@@ -17,7 +17,6 @@
********************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <math.h>
......@@ -874,13 +873,6 @@ static int _fetch_and_process_packet(OggVorbis_File *vf,
}
}
/* if, eg, 64 bit stdio is configured by default, this will build with
fseek64 */
static int _fseek64_wrap(FILE *f,int64_t off,int whence){
if(f==NULL)return(-1);
return fseek(f,off,whence);
}
static int _ov_open1(void *f,OggVorbis_File *vf,const char *initial,
long ibytes, ov_callbacks callbacks){
int offsettest=((f && callbacks.seek_func)?callbacks.seek_func(f,0,SEEK_CUR):-1);
......@@ -987,9 +979,6 @@ int ov_clear(OggVorbis_File *vf){
(vf->callbacks.close_func)(vf->datasource);
memset(vf,0,sizeof(*vf));
}
#ifdef DEBUG_LEAKS
_VDBG_dump();
#endif
return(0);
}
......@@ -1008,65 +997,6 @@ int ov_open_callbacks(void *f,OggVorbis_File *vf,
return _ov_open2(vf);
}
int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes){
ov_callbacks callbacks = {
(size_t (*)(void *, size_t, size_t, void *)) fread,
(int (*)(void *, int64_t, int)) _fseek64_wrap,
(int (*)(void *)) fclose,
(long (*)(void *)) ftell
};
return ov_open_callbacks((void *)f, vf, initial, ibytes, callbacks);
}
int ov_fopen(const char *path,OggVorbis_File *vf){
int ret;
FILE *f = fopen(path,"rb");
if(!f) return -1;
ret = ov_open(f,vf,NULL,0);
if(ret) fclose(f);
return ret;
}
/* Only partially open the vorbis file; test for Vorbisness, and load
the headers for the first chain. Do not seek (although test for
seekability). Use ov_test_open to finish opening the file, else
ov_clear to close/free it. Same return codes as open. */
int ov_test_callbacks(void *f,OggVorbis_File *vf,
const char *initial,long ibytes,ov_callbacks callbacks)
{
return _ov_open1(f,vf,initial,ibytes,callbacks);
}
int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes){
ov_callbacks callbacks = {
(size_t (*)(void *, size_t, size_t, void *)) fread,
(int (*)(void *, int64_t, int)) _fseek64_wrap,
(int (*)(void *)) fclose,
(long (*)(void *)) ftell
};
return ov_test_callbacks((void *)f, vf, initial, ibytes, callbacks);
}
int ov_test_open(OggVorbis_File *vf){
if(vf->ready_state!=PARTOPEN)return(OV_EINVAL);
return _ov_open2(vf);
}
/* How many logical bitstreams in this physical bitstream? */
long ov_streams(OggVorbis_File *vf){
return vf->links;
}
/* Is the FILE * associated with vf seekable? */
long ov_seekable(OggVorbis_File *vf){
return vf->seekable;
}
/* returns the bitrate for a given logical bitstream or the entire
physical bitstream. If the file is open for random access, it will
find the *actual* average bitrate. If the file is streaming, it
......
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