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

« back to all changes in this revision

Viewing changes to mpeglib/lib/mpegplay/mpegVideoStream.h

  • 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
  a buffer
 
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
 
 
15
 
 
16
 
 
17
#ifndef __MPEGVIDEOSTREAM_H
 
18
#define __MPEGVIDEOSTREAM_H
 
19
 
 
20
#include <iostream.h>
 
21
#include "startCodes.h"
 
22
#include "mpegVideoHeader.h"
 
23
#include "mpegSystemStream.h"
 
24
#include "mpegVideoBitWindow.h"
 
25
 
 
26
#define _BYTE_TEST 1024
 
27
 
 
28
/**
 
29
   A really ugly class. Most of the methods have names
 
30
   which does not make it clear for what they are usefull.
 
31
   (Don't touch a running system :-)
 
32
 
 
33
   We wrap the inputStream and offer functions for getting
 
34
   bits, appending to the internal buffer, flushing, syncing
 
35
   all this stuff.
 
36
 
 
37
 
 
38
*/
 
39
 
 
40
class MpegVideoStream {
 
41
 
 
42
  int size;
 
43
  InputStream* input;
 
44
  MpegSystemStream* mpegSystemStream;
 
45
  MpegSystemHeader* mpegSystemHeader;
 
46
  MpegVideoBitWindow* mpegVideoBitWindow;
 
47
 
 
48
  int lHasStream;
 
49
 
 
50
 public:
 
51
  MpegVideoStream(InputStream* input);
 
52
  ~MpegVideoStream();
 
53
 
 
54
  // returns true if init successfull
 
55
  int firstInitialize(MpegVideoHeader* mpegHeader);
 
56
  int nextGOP();
 
57
  int nextPIC();
 
58
  int next_start_code();
 
59
  
 
60
  int hasBytes(int bytes);
 
61
  int eof();
 
62
 
 
63
  inline void clear() { 
 
64
    mpegVideoBitWindow->clear();      
 
65
  }
 
66
 
 
67
  inline void flushBits(int bits) { 
 
68
    hasBytes(_BYTE_TEST);
 
69
    mpegVideoBitWindow->flushBitsDirect(bits); 
 
70
  }
 
71
 
 
72
  inline unsigned int showBits(int bits) { 
 
73
    hasBytes(_BYTE_TEST);
 
74
    return mpegVideoBitWindow->showBits(bits);
 
75
  }
 
76
 
 
77
  inline unsigned int showBits32() { 
 
78
    return mpegVideoBitWindow->showBits32(); 
 
79
  }
 
80
 
 
81
  inline unsigned int showBits16() { 
 
82
    return mpegVideoBitWindow->showBits(16); 
 
83
  }  
 
84
 
 
85
  inline void flushBitsDirect(unsigned int bits) {
 
86
     mpegVideoBitWindow->flushBitsDirect(bits);
 
87
  }
 
88
 
 
89
  unsigned int getBits(int bits) { 
 
90
    hasBytes(_BYTE_TEST);
 
91
    return mpegVideoBitWindow->getBits(bits);
 
92
  }
 
93
 
 
94
  inline void flushByteOffset() { 
 
95
    mpegVideoBitWindow->flushByteOffset();
 
96
  }
 
97
 
 
98
  TimeStamp* getCurrentTimeStamp();
 
99
 
 
100
 private:
 
101
  int getByteDirect();
 
102
  int get_more_video_data();
 
103
  void fill_videoBuffer(MpegSystemHeader* mpegSystemHeader);
 
104
  int isStartCode(unsigned int data);
 
105
 
 
106
 
 
107
};
 
108
#endif
 
109
 
 
110
 
 
111