~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to mpeglib/example/yaf/yafsplay/splay_control.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  generic interactive controler 
 
3
  Copyright (C) 1998  Martin Vogt
 
4
 
 
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.
 
8
 
 
9
  For more information look at the file COPYRIGHT in this package
 
10
 
 
11
 */
 
12
 
 
13
 
 
14
 
 
15
// Set for local include
 
16
#define DIRECT_INCLUDE
 
17
 
 
18
#include "../yafcore/yaf_control.h"
 
19
#include "../yafxplayer/inputDecoderYAF.h"
 
20
 
 
21
 
 
22
#include <math.h>
 
23
 
 
24
 
 
25
 
 
26
// we include our plugin here
 
27
#include "../../../lib/decoder/splayPlugin.h"
 
28
 
 
29
#if defined(HAVE_GETOPT_H) 
 
30
#include <getopt.h>
 
31
#endif
 
32
 
 
33
 
 
34
void control_splay(InputInterface* input,OutputInterface* output,
 
35
                   InputDecoder* decoder) {
 
36
 
 
37
 
 
38
  cout<< "Command:0 Msg:protocol yaf-0.1" << endl;
 
39
  cout<< "Command:0 Msg:implements xplayer" << endl;
 
40
  cout<< "Command:0 Msg:decoder splay Version:0.8.2" << endl;
 
41
  cout<< "Command:0 Msg:mimetypes audio/mpg1;audio/mpg2;audio/mp3;" << endl;
 
42
  cout<< "Command:0 Msg:comment splay by Woo-jae Jung" << endl;
 
43
  cout<< "Command:0 Msg:comment yaf port by mvogt@rhrk.uni-kl.de"<<endl;
 
44
  cout<< "Command:0 Msg:comment based on sources from eMusic and splay"<<endl;
 
45
  cout<< "Command:0 Msg:comment enter 'help' " << endl;
 
46
 
 
47
 
 
48
  
 
49
  yaf_control(input,output,decoder);
 
50
}
 
51
 
 
52
 
 
53
void usage() {
 
54
  cout << "yaf-splay is a interactive frontend for the splay decoder"<<endl;
 
55
  cout << "Usage : yaf-splay [-2am] [url]"<<endl;
 
56
  cout << endl;
 
57
  cout << "-2 : playing with half frequency."<<endl;
 
58
  cout << "-m : force to mono."<<endl;
 
59
  cout << "-r : autoupdate musicinfo"<<endl;
 
60
  cout << "-a : no internal audio device"<<endl;
 
61
  cout << "-c : no time calculation"<<endl;
 
62
  cout << "-y : autoplay off"<<endl;
 
63
  cout << "-d : only decode"<<endl;
 
64
  cout << endl;
 
65
  cout << "THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! " \
 
66
       << "USE AT YOUR OWN RISK!"<<endl;
 
67
  cout << endl;
 
68
  cout << "for more help type 'help' in interactive mode"<<endl;
 
69
}
 
70
 
 
71
 
 
72
 
 
73
int main(int argc, char** argv) {
 
74
  int c;
 
75
  int lInternalAudio=true;
 
76
 
 
77
 
 
78
  pow(6.0,3.0);            // fixes bug in __math.h
 
79
 
 
80
 
 
81
 
 
82
  
 
83
  InputInterface* input=new InputInterface();
 
84
 
 
85
  OutputInterface output(&cout);
 
86
 
 
87
  YafOutputStream* yafOutput=new YafOutputStream(input);
 
88
 
 
89
 
 
90
  SplayPlugin* plugin=new SplayPlugin();
 
91
 
 
92
  plugin->setOutputPlugin(yafOutput);
 
93
  InputDecoderYAF decoder(plugin,yafOutput);
 
94
  
 
95
 
 
96
 
 
97
  while(1) { 
 
98
    c = getopt (argc, argv, "2yamhd");
 
99
    if (c == -1) break;
 
100
    switch(c) {
 
101
    case 'a': {    
 
102
      lInternalAudio=false;
 
103
      break;
 
104
    }
 
105
    case 'h': {
 
106
      usage();
 
107
      exit(0);
 
108
    }
 
109
    case '2': {
 
110
      plugin->config("-2","true",NULL);
 
111
      break;
 
112
    }
 
113
    case 'y': {
 
114
      decoder.setAutoPlay(false);
 
115
      break;
 
116
    }
 
117
    case 'm': {
 
118
      plugin->config("-m","true",NULL);
 
119
      break;
 
120
    }
 
121
    case 'r': {
 
122
      plugin->config("runtime","on",NULL);
 
123
      break;
 
124
    }
 
125
    case 'd': {
 
126
      plugin->config("-d","on",NULL);
 
127
      break;
 
128
    }
 
129
    case 'c': {
 
130
      plugin->config("-c","true",NULL);
 
131
      break;
 
132
    }
 
133
    default:
 
134
      printf ("?? getopt returned character code 0%o ??\n", c);
 
135
      usage();
 
136
      exit(-1);
 
137
    }
 
138
  }
 
139
  if (optind < argc ) {
 
140
    Buffer buffer(300);
 
141
    buffer.append("open ");
 
142
    buffer.append(argv[optind]);
 
143
    buffer.append("\n");
 
144
    
 
145
    input->addInputLine(&buffer);
 
146
 
 
147
  }
 
148
 
 
149
 
 
150
 
 
151
  yafOutput->internalDevice(lInternalAudio);
 
152
  control_splay(input,&output,&decoder);
 
153
  delete plugin;
 
154
  delete yafOutput;
 
155
  delete input;
 
156
 
 
157
}
 
158
 
 
159