Skip to content

Commit 3d474bd

Browse files
author
Dariush Bahri
committed
Added start-paused and end-paused options:
popcornmix#669
1 parent 6dfbe08 commit 3d474bd

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ Usage: omxplayer [OPTIONS] [FILE]
121121
--user-agent 'ua' Send specified User-Agent as part of HTTP requests
122122
--lavfdopts 'opts' Options passed to libavformat, e.g. 'probesize:250000,...'
123123
--avdict 'opts' Options passed to demuxer, e.g., 'rtsp_transport:tcp,...'
124+
--start-paused Immediately pause the video after loading, will wait for dbus or key command to play
125+
--end-paused Pause the video on the last frame indefinitely
124126

125127
For example:
126128

‎omxplayer.cpp‎

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ bool m_has_audio = false;
115115
bool m_has_subtitle = false;
116116
bool m_gen_log = false;
117117
bool m_loop = false;
118+
bool m_start_paused = false;
119+
bool m_end_paused = false;
118120

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

@@ -570,6 +572,8 @@ int main(int argc, char *argv[])
570572
const int http_user_agent_opt = 0x301;
571573
const int lavfdopts_opt = 0x400;
572574
const int avdict_opt = 0x401;
575+
const int start_paused = 0x214;
576+
const int end_paused = 0x215;
573577

574578
struct option longopts[] = {
575579
{ "info", no_argument, NULL, 'i' },
@@ -619,6 +623,8 @@ int main(int argc, char *argv[])
619623
{ "key-config", required_argument, NULL, key_config_opt },
620624
{ "no-osd", no_argument, NULL, no_osd_opt },
621625
{ "no-keys", no_argument, NULL, no_keys_opt },
626+
{ "start-paused", no_argument, NULL, start_paused },
627+
{ "end-paused", no_argument, NULL, end_paused },
622628
{ "orientation", required_argument, NULL, orientation_opt },
623629
{ "fps", required_argument, NULL, fps_opt },
624630
{ "live", no_argument, NULL, live_opt },
@@ -766,6 +772,12 @@ int main(int argc, char *argv[])
766772
case no_keys_opt:
767773
m_no_keys = true;
768774
break;
775+
case start_paused:
776+
m_start_paused = true;
777+
break;
778+
case end_paused:
779+
m_end_paused = true;
780+
break;
769781
case font_opt:
770782
m_font_path = optarg;
771783
m_asked_for_font = true;
@@ -1738,8 +1750,19 @@ int main(int argc, char *argv[])
17381750
{
17391751
if (m_av_clock->OMXIsPaused())
17401752
{
1741-
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);
1742-
m_av_clock->OMXResume();
1753+
if (!m_start_paused)
1754+
{
1755+
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);
1756+
m_av_clock->OMXResume();
1757+
}
1758+
else
1759+
{
1760+
CLog::Log(LOGDEBUG, "start-paused(%d)\n", m_start_paused);
1761+
m_av_clock->OMXResume();
1762+
m_Pause=true;
1763+
m_start_paused=false;
1764+
m_av_clock->OMXPause();
1765+
}
17431766
}
17441767
}
17451768
else if (m_Pause || audio_fifo_low || video_fifo_low)
@@ -1785,8 +1808,9 @@ int main(int argc, char *argv[])
17851808
m_incr = m_loop_from - (m_av_clock->OMXMediaTime() ? m_av_clock->OMXMediaTime() / DVD_TIME_BASE : last_seek_pos);
17861809
continue;
17871810
}
1788-
1789-
break;
1811+
1812+
if (!m_end_paused)
1813+
break;
17901814
}
17911815

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

0 commit comments

Comments
 (0)