Skip to content

Commit

Permalink
Added start-paused and end-paused options:
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariush Bahri committed May 28, 2020
1 parent 6dfbe08 commit 3d474bd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ Usage: omxplayer [OPTIONS] [FILE]
--user-agent 'ua' Send specified User-Agent as part of HTTP requests
--lavfdopts 'opts' Options passed to libavformat, e.g. 'probesize:250000,...'
--avdict 'opts' Options passed to demuxer, e.g., 'rtsp_transport:tcp,...'
--start-paused Immediately pause the video after loading, will wait for dbus or key command to play
--end-paused Pause the video on the last frame indefinitely

For example:

Expand Down
32 changes: 28 additions & 4 deletions omxplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ bool m_has_audio = false;
bool m_has_subtitle = false;
bool m_gen_log = false;
bool m_loop = false;
bool m_start_paused = false;
bool m_end_paused = false;

enum{ERROR=-1,SUCCESS,ONEBYTE};

Expand Down Expand Up @@ -570,6 +572,8 @@ 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 start_paused = 0x214;
const int end_paused = 0x215;

struct option longopts[] = {
{ "info", no_argument, NULL, 'i' },
Expand Down Expand Up @@ -619,6 +623,8 @@ int main(int argc, char *argv[])
{ "key-config", required_argument, NULL, key_config_opt },
{ "no-osd", no_argument, NULL, no_osd_opt },
{ "no-keys", no_argument, NULL, no_keys_opt },
{ "start-paused", no_argument, NULL, start_paused },
{ "end-paused", no_argument, NULL, end_paused },
{ "orientation", required_argument, NULL, orientation_opt },
{ "fps", required_argument, NULL, fps_opt },
{ "live", no_argument, NULL, live_opt },
Expand Down Expand Up @@ -766,6 +772,12 @@ int main(int argc, char *argv[])
case no_keys_opt:
m_no_keys = true;
break;
case start_paused:
m_start_paused = true;
break;
case end_paused:
m_end_paused = true;
break;
case font_opt:
m_font_path = optarg;
m_asked_for_font = true;
Expand Down Expand Up @@ -1738,8 +1750,19 @@ int main(int argc, char *argv[])
{
if (m_av_clock->OMXIsPaused())
{
CLog::Log(LOGDEBUG, "Resume %.2f,%.2f (%d,%d,%d,%d) EOF:%d PKT:%p\n", audio_fifo, video_fifo, audio_fifo_low, video_fifo_low, audio_fifo_high, video_fifo_high, m_omx_reader.IsEof(), m_omx_pkt);
m_av_clock->OMXResume();
if (!m_start_paused)
{
CLog::Log(LOGDEBUG, "Resume %.2f,%.2f (%d,%d,%d,%d) EOF:%d PKT:%p\n", audio_fifo, video_fifo, audio_fifo_low, video_fifo_low, audio_fifo_high, video_fifo_high, m_omx_reader.IsEof(), m_omx_pkt);
m_av_clock->OMXResume();
}
else
{
CLog::Log(LOGDEBUG, "start-paused(%d)\n", m_start_paused);
m_av_clock->OMXResume();
m_Pause=true;
m_start_paused=false;
m_av_clock->OMXPause();
}
}
}
else if (m_Pause || audio_fifo_low || video_fifo_low)
Expand Down Expand Up @@ -1785,8 +1808,9 @@ int main(int argc, char *argv[])
m_incr = m_loop_from - (m_av_clock->OMXMediaTime() ? m_av_clock->OMXMediaTime() / DVD_TIME_BASE : last_seek_pos);
continue;
}

break;

if (!m_end_paused)
break;
}

if(m_has_video && m_omx_pkt && m_omx_reader.IsActive(OMXSTREAM_VIDEO, m_omx_pkt->stream_index))
Expand Down

0 comments on commit 3d474bd

Please sign in to comment.