MythTV master
mythdvdcontext.cpp
Go to the documentation of this file.
1// Qt
2#include <QString>
3
4// MythTV
5#include "mythdvdcontext.h"
6
7MythDVDContext::MythDVDContext(const dsi_t& DSI, const pci_t& PCI)
8 : ReferenceCounter("MythDVDContext"),
9 m_dsi(DSI),
10 m_pci(PCI)
11{
12}
13
14int64_t MythDVDContext::GetStartPTS(void) const
15{
16 return static_cast<int64_t>(m_pci.pci_gi.vobu_s_ptm);
17}
18
19int64_t MythDVDContext::GetEndPTS(void) const
20{
21 return static_cast<int64_t>(m_pci.pci_gi.vobu_e_ptm);
22}
23
25{
26 return static_cast<int64_t>(m_pci.pci_gi.vobu_se_e_ptm);
27}
28
29uint32_t MythDVDContext::GetLBA(void) const
30{
31 return m_pci.pci_gi.nv_pck_lbn;
32}
33
38{
39 return static_cast<int>(((GetEndPTS() - GetStartPTS()) * GetFPS()) / 90000);
40}
41
46{
47 int frames = 0;
48
49 if (GetSeqEndPTS())
50 {
51 // Sequence end PTS is set. This means that video frames
52 // are not present all the way to 'End PTS'
53 frames = static_cast<int>(((GetSeqEndPTS() - GetStartPTS()) * GetFPS()) / 90000);
54 }
55 else if (m_dsi.dsi_gi.vobu_1stref_ea != 0)
56 {
57 // At least one video frame is present
58 frames = GetNumFrames();
59 }
60
61 return frames;
62}
63
65{
66 return (m_pci.pci_gi.e_eltm.frame_u & 0x80) ? 30 : 25;
67}
68
74{
75 uint32_t lba = m_dsi.vobu_sri.prev_video;
76
77 if (lba != 0xbfffffff)
78 {
79 // If there is a previous video frame in this
80 // cell, calculate the absolute LBA from the
81 // offset
82 lba = GetLBA() - (lba & 0x7ffffff);
83 }
84
85 return lba;
86}
int GetFPS(void) const
int GetNumFramesPresent(void) const
Returns the number of video frames present in this VOBU.
int64_t GetEndPTS(void) const
uint32_t GetLBA(void) const
MythDVDContext()=delete
uint32_t GetLBAPrevVideoFrame(void) const
Returns the logical block address of the previous VOBU containing video.
int64_t GetSeqEndPTS(void) const
int GetNumFrames(void) const
Returns the duration of this VOBU in frames.
int64_t GetStartPTS(void) const
General purpose reference counter.