1
/* poppler-sound.cc: qt interface to poppler
2
* Copyright (C) 2006-2007, Pino Toscano <pino@kde.org>
3
* Copyright (C) 2008, Albert Astals Cid <aacid@kde.org>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2, or (at your option)
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
20
#include "poppler-qt4.h"
42
SoundObject::SoundType m_type;
46
SoundObject::SoundObject(Sound *popplersound)
48
m_soundData = new SoundData();
49
switch ( popplersound->getSoundKind() )
52
m_soundData->m_type = SoundObject::Embedded;
56
m_soundData->m_type = SoundObject::External;
60
m_soundData->m_soundObj = popplersound->copy();
63
SoundObject::~SoundObject()
68
SoundObject::SoundType SoundObject::soundType() const
70
return m_soundData->m_type;
73
QString SoundObject::url() const
75
if ( m_soundData->m_type != SoundObject::External )
78
GooString * goo = m_soundData->m_soundObj->getFileName();
79
return goo ? QString( goo->getCString() ) : QString();
82
QByteArray SoundObject::data() const
84
if ( m_soundData->m_type != SoundObject::Embedded )
87
Stream *stream = m_soundData->m_soundObj->getStream();
92
while ( (i = stream->getChar()) != EOF) {
93
fileArray[dataLen] = (char)i;
96
fileArray.resize(dataLen);
101
double SoundObject::samplingRate() const
103
return m_soundData->m_soundObj->getSamplingRate();
106
int SoundObject::channels() const
108
return m_soundData->m_soundObj->getChannels();
111
int SoundObject::bitsPerSample() const
113
return m_soundData->m_soundObj->getBitsPerSample();
116
SoundObject::SoundEncoding SoundObject::soundEncoding() const
118
switch ( m_soundData->m_soundObj->getEncoding() )
121
return SoundObject::Raw;
123
return SoundObject::Signed;
125
return SoundObject::muLaw;
127
return SoundObject::ALaw;
129
return SoundObject::Raw;