TDE core libraries
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.

kconverttest.cc 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #include <stdio.h>
  2. #include <tqfile.h>
  3. #include <tqobject.h>
  4. #include <tdelocale.h>
  5. #include <tdeaboutdata.h>
  6. #include <tdecmdlineargs.h>
  7. #include <tdeapplication.h>
  8. #include <flowsystem.h>
  9. #include <kplayobject.h>
  10. #include <kartsdispatcher.h>
  11. #include <kplayobjectfactory.h>
  12. #include <kaudioconverter.h>
  13. #include "kconverttest.moc"
  14. using namespace std;
  15. using namespace Arts;
  16. static TDECmdLineOptions options[] =
  17. {
  18. { "+[URL]", I18N_NOOP("URL to open"), 0 },
  19. TDECmdLineLastOption
  20. };
  21. KConvertTest::KConvertTest()
  22. {
  23. }
  24. void KConvertTest::slotRawStreamStart()
  25. {
  26. // cout << "[START]\n\n" << endl;
  27. }
  28. void KConvertTest::slotNewBlockSize(long blockSize)
  29. {
  30. m_blockSize = blockSize;
  31. }
  32. void KConvertTest::slotNewBlockPointer(long blockPointer)
  33. {
  34. m_blockPointer = blockPointer;
  35. }
  36. void KConvertTest::slotNewData()
  37. {
  38. fwrite((void *) m_blockPointer, 1, m_blockSize, stdout);
  39. }
  40. void KConvertTest::slotRawStreamFinished()
  41. {
  42. // cout << "\n\n[END]" << endl;
  43. }
  44. int main(int argc, char **argv)
  45. {
  46. TDEAboutData aboutData("kconverttest", I18N_NOOP("KConvertTest"), I18N_NOOP("0.1"), "", TDEAboutData::License_GPL, "");
  47. TDECmdLineArgs::init(argc, argv, &aboutData);
  48. TDECmdLineArgs::addCmdLineOptions(options);
  49. TDEApplication app;
  50. TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
  51. KURL url;
  52. if(args->count())
  53. url = args->arg(0);
  54. else
  55. exit(1);
  56. args->clear();
  57. KConvertTest *get = new KConvertTest();
  58. KArtsDispatcher dispatcher;
  59. KAudioConverter converter;
  60. // FIXME: crashes
  61. // converter.setup(44100);
  62. converter.requestPlayObject(url);
  63. TQObject::connect(&converter, TQT_SIGNAL(rawStreamStart()), get, TQT_SLOT(slotRawStreamStart()));
  64. TQObject::connect(&converter, TQT_SIGNAL(newBlockSize(long)), get, TQT_SLOT(slotNewBlockSize(long)));
  65. TQObject::connect(&converter, TQT_SIGNAL(newBlockPointer(long)), get, TQT_SLOT(slotNewBlockPointer(long)));
  66. TQObject::connect(&converter, TQT_SIGNAL(newData()), get, TQT_SLOT(slotNewData()));
  67. TQObject::connect(&converter, TQT_SIGNAL(rawStreamFinished()), get, TQT_SLOT(slotRawStreamFinished()));
  68. converter.start();
  69. app.exec();
  70. }