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

« back to all changes in this revision

Viewing changes to mpeglib/lib/input/inputPlugin.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
  C interface creator for input_plugins
 
3
  Copyright (C) 1999  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
#include "inputPlugin.h"
 
15
 
 
16
 
 
17
 
 
18
 
 
19
InputPlugin::InputPlugin() {
 
20
}
 
21
 
 
22
 
 
23
InputPlugin::~InputPlugin() {
 
24
}
 
25
 
 
26
 
 
27
 
 
28
int InputPlugin::getInputType(const char* dest) {
 
29
  return InputDetector::getInputType(dest);
 
30
}
 
31
 
 
32
 
 
33
InputStream* InputPlugin::createInputStream(int inputType) {
 
34
  // make checks which input routine to use
 
35
  InputStream* inputStream;
 
36
  int method;
 
37
 
 
38
  inputStream=NULL;
 
39
  method=inputType;
 
40
 
 
41
  switch(method) {
 
42
  case __INPUT_FILE: {
 
43
    inputStream=new FileInputStream();
 
44
    break;
 
45
  }
 
46
  case __INPUT_CDDA: {
 
47
    inputStream=new CDDAInputStream();
 
48
    break;
 
49
  }
 
50
 
 
51
  case __INPUT_HTTP: {
 
52
    inputStream=new HttpInputStream();
 
53
    break;
 
54
  }
 
55
  case __INPUT_CDI: {
 
56
    inputStream=new CDRomInputStream();
 
57
    break;
 
58
  }  
 
59
  default:
 
60
    cout << "error cannot create default input stream"<<endl;
 
61
    exit(0);
 
62
  }
 
63
 
 
64
  return inputStream;
 
65
}
 
66
 
 
67
InputStream* InputPlugin::createInputStream(int inputType,int lThreadSafe) {
 
68
  InputStream* input=InputPlugin::createInputStream(inputType);
 
69
  if (lThreadSafe == false) {
 
70
    return input;
 
71
  }
 
72
  InputStream* tsInput=new ThreadSafeInputStream(input);
 
73
  return tsInput;
 
74
}
 
75
 
 
76
 
 
77
InputStream* InputPlugin::createInputStream(const char* dest) {
 
78
  int method;
 
79
 
 
80
  method=InputPlugin::getInputType(dest);
 
81
  return (InputPlugin::createInputStream(method));
 
82
}
 
83
 
 
84
 
 
85
InputStream* InputPlugin::createInputStream(const char* dest,int lThreadSafe) {
 
86
  int method;
 
87
 
 
88
  method=InputPlugin::getInputType(dest);
 
89
  return (InputPlugin::createInputStream(method,lThreadSafe));
 
90
}