Skip to content

Commit

Permalink
demuxer: FPS should scaled from rate
Browse files Browse the repository at this point in the history
  • Loading branch information
janbar committed Nov 11, 2024
1 parent 5d98676 commit 3e9e710
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/demux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ bool Demux::update_pvr_stream(TSDemux::ElementaryStream* es)
{
case PVR_CODEC_TYPE_VIDEO:
kodi::Log(ADDON_LOG_INFO, LOGTAG "%d: %dx%d %3.3f", es->pid,
it->GetWidth(), it->GetHeight(), it->GetFPSRate());
it->GetWidth(), it->GetHeight(), (double)it->GetFPSRate()/(double)it->GetFPSScale());
break;
case PVR_CODEC_TYPE_AUDIO:
kodi::Log(ADDON_LOG_INFO, LOGTAG "%d: %d %dch %d %s", es->pid,
Expand Down
12 changes: 5 additions & 7 deletions src/demuxer/ES_h264.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ ES_h264::ES_h264(uint16_t pes_pid)
{
m_Height = 0;
m_Width = 0;
m_FPS = 25;
m_FpsScale = 0;
m_FrameDuration = 0;
m_vbvDelay = -1;
m_vbvSize = 0;
m_PixelAspect.den = 1;
Expand Down Expand Up @@ -520,11 +518,11 @@ bool ES_h264::Parse_SPS(uint8_t *buf, int len)

if (bs.readBits1()) // timing_info_present_flag
{
// uint32_t num_units_in_tick = bs.readBits(32);
// uint32_t time_scale = bs.readBits(32);
// int fixed_frame_rate = bs.readBits1();
// if (num_units_in_tick > 0)
// m_FPS = time_scale / (num_units_in_tick * 2);
// uint32_t num_units_in_tick = bs.readBits(32);
// uint32_t time_scale = bs.readBits(32);
// int fixed_frame_rate = bs.readBits1();
// if (num_units_in_tick > 0)
// m_FPS = time_scale / (num_units_in_tick * 2);
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/demuxer/ES_h264.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ namespace TSDemux
bool m_NeedPPS;
int m_Width;
int m_Height;
int m_FPS;
int m_FpsScale;
mpeg_rational_t m_PixelAspect;
int m_FrameDuration;
h264_private m_streamData;
int m_vbvDelay; /* -1 if CBR */
int m_vbvSize; /* Video buffer size (in bytes) */
Expand Down

0 comments on commit 3e9e710

Please sign in to comment.