VLC-Qt 0.8.0- (Different version)
WidgetVideo.h
00001 /****************************************************************************
00002 * VLC-Qt - Qt and libvlc connector library
00003 * Copyright (C) 2012 Tadej Novak <tadej@tano.si>
00004 *
00005 * This library is free software: you can redistribute it and/or modify
00006 * it under the terms of the GNU Lesser General Public License as published
00007 * by the Free Software Foundation, either version 3 of the License, or
00008 * (at your option) any later version.
00009 *
00010 * This library is distributed in the hope that it will be useful,
00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013 * GNU Lesser General Public License for more details.
00014 *
00015 * You should have received a copy of the GNU Lesser General Public License
00016 * along with this library. If not, see <http://www.gnu.org/licenses/>.
00017 *****************************************************************************/
00018 
00019 #ifndef VLCQT_WIDGETVIDEO_H_
00020 #define VLCQT_WIDGETVIDEO_H_
00021 
00022 #include <QtCore/QTimer>
00023 
00024 #include <QFrame>
00025 
00026 #if defined(Q_OS_MAC)
00027     #include <QMacCocoaViewContainer>
00028 #endif
00029 
00030 #include "Enums.h"
00031 #include "SharedExportWidgets.h"
00032 #include "VideoDelegate.h"
00033 
00034 class VlcMediaPlayer;
00035 
00043 #if defined(Q_OS_MAC)
00044 class VLCQT_WIDGETS_EXPORT VlcWidgetVideo : public QMacCocoaViewContainer, public VlcVideoDelegate
00045 #else
00046 class VLCQT_WIDGETS_EXPORT VlcWidgetVideo : public QFrame, public VlcVideoDelegate
00047 #endif
00048 {
00049 Q_OBJECT
00050 public:
00056     explicit VlcWidgetVideo(VlcMediaPlayer *player,
00057                             QWidget *parent = 0);
00058 
00063     explicit VlcWidgetVideo(QWidget *parent = 0);
00064 
00068     ~VlcWidgetVideo();
00069 
00074     inline Vlc::Ratio currentAspectRatio() const { return _currentAspectRatio; }
00075 
00080     inline Vlc::Ratio defaultAspectRatio() const { return _defaultAspectRatio; }
00081 
00086     void setCurrentAspectRatio(const Vlc::Ratio &ratio);
00087 
00092     void setDefaultAspectRatio(const Vlc::Ratio &ratio);
00093 
00098     inline Vlc::Ratio currentCropRatio() const { return _currentCropRatio; }
00099 
00104     inline Vlc::Ratio defaultCropRatio() const { return _defaultCropRatio; }
00105 
00110     void setCurrentCropRatio(const Vlc::Ratio &ratio);
00111 
00116     void setDefaultCropRatio(const Vlc::Ratio &ratio);
00117 
00122     inline Vlc::Deinterlacing currentDeinterlacing() const { return _currentDeinterlacing; }
00123 
00128     inline Vlc::Deinterlacing defaultDeinterlacing() const { return _defaultDeinterlacing; }
00129 
00134     void setCurrentDeinterlacing(const Vlc::Deinterlacing &deinterlacing);
00135 
00140     void setDefaultDeinterlacing(const Vlc::Deinterlacing &deinterlacing);
00141 
00146     inline Vlc::Scale currentScale() const { return _currentScale; }
00147 
00152     inline Vlc::Scale defaultScale() const { return _defaultScale; }
00153 
00158     void setCurrentScale(const Vlc::Scale &scale);
00159 
00164     void setDefaultScale(const Vlc::Scale &scale);
00165 
00170     void setMediaPlayer(VlcMediaPlayer *player);
00171 
00179     WId request();
00180 
00184     void release();
00185 
00186 
00187 public slots:
00193     void enableDefaultSettings();
00194 
00200     void enablePreviousSettings();
00201 
00207     void initDefaultSettings();
00208 
00213     void setAspectRatio(const Vlc::Ratio &ratio);
00214 
00219     void setCropRatio(const Vlc::Ratio &ratio);
00220 
00225     void setDeinterlacing(const Vlc::Deinterlacing &deinterlacing);
00226 
00231     void setScale(const Vlc::Scale &scale);
00232 
00233 
00234 private slots:
00235     void applyPreviousSettings();
00236 
00237 private:
00238     void initWidgetVideo();
00239     void sync();
00240 
00241     VlcMediaPlayer *_vlcMediaPlayer;
00242 
00243 #if !defined(Q_OS_MAC)
00244     QWidget *_video;
00245     QLayout *_layout;
00246 #endif
00247 
00248     bool _enableSettings;
00249 
00250     Vlc::Ratio _defaultAspectRatio;
00251     Vlc::Ratio _defaultCropRatio;
00252     Vlc::Deinterlacing _defaultDeinterlacing;
00253     Vlc::Scale _defaultScale;
00254 
00255     Vlc::Ratio _currentAspectRatio;
00256     Vlc::Ratio _currentCropRatio;
00257     Vlc::Deinterlacing _currentDeinterlacing;
00258     Vlc::Scale _currentScale;
00259 };
00260 
00261 #endif // VLCQ_WIDGETVIDEO_H_
 All Classes Namespaces Functions Enumerations