Skip to content

Commit 94eb032

Browse files
Add PTS and DTS accessors to PESPacket.
1 parent 6c7d56d commit 94eb032

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

mythtv/libs/libmythtv/mpeg/pespacket.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,29 @@ class PESPacket
191191
/// 1 bit Extension flags are present
192192
bool HasExtensionFlags() const { return _pesdata[4] & 0x1; }
193193

194+
/// Presentation Time Stamp, present if HasPTS() is true
195+
uint64_t PTS(void) const
196+
{
197+
int i = 6;
198+
return
199+
(uint64_t(_pesdata[i+0] & 0x0e) << 29) |
200+
(uint64_t(_pesdata[i+1] ) << 22) |
201+
(uint64_t(_pesdata[i+2] & 0xfe) << 14) |
202+
(uint64_t(_pesdata[i+3] ) << 7) |
203+
(uint64_t(_pesdata[i+4] & 0xfe) >> 1);
204+
}
205+
/// Decode Time Stamp, present if HasDTS() is true
206+
uint64_t DTS(void) const
207+
{
208+
int i = 6+5;
209+
return
210+
(uint64_t(_pesdata[i+0] & 0x0e) << 29) |
211+
(uint64_t(_pesdata[i+1] ) << 22) |
212+
(uint64_t(_pesdata[i+2] & 0xfe) << 14) |
213+
(uint64_t(_pesdata[i+3] ) << 7) |
214+
(uint64_t(_pesdata[i+4] & 0xfe) >> 1);
215+
}
216+
194217
// 8 bits PES Header Length
195218
// variable length -- pes header fields
196219
// variable length -- pes data block

0 commit comments

Comments
 (0)