source: smplayer/trunk/src/videopreview/videopreview.h@ 119

Last change on this file since 119 was 119, checked in by Silvan Scherrer, 13 years ago

SMPlayer: latest svn update

  • Property svn:eol-style set to LF
File size: 4.2 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2011 Ricardo Villalba <rvm@escomposlinux.org>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17*/
18
19#ifndef _VIDEOPREVIEW_H_
20#define _VIDEOPREVIEW_H_
21
22#include <QWidget>
23#include <QString>
24#include <QList>
25
26class QProgressDialog;
27class QGridLayout;
28class QLabel;
29class QScrollArea;
30class QDialogButtonBox;
31class QSettings;
32class QAction;
33
34class VideoInfo
35{
36public:
37 VideoInfo() { filename.clear(); width = 0; height = 0; length = 0;
38 size = 0; fps = 0; aspect = 0; video_bitrate = 0;
39 audio_bitrate = 0; audio_rate = 0; video_format.clear(); };
40 ~VideoInfo() {};
41
42 QString filename;
43 int width;
44 int height;
45 int length;
46 qint64 size;
47 double fps;
48 double aspect;
49 int video_bitrate;
50 int audio_bitrate;
51 int audio_rate;
52 QString video_format;
53};
54
55class VideoPreview : public QWidget
56{
57 Q_OBJECT
58
59public:
60 enum ExtractFormat { JPEG = 1, PNG = 2 };
61
62 VideoPreview(QString mplayer_path, QWidget * parent = 0);
63 ~VideoPreview();
64
65 void setMplayerPath(QString mplayer_path);
66 QString mplayerPath() { return mplayer_bin; };
67
68 void setVideoFile(QString file) { prop.input_video = file; };
69 QString videoFile() { return prop.input_video; };
70
71 void setDVDDevice(const QString & dvd_device) { prop.dvd_device = dvd_device; };
72 QString DVDDevice() { return prop.dvd_device; };
73
74 void setCols(int cols) { prop.n_cols = cols; };
75 int cols() { return prop.n_cols; };
76
77 void setRows(int rows) { prop.n_rows = rows; };
78 int rows() { return prop.n_rows; };
79
80 void setGrid(int cols, int rows) { prop.n_cols = cols; prop.n_rows = rows; };
81
82 void setInitialStep(int step) { prop.initial_step = step; };
83 int initialStep() { return prop.initial_step; };
84
85 void setMaxWidth(int w) { prop.max_width = w; };
86 int maxWidth() { return prop.max_width; };
87
88 void setDisplayOSD(bool b) { prop.display_osd = b; };
89 bool displayOSD() { return prop.display_osd; };
90
91 void setAspectRatio(double asp) { prop.aspect_ratio = asp; };
92 double aspectRatio() { return prop.aspect_ratio; };
93
94 void setExtractFormat( ExtractFormat format ) { prop.extract_format = format; };
95 ExtractFormat extractFormat() { return prop.extract_format; };
96
97 bool createThumbnails();
98
99 bool showConfigDialog(QWidget * parent);
100
101 void setSettings(QSettings * settings);
102 QSettings * settings() { return set; };
103
104 VideoInfo getInfo(const QString & mplayer_path, const QString & filename);
105 QString errorMessage() { return error_message; };
106
107 void adjustWindowSize();
108
109protected slots:
110 void cancelPressed();
111 void saveImage();
112 void showInfo(bool visible);
113
114protected:
115 virtual void retranslateStrings();
116 virtual void changeEvent( QEvent * event );
117
118protected:
119 bool extractImages();
120 bool runMplayer(int seek, double aspect_ratio);
121 bool addPicture(const QString & filename, int num, int time);
122 void displayVideoInfo(const VideoInfo & i);
123 void cleanDir(QString directory);
124 void clearThumbnails();
125 QString framePicture();
126 void saveSettings();
127 void loadSettings();
128
129 QList <QLabel *> label_list;
130
131 QGridLayout * grid_layout;
132 QLabel * info;
133 QLabel * foot;
134 QWidget * w_contents;
135 QScrollArea * scroll_area;
136 QDialogButtonBox * button_box;
137
138 QString mplayer_bin;
139
140 QString output_dir;
141 QString full_output_dir;
142
143 QProgressDialog * progress;
144 bool canceled;
145
146 QSettings * set;
147
148 QAction * toggleInfoAct;
149
150 struct Properties {
151 QString input_video;
152 QString dvd_device;
153 int n_cols, n_rows, initial_step, max_width;
154 double aspect_ratio;
155 bool display_osd;
156 ExtractFormat extract_format;
157 } prop;
158
159 struct {
160 int thumbnail_width;
161 } run;
162
163 QString last_directory;
164 bool save_last_directory;
165 QString error_message;
166};
167
168#endif
Note: See TracBrowser for help on using the repository browser.