You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
2.1 KiB
97 lines
2.1 KiB
15 years ago
|
#include <stdio.h>
|
||
|
|
||
14 years ago
|
#include <tqfile.h>
|
||
|
#include <tqobject.h>
|
||
15 years ago
|
|
||
12 years ago
|
#include <tdelocale.h>
|
||
12 years ago
|
#include <tdeaboutdata.h>
|
||
|
#include <tdecmdlineargs.h>
|
||
|
#include <tdeapplication.h>
|
||
15 years ago
|
|
||
|
#include <flowsystem.h>
|
||
|
#include <kplayobject.h>
|
||
|
#include <kartsdispatcher.h>
|
||
|
#include <kplayobjectfactory.h>
|
||
|
#include <kaudioconverter.h>
|
||
|
#include "kconverttest.moc"
|
||
|
|
||
|
using namespace std;
|
||
|
using namespace Arts;
|
||
|
|
||
12 years ago
|
static TDECmdLineOptions options[] =
|
||
15 years ago
|
{
|
||
|
{ "+[URL]", I18N_NOOP("URL to open"), 0 },
|
||
12 years ago
|
TDECmdLineLastOption
|
||
15 years ago
|
};
|
||
|
|
||
|
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)
|
||
|
{
|
||
12 years ago
|
TDEAboutData aboutData("kconverttest", I18N_NOOP("KConvertTest"), I18N_NOOP("0.1"), "", TDEAboutData::License_GPL, "");
|
||
15 years ago
|
|
||
12 years ago
|
TDECmdLineArgs::init(argc, argv, &aboutData);
|
||
|
TDECmdLineArgs::addCmdLineOptions(options);
|
||
12 years ago
|
TDEApplication app;
|
||
15 years ago
|
|
||
12 years ago
|
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
|
||
15 years ago
|
|
||
|
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);
|
||
|
|
||
14 years ago
|
TQObject::connect(&converter, TQT_SIGNAL(rawStreamStart()), get, TQT_SLOT(slotRawStreamStart()));
|
||
15 years ago
|
|
||
14 years ago
|
TQObject::connect(&converter, TQT_SIGNAL(newBlockSize(long)), get, TQT_SLOT(slotNewBlockSize(long)));
|
||
|
TQObject::connect(&converter, TQT_SIGNAL(newBlockPointer(long)), get, TQT_SLOT(slotNewBlockPointer(long)));
|
||
|
TQObject::connect(&converter, TQT_SIGNAL(newData()), get, TQT_SLOT(slotNewData()));
|
||
15 years ago
|
|
||
14 years ago
|
TQObject::connect(&converter, TQT_SIGNAL(rawStreamFinished()), get, TQT_SLOT(slotRawStreamFinished()));
|
||
15 years ago
|
|
||
|
converter.start();
|
||
|
|
||
|
app.exec();
|
||
|
}
|
||
|
|