From 8f1768353ed5f4460b5eb258573d21b049a60cd5 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Mon, 13 Mar 2017 06:58:33 -0700 Subject: [PATCH 1/3] Added function start-paused This function allows a user to start omxplayer in a paused state instead of immediately starting playback of the video. The user can then use standard keyboard or dbus commands to begin playback manually. To use this function add the command-line parameter: --start-paused to the omxplayer command. Example: omxplayer -p -o hdmi --start-paused test.mkv This will start the omxplayer, load the buffer to begin playback and then pause. To resume playback, press the key on the keyboard for resume (by default this is the p or space keys), or send a dbus command. --- README.md | 1 + omxplayer.cpp | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 241b8d67..c93c7ca9 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ 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 For example: diff --git a/omxplayer.cpp b/omxplayer.cpp index bde45363..faa7d263 100644 --- a/omxplayer.cpp +++ b/omxplayer.cpp @@ -114,6 +114,7 @@ bool m_has_audio = false; bool m_has_subtitle = false; bool m_gen_log = false; bool m_loop = false; +bool m_start_paused = false; enum{ERROR=-1,SUCCESS,ONEBYTE}; @@ -569,6 +570,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 start_paused = 0x214; struct option longopts[] = { { "info", no_argument, NULL, 'i' }, @@ -618,6 +620,7 @@ 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 }, { "orientation", required_argument, NULL, orientation_opt }, { "fps", required_argument, NULL, fps_opt }, { "live", no_argument, NULL, live_opt }, @@ -765,6 +768,9 @@ int main(int argc, char *argv[]) case no_keys_opt: m_no_keys = true; break; + case start_paused: + m_start_paused = true; + break; case font_opt: m_font_path = optarg; m_asked_for_font = true; @@ -1435,6 +1441,7 @@ int main(int argc, char *argv[]) break; case KeyConfig::ACTION_PLAY: m_Pause=false; + //m_start_paused=false; if(m_has_subtitle) { m_player_subtitles.Resume(); @@ -1442,6 +1449,7 @@ int main(int argc, char *argv[]) break; case KeyConfig::ACTION_PAUSE: m_Pause=true; + //m_start_paused=false; if(m_has_subtitle) { m_player_subtitles.Pause(); @@ -1449,6 +1457,7 @@ int main(int argc, char *argv[]) break; case KeyConfig::ACTION_PLAYPAUSE: m_Pause = !m_Pause; + //m_start_paused = false; if (m_av_clock->OMXPlaySpeed() != DVD_PLAYSPEED_NORMAL && m_av_clock->OMXPlaySpeed() != DVD_PLAYSPEED_PAUSE) { printf("resume\n"); @@ -1722,8 +1731,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) From 8af810c4aadc8a92497156633527cacd63b813d4 Mon Sep 17 00:00:00 2001 From: "NF @ nf-nph-F-02-1" Date: Sun, 9 Dec 2018 15:59:07 +0000 Subject: [PATCH 2/3] Added --end-paused option to pause on last frame --- README.md | 1 + omxplayer.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ae913d35..b1cb6d99 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ Usage: omxplayer [OPTIONS] [FILE] --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: diff --git a/omxplayer.cpp b/omxplayer.cpp index 3dd72c3e..3477c2cd 100644 --- a/omxplayer.cpp +++ b/omxplayer.cpp @@ -115,6 +115,7 @@ 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}; @@ -571,6 +572,7 @@ int main(int argc, char *argv[]) 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' }, @@ -621,6 +623,7 @@ int main(int argc, char *argv[]) { "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 }, @@ -771,6 +774,9 @@ int main(int argc, char *argv[]) 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; @@ -1811,7 +1817,8 @@ int main(int argc, char *argv[]) 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)) From 5cead73e59c4a82d2f5c9b9125320a49e720ffd1 Mon Sep 17 00:00:00 2001 From: dronus Date: Wed, 19 Dec 2018 01:07:59 +0100 Subject: [PATCH 3/3] removed three obsolete commented out lines --- omxplayer.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/omxplayer.cpp b/omxplayer.cpp index 3477c2cd..4e6dbf6a 100644 --- a/omxplayer.cpp +++ b/omxplayer.cpp @@ -1461,7 +1461,6 @@ int main(int argc, char *argv[]) break; case KeyConfig::ACTION_PLAY: m_Pause=false; - //m_start_paused=false; if(m_has_subtitle) { m_player_subtitles.Resume(); @@ -1469,7 +1468,6 @@ int main(int argc, char *argv[]) break; case KeyConfig::ACTION_PAUSE: m_Pause=true; - //m_start_paused=false; if(m_has_subtitle) { m_player_subtitles.Pause(); @@ -1477,7 +1475,6 @@ int main(int argc, char *argv[]) break; case KeyConfig::ACTION_PLAYPAUSE: m_Pause = !m_Pause; - //m_start_paused = false; if (m_av_clock->OMXPlaySpeed() != DVD_PLAYSPEED_NORMAL && m_av_clock->OMXPlaySpeed() != DVD_PLAYSPEED_PAUSE) { printf("resume\n");