video_playback.h
Go to the documentation of this file.
1 //=================================================================================================
2 // Copyright (c) 2013, Johannes Meyer, TU Darmstadt
3 // All rights reserved.
4 
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 // * Neither the name of the Flight Systems and Automatic Control group,
13 // TU Darmstadt, nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without
15 // specific prior written permission.
16 
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
21 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //=================================================================================================
28 
29 #ifndef RQT_VIDEO_PLAYBACK_VIDEO_PLAYBACK_H
30 #define RQT_VIDEO_PLAYBACK_VIDEO_PLAYBACK_H
31 
32 #include <rqt_gui_cpp/plugin.h>
33 #include <ui_video_playback.h>
34 
35 #include <ros/ros.h>
36 #include <rosgraph_msgs/Clock.h>
37 
38 #include <Phonon/MediaObject>
39 #include <Phonon/MediaNode>
40 
41 namespace rqt_video_playback {
42 
44  : public rqt_gui_cpp::Plugin
45 {
46  Q_OBJECT
47 
48 public:
49  VideoPlayback();
50  virtual ~VideoPlayback();
51 
52  virtual void initPlugin(qt_gui_cpp::PluginContext& context);
53 
54  virtual bool eventFilter(QObject* watched, QEvent* event);
55 
56  virtual void shutdownPlugin();
57 
58  virtual void saveSettings(qt_gui_cpp::Settings& plugin_settings, qt_gui_cpp::Settings& instance_settings) const;
59 
60  virtual void restoreSettings(const qt_gui_cpp::Settings& plugin_settings, const qt_gui_cpp::Settings& instance_settings);
61 
62 protected slots:
63  void openClicked();
64  void playClicked();
65  void previousClicked();
66  void nextClicked();
67  void sliderValueChanged(int);
68 
69  void sync();
70 
71  void tick(qint64);
72  void stateChanged(Phonon::State newstate, Phonon::State oldstate);
73  void totalTimeChanged(qint64);
74  void currentSourceChanged(Phonon::MediaSource);
75 
76 signals:
77  void clockUpdated();
78 
79 protected:
80  virtual void callbackClock(const rosgraph_msgs::Clock::ConstPtr& msg);
81  Phonon::MediaObject *mediaObject() const { return ui_.videoPlayer->mediaObject(); }
82 
83 private:
84  ros::Duration toRos(qint64 time);
85  qint64 fromRos(const ros::Duration& duration);
86 
87  Ui_VideoPlayback ui_;
88 
89  QWidget* widget_;
90 
92 
95 
96 private:
97  qint64 step_time_;
99 };
100 
101 } // namespace rqt_video_playback
102 
103 #endif // RQT_VIDEO_PLAYBACK_VIDEO_PLAYBACK_H
virtual void callbackClock(const rosgraph_msgs::Clock::ConstPtr &msg)
virtual void initPlugin(qt_gui_cpp::PluginContext &context)
ros::Duration toRos(qint64 time)
void stateChanged(Phonon::State newstate, Phonon::State oldstate)
virtual void restoreSettings(const qt_gui_cpp::Settings &plugin_settings, const qt_gui_cpp::Settings &instance_settings)
virtual bool eventFilter(QObject *watched, QEvent *event)
qint64 fromRos(const ros::Duration &duration)
void currentSourceChanged(Phonon::MediaSource)
Phonon::MediaObject * mediaObject() const
virtual void saveSettings(qt_gui_cpp::Settings &plugin_settings, qt_gui_cpp::Settings &instance_settings) const


rqt_video_playback
Author(s): Johannes Meyer
autogenerated on Mon Jun 10 2019 13:36:43