Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOALSoundDecoder.m File Reference
import "OOALSoundDecoder.h"
import "NSDataOOExtensions.h"
import <vorbis/vorbisfile.h>
import "OOLogging.h"
import "unzip.h"
+ Include dependency graph for OOALSoundDecoder.m:

Go to the source code of this file.

Classes

class  OOALSoundVorbisCodec
 

Enumerations

enum  { kMaxDecodeSize = 1 << 20 }
 

Functions

static size_t OOReadOXZVorbis (void *ptr, size_t size, size_t nmemb, void *datasource)
 
static int OOCloseOXZVorbis (void *datasource)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kMaxDecodeSize 

Definition at line 35 of file OOALSoundDecoder.m.

36{
37 kMaxDecodeSize = 1 << 20 // 2^20 frames = 4 MB
38};
@ kMaxDecodeSize

Function Documentation

◆ OOCloseOXZVorbis()

static int OOCloseOXZVorbis ( void * datasource)
static

Definition at line 520 of file OOALSoundDecoder.m.

521{
522// doing this prevents replaying
523// OOALSoundVorbisCodec *src = (OOALSoundVorbisCodec *)datasource;
524// unzClose(src->uf);
525 return 0;
526}

◆ OOReadOXZVorbis()

static size_t OOReadOXZVorbis ( void * ptr,
size_t size,
size_t nmemb,
void * datasource )
static

Definition at line 500 of file OOALSoundDecoder.m.

501{
502 OOALSoundVorbisCodec *src = (OOALSoundVorbisCodec *)datasource;
503 size_t toRead = size*nmemb;
504 void *buf = (void*)malloc(toRead);
505 int err = UNZ_OK;
506 err = unzReadCurrentFile(src->uf, buf, toRead);
507// OOLog(@"sound.replay",@"Read %d blocks, got %d",toRead,err);
508 if (err > 0)
509 {
510 memcpy(ptr, buf, err);
511 }
512 if (err < 0)
513 {
514 return OV_EREAD;
515 }
516 return err;
517}
voidpf void uLong size
Definition ioapi.h:134
voidpf void * buf
Definition ioapi.h:134
int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len)
Definition unzip.c:1696
#define UNZ_OK
Definition unzip.h:74

References OOALSoundVorbisCodec::uf, UNZ_OK, and unzReadCurrentFile().

+ Here is the call graph for this function: