File: soundinputstream.cc

package info (click to toggle)
splay 0.9.5.2-13
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 756 kB
  • ctags: 1,167
  • sloc: cpp: 7,680; sh: 330; makefile: 83
file content (52 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* MPEG Sound library

   (C) 1997 by Woo-jae Jung */

// Soundinputstream.cc
// Abstractclass of inputstreams

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <string.h>

#include "mpegsound.h"

Soundinputstream::Soundinputstream()
{
  __errorcode=SOUND_ERROR_OK;
};

Soundinputstream::~Soundinputstream()
{
  // Nothing...
};

/********************/
/* File & Http open */
/********************/
Soundinputstream *Soundinputstream::hopen(char *filename,int *errorcode)
{
  Soundinputstream *st;

  if(filename==NULL)st=new Soundinputstreamfromfile;
  else if(strstr(filename,"://"))st=new Soundinputstreamfromhttp;
  else st=new Soundinputstreamfromfile;

  if(st==NULL)
  {
    *errorcode=SOUND_ERROR_MEMORYNOTENOUGH;
    return NULL;
  }

  if(!st->open(filename))
  {
    *errorcode=st->geterrorcode();
    delete st;
    return NULL;
  }

  return st;
}