~ubuntu-branches/ubuntu/wily/smplayer/wily

« back to all changes in this revision

Viewing changes to src/corelib/core.h

  • Committer: Bazaar Package Importer
  • Author(s): Maia Kozheva
  • Date: 2009-03-31 23:05:43 UTC
  • mfrom: (1.2.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20090331230543-0h2hfwpwlu9opbv2
* New upstream release. (Closes: #523791)
  - Reworked subtitle font preferences. (Closes: #503295)
  - No longer installs qt_fr.qm. (Closes: #486314)
* debian/control:
  - Bumped Standards-Version to 3.8.1.
  - Changed maintainer name (still the same person and GPG key).
  - Changed section to video.
  - Build-depend on zlib1g-dev for findsubtitles.
  - Require Qt >= 4.3 per readme.
  - Added ${misc:Depends}.
  - Make smplayer-translations depend on smplayer and smplayer recommend
    smplayer-translations, not the other way round. (Closes: #489375)
* debian/copyright:
  - Significantly expanded per-file with new upstream authors.
* debian/rules:
  - Make make use correct uic in install.
  - Clean svn_revision.
  - Removed get-orig-source - not needed with uscan --repack.
* debian/patches/01_gl_translation.patch:
  - Added patch to fix lrelease error on smplayer_gl.ts.
* Added debian/README.source for simple-patchsys.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  smplayer, GUI front-end for mplayer.
2
 
    Copyright (C) 2006-2008 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 _CORE_H_
20
 
#define _CORE_H_
21
 
 
22
 
#include <QObject>
23
 
#include <QProcess> // For QProcess::ProcessError
24
 
#include "mediadata.h"
25
 
#include "mediasettings.h"
26
 
#include "config.h"
27
 
 
28
 
 
29
 
class MplayerProcess;
30
 
class MplayerWindow;
31
 
class QSettings;
32
 
 
33
 
#ifdef Q_OS_WIN
34
 
class WinScreenSaver;
35
 
#endif
36
 
 
37
 
class Core : public QObject
38
 
{
39
 
    Q_OBJECT
40
 
    
41
 
public:
42
 
        enum State { Stopped = 0, Playing = 1, Paused = 2 };
43
 
 
44
 
    Core( MplayerWindow *mpw, QWidget* parent = 0 );
45
 
    ~Core();
46
 
 
47
 
    MediaData mdat;
48
 
        MediaSettings mset;
49
 
 
50
 
    QString mplayer_log;
51
 
 
52
 
        //! Return the current state
53
 
        State state() { return _state; };
54
 
 
55
 
        //! Return a string with the name of the current state,
56
 
        //! so it can be printed on debugging messages.
57
 
        QString stateToString();
58
 
 
59
 
protected:
60
 
        //! Change the current state (Stopped, Playing or Paused)
61
 
        //! And sends the stateChanged() signal.
62
 
        void setState(State s);
63
 
    
64
 
public slots:
65
 
        //! Generic open, with autodetection of type
66
 
        void open(QString file, int seek=-1); 
67
 
        void openFile(QString filename, int seek=-1);
68
 
        void openStream(QString name);
69
 
        /*
70
 
        void openDVD( bool from_folder, QString directory = "");
71
 
        void openDVD(); // Plays title 1
72
 
        void openDVD(int title = 1);
73
 
        */
74
 
        void openDVD(QString dvd_url);
75
 
        void openVCD(int title = -1);
76
 
        void openAudioCD(int title = -1);
77
 
 
78
 
        void loadSub(const QString & sub);
79
 
        void unloadSub();
80
 
 
81
 
        void loadAudioFile(const QString & audiofile);
82
 
        void unloadAudioFile();
83
 
 
84
 
    void stop(); 
85
 
    void play();
86
 
        void play_or_pause();
87
 
    void pause_and_frame_step();
88
 
        void pause();
89
 
        void frameStep();
90
 
        void screenshot();
91
 
 
92
 
        //! Public restart, for the GUI.
93
 
        void restart();
94
 
 
95
 
        //! Reopens the file (no restart)
96
 
        void reload();
97
 
 
98
 
    void goToPos( int perc );
99
 
    void goToSec( double sec );
100
 
 
101
 
        void toggleRepeat();
102
 
        void toggleRepeat(bool b);
103
 
 
104
 
        void toggleFlip();
105
 
        void toggleFlip(bool b);
106
 
 
107
 
        // Audio filters
108
 
        void toggleKaraoke();
109
 
        void toggleKaraoke(bool b);
110
 
        void toggleExtrastereo();
111
 
        void toggleExtrastereo(bool b);
112
 
        void toggleVolnorm();
113
 
        void toggleVolnorm(bool b);
114
 
 
115
 
        void setAudioChannels(int channels);
116
 
        void setStereoMode(int mode);
117
 
 
118
 
        // Video filters
119
 
        void toggleAutophase();
120
 
        void toggleAutophase(bool b);
121
 
        void toggleDeblock();
122
 
        void toggleDeblock(bool b);
123
 
        void toggleDering();
124
 
        void toggleDering(bool b);
125
 
        void toggleNoise();
126
 
        void toggleNoise(bool b);
127
 
        void togglePostprocessing();
128
 
        void togglePostprocessing(bool b);
129
 
        void changeDenoise(int);
130
 
#if NEW_ASPECT_CODE
131
 
        void changeLetterbox(bool);
132
 
#endif
133
 
        void changeUpscale(bool);
134
 
 
135
 
        void seek(int secs);
136
 
        void sforward();        // + 10 seconds
137
 
        void srewind();         // - 10 seconds
138
 
    void forward();     // + 1 minute
139
 
    void rewind();              // -1 minute
140
 
    void fastforward(); // + 10 minutes
141
 
    void fastrewind();  // - 10 minutes
142
 
        void forward(int secs);
143
 
        void rewind(int secs);
144
 
        void wheelUp();
145
 
        void wheelDown();
146
 
 
147
 
        void setSpeed( double value );
148
 
        void incSpeed();
149
 
        void decSpeed();
150
 
        void doubleSpeed();
151
 
        void halveSpeed();
152
 
        void normalSpeed();
153
 
 
154
 
    void setVolume(int volume, bool force = false);
155
 
        void switchMute();
156
 
        void mute(bool b);
157
 
        void incVolume();
158
 
        void decVolume();
159
 
 
160
 
        void setBrightness(int value);
161
 
        void setContrast(int value);
162
 
        void setGamma(int value);
163
 
        void setHue(int value);
164
 
        void setSaturation(int value);
165
 
 
166
 
        void incBrightness();
167
 
        void decBrightness();
168
 
        void incContrast();
169
 
        void decContrast();
170
 
        void incGamma();
171
 
        void decGamma();
172
 
        void incHue();
173
 
        void decHue();
174
 
        void incSaturation();
175
 
        void decSaturation();
176
 
 
177
 
        void incSubDelay();
178
 
        void decSubDelay();
179
 
 
180
 
        void incAudioDelay();
181
 
        void decAudioDelay();
182
 
 
183
 
        void incSubPos();
184
 
        void decSubPos();
185
 
 
186
 
        void changeSubScale(double value);
187
 
        void incSubScale();
188
 
        void decSubScale();
189
 
 
190
 
        //! Select next line in subtitle file
191
 
        void incSubStep();
192
 
        //! Select previous line in subtitle file
193
 
        void decSubStep();
194
 
 
195
 
        void changeDeinterlace(int);
196
 
    void changeSubtitle(int);
197
 
        void nextSubtitle();
198
 
        void changeAudio(int);
199
 
        void nextAudio();
200
 
        void changeTitle(int);
201
 
        void changeChapter(int);
202
 
        void prevChapter();
203
 
        void nextChapter();
204
 
        void changeAngle(int);
205
 
        void changeAspectRatio(int);
206
 
        void changeOSD(int);
207
 
        void nextOSD();
208
 
 
209
 
        void changeSize(int); // Size of the window
210
 
        void toggleDoubleSize();
211
 
        void changePanscan(double); // Zoom on mplayerwindow
212
 
 
213
 
        void changeRotate(int r);
214
 
 
215
 
        void incPanscan();
216
 
        void decPanscan();
217
 
        void resetPanscan();
218
 
 
219
 
        void changeUseAss(bool);
220
 
        void toggleClosedCaption(bool);
221
 
        void toggleForcedSubsOnly(bool);
222
 
 
223
 
        void visualizeMotionVectors(bool);
224
 
 
225
 
    // Pass a command to mplayer by stdin:
226
 
    void tellmp(const QString & command);
227
 
 
228
 
public:
229
 
        //! Returns the number of the first chapter in mkv
230
 
        //! files. In some versions of mplayer is 0, in others 1
231
 
        static int mkv_first_chapter();
232
 
        static int dvd_first_chapter();
233
 
 
234
 
protected slots:
235
 
    void changeCurrentSec(double sec);
236
 
    void changePause();
237
 
        void gotWindowResolution( int w, int h );
238
 
        void gotNoVideo();
239
 
        void gotVO(QString);
240
 
        void gotAO(QString);
241
 
        void gotStartingTime(double);
242
 
 
243
 
        void finishRestart();
244
 
    void processFinished();
245
 
        void fileReachedEnd();
246
 
    
247
 
        void updateLog(QString line);
248
 
 
249
 
        void displayMessage(QString text);
250
 
        void displayScreenshotName(QString filename);
251
 
 
252
 
        void streamTitleAndUrlChanged(QString,QString);
253
 
        void autosaveMplayerLog();
254
 
        
255
 
        void watchState(Core::State state);
256
 
 
257
 
        //! Called when a video has just started to play.
258
 
        //! This function checks if the codec of video is ffh264 and if
259
 
        //! the resolution is HD
260
 
        void checkIfVideoIsHD();
261
 
 
262
 
protected:
263
 
        void playNewFile(QString file, int seek=-1);
264
 
        void restartPlay();
265
 
        void initPlaying(int seek=-1);
266
 
        void newMediaPlaying();
267
 
 
268
 
    void startMplayer(QString file, double seek = -1 );
269
 
        void stopMplayer();
270
 
 
271
 
#ifndef NO_USE_INI_FILES
272
 
        bool checkHaveSettingsSaved(QString filename);
273
 
        void saveMediaInfo();
274
 
        void loadMediaInfo(QString filename);
275
 
#endif
276
 
 
277
 
    void initializeMenus();
278
 
        void updateWidgets();
279
 
 
280
 
#if SCALE_ASS_SUBS
281
 
        //! Returns true if changing the subscale requires to restart mplayer
282
 
        bool subscale_need_restart();
283
 
#endif
284
 
 
285
 
signals:
286
 
        void aboutToStartPlaying(); // Signal emited just before to start mplayer
287
 
        void mediaLoaded();
288
 
        void mediaInfoChanged();
289
 
    void stateChanged(Core::State state);
290
 
        void mediaStartPlay();
291
 
        void mediaFinished(); // Media has arrived to the end.
292
 
        void mediaStoppedByUser();
293
 
        void showMessage(QString text);
294
 
        void menusNeedInitialize();
295
 
        void widgetsNeedUpdate();
296
 
        void equalizerNeedsUpdate();
297
 
        void showTime(double sec);
298
 
        void posChanged(int); // To connect a slider
299
 
        void showFrame(int frame);
300
 
        void needResize(int w, int h);
301
 
        void noVideo();
302
 
        void volumeChanged(int);
303
 
 
304
 
        //! MPlayer started but finished with exit code != 0
305
 
        void mplayerFinishedWithError(int exitCode);
306
 
 
307
 
        //! MPlayer didn't started or crashed
308
 
        void mplayerFailed(QProcess::ProcessError error);
309
 
 
310
 
        // Resend signal from mplayerprocess:
311
 
        void failedToParseMplayerVersion(QString line_with_mplayer_version);
312
 
 
313
 
protected:
314
 
    MplayerProcess * proc;
315
 
    MplayerWindow * mplayerwindow;
316
 
 
317
 
#ifndef NO_USE_INI_FILES
318
 
        QSettings * file_settings;
319
 
#endif
320
 
 
321
 
#ifdef Q_OS_WIN
322
 
        WinScreenSaver * win_screensaver;
323
 
#endif
324
 
    
325
 
private:
326
 
        // Some variables to proper restart
327
 
        bool we_are_restarting;
328
 
 
329
 
        bool just_loaded_external_subs;
330
 
        bool just_unloaded_external_subs;
331
 
        State _state;
332
 
        bool change_volume_after_unpause;
333
 
};
334
 
    
335
 
#endif