video_dialog.h
Go to the documentation of this file.
1 #ifndef VIDEO_DIALOG_H
2 #define VIDEO_DIALOG_H
3 
4 #include <memory>
5 #include <QDialog>
6 #include <QtAV>
7 #include <QSlider>
8 #include <QPushButton>
9 #include <QCloseEvent>
10 #include <QtAV/FrameReader.h>
11 #include "ui_video_dialog.h"
12 
13 #include "qoi.h"
14 
15 class ImageLabel : public QWidget
16 {
17  Q_OBJECT
18 
19 public:
20  explicit ImageLabel(QWidget* parent = nullptr);
21  const QPixmap* pixmap() const;
22 
23 public slots:
24  void setPixmap(const QPixmap&);
25 
26 protected:
27  void paintEvent(QPaintEvent*);
28 
29 private:
30  QPixmap pix;
31 };
32 
33 class VideoDialog : public QDialog
34 {
35  Q_OBJECT
36 
37 public:
38  explicit VideoDialog(QWidget* parent = nullptr);
39  ~VideoDialog();
40 
41  QString referenceCurve() const;
42 
43  void pause(bool paused);
44 
45  bool isPaused() const;
46 
47  Ui::VideoDialog* ui;
48 
49  bool loadFile(QString filename);
50 
51 private slots:
52  void on_loadButton_clicked();
53 
54  void on_timeSlider_valueChanged(int value);
55 
56  void closeEvent(QCloseEvent* event)
57  {
58  emit closed();
59  }
60 
61 public Q_SLOTS:
62 
63  void seekByValue(double value);
64 
65 private Q_SLOTS:
66  void updateSliderPos(qint64 value);
67  void updateSlider();
68  void updateSliderUnit();
69 
71 
73 
74 signals:
75 
76  void closed();
77 
78 private:
79  QtAV::VideoOutput* _video_output;
80  QtAV::AVPlayer* _media_player;
81  std::unique_ptr<QtAV::FrameReader> _frame_reader;
82  // std::vector<QImage> _frames;
84  {
86  {
87  }
88  CompressedFrame(const CompressedFrame&) = delete;
90  {
91  std::swap(other.data, data);
92  std::swap(other.length, length);
93  }
94 
96  {
97  if (data)
98  free(data);
99  }
100 
101  int length;
103  void* data;
104  };
105  std::vector<CompressedFrame> _compressed_frames;
106 
107  bool eventFilter(QObject* obj, QEvent* ev);
109 
111 
112  bool _decoded = false;
113 };
114 
115 #endif // VIDEO_DIALOG_H
VideoDialog::CompressedFrame::length
int length
Definition: video_dialog.h:101
VideoDialog::seekByValue
void seekByValue(double value)
Definition: video_dialog.cpp:213
VideoDialog::isPaused
bool isPaused() const
Definition: video_dialog.cpp:127
VideoDialog::updateSlider
void updateSlider()
Definition: video_dialog.cpp:149
VideoDialog::ui
Ui::VideoDialog * ui
Definition: video_dialog.h:47
VideoDialog::on_timeSlider_valueChanged
void on_timeSlider_valueChanged(int value)
Definition: video_dialog.cpp:183
VideoDialog::_compressed_frames
std::vector< CompressedFrame > _compressed_frames
Definition: video_dialog.h:105
VideoDialog::updateSliderPos
void updateSliderPos(qint64 value)
VideoDialog::_label
ImageLabel * _label
Definition: video_dialog.h:110
VideoDialog::CompressedFrame::CompressedFrame
CompressedFrame(CompressedFrame &&other)
Definition: video_dialog.h:89
VideoDialog::on_clearButton_clicked
void on_clearButton_clicked()
Definition: video_dialog.cpp:275
VideoDialog::CompressedFrame::data
void * data
Definition: video_dialog.h:103
VideoDialog::_decoded
bool _decoded
Definition: video_dialog.h:112
ImageLabel::paintEvent
void paintEvent(QPaintEvent *)
Definition: video_dialog.cpp:35
VideoDialog::_dragging_curve
QString _dragging_curve
Definition: video_dialog.h:108
VideoDialog::closed
void closed()
VideoDialog::closeEvent
void closeEvent(QCloseEvent *event)
Definition: video_dialog.h:56
ImageLabel::setPixmap
void setPixmap(const QPixmap &)
Definition: video_dialog.cpp:30
VideoDialog::_video_output
QtAV::VideoOutput * _video_output
Definition: video_dialog.h:79
VideoDialog::_frame_reader
std::unique_ptr< QtAV::FrameReader > _frame_reader
Definition: video_dialog.h:81
ImageLabel::ImageLabel
ImageLabel(QWidget *parent=nullptr)
Definition: video_dialog.cpp:21
VideoDialog::VideoDialog
VideoDialog(QWidget *parent=nullptr)
Definition: video_dialog.cpp:59
VideoDialog::referenceCurve
QString referenceCurve() const
Definition: video_dialog.cpp:117
ImageLabel::pix
QPixmap pix
Definition: video_dialog.h:30
VideoDialog::CompressedFrame::~CompressedFrame
~CompressedFrame()
Definition: video_dialog.h:95
qoi.h
VideoDialog::pause
void pause(bool paused)
Definition: video_dialog.cpp:122
std::swap
NLOHMANN_BASIC_JSON_TPL_DECLARATION void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL &j1, nlohmann::NLOHMANN_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name) is_nothrow_move_constructible< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression) is_nothrow_move_assignable< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
Definition: json.hpp:21884
VideoDialog
Definition: video_dialog.h:33
VideoDialog::on_decodeButton_clicked
void on_decodeButton_clicked()
Definition: video_dialog.cpp:290
VideoDialog::CompressedFrame
Definition: video_dialog.h:83
VideoDialog::_media_player
QtAV::AVPlayer * _media_player
Definition: video_dialog.h:80
ImageLabel::pixmap
const QPixmap * pixmap() const
Definition: video_dialog.cpp:25
VideoDialog::CompressedFrame::CompressedFrame
CompressedFrame()
Definition: video_dialog.h:85
VideoDialog::updateSliderUnit
void updateSliderUnit()
qoi_desc
Definition: qoi.h:255
VideoDialog::CompressedFrame::info
qoi_desc info
Definition: video_dialog.h:102
ImageLabel
Definition: video_dialog.h:15
VideoDialog::~VideoDialog
~VideoDialog()
Definition: video_dialog.cpp:90
VideoDialog::on_loadButton_clicked
void on_loadButton_clicked()
Definition: video_dialog.cpp:132
VideoDialog::loadFile
bool loadFile(QString filename)
Definition: video_dialog.cpp:95
VideoDialog::eventFilter
bool eventFilter(QObject *obj, QEvent *ev)
Definition: video_dialog.cpp:226
nullptr
#define nullptr
Definition: backward.hpp:386


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:48