blob: 86b8055380db329b9f49322c359621a041c0ebc8 (
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*
a buffer
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 __MPEGVIDEOSTREAM_H
#define __MPEGVIDEOSTREAM_H
#include "startCodes.h"
#include "mpegVideoHeader.h"
#include "mpegSystemStream.h"
#include "mpegVideoBitWindow.h"
#define _BYTE_TEST 1024
/**
A really ugly class. Most of the methods have names
which does not make it clear for what they are useful.
(Don't touch a running system :-)
We wrap the inputStream and offer functions for getting
bits, appending to the internal buffer, flushing, syncing
all this stuff.
*/
class MpegVideoStream {
int size;
InputStream* input;
MpegSystemStream* mpegSystemStream;
MpegSystemHeader* mpegSystemHeader;
MpegVideoBitWindow* mpegVideoBitWindow;
int lHasStream;
public:
MpegVideoStream(InputStream* input);
~MpegVideoStream();
// returns true if init successful
int firstInitialize(MpegVideoHeader* mpegHeader);
int nextGOP();
int nextPIC();
int next_start_code();
int hasBytes(int bytes);
int eof();
inline void clear() {
mpegVideoBitWindow->clear();
}
inline void flushBits(int bits) {
hasBytes(_BYTE_TEST);
mpegVideoBitWindow->flushBitsDirect(bits);
}
inline unsigned int showBits(int bits) {
hasBytes(_BYTE_TEST);
return mpegVideoBitWindow->showBits(bits);
}
inline unsigned int showBits32() {
return mpegVideoBitWindow->showBits32();
}
inline unsigned int showBits16() {
return mpegVideoBitWindow->showBits(16);
}
inline void flushBitsDirect(unsigned int bits) {
mpegVideoBitWindow->flushBitsDirect(bits);
}
unsigned int getBits(int bits) {
hasBytes(_BYTE_TEST);
return mpegVideoBitWindow->getBits(bits);
}
inline void flushByteOffset() {
mpegVideoBitWindow->flushByteOffset();
}
TimeStamp* getCurrentTimeStamp();
private:
int getByteDirect();
int get_more_video_data();
void fill_videoBuffer(MpegSystemHeader* mpegSystemHeader);
int isStartCode(unsigned int data);
};
#endif
|