>From 0c2e96e2105e08bc8f1eef652f830972f71fd39d Mon Sep 17 00:00:00 2001 From: Martin Lambers
Date: Sun, 24 Apr 2011 16:00:34 +0200 Subject: [PATCH] Add a loop mode. This allows to loop the current file. This can be extended in the future. --- doc/bino.1 | 4 ++- doc/bino.texi | 5 +++- src/Makefile.am | 1 + src/controller.h | 6 +++- src/icons/media-playlist-repeat.png | Bin 0 -> 2872 bytes src/main.cpp | 8 ++++- src/media_data.cpp | 6 +++- src/media_data.h | 7 +++++ src/player.cpp | 30 ++++++++++++++++++++- src/player_qt.cpp | 48 +++++++++++++++++++++++++++-------- src/player_qt.h | 2 + 11 files changed, 97 insertions(+), 20 deletions(-) create mode 100644 src/icons/media-playlist-repeat.png diff --git a/doc/bino.1 b/doc/bino.1 index 233333a..e7e2d47 100644 --- a/doc/bino.1 +++ b/doc/bino.1 @@ -29,7 +29,7 @@ Print version. .IP "\-n|\-\-no\-gui" Do not use the GUI, just play the given input in a plain window using the parameters given on the command line. -.IP "\-l|\-\-log\-level=\fILEVEL\fP" +.IP "\-L|\-\-log\-level=\fILEVEL\fP" Select log level: \fIdebug\fP, \fIinfo\fP, \fIwarning\fP, \fIerror\fP, or \fIquiet\fP. .IP "\-v|\-\-video=\fISTREAM\fP" @@ -188,6 +188,8 @@ Amount of crosstalk ghostbusting to apply (0 to 1). .IP "\-b|\-\-benchmark" Benchmark mode: no audio, no time synchronization, output of frames-per-second measurements. +.IP "\-l|\-\-loop" +Loop the input media. .SH INTERACTIVE CONTROL .IP "ESC" Leave fullscreen mode, or quit when in window mode. diff --git a/doc/bino.texi b/doc/bino.texi index f503732..47bf61a 100644 --- a/doc/bino.texi +++ b/doc/bino.texi @@ -95,7 +95,7 @@ Print version. @itemx --no-gui Do not use the GUI, just play the given input in a plain window using the parameters given on the command line. address@hidden -l address@hidden -L @itemx address@hidden Select log level: @var{debug}, @var{info}, @var{warning}, @var{error}, or @var{quiet}. @@ -148,6 +148,9 @@ Amount of crosstalk ghostbusting to apply (0 to 1). @itemx --benchmark Benchmark mode: no audio, no time synchronization, output of frames-per-second measurements. address@hidden -l address@hidden --loop +Loop the input media. @end table @node Input Layouts diff --git a/src/Makefile.am b/src/Makefile.am index 8df35d3..4452882 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,6 +34,7 @@ ICONS = \ icons/media-playback-pause.png \ icons/media-playback-start.png \ icons/media-playback-stop.png \ + icons/media-playlist-repeat.png \ icons/media-seek-backward.png \ icons/media-seek-forward.png \ icons/preferences-desktop-keyboard.png \ diff --git a/src/controller.h b/src/controller.h index 93021dd..96ae0be 100644 --- a/src/controller.h +++ b/src/controller.h @@ -83,7 +83,8 @@ public: adjust_subtitle_parallax, // float (relative adjustment) set_subtitle_parallax, // float (absolute value) seek, // float (relative adjustment) - set_pos // float (absolute position) + set_pos, // float (absolute position) + set_loop_mode, // parameters::loop_mode_t }; type type; @@ -146,7 +147,8 @@ public: subtitle_scale, // float subtitle_color, // uint64_t subtitle_parallax, // float - pos // float + pos, // float + loop_mode, // parameters::loop_mode_t }; type type; diff --git a/src/icons/media-playlist-repeat.png b/src/icons/media-playlist-repeat.png new file mode 100644 index 0000000000000000000000000000000000000000..60f46047ea1754c1b2aaab99c94cf50c20950c4b GIT binary patch literal 2872 zcmV-83&-?{P)Play.
")); connect(_play_button, SIGNAL(pressed()), this, SLOT(play_pressed())); @@ -744,58 +744,67 @@ controls_widget::controls_widget(QSettings *settings, QWidget *parent) connect(_stop_button, SIGNAL(pressed()), this, SLOT(stop_pressed())); layout->addWidget(_stop_button, 1, 2); layout->addWidget(new QWidget, 1, 3); + _loop_button = new QPushButton(get_icon("media-playlist-repeat"), ""); + _loop_button->setToolTip(_("Toggle loop mode.
")); + _loop_button->setCheckable(true); + _loop_button->setChecked(false); + connect(_loop_button, SIGNAL(toggled(bool)), this, SLOT(loop_pressed())); + layout->addWidget(_loop_button, 1, 4); + layout->addWidget(new QWidget, 1, 5); _fullscreen_button = new QPushButton(get_icon("view-fullscreen"), ""); _fullscreen_button->setToolTip(_("Switch to fullscreen mode. " "You can leave fullscreen mode by pressing the f key.
")); connect(_fullscreen_button, SIGNAL(pressed()), this, SLOT(fullscreen_pressed())); - layout->addWidget(_fullscreen_button, 1, 4); + layout->addWidget(_fullscreen_button, 1, 6); _center_button = new QPushButton(get_icon("view-restore"), ""); _center_button->setToolTip(_("Center the video area on your screen.
")); connect(_center_button, SIGNAL(pressed()), this, SLOT(center_pressed())); - layout->addWidget(_center_button, 1, 5); - layout->addWidget(new QWidget, 1, 6); + layout->addWidget(_center_button, 1, 7); + layout->addWidget(new QWidget, 1, 8); _bbb_button = new QPushButton(get_icon("media-seek-backward"), ""); _bbb_button->setFixedSize(_bbb_button->minimumSizeHint()); _bbb_button->setIconSize(_bbb_button->iconSize() * 12 / 10); _bbb_button->setToolTip(_("Seek backward 10 minutes.
")); connect(_bbb_button, SIGNAL(pressed()), this, SLOT(bbb_pressed())); - layout->addWidget(_bbb_button, 1, 7); + layout->addWidget(_bbb_button, 1, 9); _bb_button = new QPushButton(get_icon("media-seek-backward"), ""); _bb_button->setFixedSize(_bb_button->minimumSizeHint()); _bb_button->setToolTip(_("Seek backward 1 minute.
")); connect(_bb_button, SIGNAL(pressed()), this, SLOT(bb_pressed())); - layout->addWidget(_bb_button, 1, 8); + layout->addWidget(_bb_button, 1, 10); _b_button = new QPushButton(get_icon("media-seek-backward"), ""); _b_button->setFixedSize(_b_button->minimumSizeHint()); _b_button->setIconSize(_b_button->iconSize() * 8 / 10); _b_button->setToolTip(_("Seek backward 10 seconds.
")); connect(_b_button, SIGNAL(pressed()), this, SLOT(b_pressed())); - layout->addWidget(_b_button, 1, 9); + layout->addWidget(_b_button, 1, 11); _f_button = new QPushButton(get_icon("media-seek-forward"), ""); _f_button->setFixedSize(_f_button->minimumSizeHint()); _f_button->setIconSize(_f_button->iconSize() * 8 / 10); _f_button->setToolTip(_("Seek forward 10 seconds.
")); connect(_f_button, SIGNAL(pressed()), this, SLOT(f_pressed())); - layout->addWidget(_f_button, 1, 10); + layout->addWidget(_f_button, 1, 12); _ff_button = new QPushButton(get_icon("media-seek-forward"), ""); _ff_button->setFixedSize(_ff_button->minimumSizeHint()); _ff_button->setToolTip(_("Seek forward 1 minute.
")); connect(_ff_button, SIGNAL(pressed()), this, SLOT(ff_pressed())); - layout->addWidget(_ff_button, 1, 11); + layout->addWidget(_ff_button, 1, 13); _fff_button = new QPushButton(get_icon("media-seek-forward"), ""); _fff_button->setFixedSize(_fff_button->minimumSizeHint()); _fff_button->setIconSize(_fff_button->iconSize() * 12 / 10); _fff_button->setToolTip(_("Seek forward 10 minutes.
")); connect(_fff_button, SIGNAL(pressed()), this, SLOT(fff_pressed())); - layout->addWidget(_fff_button, 1, 12); + layout->addWidget(_fff_button, 1, 14); layout->setRowStretch(0, 0); layout->setColumnStretch(3, 1); - layout->setColumnStretch(6, 1); + layout->setColumnStretch(5, 1); + layout->setColumnStretch(8, 1); setLayout(layout); _play_button->setEnabled(false); _pause_button->setEnabled(false); _stop_button->setEnabled(false); + _loop_button->setEnabled(false); _fullscreen_button->setEnabled(false); _center_button->setEnabled(false); _bbb_button->setEnabled(false); @@ -833,6 +842,13 @@ void controls_widget::stop_pressed() send_cmd(command::toggle_play); } +void controls_widget::loop_pressed() +{ + int loop_mode = static_cast