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

« back to all changes in this revision

Viewing changes to mpeglib/example/yaf/yafcdda/cdda_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) 2000  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
 
 
16
// Set for local include
 
17
#define DIRECT_INCLUDE
 
18
 
 
19
#include "../yafcore/yaf_control.h"
 
20
#include "../yafxplayer/inputDecoderYAF.h"
 
21
 
 
22
 
 
23
 
 
24
 
 
25
 
 
26
 
 
27
#include <iostream.h>
 
28
#include <stdio.h>
 
29
#include <stdlib.h>
 
30
#include <math.h>
 
31
 
 
32
#if defined(HAVE_GETOPT_H) 
 
33
#include <getopt.h>
 
34
#endif
 
35
 
 
36
// we include our plugin here
 
37
#include "../../../lib/decoder/cddaPlugin.h"
 
38
 
 
39
#if defined(HAVE_GETOPT_H) 
 
40
#include <getopt.h>
 
41
#endif
 
42
 
 
43
 
 
44
                                          
 
45
 
 
46
 
 
47
void control_divx(InputInterface* input,OutputInterface* output,
 
48
                  InputDecoder* decoder) {
 
49
 
 
50
 
 
51
  cout<< "Command:0 Msg:protocol yaf-0.1" << endl;
 
52
  cout<< "Command:0 Msg:implements xplayer" << endl;
 
53
  cout<< "Command:0 Msg:decoder cdparanoia " << endl;
 
54
  cout<< "Command:0 Msg:mimetypes audio/cdda;" << endl;
 
55
  cout<< "Command:0 Msg:comment cdparanoia by Monty <xiphmont@mit.edu>" << endl;
 
56
  cout<< "Command:0 Msg:comment yaf port by mvogt@rhrk.uni-kl.de"<<endl;
 
57
  cout<< "Command:0 Msg:comment based on sources from audiocd"<<endl;
 
58
  cout<< "Command:0 Msg:comment enter 'help' " << endl;
 
59
 
 
60
 
 
61
  
 
62
 
 
63
  
 
64
  yaf_control(input,output,decoder);
 
65
}
 
66
 
 
67
 
 
68
void usage() {
 
69
  cout << "yaf-cdda is a interactive frontend for the cdda decoder"<<endl;
 
70
  cout << "Usage : yaf-cdda [ahy] [url]"<<endl;
 
71
  cout << endl;
 
72
  cout << "-a : no internal audio device"<<endl;
 
73
  cout << "-h : help"<<endl;
 
74
  cout << "-y : autoplay off"<<endl;
 
75
  cout << endl;
 
76
  cout << "THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! " \
 
77
       << "USE AT YOUR OWN RISK!"<<endl;
 
78
  cout << endl;
 
79
  cout << "for more help type 'help' in interactive mode"<<endl;
 
80
}
 
81
 
 
82
 
 
83
 
 
84
 
 
85
int main(int argc, char** argv) {
 
86
  int c;
 
87
  int lInternalAudio=true;
 
88
 
 
89
  pow(6.0,3.0);            // fixes bug in __math.h
 
90
  InputInterface input;
 
91
  OutputInterface output(&cout);
 
92
 
 
93
 
 
94
  YafOutputStream* yafOutput=new YafOutputStream(&input);
 
95
  CDDAPlugin* plugin=new CDDAPlugin();
 
96
 
 
97
  plugin->setOutputPlugin(yafOutput);
 
98
  InputDecoderYAF decoder(plugin,yafOutput);
 
99
 
 
100
  
 
101
 
 
102
  while(1) { 
 
103
    c = getopt (argc, argv, "2al:L:scb:mhpywd:");
 
104
    if (c == -1) break;
 
105
    switch(c) {
 
106
    case 'a': {    
 
107
      lInternalAudio=false;
 
108
      break;
 
109
    }
 
110
    case 'h': {
 
111
      usage();
 
112
      exit(0);
 
113
    }
 
114
    case 'y': {
 
115
      decoder.setAutoPlay(false);
 
116
      break;
 
117
    }
 
118
    case '2': {
 
119
      plugin->config("-2","true",NULL);
 
120
      break;
 
121
    }
 
122
    case 'm': {
 
123
      plugin->config("-m","true",NULL);
 
124
      break;
 
125
    }
 
126
    case 'c': {
 
127
      plugin->config("-c","true",NULL);
 
128
      break;
 
129
    }
 
130
    case 'w': {
 
131
      plugin->config("-w","true",NULL);
 
132
      break;
 
133
    }
 
134
    case 's': {
 
135
      yafOutput->config("-s","true",NULL);
 
136
      break;
 
137
    }
 
138
    case 'b': {
 
139
      yafOutput->config("-b",optarg,NULL);
 
140
      break;
 
141
    }    
 
142
    case 'd': {
 
143
      yafOutput->config("yufDump",optarg,NULL);
 
144
      break;
 
145
    }    
 
146
    case 'p': {
 
147
      yafOutput->config("-p",optarg,NULL);
 
148
      break;
 
149
    }    
 
150
    case 'l': {
 
151
      plugin->config("AudioLayer",optarg,NULL);
 
152
      cout << "trying to configure" << endl;
 
153
      break;
 
154
    }
 
155
    case 'L': {
 
156
      plugin->config("VideoLayer",optarg,NULL);
 
157
      break;
 
158
    }
 
159
 
 
160
 
 
161
    default:
 
162
      printf ("?? getopt returned character code 0%o ??\n", c);
 
163
      usage();
 
164
      exit(-1);
 
165
    }
 
166
  }
 
167
 
 
168
  if (optind < argc ) {
 
169
    Buffer buffer(300);
 
170
    buffer.append("open ");
 
171
    buffer.append(argv[optind]);
 
172
    buffer.append("\n");
 
173
    input.addInputLine(&buffer);
 
174
 
 
175
  }
 
176
  yafOutput->internalDevice(lInternalAudio);
 
177
  control_divx(&input,&output,&decoder);
 
178
  delete plugin;
 
179
  delete yafOutput;
 
180
 
 
181
}
 
182
 
 
183