diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch) | |
tree | 5ac38a06f3dde268dc7927dc155896926aaf7012 /arts/kde/kconverttest.cc | |
download | tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip |
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/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'arts/kde/kconverttest.cc')
-rw-r--r-- | arts/kde/kconverttest.cc | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/arts/kde/kconverttest.cc b/arts/kde/kconverttest.cc new file mode 100644 index 000000000..25cb02e4c --- /dev/null +++ b/arts/kde/kconverttest.cc @@ -0,0 +1,96 @@ +#include <stdio.h> + +#include <qfile.h> +#include <qobject.h> + +#include <klocale.h> +#include <kaboutdata.h> +#include <kcmdlineargs.h> +#include <kapplication.h> + +#include <flowsystem.h> +#include <kplayobject.h> +#include <kartsdispatcher.h> +#include <kplayobjectfactory.h> +#include <kaudioconverter.h> +#include "kconverttest.moc" + +using namespace std; +using namespace Arts; + +static KCmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP("URL to open"), 0 }, + KCmdLineLastOption +}; + +KConvertTest::KConvertTest() +{ +} + +void KConvertTest::slotRawStreamStart() +{ +// cout << "[START]\n\n" << endl; +} + +void KConvertTest::slotNewBlockSize(long blockSize) +{ + m_blockSize = blockSize; +} + +void KConvertTest::slotNewBlockPointer(long blockPointer) +{ + m_blockPointer = blockPointer; +} + +void KConvertTest::slotNewData() +{ + fwrite((void *) m_blockPointer, 1, m_blockSize, stdout); +} + +void KConvertTest::slotRawStreamFinished() +{ +// cout << "\n\n[END]" << endl; +} + +int main(int argc, char **argv) +{ + KAboutData aboutData("kconverttest", I18N_NOOP("KConvertTest"), I18N_NOOP("0.1"), "", KAboutData::License_GPL, ""); + + KCmdLineArgs::init(argc, argv, &aboutData); + KCmdLineArgs::addCmdLineOptions(options); + KApplication app; + + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + KURL url; + + if(args->count()) + url = args->arg(0); + else + exit(1); + + args->clear(); + + KConvertTest *get = new KConvertTest(); + + KArtsDispatcher dispatcher; + KAudioConverter converter; + + // FIXME: crashes + // converter.setup(44100); + converter.requestPlayObject(url); + + QObject::connect(&converter, SIGNAL(rawStreamStart()), get, SLOT(slotRawStreamStart())); + + QObject::connect(&converter, SIGNAL(newBlockSize(long)), get, SLOT(slotNewBlockSize(long))); + QObject::connect(&converter, SIGNAL(newBlockPointer(long)), get, SLOT(slotNewBlockPointer(long))); + QObject::connect(&converter, SIGNAL(newData()), get, SLOT(slotNewData())); + + QObject::connect(&converter, SIGNAL(rawStreamFinished()), get, SLOT(slotRawStreamFinished())); + + converter.start(); + + app.exec(); +} + |