Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
OggCodec.cpp
Go to the documentation of this file.
1
//
2
// C++ Implementation: Audio::OggCodec
3
//
4
5
#include "config.h"
6
7
#ifdef HAVE_OGG
8
9
#include "../CodecRegistry.h"
10
11
#include "
OggCodec.h
"
12
#include "
OggStream.h
"
13
#include "
OggData.h
"
14
#include "config.h"
15
16
namespace
Audio {
17
18
OggCodec::OggCodec
() : Codec(
"ogg"
)
19
{
20
}
21
22
OggCodec::~OggCodec
()
23
{
24
}
25
26
const
Codec::Extensions
*
OggCodec::getExtensions
()
const
throw()
27
{
28
static
Extensions
ext;
29
if
(ext.empty() == 0) {
30
ext.push_back(
".ogg"
);
31
}
32
return
&ext;
33
}
34
35
bool
OggCodec::canHandle
(
const
std::string& path,
bool
canOpen,
VSFileSystem::VSFileType
type)
throw
()
36
{
37
if
(canOpen) {
38
try
{
39
VSFileSystem::VSFile
file
;
40
if
( file.
OpenReadOnly
(path, type) <=
VSFileSystem::Ok
)
41
return
false
;
42
43
Format fmt;
44
__impl::OggData
test
(file, fmt, 0);
45
46
return
true
;
47
}
catch
(
Exception
e) {
48
return
false
;
49
}
50
}
else
{
51
// Can't know for sure
52
return
true
;
53
}
54
}
55
56
Stream*
OggCodec::open
(
const
std::string& path,
VSFileSystem::VSFileType
type)
throw
(
Exception
)
57
{
58
return
new
OggStream(path, type);
59
}
60
61
static
CodecRegistration registration(
new
OggCodec());
62
63
};
64
65
#endif
src
audio
codecs
OggCodec.cpp
Generated on Fri May 29 2015 23:07:06 for Vegastrike 0.5.1 rc1 by
1.8.4