From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- mpeglib/lib/splay/mpegtoraw.cpp | 127 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 mpeglib/lib/splay/mpegtoraw.cpp (limited to 'mpeglib/lib/splay/mpegtoraw.cpp') diff --git a/mpeglib/lib/splay/mpegtoraw.cpp b/mpeglib/lib/splay/mpegtoraw.cpp new file mode 100644 index 00000000..93143bbe --- /dev/null +++ b/mpeglib/lib/splay/mpegtoraw.cpp @@ -0,0 +1,127 @@ +/* MPEG/WAVE Sound library + + (C) 1997 by Jung woo-jae */ + +// Mpegtoraw.cc +// Server which get mpeg format and put raw format. + + +#include "mpegsound.h" +#include "synthesis.h" +#include "dump.h" +#include "../frame/audioFrame.h" + +#include + +using namespace std; + +Mpegtoraw::Mpegtoraw(MpegAudioStream* mpegAudioStream, + MpegAudioHeader* mpegAudioHeader) { + + this->mpegAudioStream=mpegAudioStream; + this->mpegAudioHeader=mpegAudioHeader; + + this->lOutputStereo=true; + setStereo(true); + setDownSample(false); + + dump=new Dump(); + synthesis=new Synthesis(); + initialize(); + +} + +Mpegtoraw::~Mpegtoraw() { + + delete synthesis; + delete dump; +} + + + + + + + +void Mpegtoraw::setStereo(int flag) { + lWantStereo=flag; +} + +void Mpegtoraw::setDownSample(int flag) { + lDownSample=flag; +} + +int Mpegtoraw::getStereo() { + return lWantStereo; +} + +int Mpegtoraw::getDownSample() { + return lDownSample; +} + + + + + + + +// Convert mpeg to raw +// Mpeg headder class +void Mpegtoraw::initialize() { + + + + layer3initialize(); + + +} + + + + + +// Convert mpeg to raw +int Mpegtoraw::decode(AudioFrame* audioFrame) { + int back=true; + + this->audioFrame=audioFrame; + if (audioFrame->getSize() < RAWDATASIZE) { + cout << "audioFrame needs at least:"<clearrawdata(); + synthesis->clearrawdata(); + + int layer=mpegAudioHeader->getLayer(); + this->lOutputStereo=lWantStereo & mpegAudioHeader->getInputstereo(); + + if (mpegAudioHeader->getProtection()==false) { + mpegAudioStream->getbyte(); + mpegAudioStream->getbyte(); + } + switch(layer) { + case 3: + extractlayer3(); + break; + case 2: + extractlayer2(); + break; + case 1: + extractlayer1(); + break; + default: + cout << "unknown layer:"<setFrameFormat(lOutputStereo, + mpegAudioHeader->getFrequencyHz()>>lDownSample); + + audioFrame->putFloatData(synthesis->getOutputData(),synthesis->getLen()); + return back; + +} -- cgit v1.2.1