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

« back to all changes in this revision

Viewing changes to mpeglib/example/cddaplay/cddaplay.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
 * main.c --
 
3
 *
 
4
 * Example program for mpegplay library.
 
5
 
 
6
 
 
7
 */
 
8
 
 
9
 
 
10
#include "../../lib/decoder/cddaPlugin.h"
 
11
#include "../../lib/input/inputPlugin.h"
 
12
 
 
13
int main(int argc, char** argv) {
 
14
 
 
15
 
 
16
  if (argc <= 1) {
 
17
    printf("Usage:\n\n");
 
18
    printf("%s \"cdda://dev/<device> track:<nr>.cdda\n\n",argv[0]);
 
19
    exit(0);
 
20
  }
 
21
  //
 
22
  // The order is important !!!!
 
23
  // 1. construct
 
24
  // 2. set Output
 
25
  // 3. open input
 
26
  // 4. set input
 
27
  // 
 
28
  // you cannot set the input _before_ the output 
 
29
  // in fact you can, but this gives you a segfault!
 
30
    
 
31
  CDDAPlugin* plugin=new CDDAPlugin();
 
32
  OutputStream* out=OutPlugin::createOutputStream(_OUTPUT_LOCAL);
 
33
  InputStream* in= InputPlugin::createInputStream(argv[1]);
 
34
 
 
35
 
 
36
 
 
37
  // The plugin does not do "open"
 
38
  in->open(argv[1]);
 
39
 
 
40
 
 
41
 
 
42
 
 
43
 
 
44
  // watch the order!
 
45
  plugin->setOutputPlugin(out);
 
46
  plugin->setInputPlugin(in);
 
47
  //plugin->seek(1950);
 
48
  cout << "hello 1 -s"<<endl;
 
49
 
 
50
 
 
51
  plugin->play();
 
52
  cout << "hello 1 -e"<<endl;
 
53
 
 
54
 
 
55
  while(1) {
 
56
    if (plugin->getStreamState() != _STREAM_STATE_EOF) {
 
57
      cout << "******* plugin->getStreamState() continue"<<endl;
 
58
      sleep(3);
 
59
      continue;
 
60
    }
 
61
    break;
 
62
  }
 
63
  cout << "********************plugin eof"<<endl;
 
64
  plugin->close();
 
65
 
 
66
  delete plugin;
 
67
  delete in;
 
68
  delete out;
 
69
 
 
70
}
 
71