blob: 6d8c1efe9618b43e812138a7272297ceeba7f22f (
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
/*
mpeg video picture
Copyright (C) 2000 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
*/
#include "picture.h"
Picture::Picture() {
/* Initialize pointers to extension and user data. */
extraBit=0;
startOfPicStamp=new TimeStamp();
extension=new MpegExtension();
}
Picture::~Picture() {
delete startOfPicStamp;
delete extension;
}
/*
*--------------------------------------------------------------
*
* ParsePicture --
*
* Parses picture header. Marks picture to be presented
* at particular time given a time stamp.
*
* Results:
* Values from picture header put into video stream structure.
*
* Side effects:
* Bit stream irreversibly parsed.
*
*--------------------------------------------------------------
*/
int Picture::processPicture(MpegVideoStream* mpegVideoStream) {
TimeStamp* stamp;
/* Flush header start code. */
mpegVideoStream->flushBits(32);
/* Parse off temporal reference. */
temp_ref=mpegVideoStream->getBits(10);
/* Parse of picture type. */
code_type=mpegVideoStream->getBits(3);
// get timestamp from stamp queue
stamp=mpegVideoStream->getCurrentTimeStamp();
stamp->copyTo(startOfPicStamp);
// now invalidate the PTSFlag
stamp->setPTSFlag(false);
/* Parse off vbv buffer delay value. */
vbv_delay=mpegVideoStream->getBits(16);
/* If P or B type frame... */
if ((code_type == P_TYPE) || (code_type == B_TYPE)) {
/* Parse off forward vector full pixel flag. sets it to true/false*/
full_pel_forw_vector=mpegVideoStream->getBits(1);
/* Parse of forw_r_code. */
/* Decode forw_r_code into forw_r_size and forw_f. */
forw_r_size=mpegVideoStream->getBits(3);
forw_r_size--;
forw_f = (1 << forw_r_size);
}
/* If B type frame... */
if (code_type == B_TYPE) {
/* Parse off back vector full pixel flag. */
full_pel_back_vector=mpegVideoStream->getBits(1);
/* Parse off back_r_code. */
/* Decode back_r_code into back_r_size and back_f. */
back_r_size=mpegVideoStream->getBits(3);
back_r_size--;
back_f = (1 << back_r_size);
}
/* Get extra bit picture info. */
/*
extraBit=mpegVideoStream->getBits(1);
if (extraBit) {
cout << "extraBit"<<endl;
exit(0);
extension->processExtBuffer(mpegVideoStream);
}
*/
extension->processExtra_bit_info(mpegVideoStream);
extension->processExtensionData(mpegVideoStream);
return true;
}
int Picture::processPictureCodingExtension(MpegVideoStream* ) {
return true;
}
unsigned int Picture::geth_back_r(MpegVideoStream* mpegVideoStream) {
return mpegVideoStream->getBits(back_r_size);
}
unsigned int Picture::getv_back_r(MpegVideoStream* mpegVideoStream) {
return mpegVideoStream->getBits(back_r_size);
}
unsigned int Picture::geth_forw_r(MpegVideoStream* mpegVideoStream) {
return mpegVideoStream->getBits(forw_r_size);
}
unsigned int Picture::getv_forw_r(MpegVideoStream* mpegVideoStream) {
return mpegVideoStream->getBits(forw_r_size);
}
|