summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/input/cdromInputStream.h
blob: cda18efec69960149f70bc46688c273c89538ca7 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
  reads input data from cdrom
  Copyright (C) 1999  Martin Vogt

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU Library General Public License as published by
  the Free Software Foundation.

  For more information look at the file COPYRIGHT in this package

 */



#ifndef __VIDEOCDINPUTSTREAM_H
#define __VIDEOCDINPUTSTREAM_H



#include "inputStream.h"



#define _CDROM_FRAMES   75
#define _CDROM_SECS     60


/**
   This is necessary because CD-I or VCD disks are not correctly
   mounted by the linux kernel.
   Windows seems to do it correct (sometimes, the other time it nearly crash)
   During my test I found out that CD-I and VCD seems to be different.
   One works with the CD-I loader the other with the VCD loader.
   
   This class tries to find out if its a CD-I / VCD stream.
   Then you can set the interface and load from this interface.

   This class depends on the reader routines from xreadcdi/ xreadvcd,
   Author: Ales Makarov <xmakarov@sun.felk.cvut.cz>
   FTP   : ftp://mca.sh.cvut.cz/pub/readvcd/

   The code is used in a few other packages, in which I looked as well.

*/

class CDRomRawAccess;
class CDRomToc;

class CDRomInputStream : public InputStream{

  CDRomRawAccess* cdRomRawAccess;
  CDRomToc* cdRomToc;

  int buflen;
  char* bufCurrent;
 
  int currentFrame;
  int currentMinute;
  int currentSecond;
  long byteCounter;
 
 public:
  CDRomInputStream();
  ~CDRomInputStream();

  int open(const char* dest);
  void close();
  int isOpen();

  int eof();
  int read(char* ptr,int size);
  int seek(long bytePos);

  long getByteLength();
  long getBytePosition();

  void print();

 private:
  long getBytePos(int min,int sec);

  int setTimePos(int posInTime);
  int getByteDirect();
  void next_sector();
  int readCurrent();
  int fillBuffer();
};
#endif