diff options
Diffstat (limited to 'src/corelib/video')
-rw-r--r-- | src/corelib/video/mvideo.h | 87 | ||||
-rw-r--r-- | src/corelib/video/mvideowidget.cpp | 195 | ||||
-rw-r--r-- | src/corelib/video/mvideowidget.h | 236 | ||||
-rw-r--r-- | src/corelib/video/mvideowidgetmodel.h | 119 | ||||
-rw-r--r-- | src/corelib/video/video.pri | 22 |
5 files changed, 0 insertions, 659 deletions
diff --git a/src/corelib/video/mvideo.h b/src/corelib/video/mvideo.h deleted file mode 100644 index e5c58fdf..00000000 --- a/src/corelib/video/mvideo.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * This file is part of libmeegotouch * - * - * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * - * Contact: Tomas Junnonen <tomas.junnonen@nokia.com> - * - * This software, including documentation, is protected by copyright - * controlled by Nokia Corporation. All rights are reserved. Copying, - * including reproducing, storing, adapting or translating, any or all of - * this material requires the prior written consent of Nokia Corporation. - * This material also contains confidential information which may not be - * disclosed to others without the prior written consent of Nokia. - */ -#ifndef MVIDEO_H -#define MVIDEO_H - -#include <QObject> -#include <QSize> -#include <MExport> - -class M_CORE_EXPORT MVideo : public QObject -{ - Q_OBJECT - -public: - - //! Supported raw video data formats. - enum DataFormat { - //! 24bit RGB - RGB = 0, - //BGR, - //RGBx, - //BGRx, - //! 12bit YUV (YV12, I420) - YUV - }; - - - //! States for the video playback - enum State { - //! Video is not ready yet, playback cannot be started. - NotReady = 0, - //! Video is paused. - Paused, - //! Video is playing. - Playing, - //! Video is stopped. - Stopped - }; - - virtual bool open(const QString& filename) = 0; - - virtual bool isReady() const = 0; - - virtual void setVideoState(MVideo::State state) = 0; - virtual MVideo::State videoState() const = 0; - - virtual void seek(quint64 time) = 0; - virtual quint64 position() const = 0; - virtual quint64 length() const = 0; - - virtual void setMuted(bool muted) = 0; - virtual bool isMuted() const = 0; - virtual void setVolume(qreal volume) = 0; - virtual qreal volume() const = 0; - - virtual void setLooping(bool enabled) = 0; - virtual bool isLooping() const = 0; - - virtual QSize resolution() const = 0; - - virtual uchar* frameData() const = 0; - virtual MVideo::DataFormat frameDataFormat() const = 0; - - virtual bool lockFrameData() = 0; - virtual void unlockFrameData() = 0; - -Q_SIGNALS: - - void videoReady(); - void frameReady(); - void stateChanged(); -}; - -#endif diff --git a/src/corelib/video/mvideowidget.cpp b/src/corelib/video/mvideowidget.cpp deleted file mode 100644 index d31c7357..00000000 --- a/src/corelib/video/mvideowidget.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* * This file is part of libmeegotouch * - * - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * - * Contact: Tomas Junnonen <tomas.junnonen@nokia.com> - * - * This software, including documentation, is protected by copyright - * controlled by Nokia Corporation. All rights are reserved. Copying, - * including reproducing, storing, adapting or translating, any or all of - * this material requires the prior written consent of Nokia Corporation. - * This material also contains confidential information which may not be - * disclosed to others without the prior written consent of Nokia. - */ -#include "mvideowidget.h" -#include "private/mwidgetcontroller_p.h" -#include "mdebug.h" - -#include "mwidgetcreator.h" -M_REGISTER_WIDGET(MVideoWidget) - -class MVideoWidgetPrivate : public MWidgetControllerPrivate -{ -public: - - Q_DECLARE_PUBLIC(MVideoWidget) - - MVideoWidgetPrivate(); - virtual ~MVideoWidgetPrivate(); - - -}; - -MVideoWidgetPrivate::MVideoWidgetPrivate() -{ -} - -MVideoWidgetPrivate::~MVideoWidgetPrivate() -{ -} - -MVideoWidget::MVideoWidget(QGraphicsItem *parent, MVideoWidgetModel* model) - : MWidgetController(new MVideoWidgetPrivate, model == NULL ? new MVideoWidgetModel : model, parent) -{ -} - -MVideoWidget::MVideoWidget(MVideoWidgetPrivate* dd, MVideoWidgetModel* model, QGraphicsItem* parent) - : MWidgetController(dd, model, parent) -{ - -} - -MVideoWidget::~MVideoWidget() -{ -} - -void MVideoWidget::open(const QString& filename) -{ - model()->setFilename(filename); -} - -MVideo::State MVideoWidget::state() const -{ - return model()->state(); -} - -void MVideoWidget::seek(quint64 time) -{ - if( time <= length() ) - model()->setPosition(time); -} - -quint64 MVideoWidget::length() const -{ - return model()->length(); -} - -quint64 MVideoWidget::position() const -{ - return model()->position(); -} - -void MVideoWidget::setVolume(qreal volume) -{ - volume = (volume < 0) ? 0.0 : ((volume > 10.0) ? 10.0 : volume); - model()->setVolume(volume); -} - -qreal MVideoWidget::volume() const -{ - return model()->volume(); -} - -void MVideoWidget::setMuted(bool mute) -{ - model()->setMuted(mute); -} - -bool MVideoWidget::isMuted() const -{ - return model()->muted(); -} - -/*QImage MVideoWidget::currentFrame() const -{ - Q_D(MVideoWidget); -#ifdef M_USE_OPENGL - MGstVideoSink *msink = M_GST_VIDEO_SINK(d->gst_elem_videosink); - return QImage(GST_BUFFER_DATA(d->gst_buffer), msink->w, msink->h, QImage::Format_RGB32); -#else - return d->image->copy(); -#endif - - return QImage(); -}*/ - -void MVideoWidget::setScaleMode(MVideoWidgetModel::Scale mode) -{ - model()->setScaleMode(mode); -} - -MVideoWidgetModel::Scale MVideoWidget::scaleMode() const -{ - return model()->scaleMode(); -} - -void MVideoWidget::setAspectRatioMode(MVideoWidgetModel::AspectRatio aspectRatio) -{ - model()->setAspectRatioMode(aspectRatio); -} - -MVideoWidgetModel::AspectRatio MVideoWidget::aspectRatioMode() const -{ - return model()->aspectRatioMode(); -} - -void MVideoWidget::setLooping(bool enabled) -{ - model()->setLooping(enabled); -} - -bool MVideoWidget::isLooping() const -{ - return model()->looping(); -} - -void MVideoWidget::setFullscreen(bool fullscreen) -{ - model()->setFullscreen(fullscreen); -} - -bool MVideoWidget::isFullscreen() const -{ - return model()->fullscreen(); -} - -void MVideoWidget::play() -{ - model()->setState(MVideo::Playing); -} - -void MVideoWidget::pause() -{ - model()->setState(MVideo::Paused); -} - -void MVideoWidget::stop() -{ - model()->setState(MVideo::Stopped); -} - -void MVideoWidget::setupModel() -{ - MWidgetController::setupModel(); -} - -void MVideoWidget::updateData(const QList<const char*>& modifications) -{ - MWidgetController::updateData(modifications); - mDebug("MVideoWidget::updateData()") << modifications; - - const char* member; - foreach(member, modifications) { - if( member == MVideoWidgetModel::State ) { - mDebug("MVideoWidget::updateData()") << "State" << model()->state(); - } - else if( member == MVideoWidgetModel::Position ) { - mDebug("MVideoWidget::updateData()") << "Position" << model()->position() << "/" << model()->length(); - } - else if( member == MVideoWidgetModel::Length ) { - if( model()->length() > 0 && model()->state() != MVideo::NotReady ) - emit videoReady(); - } - } -} diff --git a/src/corelib/video/mvideowidget.h b/src/corelib/video/mvideowidget.h deleted file mode 100644 index 7c6c7f63..00000000 --- a/src/corelib/video/mvideowidget.h +++ /dev/null @@ -1,236 +0,0 @@ -/*************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (directui@nokia.com) -** -** This file is part of libmeegotouch. -** -** If you have questions regarding the use of this file, please contact -** Nokia at directui@nokia.com. -** -** This library is free software; you can redistribute it and/or -** modify it under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation -** and appearing in the file LICENSE.LGPL included in the packaging -** of this file. -** -****************************************************************************/ - -#ifndef MVIDEOWIDGET_H -#define MVIDEOWIDGET_H - -#include <mwidgetcontroller.h> -#include <mvideowidgetmodel.h> - -class MVideoWidgetPrivate; - - -/*! - \class MVideoWidget - \brief MVideoWidget provides functionality for playing videos. - - \ingroup widgets - - \section MVideoWidgetOverview Overview - MVideoWidget supports following features: - - - Standard playback controlling through play(), pause(), stop(), seek() - and setLooping() methods. - - Volume controlling through the setVolume() and setMute() methods. - - Automatic fitting and appearence of the video can be changed using the - setScaleToFit(), setKeepAspectRatio() and setFullscreen() - methods. - - \section MVideoWidgetUseGuidelines Usage guidelines - - \section MVideoWidgetVariants Variants - \li \link MVideoWidgetView Default view. \endlink Standard view for - displaying video frames without any visual controls. - - \section MVideoWidgetOpenIssues Open issues - - \section MVideoWidgetExamples Examples - - \sa MVideoWidgetModel -*/ -class M_CORE_EXPORT MVideoWidget : public MWidgetController -{ - Q_OBJECT - M_CONTROLLER(MVideoWidget) - -public: - - /*! - \brief Constructs a video widget. - */ - MVideoWidget(QGraphicsItem *parent = 0, MVideoWidgetModel* model = 0); - - /*! - \brief Destroys the video widget. - */ - virtual ~MVideoWidget(); - - /*! - \brief Opens a video from a file. - */ - void open(const QString& filename); - - /*! - \brief Return the playback state. - */ - MVideo::State state() const; - - /*! - \brief Seek video to a wanted position/time. - - \a time is defined as milliseconds and it should be in a range of 0 to - lenght of video. - */ - void seek(quint64 time); - - /*! - \brief Query length of the video. - - \return Length of video in milliseconds. - */ - quint64 length() const; - - /*! - \brief Query the current position of the video. - - \return Position of the video in milliseconds. - */ - quint64 position() const; - - /*! - \brief Set volume factor for the video's audio track. - - \a volume should be in a range of 0.0 -> 10.0. 1.0 means 100% volume. - 1.0 -> 10.0 are gain through amplification. - */ - void setVolume(qreal volume); - - /*! - \brief Query current volume factor of the video's audio track. - - \returns Audio volume. 0.0 if video does not contain audio track. - */ - qreal volume() const; - - /*! - \brief Mute the video's audio. - */ - void setMuted(bool mute); - - /*! - \brief Query current mute status. - - \returns True if audio is muted or no audio track exists, false is audio is - not muted. - */ - bool isMuted() const; - - /*! - * Snapshot the current video frame. - * \returns image of current video frame - */ - //QImage currentFrame() const; - - /*! - \brief Set scaling mode to video. - - If \a mode is MVideoWidgetModel::ScaleToFit the video scaled to fit the widget size. If \a mode - is MVideoWidgetModel::ScaleDisabled the video is rendered in it's native resolution into the middle - of the widget. - */ - void setScaleMode(MVideoWidgetModel::Scale mode); - - /*! - \brief Returns video scaling mode. - */ - MVideoWidgetModel::Scale scaleMode() const; - - /*! - \brief Set aspect ratio - - If \a aspectRatio is MVideoWidgetModel::AspectRatioOriginal, the video is scaled without breaking the - native aspect ratio. If \a aspectRatio is MVideoWidgetModel::AspectRatioScaled, the native aspect - ratio is not preserved and the video is scaled to match the size of the widget. - */ - void setAspectRatioMode(MVideoWidgetModel::AspectRatio aspectRatio); - - /*! - \brief Return type of the aspect ratio. - */ - MVideoWidgetModel::AspectRatio aspectRatioMode() const; - - /*! - \brief Enable / disable automatic looping of the video. - */ - void setLooping(bool enabled); - - /*! - \brief Query looping mode. - - \returns looping mode. - */ - bool isLooping() const; - - /*! - \brief Enable / disable fullscreen mode. - */ - void setFullscreen(bool fullscreen); - - /*! - \brief Query fullscreen mode. - */ - bool isFullscreen() const; - -Q_SIGNALS: - - void videoReady(); - -public Q_SLOTS: - /*! - \brief Start video playback. - */ - void play(); - - /*! - \brief Pause video playback. - - When resuming the video playback with call to MVideoWidget::play(), - video continues to play from the position it was left when pausing. - */ - void pause(); - - /*! - \brief Stop video playback. - - The video is rewinded to the beginning. - */ - void stop(); - -protected Q_SLOTS: - - //! \reimp - virtual void updateData(const QList<const char*>& modifications); - //! \reimp_end - -protected: - - //! \cond - MVideoWidget(MVideoWidgetPrivate* dd, MVideoWidgetModel* model, QGraphicsItem *parent); - //! \endcond - - //! \reimp - virtual void setupModel(); - //! \reimp_end - -private: - - Q_DECLARE_PRIVATE(MVideoWidget) - Q_DISABLE_COPY(MVideoWidget) -}; -#endif // MVIDEOWIDGET_H diff --git a/src/corelib/video/mvideowidgetmodel.h b/src/corelib/video/mvideowidgetmodel.h deleted file mode 100644 index d61d2aae..00000000 --- a/src/corelib/video/mvideowidgetmodel.h +++ /dev/null @@ -1,119 +0,0 @@ -/* * This file is part of libmeegotouch * - * - * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * - * Contact: Tomas Junnonen <tomas.junnonen@nokia.com> - * - * This software, including documentation, is protected by copyright - * controlled by Nokia Corporation. All rights are reserved. Copying, - * including reproducing, storing, adapting or translating, any or all of - * this material requires the prior written consent of Nokia Corporation. - * This material also contains confidential information which may not be - * disclosed to others without the prior written consent of Nokia. - */ -#ifndef MVIDEOWIDGETMODEL_H -#define MVIDEOWIDGETMODEL_H - -#include <mwidgetmodel.h> -#include "mvideo.h" - -/*! - \class MVideoWidgetModel - \brief Data model class for MVideoWidget. - - \ingroup models - \sa MVideoWidget -*/ -class M_CORE_EXPORT MVideoWidgetModel : public MWidgetModel -{ - Q_OBJECT - M_MODEL_INTERNAL(MVideoWidgetModel) - -public: - enum Scale - { - ScaleDisabled, - ScaleToFit - }; - - enum AspectRatio - { - AspectRatioOriginal, - AspectRatioScaled - }; - - /*! - \property MVideoWidgetModel::state - \brief Current state of the video playback. - */ - M_MODEL_PROPERTY(MVideo::State, state, State, true, MVideo::NotReady) - - /*! - \property MVideoWidgetModel::filename - \brief Name of the opened video file. - */ - M_MODEL_PROPERTY(QString, filename, Filename, true, QString()) - - /*! - \property MVideoWidgetModel::length - \brief Length of the opened video in milliseconds. - */ - M_MODEL_PROPERTY(quint64, length, Length, true, 0) - - /*! - \property MVideoWidgetModel::position - \brief Current position of the played video in milliseconds. - */ - M_MODEL_PROPERTY(quint64, position, Position, true, 0) - - /*! - \property MVideoWidgetModel::looping - \brief Boolean flag defining whether video is looping automatically. - */ - M_MODEL_PROPERTY(bool, looping, Looping, true, true) - - /*! - \property MVideoWidgetModel::scaleMode - \brief Defines how the video is scaled to the canvas. - */ - M_MODEL_PROPERTY(MVideoWidgetModel::Scale, scaleMode, ScaleMode, true, MVideoWidgetModel::ScaleToFit) - - /*! - \property MVideoWidgetModel::aspectRatio - \brief Defines how to set up aspect ratio for the video. - */ - M_MODEL_PROPERTY(MVideoWidgetModel::AspectRatio, aspectRatioMode, AspectRatioMode, true, MVideoWidgetModel::AspectRatioOriginal) - - /*! - \property MVideoWidgetModel::keepAspectRatio - \brief Boolean flag defining if the video should be displayed in - fullscreen mode. - */ - M_MODEL_PROPERTY(bool, fullscreen, Fullscreen, true, false) - - /*! - \property MVideoWidgetModel::mute - \brief Boolean flag defining audio of video should be muted. - */ - M_MODEL_PROPERTY(bool, muted, Muted, true, false) - - /*! - \property MVideoWidgetModel::volume - \brief Current audio volume of played video. - */ - M_MODEL_PROPERTY(qreal, volume, Volume, true, 1.0) - -public: - - /*! - \brief Update the MVideoWidgetModel::position property without emitting the change signal. - */ - void setPositionNoEmit(const qint64& pos) - { - _position() = pos; - } -}; - -#endif - diff --git a/src/corelib/video/video.pri b/src/corelib/video/video.pri deleted file mode 100644 index cc057173..00000000 --- a/src/corelib/video/video.pri +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################### -# mvideowidget, Separated to video folder. -############################################################################### -VIDEO_SRC_DIR = ./video -INCLUDEPATH +=./video - -contains( DEFINES, HAVE_GSTREAMER) { - VIDEO_MODEL_HEADERS += \ - $$VIDEO_SRC_DIR/mvideowidgetmodel.h - - MODEL_HEADERS += $$VIDEO_MODEL_HEADERS - - PUBLIC_HEADERS += \ - $$VIDEO_SRC_DIR/mvideowidget.h \ - $$VIDEO_SRC_DIR/mvideo.h \ - $$VIDEO_MODEL_HEADERS \ - - SOURCES += \ - $$VIDEO_SRC_DIR/mvideowidget.cpp \ - -} - |