29 format(FORMAT_INVALID)
33 if((result = ov_fopen(path, &
oggStream)) < 0) {
40 vorbis_info* vorbisInfo = ov_info(&
oggStream, -1);
43 if(vorbisInfo->channels == 1) {
68 *error =
"OggSoundStream: Invalid, no data available.";
75 while(*resultSize < bufferSize) {
76 result = ov_read(&
oggStream, buffer + *resultSize, bufferSize - *resultSize, 0, 2, 1, &
section);
79 *resultSize += result;
91 if(*resultSize == 0) {
92 *error =
"OggSoundStream: Read 0 bytes.";
105 GfError(
"OggSoundStream: Invalid, no info available.\n");
118 GfError(
"OggSoundStream: Invalid, no info available.\n");
122 vorbis_info* vorbisInfo = ov_info(&
oggStream, -1);
123 vorbis_comment* vorbisComment = ov_comment(&
oggStream, -1);
125 GfOut(
"version %d\n", vorbisInfo->version);
126 GfOut(
"channels %d\n", vorbisInfo->channels);
127 GfOut(
"rate (hz) %ld\n", vorbisInfo->rate);
128 GfOut(
"bitrate upper %ld\n", vorbisInfo->bitrate_upper);
129 GfOut(
"bitrate nominal %ld\n", vorbisInfo->bitrate_nominal);
130 GfOut(
"bitrate lower %ld\n", vorbisInfo->bitrate_lower);
131 GfOut(
"bitrate window %ld\n\n", vorbisInfo->bitrate_window);
132 GfOut(
"vendor %s\n", vorbisComment->vendor);
135 for(i = 0; i < vorbisComment->comments; i++) {
136 GfOut(
" %s\n", vorbisComment->user_comments[i]);
148 return "OggSoundStream: Read from media.";
150 return "OggSoundStream: Not Vorbis data.";
152 return "OggSoundStream: Vorbis version mismatch.";
154 return "OggSoundStream: Invalid Vorbis header.";
156 return "OggSoundStream: Internal logic fault (bug or heap/stack corruption.";
158 return "OggSoundStream: Unknown Ogg error.";
virtual bool read(char *buffer, const int bufferSize, int *resultSize, const char **error)
const char * errorString(int code)
Section header structure.
OggSoundStream(char *path)
virtual ~OggSoundStream()
The Gaming Framework API.