Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option --force-fps #678

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions OMXVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ unsigned int COMXVideo::GetSize()
return m_omx_decoder.GetInputBufferSize();
}

long fake_pts=0;
int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts)
{
CSingleLock lock (m_critSection);
Expand All @@ -740,6 +741,13 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts)
CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE);
m_setStartTime = false;
}

if(m_config.force_fps>0) {
pts=fake_pts;
fake_pts += (1000000L / m_config.force_fps);
CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : force-pts fake_pts %ld\n", fake_pts);
}

if (pts == DVD_NOPTS_VALUE && dts == DVD_NOPTS_VALUE)
nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN;
else if (pts == DVD_NOPTS_VALUE)
Expand Down
2 changes: 2 additions & 0 deletions OMXVideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class OMXVideoConfig
int layer;
float queue_size;
float fifo_size;
int force_fps;

OMXVideoConfig()
{
Expand All @@ -81,6 +82,7 @@ class OMXVideoConfig
layer = 0;
queue_size = 10.0f;
fifo_size = (float)80*1024*60 / (1024*1024);
force_fps=0;
}
};

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Usage: omxplayer [OPTIONS] [FILE]
--timeout n Timeout for stalled file/network operations (default 10s)
--orientation n Set orientation of video (0, 90, 180 or 270)
--fps n Set fps of video where timestamps are not present
--force-fps n Force the given fps, even if timestamps are present
--live Set for live tv or vod type stream
--layout Set output speaker layout (e.g. 5.1)
--dbus_name name default: org.mpris.MediaPlayer2.omxplayer
Expand Down
5 changes: 5 additions & 0 deletions omxplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ int main(int argc, char *argv[])
const int http_user_agent_opt = 0x301;
const int lavfdopts_opt = 0x400;
const int avdict_opt = 0x401;
const int force_fps_opt = 0x402;

struct option longopts[] = {
{ "info", no_argument, NULL, 'i' },
Expand Down Expand Up @@ -631,6 +632,7 @@ int main(int argc, char *argv[])
{ "user-agent", required_argument, NULL, http_user_agent_opt },
{ "lavfdopts", required_argument, NULL, lavfdopts_opt },
{ "avdict", required_argument, NULL, avdict_opt },
{ "force-fps", required_argument, NULL, force_fps_opt },
{ 0, 0, 0, 0 }
};

Expand Down Expand Up @@ -893,6 +895,9 @@ int main(int argc, char *argv[])
case display_opt:
m_config_video.display = atoi(optarg);
break;
case force_fps_opt:
m_config_video.force_fps = atoi(optarg);
break;
case http_cookie_opt:
m_cookie = optarg;
break;
Expand Down