File indexing completed on 2024-05-12 04:52:07
0001 /* 0002 * mplayermediawidget.h 0003 * 0004 * Copyright (C) 2010-2011 Christoph Pfister <christophpfister@gmail.com> 0005 * 0006 * This program is free software; you can redistribute it and/or modify 0007 * it under the terms of the GNU General Public License as published by 0008 * the Free Software Foundation; either version 2 of the License, or 0009 * (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License along 0017 * with this program; if not, write to the Free Software Foundation, Inc., 0018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 0019 */ 0020 0021 #ifndef MPLAYERMEDIAWIDGET_H 0022 #define MPLAYERMEDIAWIDGET_H 0023 0024 #include <QFile> 0025 #include <QProcess> 0026 #include "../abstractmediawidget.h" 0027 0028 class MPlayerMediaWidget : public AbstractMediaWidget 0029 { 0030 Q_OBJECT 0031 private: 0032 explicit MPlayerMediaWidget(QWidget *parent); 0033 0034 public: 0035 ~MPlayerMediaWidget(); 0036 0037 // returns NULL if init fails 0038 static AbstractMediaWidget *createMPlayerMediaWidget(QWidget *parent); 0039 0040 void setMuted(bool muted); 0041 void setVolume(int volume); // [0 - 200] 0042 void setAspectRatio(MediaWidget::AspectRatio aspectRatio); 0043 void setDeinterlacing(MediaWidget::DeinterlaceMode deinterlacing); 0044 void play(const MediaSource &source); 0045 void stop(); 0046 void setPaused(bool paused); 0047 void seek(int time); // milliseconds 0048 void setCurrentAudioStream(int currentAudioStream); 0049 void setCurrentSubtitle(int currentSubtitle); 0050 void setExternalSubtitle(const QUrl &subtitleUrl); 0051 void setCurrentTitle(int currentTitle); 0052 void setCurrentChapter(int currentChapter); 0053 void setCurrentAngle(int currentAngle); 0054 bool jumpToPreviousChapter(); 0055 bool jumpToNextChapter(); 0056 void showDvdMenu(); 0057 0058 void mouseMoved(int x, int y); 0059 void mouseClicked(); 0060 0061 private slots: 0062 void error(QProcess::ProcessError error); 0063 void readStandardOutput(); 0064 void readStandardError(); 0065 0066 private: 0067 enum Command 0068 { 0069 SetDeinterlacing, 0070 SetVolume, 0071 ShowDvdMenu, 0072 Stop, 0073 TogglePause, 0074 Quit 0075 }; 0076 0077 void resetState(); 0078 void resizeEvent(QResizeEvent *event); 0079 void sendCommand(Command command); 0080 void timerEvent(QTimerEvent *event); 0081 void updateVideoWidgetGeometry(); 0082 0083 QWidget *videoWidget; 0084 QFile standardError; 0085 QProcess process; 0086 bool muted; 0087 int volume; 0088 MediaWidget::AspectRatio aspectRatio; 0089 MediaWidget::DeinterlaceMode deinterlacing; 0090 int timerId; 0091 QList<int> audioIds; 0092 int videoWidth; 0093 int videoHeight; 0094 float videoAspectRatio; 0095 }; 0096 0097 #endif /* MPLAYERMEDIAWIDGET_H */