FFMS2: Add a missing function the updated matroska parser expects

Originally committed to SVN as r2890.
This commit is contained in:
Fredrik Mellbin 2009-05-01 16:58:15 +00:00
parent 35cea05304
commit 94cf1e4c22
2 changed files with 19 additions and 7 deletions

View file

@ -98,6 +98,15 @@ int StdIoProgress(StdIoStream *st, ulonglong cur, ulonglong max) {
return 1;
}
longlong StdIoGetFileSize(StdIoStream *st) {
longlong epos = 0;
longlong cpos = _ftelli64(st->fp);
_fseeki64(st->fp, 0, SEEK_END);
epos = _ftelli64(st->fp);
_fseeki64(st->fp, cpos, SEEK_SET);
return epos;
}
void InitStdIoStream(StdIoStream *st) {
memset(st,0,sizeof(st));
st->base.read = StdIoRead;
@ -108,4 +117,5 @@ void InitStdIoStream(StdIoStream *st) {
st->base.memrealloc = StdIoRealloc;
st->base.memfree = StdIoFree;
st->base.progress = StdIoProgress;
st->base.getfilesize = StdIoGetFileSize;
}

View file

@ -36,9 +36,9 @@
* source file
*/
struct StdIoStream {
struct InputStream base;
FILE *fp;
int error;
struct InputStream base;
FILE *fp;
int error;
};
typedef struct StdIoStream StdIoStream;
@ -64,16 +64,18 @@ unsigned StdIoGetCacheSize(StdIoStream *st);
const char *StdIoGetLastError(StdIoStream *st);
/* memory allocation, this is done via stdlib */
void *StdIoMalloc(StdIoStream *st, size_t size);
void *StdIoMalloc(StdIoStream *st, size_t size);
void *StdIoRealloc(StdIoStream *st, void *mem, size_t size);
void *StdIoRealloc(StdIoStream *st, void *mem, size_t size);
void StdIoFree(StdIoStream *st, void *mem);
void StdIoFree(StdIoStream *st, void *mem);
/* progress report handler for lengthy operations
* returns 0 to abort operation, nonzero to continue
*/
int StdIoProgress(StdIoStream *st, ulonglong cur, ulonglong max);
int StdIoProgress(StdIoStream *st, ulonglong cur, ulonglong max);
longlong StdIoGetFileSize(StdIoStream *st);
void InitStdIoStream(StdIoStream *st);