1
// vim:ts=2:sw=2:sts=2:et
4
The plugins are identified by their extension
13
#include "soundserver.h"
30
#if defined(HAVE_GETOPT_H)
39
SimpleSoundServer* server=NULL;
44
cout << "mpeglibartsply command line tool for arts playobjects"<<endl;
45
cout << "Usage : mpeglibartsply [url]"<<endl;
47
cout << "-1 : create/destroy PlayObject test."<<endl;
48
cout << "-2 : create/seek/play/destroy PlayObject test."<<endl;
49
cout << "-3 : torture seek implementation test"<<endl;
50
cout << "-h : help"<<endl;
52
cout << "THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! " \
53
<< "USE AT YOUR OWN RISK!"<<endl;
61
server= new SimpleSoundServer (Reference("global:Arts_SimpleSoundServer"));
63
if(server->isNull()) {
64
cerr << "Can't connect to sound server" << endl;
71
void destroyServer() {
77
create destroy playobjects without playing anything
82
PlayObject play=server->createPlayObject(file1);
83
cout << "cnt:"<<cnt++<<endl;
88
create playobjects playing some time, do seek play destroy
93
PlayObject play=server->createPlayObject(file1);
100
cout << "cnt:"<<cnt++<<endl;
105
create playobject seek random play seek again
109
PlayObject play=server->createPlayObject(file1);
113
cout << "waiting for length info.."<<endl;
115
poTime length=play.overallTime();
119
// do not jump near to end, the danger that
120
// we get an eof is to high
122
cout << "file to short for test"<<endl;
134
// seek to a know position
136
play.seek(startTime);
137
// now wait for seek completion we need a poll here
139
poTime current=play.currentTime();
140
if (current.seconds < 5) {
147
// now we know that the playObject is near the beginning
151
long seekPos=(long)(((float)randNo*(float)secs)/(float)RAND_MAX);
152
// need to jump over the start area
155
cout << "seek to :"<<seekPos
158
seekTime.seconds=seekPos;
161
// now wait for seek completion we need a poll here
163
poTime current=play.currentTime();
164
if (current.seconds > seekPos) {
167
if (current.seconds == seekPos) {
168
if (current.ms > 0) {
177
cout << "stresstest successfully passed."<<endl;
181
int main(int argc, char **argv) {
187
c = getopt (argc, argv, "123456h");
219
printf ("?? getopt returned character code 0%o ??\n", c);
225
if (optind >= argc ) {
230
if (optind < argc ) {
235
if (optind < argc ) {
254
if (file1[0] != '/') {
255
char buf[PATH_MAX+1];
256
char *path = getcwd(buf, PATH_MAX - file1.length());
258
file1.insert(0, "/");
259
file1.insert(0, path);
262
PlayObject play=server->createPlayObject(file1);
264
cout << "cannot play this"<<endl;
269
while (play.state() != posIdle) {