CLAM-Development
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
audiofileio
codecs
OggVorbisAudioStream.hxx
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG)
3
* UNIVERSITAT POMPEU FABRA
4
*
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*
20
*/
21
22
#if USE_OGGVORBIS != 1
23
#error USE_OGGVORBIS was not set to 1 in your settings.cfg file, but you are including files that require this. Please fix your settings.cfg
24
#endif
25
26
#ifndef __OGGVORBISAUDIOSTREAM__
27
#define __OGGVORBISAUDIOSTREAM__
28
29
#include <string>
30
#include <vorbis/vorbisfile.h>
31
#include <vorbis/vorbisenc.h>
32
#include <deque>
33
#include <vector>
34
#include "
AudioCodecs_Stream.hxx
"
35
#include "
DataTypes.hxx
"
36
37
namespace
CLAM
38
{
39
40
namespace
AudioCodecs
41
{
42
class
OggVorbisAudioStream
:
public
Stream
43
{
44
45
public
:
46
OggVorbisAudioStream
(
const
AudioFile
& file );
47
~OggVorbisAudioStream
();
48
49
void
PrepareReading
();
50
void
PrepareWriting
();
51
void
Dispose
();
52
void
SeekTo
(
unsigned
long
framePosition);
53
54
protected
:
55
void
DiskToMemoryTransfer
();
56
void
MemoryToDiskTransfer
();
57
58
private
:
59
void
VorbisI_EncoderSetup();
60
void
WriteBitstreamHeader();
61
62
void
DoVorbisAnalysis();
63
void
PushAnalysisBlocksOntoOggStream();
64
void
ConsumeDecodedSamples();
65
66
protected
:
67
std::string
mName
;
68
FILE*
mFileHandle
;
69
OggVorbis_File
mNativeFileParams
;
70
int
mCurrentSection
;
71
bool
mValidFileParams
;
72
73
// Structs needed for Vorbis encoding
74
vorbis_info
mStreamInfo
;
75
vorbis_comment
mFileComments
;
76
77
ogg_stream_state
mOggStreamState
;
// os
78
ogg_page
mOggPage
;
// og
79
ogg_packet
mOggPacket
;
// op
80
vorbis_dsp_state
mDSPState
;
// vd
81
vorbis_block
mVorbisBlock
;
// vb
82
83
int
mEncodedSampleRate
;
84
bool
mEncoding
;
85
86
static
const
unsigned
mMaxBlockSize
;
87
static
const
unsigned
mAnalysisWindowSize
;
88
std::vector<TInt16>
mBlockBuffer
;
89
std::vector<std::deque<TData> >
mEncodeBuffer
;
90
std::deque<TInt16>
mDecodeBuffer
;
91
92
TSize
mLastBytesRead
;
93
};
94
}
95
96
}
97
98
#endif // OggVorbisAudioStream.hxx
99
Generated by
1.8.1