Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
4 deleted
18 edited
12 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp

    r651 r769  
    2121#include "abstractaudioeffect.h"
    2222#include "audioplayer.h"
    23 #include "mmf_videoplayer.h"
    2423
    2524QT_BEGIN_NAMESPACE
  • trunk/src/3rdparty/phonon/mmf/abstractaudioeffect.h

    r651 r769  
    2929#include "effectparameter.h"
    3030#include "mmf_medianode.h"
    31 #include "mmf_videoplayer.h"
    3231
    3332class CMdaAudioOutputStream;
  • trunk/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp

    r561 r769  
    4949        :   AbstractPlayer(player)
    5050        ,   m_parent(parent)
    51         ,   m_playPending(false)
     51        ,   m_pending(NothingPending)
    5252        ,   m_positionTimer(new QTimer(this))
    5353        ,   m_bufferStatusTimer(new QTimer(this))
     
    7575
    7676    case LoadingState:
    77         m_playPending = true;
     77        setPending(PlayPending);
    7878        break;
    7979
    8080    case StoppedState:
    8181    case PausedState:
    82         doPlay();
    83         startPositionTimer();
    84         changeState(PlayingState);
     82        startPlayback();
    8583        break;
    8684
     
    104102    TRACE_ENTRY("state %d", privateState());
    105103
    106     m_playPending = false;
    107104    stopTimers();
    108105
     
    110107    case GroundState:
    111108    case LoadingState:
     109    case StoppedState:
     110        setPending(PausePending);
     111        break;
     112
    112113    case PausedState:
    113     case StoppedState:
    114114        // Do nothing
    115115        break;
     
    136136    TRACE_ENTRY("state %d", privateState());
    137137
    138     m_playPending = false;
     138    setPending(NothingPending);
    139139    stopTimers();
    140140
     
    366366}
    367367
     368void MMF::AbstractMediaPlayer::loadingComplete(int error)
     369{
     370    Q_ASSERT(Phonon::LoadingState == state());
     371
     372    if (KErrNone == error) {
     373        updateMetaData();
     374        changeState(StoppedState);
     375    } else {
     376        setError(tr("Loading clip failed"), error);
     377    }
     378}
     379
    368380void MMF::AbstractMediaPlayer::playbackComplete(int error)
    369381{
    370382    stopTimers();
    371383
     384    if (KErrNone == error && !m_aboutToFinishSent) {
     385        const qint64 total = totalTime();
     386        emit MMF::AbstractPlayer::tick(total);
     387        m_aboutToFinishSent = true;
     388        emit aboutToFinish();
     389    }
     390
    372391    if (KErrNone == error) {
    373         changeState(StoppedState);
     392        changeState(PausedState);
    374393
    375394        // MediaObject::switchToNextSource deletes the current player, so we
     
    380399    else {
    381400        setError(tr("Playback complete"), error);
     401        emit finished();
    382402    }
    383403}
     
    394414void MMF::AbstractMediaPlayer::positionTick()
    395415{
    396     emitMarksIfReached();
    397 
    398416    const qint64 current = currentTime();
     417    emitMarksIfReached(current);
    399418    emit MMF::AbstractPlayer::tick(current);
    400419}
    401420
    402 void MMF::AbstractMediaPlayer::emitMarksIfReached()
    403 {
    404     const qint64 current = currentTime();
     421void MMF::AbstractMediaPlayer::emitMarksIfReached(qint64 current)
     422{
    405423    const qint64 total = totalTime();
    406424    const qint64 remaining = total - current;
     
    436454}
    437455
     456void MMF::AbstractMediaPlayer::setPending(Pending pending)
     457{
     458    const Phonon::State oldState = state();
     459    m_pending = pending;
     460    const Phonon::State newState = state();
     461    if (newState != oldState)
     462        emit stateChanged(newState, oldState);
     463}
     464
     465void MMF::AbstractMediaPlayer::startPlayback()
     466{
     467    doPlay();
     468    startPositionTimer();
     469    changeState(PlayingState);
     470}
     471
    438472void MMF::AbstractMediaPlayer::bufferStatusTick()
    439473{
    440474    emit MMF::AbstractPlayer::bufferStatus(bufferStatus());
     475}
     476
     477Phonon::State MMF::AbstractMediaPlayer::phononState(PrivateState state) const
     478{
     479    Phonon::State result = AbstractPlayer::phononState(state);
     480
     481    if (PausePending == m_pending) {
     482        Q_ASSERT(Phonon::StoppedState == result || Phonon::LoadingState == result);
     483        result = Phonon::PausedState;
     484    }
     485
     486    return result;
    441487}
    442488
     
    448494    const Phonon::State newPhononState = phononState(newState);
    449495
    450     // TODO: add some invariants to check that the transition is valid
    451     AbstractPlayer::changeState(newState);
    452 
    453496    if (LoadingState == oldPhononState && StoppedState == newPhononState) {
    454         // Ensure initial volume is set on MMF API before starting playback
    455         doVolumeChanged();
    456 
    457         // Check whether play() was called while clip was being loaded.  If so,
    458         // playback should be started now
    459         if (m_playPending) {
    460             TRACE_0("play was called while loading; starting playback now");
    461             m_playPending = false;
    462             play();
    463         }
     497        switch (m_pending) {
     498        case NothingPending:
     499            AbstractPlayer::changeState(newState);
     500            break;
     501
     502        case PlayPending:
     503            changeState(PlayingState); // necessary in order to apply initial volume
     504            doVolumeChanged();
     505            startPlayback();
     506            break;
     507
     508        case PausePending:
     509            AbstractPlayer::changeState(PausedState);
     510            break;
     511        }
     512
     513        setPending(NothingPending);
     514    } else {
     515        AbstractPlayer::changeState(newState);
    464516    }
    465517}
  • trunk/src/3rdparty/phonon/mmf/abstractmediaplayer.h

    r561 r769  
    6161    // AbstractPlayer
    6262    virtual void doSetTickInterval(qint32 interval);
     63    virtual Phonon::State phononState(PrivateState state) const;
     64    virtual void changeState(PrivateState newState);
    6365
    6466    virtual void doPlay() = 0;
     
    7173    virtual int bufferStatus() const = 0;
    7274    virtual void close() = 0;
    73     virtual void changeState(PrivateState newState);
    7475
    7576    void updateMetaData();
     
    8182    void bufferingComplete();
    8283    void maxVolumeChanged(int maxVolume);
     84    void loadingComplete(int error);
    8385    void playbackComplete(int error);
    8486
     
    9294    void stopTimers();
    9395    void doVolumeChanged();
    94     void emitMarksIfReached();
     96    void emitMarksIfReached(qint64 position);
    9597    void resetMarksIfRewound();
     98    void startPlayback();
     99
     100    enum Pending {
     101        NothingPending,
     102        PausePending,
     103        PlayPending
     104    };
     105
     106    void setPending(Pending pending);
    96107
    97108private Q_SLOTS:
     
    102113    MediaObject *const          m_parent;
    103114
    104     /**
    105      * This flag is set to true if play is called when the object is
    106      * in a Loading state.  Once loading is complete, playback will
    107      * be started.
    108      */
    109     bool                        m_playPending;
     115    Pending                     m_pending;
    110116
    111117    QScopedPointer<QTimer>      m_positionTimer;
  • trunk/src/3rdparty/phonon/mmf/abstractplayer.cpp

    r561 r769  
    4949        m_transitionTime = player->m_transitionTime;
    5050        m_prefinishMark = player->m_prefinishMark;
     51
     52        // This is to prevent unwanted state transitions occurring as a result
     53        // of MediaObject::switchToNextSource() during playlist playback.
     54        if (StoppedState == player->m_state)
     55            m_state = player->m_state;
    5156    }
    5257}
     
    97102//-----------------------------------------------------------------------------
    98103
    99 void MMF::AbstractPlayer::setVideoOutput(VideoOutput* videoOutput)
     104void MMF::AbstractPlayer::setVideoOutput(AbstractVideoOutput* videoOutput)
    100105{
    101106    m_videoOutput = videoOutput;
     
    142147}
    143148
    144 Phonon::State MMF::AbstractPlayer::phononState(PrivateState state)
     149Phonon::State MMF::AbstractPlayer::phononState(PrivateState state) const
    145150{
    146151    const Phonon::State phononState =
  • trunk/src/3rdparty/phonon/mmf/abstractplayer.h

    r651 r769  
    2525#include <QObject>
    2626
    27 #include "videooutput.h"
     27#include "abstractvideooutput.h"
    2828
    2929class RFile;
     
    3535namespace MMF
    3636{
    37 class VideoOutput;
    3837
    3938/**
     
    8079    virtual void volumeChanged(qreal volume);
    8180
    82     void setVideoOutput(VideoOutput* videoOutput);
     81    void setVideoOutput(AbstractVideoOutput *videoOutput);
    8382
    8483    /**
     
    135134     * Converts PrivateState into the corresponding Phonon::State
    136135     */
    137     static Phonon::State phononState(PrivateState state);
     136    virtual Phonon::State phononState(PrivateState state) const;
    138137
    139138    virtual void videoOutputChanged();
     
    157156protected:
    158157    // Not owned
    159     VideoOutput*                m_videoOutput;
     158    AbstractVideoOutput*        m_videoOutput;
    160159
    161160    qreal                       m_volume;
  • trunk/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp

    r561 r769  
    1919#include "ancestormovemonitor.h"
    2020#include "utils.h"
    21 #include "videooutput.h"
     21
     22#include "videooutput_dsa.h"
    2223
    2324#include <QCoreApplication>
     
    6061//-----------------------------------------------------------------------------
    6162
    62 void AncestorMoveMonitor::registerTarget(VideoOutput *target)
     63void AncestorMoveMonitor::registerTarget(DsaVideoOutput *target)
    6364{
    6465    TRACE_CONTEXT(AncestorMoveMonitor::registerTarget, EVideoInternal);
     
    9495}
    9596
    96 void AncestorMoveMonitor::unRegisterTarget(VideoOutput *target)
     97void AncestorMoveMonitor::unRegisterTarget(DsaVideoOutput *target)
    9798{
    9899    TRACE_CONTEXT(AncestorMoveMonitor::unRegisterTarget, EVideoInternal);
     
    127128        if(it != m_hash.end()) {
    128129            const TargetList& targetList = it.value();
    129             VideoOutput* target = 0;
     130            DsaVideoOutput* target = 0;
    130131            foreach(target, targetList) {
    131132                switch (event->type()) {
     
    167168        TRACE("ancestor 0x%08x", ancestor);
    168169        const TargetList& targetList = it.value();
    169         VideoOutput* target = 0;
     170        DsaVideoOutput* target = 0;
    170171        foreach(target, targetList) {
    171172            TRACE("    target 0x%08x", target);
     
    175176}
    176177
    177 
    178 
    179178QT_END_NAMESPACE
    180179
  • trunk/src/3rdparty/phonon/mmf/ancestormovemonitor.h

    r561 r769  
    3030namespace MMF
    3131{
    32 class VideoOutput;
     32class DsaVideoOutput;
    3333
    3434class AncestorMoveMonitor : public QObject
     
    5050     * the target receives a ParentChange event.
    5151     */
    52     void registerTarget(VideoOutput *target);
     52    void registerTarget(DsaVideoOutput *target);
    5353
    5454    /**
     
    5858     * delivered to its ancestors.
    5959     */
    60     void unRegisterTarget(VideoOutput *target);
     60    void unRegisterTarget(DsaVideoOutput *target);
    6161
    6262protected:
     
    7878     * efficiency of iteration.
    7979     */
    80     typedef QList<VideoOutput *> TargetList;
     80    typedef QList<DsaVideoOutput *> TargetList;
    8181
    8282    /**
     
    9393QT_END_NAMESPACE
    9494
    95 #endif
     95#endif // !PHONON_MMF_ANCESTORMOVEMONITOR_H
  • trunk/src/3rdparty/phonon/mmf/audioplayer.cpp

    r561 r769  
    100100#if !defined(__SERIES60_31__)
    101101    const int err = m_player->SetVolume(mmfVolume);
    102     if (QSysInfo::s60Version() >= QSysInfo::SV_S60_5_0)
     102    if (QSysInfo::s60Version() >= QSysInfo::SV_S60_3_2)
    103103        return err;
    104104    else
     
    204204        m_totalTime = toMilliSeconds(m_player->Duration());
    205205        emit totalTimeChanged(m_totalTime);
    206         updateMetaData();
    207         changeState(StoppedState);
    208     } else {
    209         setError(tr("Opening clip failed"), aError);
    210206    }
     207
     208    loadingComplete(aError);
    211209
    212210    TRACE_EXIT_0();
  • trunk/src/3rdparty/phonon/mmf/backend.cpp

    r651 r769  
    2525
    2626#include "abstractaudioeffect.h"
    27 #include "ancestormovemonitor.h"
    2827#include "audiooutput.h"
    2928#include "audioplayer.h"
     
    4544Backend::Backend(QObject *parent)
    4645    : QObject(parent)
     46#ifndef PHONON_MMF_VIDEO_SURFACES
    4747    , m_ancestorMoveMonitor(new AncestorMoveMonitor(this))
     48#endif
    4849    , m_effectFactory(new EffectFactory(this))
    4950{
     
    8788        return m_effectFactory->createAudioEffect(type, parent);
    8889    }
     90
    8991    case VideoWidgetClass:
    90         result = new VideoWidget(m_ancestorMoveMonitor.data(), qobject_cast<QWidget *>(parent));
     92    {
     93        VideoWidget *widget = new VideoWidget(qobject_cast<QWidget *>(parent));
     94#ifndef PHONON_MMF_VIDEO_SURFACES
     95        widget->setAncestorMoveMonitor(m_ancestorMoveMonitor.data());
     96#endif
     97        result = widget;
     98    }
    9199        break;
    92100
  • trunk/src/3rdparty/phonon/mmf/backend.h

    r651 r769  
    2020#define PHONON_MMF_BACKEND_H
    2121
     22#ifndef PHONON_MMF_VIDEO_SURFACES
    2223#include "ancestormovemonitor.h"
     24#endif
     25
    2326#include "effectfactory.h"
    2427
     
    5457
    5558private:
     59#ifndef PHONON_MMF_VIDEO_SURFACES
    5660    QScopedPointer<AncestorMoveMonitor> m_ancestorMoveMonitor;
     61#endif
    5762    QScopedPointer<EffectFactory>       m_effectFactory;
    5863
  • trunk/src/3rdparty/phonon/mmf/defs.h

    r561 r769  
    3636    MediaTypeVideo
    3737};
     38
     39enum VideoParameter {
     40    WindowHandle        = 0x1,
     41    WindowScreenRect    = 0x2,
     42    ScaleFactors        = 0x4
     43};
     44Q_DECLARE_FLAGS(VideoParameters, VideoParameter)
     45Q_DECLARE_OPERATORS_FOR_FLAGS(VideoParameters)
     46
    3847}
    3948}
  • trunk/src/3rdparty/phonon/mmf/mediaobject.cpp

    r651 r769  
    2323#include "utils.h"
    2424#include "utils.h"
    25 #include "mmf_videoplayer.h"
     25
     26#ifdef PHONON_MMF_VIDEO_SURFACES
     27#include "videoplayer_surface.h"
     28#else
     29#include "videoplayer_dsa.h"
     30#endif
     31
    2632#include "videowidget.h"
    2733
     
    294300
    295301    case MediaTypeVideo:
    296         newPlayer = new VideoPlayer(this, oldPlayer);
     302#ifdef PHONON_MMF_VIDEO_SURFACES
     303        newPlayer = SurfaceVideoPlayer::create(this, oldPlayer);
     304#else
     305        newPlayer = DsaVideoPlayer::create(this, oldPlayer);
     306#endif
    297307        break;
    298308    }
     
    314324    connect(m_player.data(), SIGNAL(stateChanged(Phonon::State,Phonon::State)), SIGNAL(stateChanged(Phonon::State,Phonon::State)));
    315325    connect(m_player.data(), SIGNAL(finished()), SIGNAL(finished()));
    316     connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64)));
    317326    connect(m_player.data(), SIGNAL(bufferStatus(int)), SIGNAL(bufferStatus(int)));
    318327    connect(m_player.data(), SIGNAL(metaDataChanged(QMultiMap<QString,QString>)), SIGNAL(metaDataChanged(QMultiMap<QString,QString>)));
    319328    connect(m_player.data(), SIGNAL(aboutToFinish()), SIGNAL(aboutToFinish()));
    320     connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SIGNAL(tick(qint32)));
     329    connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SIGNAL(prefinishMarkReached(qint32)));
     330    connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SLOT(handlePrefinishMarkReached(qint32)));
     331    connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64)));
    321332
    322333    // We need to call setError() after doing the connects, otherwise the
     
    384395//-----------------------------------------------------------------------------
    385396
    386 void MMF::MediaObject::setVideoOutput(VideoOutput* videoOutput)
     397void MMF::MediaObject::setVideoOutput(AbstractVideoOutput* videoOutput)
    387398{
    388399    m_player->setVideoOutput(videoOutput);
     
    405416        switchToSource(m_nextSource);
    406417        play();
    407     }
    408 }
     418    } else {
     419        emit finished();
     420    }
     421}
     422
     423//-----------------------------------------------------------------------------
     424// Other private functions
     425//-----------------------------------------------------------------------------
     426
     427void MMF::MediaObject::handlePrefinishMarkReached(qint32 time)
     428{
     429    emit tick(time);
     430}
     431
    409432
    410433QT_END_NAMESPACE
  • trunk/src/3rdparty/phonon/mmf/mediaobject.h

    r651 r769  
    3939{
    4040class AbstractPlayer;
    41 class VideoOutput;
     41class AbstractVideoOutput;
    4242
    4343/**
     
    8686    AbstractPlayer *abstractPlayer() const;
    8787
    88     void setVideoOutput(VideoOutput* videoOutput);
     88    void setVideoOutput(AbstractVideoOutput* videoOutput);
    8989
    9090public Q_SLOTS:
     
    107107    void finished();
    108108    void tick(qint64 time);
     109
     110private Q_SLOTS:
     111    void handlePrefinishMarkReached(qint32);
    109112
    110113private:
  • trunk/src/3rdparty/phonon/mmf/utils.cpp

    r561 r769  
    5353}
    5454
    55 
    56 static const TInt KMimePrefixLength = 6; // either "audio/" or "video/"
    5755_LIT(KMimePrefixAudio, "audio/");
    5856_LIT(KMimePrefixVideo, "video/");
     57_LIT(KMimeSDP, "application/sdp");
     58
     59enum ConstantStringLengths {
     60    KMimePrefixLength = 6, // either "audio/" or "video/",
     61    KMimeSDPLength = 15 // "application/sdp"
     62};
    5963
    6064MMF::MediaType MMF::Utils::mimeTypeToMediaType(const TDesC& mimeType)
    6165{
    62     MediaType result = MediaTypeUnknown;
    63 
    6466    if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixAudio) == 0) {
    65         result = MediaTypeAudio;
    66     } else if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixVideo) == 0) {
    67         result = MediaTypeVideo;
    68     }
    69 
    70     return result;
     67        return MediaTypeAudio;
     68    } else if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixVideo) == 0 ||
     69               mimeType.Left(KMimeSDPLength).Compare(KMimeSDP) == 0) {
     70        return MediaTypeVideo;
     71    } else
     72        return MediaTypeUnknown;
    7173}
    7274
  • trunk/src/3rdparty/phonon/mmf/videowidget.cpp

    r561 r769  
    1919#include "mediaobject.h"
    2020#include "utils.h"
    21 #include "videooutput.h"
    2221
    2322#include "videowidget.h"
     23
     24#ifdef PHONON_MMF_VIDEO_SURFACES
     25#include "videooutput_surface.h"
     26#else
     27#include "videooutput_dsa.h"
     28#endif
    2429
    2530QT_BEGIN_NAMESPACE
     
    4651//-----------------------------------------------------------------------------
    4752
    48 MMF::VideoWidget::VideoWidget
    49     (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent)
     53MMF::VideoWidget::VideoWidget(QWidget *parent)
    5054        :   MediaNode(parent)
    51         ,   m_videoOutput(new VideoOutput(ancestorMoveMonitor, parent))
     55#ifdef PHONON_MMF_VIDEO_SURFACES
     56        ,   m_videoOutput(new SurfaceVideoOutput(parent))
     57#else
     58        ,   m_videoOutput(new DsaVideoOutput(parent))
     59#endif
    5260        ,   m_brightness(DefaultBrightness)
    5361        ,   m_contrast(DefaultContrast)
     
    6876    TRACE_EXIT_0();
    6977}
     78
     79#ifndef PHONON_MMF_VIDEO_SURFACES
     80void MMF::VideoWidget::setAncestorMoveMonitor(AncestorMoveMonitor *monitor)
     81{
     82    static_cast<DsaVideoOutput *>(m_videoOutput.data())->setAncestorMoveMonitor(monitor);
     83}
     84#endif
    7085
    7186
     
    109124{
    110125    TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi);
    111     TRACE("setScaleMode %d", setScaleMode);
     126    TRACE("setScaleMode %d", scaleMode);
    112127
    113128    m_videoOutput->setScaleMode(scaleMode);
  • trunk/src/3rdparty/phonon/mmf/videowidget.h

    r651 r769  
    2020#define PHONON_MMF_VIDEOWIDGET_H
    2121
     22#include "abstractvideooutput.h"
    2223#include "mmf_medianode.h"
    23 #include "videooutput.h"
    2424
    2525#include <QtGui/QWidget>
     
    3333namespace MMF
    3434{
     35#ifndef PHONON_MMF_VIDEO_SURFACES
    3536class AncestorMoveMonitor;
    36 class VideoOutput;
     37#endif
    3738
    3839class VideoWidget       :   public MediaNode
     
    4344
    4445public:
    45     VideoWidget(AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent);
     46    VideoWidget(QWidget* parent);
    4647    ~VideoWidget();
     48
     49#ifndef PHONON_MMF_VIDEO_SURFACES
     50    void setAncestorMoveMonitor(AncestorMoveMonitor *ancestorMoveMonitor);
     51#endif
    4752
    4853    // VideoWidgetInterface
     
    6772
    6873private:
    69     QScopedPointer<VideoOutput>             m_videoOutput;
     74    QScopedPointer<AbstractVideoOutput>     m_videoOutput;
    7075
    7176    qreal                                   m_brightness;
Note: See TracChangeset for help on using the changeset viewer.