2
testprogramm for arts streaming
3
Copyright (C) 2001 Martin Vogt
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU Library General Public License as published by
7
the Free Software Foundation.
9
For more information look at the file COPYRIGHT in this package
14
#include "soundserver.h"
31
#if defined(HAVE_GETOPT_H)
40
#include <arts/kplayobjectfactory.h>
43
cout << "libsplayartsplay command line tool for arts playobjects2"<<endl;
44
cout << "Usage : libsplayartsplay [url]"<<endl;
46
cout << "-h : help"<<endl;
48
cout << "THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! " \
49
<< "USE AT YOUR OWN RISK!"<<endl;
55
int main(int argc, char **argv) {
59
c = getopt (argc, argv, "h");
68
printf ("?? getopt returned character code 0%o ??\n", c);
73
if (optind == argc ) {
78
cout << "file:"<<argv[optind]<<endl;
79
string file(argv[optind]);
81
Dispatcher* d=new Dispatcher();
82
Arts::SoundServerV2 server;
83
server = Arts::Reference("global:Arts_SoundServerV2");
87
cerr << "Can't connect to sound server2" << endl;
91
//PlayObject play=server.createPlayObjectForURL(file,"audio/x-mp3",true);
93
FileInputStream fileInputStream;
95
if(!fileInputStream.open(file)) {
96
printf("can't open file %s\n",file.c_str());
100
PlayObject play=server.createPlayObjectForStream(fileInputStream,
104
cerr << "Can't create PlayObject" << endl;
107
connect(fileInputStream,"outdata", play,"indata");
108
fileInputStream.start();
110
while(!fileInputStream.eof()) {
111
d->ioManager()->processOneEvent(false);
120
KURL file(argv[optind]);
123
Arts::Dispatcher *dispatcher = new Arts::Dispatcher();
126
Arts::SoundServerV2 server;
128
server = Arts::Reference("global:Arts_SoundServerV2");
131
if(server.isNull()) {
132
cerr << "Can't connect to sound server2" << endl;
137
KPlayObject *playobj = new KPlayObject();
139
playobj->setObject(Arts::PlayObject::null());
142
KPlayObjectFactory factory(server);
144
playobj = factory.createPlayObject(file, true);
147
Arts::PlayObject po=playobj->object();
150
cerr << "Cannot create playobject" << endl;