Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
151 edited
42 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/3rdparty/phonon/CMakeLists.txt

    r2 r561  
    5656     set ( CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
    5757     set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -fno-check-new -fno-common")
    58      add_definitions (-D_BSD_SOURCE)
     58     add_definitions (-D_BSD_SOURCE -DQT_NO_EXCEPTIONS)
    5959   endif (CMAKE_SYSTEM_NAME MATCHES Linux)
    6060
     
    116116   endif (GCC_IS_NEWER_THAN_4_1)
    117117
    118    if (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR)
     118   if (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR AND NOT WIN32)
    119119      set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
    120120      set (KDE4_C_FLAGS "-fvisibility=hidden")
     
    138138          set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
    139139      endif (GCC_IS_NEWER_THAN_4_2)
    140    else (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR)
     140   else (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR AND NOT WIN32)
    141141      set (__KDE_HAVE_GCC_VISIBILITY 0)
    142    endif (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR)
     142   endif (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR AND NOT WIN32)
    143143
    144144endif (CMAKE_COMPILER_IS_GNUCXX)
     
    150150set(PHONON_LIB_MAJOR_VERSION "4")
    151151set(PHONON_LIB_MINOR_VERSION "3")
    152 set(PHONON_LIB_PATCH_VERSION "1")
    153 set(PHONON_LIB_VERSION "${PHONON_LIB_MAJOR_VERSION}.3.1")
     152set(PHONON_LIB_PATCH_VERSION "50")
     153set(PHONON_LIB_VERSION "${PHONON_LIB_MAJOR_VERSION}.4.0")
    154154set(PHONON_LIB_SOVERSION ${PHONON_LIB_MAJOR_VERSION})
    155155
     
    178178set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
    179179
    180 _set_fancy(EXEC_INSTALL_PREFIX         "${CMAKE_INSTALL_PREFIX}"                   "Base directory for executables and libraries")
    181 _set_fancy(SHARE_INSTALL_PREFIX        "${CMAKE_INSTALL_PREFIX}/share"             "Base directory for files which go to share/")
     180if (WIN32)
     181    _set_fancy(EXEC_INSTALL_PREFIX         "."                                     "Base directory for executables and libraries")
     182else(WIN32)
     183    _set_fancy(EXEC_INSTALL_PREFIX         "${CMAKE_INSTALL_PREFIX}"              "Base directory for executables and libraries")
     184endif(WIN32)
     185_set_fancy(SHARE_INSTALL_PREFIX        "${EXEC_INSTALL_PREFIX}/share"             "Base directory for files which go to share/")
     186_set_fancy(INCLUDE_INSTALL_DIR         "${EXEC_INSTALL_PREFIX}/include"           "The subdirectory to the header prefix")
    182187_set_fancy(BIN_INSTALL_DIR             "${EXEC_INSTALL_PREFIX}/bin"                "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)")
    183188_set_fancy(LIB_INSTALL_DIR             "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}"   "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})")
    184 _set_fancy(INCLUDE_INSTALL_DIR         "${CMAKE_INSTALL_PREFIX}/include"           "The subdirectory to the header prefix")
    185189_set_fancy(PLUGIN_INSTALL_DIR          "${LIB_INSTALL_DIR}/kde4"                   "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde4)")
    186190_set_fancy(ICON_INSTALL_DIR            "${SHARE_INSTALL_PREFIX}/icons"             "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)")
     
    197201   set(INSTALL_TARGETS_DEFAULT_ARGS  ${INSTALL_TARGETS_DEFAULT_ARGS}
    198202                                     BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" )
     203        set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS   "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}   -flat_namespace -undefined dynamic_lookup")
     204        set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -flat_namespace -undefined dynamic_lookup")
    199205endif(APPLE)
    200206
     
    250256
    251257
    252 add_subdirectory(cmake)
    253258add_subdirectory(phonon)
    254259add_subdirectory(includes)
  • trunk/src/3rdparty/phonon/ds9/CMakeLists.txt

    r2 r561  
    4141
    4242    add_definitions(-DPHONON_MAKE_QT_ONLY_BACKEND -DUNICODE)
    43     automoc4_add_library(phonon_ds9 SHARED ${phonon_ds9_SRCS})
     43    automoc4_add_library(phonon_ds9 MODULE ${phonon_ds9_SRCS})
    4444    set_target_properties(phonon_ds9 PROPERTIES PREFIX "")
    4545    target_link_libraries(phonon_ds9
    4646                ${PHONON_LIBS}  ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY}
    4747                dxguid strmiids dmoguids msdmo ole32 oleaut32 uuid gdi32)
     48    # 'MODULE' is treated as a LIBRARY
    4849    install(TARGETS phonon_ds9
    4950            RUNTIME DESTINATION ${BIN_INSTALL_DIR}/phonon_backend
    50             LIBRARY DESTINATION ${LIB_INSTALL_DIR}
     51            LIBRARY DESTINATION ${BIN_INSTALL_DIR}/phonon_backend
    5152            ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
    5253    install(FILES ds9.desktop DESTINATION ${SERVICES_INSTALL_DIR}/phononbackends)
  • trunk/src/3rdparty/phonon/ds9/abstractvideorenderer.cpp

    r2 r561  
    100100
    101101            if (ratio > 0) {
    102                 if (realWidth / realHeight > ratio && scaleMode == Phonon::VideoWidget::FitInView
    103                     || realWidth / realHeight < ratio && scaleMode == Phonon::VideoWidget::ScaleAndCrop) {
     102                if ((realWidth / realHeight > ratio && scaleMode == Phonon::VideoWidget::FitInView)
     103                    || (realWidth / realHeight < ratio && scaleMode == Phonon::VideoWidget::ScaleAndCrop)) {
    104104                        //the height is correct, let's change the width
    105105                        m_dstWidth = qRound(realHeight * ratio);
  • trunk/src/3rdparty/phonon/ds9/backend.cpp

    r2 r561  
    4242    namespace DS9
    4343    {
     44        QMutex *Backend::directShowMutex = 0;
     45
    4446        bool Backend::AudioMoniker::operator==(const AudioMoniker &other)
    4547        {
     
    5153            : QObject(parent)
    5254        {
    53                         ::CoInitialize(0);
     55            directShowMutex = &m_directShowMutex;
     56
     57            ::CoInitialize(0);
    5458
    5559            //registering meta types
     
    6266            m_audioOutputs.clear();
    6367            m_audioEffects.clear();
    64                         ::CoUninitialize();
     68            ::CoUninitialize();
     69
     70            directShowMutex = 0;
    6571        }
    6672
     
    132138        QList<int> Backend::objectDescriptionIndexes(Phonon::ObjectDescriptionType type) const
    133139        {
     140            QMutexLocker locker(&m_directShowMutex);
    134141            QList<int> ret;
    135142
     
    158165                        LPOLESTR str = 0;
    159166                        mon->GetDisplayName(0,0,&str);
    160                         const QString name = QString::fromUtf16((unsigned short*)str);
     167                        const QString name = QString::fromWCharArray(str);
    161168                                                ComPointer<IMalloc> alloc;
    162169                                                ::CoGetMalloc(1, alloc.pparam());
     
    205212        QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(Phonon::ObjectDescriptionType type, int index) const
    206213        {
     214            QMutexLocker locker(&m_directShowMutex);
    207215            QHash<QByteArray, QVariant> ret;
    208216            switch (type)
     
    217225                    HRESULT hr = mon->GetDisplayName(0,0, &str);
    218226                    if (SUCCEEDED(hr)) {
    219                         QString name = QString::fromUtf16((unsigned short*)str);
     227                        QString name = QString::fromWCharArray(str);
    220228                                                ComPointer<IMalloc> alloc;
    221229                                                ::CoGetMalloc(1, alloc.pparam());
     
    232240                    HRESULT hr = ::DMOGetName(m_audioEffects[index], name);
    233241                    if (SUCCEEDED(hr)) {
    234                         ret["name"] = QString::fromUtf16((unsigned short*)name);
     242                        ret["name"] = QString::fromWCharArray(name);
    235243                    }
    236244                }
  • trunk/src/3rdparty/phonon/ds9/backend.h

    r2 r561  
    2424
    2525#include <QtCore/QList>
     26#include <QtCore/QMutex>
    2627
    2728#include "compointer.h"
     
    6465            Filter getAudioOutputFilter(int index) const;
    6566
     67            static QMutex *directShowMutex;
     68
    6669        Q_SIGNALS:
    6770            void objectDescriptionChanged(ObjectDescriptionType);
     
    7578            mutable QVector<AudioMoniker> m_audioOutputs;
    7679            mutable QVector<CLSID> m_audioEffects;
     80            mutable QMutex m_directShowMutex;
    7781        };
    7882    }
  • trunk/src/3rdparty/phonon/ds9/backendnode.cpp

    r2 r561  
    5858        BackendNode::~BackendNode()
    5959        {
     60            //this will remove the filter from the graph
     61            FILTER_INFO info;
     62            for(int i = 0; i < FILTER_COUNT; ++i) {
     63                const Filter &filter = m_filters[i];
     64                if (!filter)
     65                    continue;
     66                filter->QueryFilterInfo(&info);
     67                if (info.pGraph) {
     68                    HRESULT hr = info.pGraph->RemoveFilter(filter);
     69
     70                    if (hr == VFW_E_NOT_STOPPED && m_mediaObject) {
     71                        m_mediaObject->ensureStopped();
     72
     73                        hr = info.pGraph->RemoveFilter(filter);
     74                    }
     75                    Q_ASSERT(SUCCEEDED(hr));
     76                    info.pGraph->Release();
     77                }
     78            }
    6079        }
    6180
  • trunk/src/3rdparty/phonon/ds9/ds9.desktop

    r2 r561  
    66X-KDE-PhononBackendInfo-InterfaceVersion=1
    77X-KDE-PhononBackendInfo-Version=0.1
    8 X-KDE-PhononBackendInfo-Website=http://www.trolltech.com/
     8X-KDE-PhononBackendInfo-Website=http://qt.nokia.com/
    99InitialPreference=15
    1010
    1111Name=DirectShow9
     12Name[bg]=DirectShow9
     13Name[ca]=DirectShow9
     14Name[cs]=DirectShow9
     15Name[da]=DirectShow9
     16Name[de]=DirectShow9
     17Name[el]=DirectShow9
     18Name[en_GB]=DirectShow9
     19Name[es]=DirectShow9
     20Name[et]=DirectShow9
     21Name[eu]=DirectShow9
     22Name[fr]=DirectShow9
     23Name[ga]=DirectShow9
     24Name[gl]=DirectShow9
     25Name[hsb]=DirectShow9
     26Name[hu]=DirectShow9
     27Name[is]=DirectShow9
     28Name[it]=DirectShow9
     29Name[ja]=DirectShow9
     30Name[ko]=DirectShow9
     31Name[ku]=DirectShow9
     32Name[lt]=DirectShow9
     33Name[lv]=DirectShow9
     34Name[nds]=DirectShow9
     35Name[nl]=DirectShow9
     36Name[nn]=DirectShow9
    1237Name[pa]=àš¡àšŸàš‡àš°à©ˆàš•àšžàšŒà©‹9
     38Name[pl]=DirectShow9
     39Name[pt]=DirectShow9
     40Name[pt_BR]=DirectShow9
     41Name[se]=DirectShow9
    1342Name[sk]=DirectShow 9
    1443Name[sl]=DirectShow 9
     
    1645Name[sr@latin]=DirectShow‑9
    1746Name[sv]=Directshow 9
     47Name[tr]=DirectShow9
     48Name[uk]=DirectShow9
    1849Name[x-test]=xxDirectShow9xx
     50Name[zh_CN]=DirectShow9
     51Name[zh_TW]=DirectShow9
    1952
    2053Comment=Phonon DirectShow9 backend
    2154Comment[bg]=Phonon DirectShow9
    2255Comment[ca]=Dorsal DirectShow9 del Phonon
     56Comment[cs]=Phonon DirectShow9 backend
    2357Comment[da]=DirectShow9-backend til Phonon
    2458Comment[de]=Phonon-Treiber fÃŒr DirectShow9
     
    2660ποστήριΟης DirectShow9 τοÏ
    2761 Phonon
     62Comment[en_GB]=Phonon DirectShow9 backend
    2863Comment[es]=Motor DirectShow9 para Phonon
    2964Comment[et]=Phononi DirectShow9 taustaprogramm
     65Comment[eu]=Phonon DirectShow9 backend
    3066Comment[fr]=SystÚme de gestion DirectShow9 pour Phonon
    3167Comment[ga]=Inneall DirectShow9 le haghaidh Phonon
    3268Comment[gl]=Infraestrutura de DirectShow9 para Phonon
     69Comment[hsb]=Phonon DirectShow9 backend
     70Comment[hu]=Phonon DirectShow9 modul
     71Comment[is]=Phonon DirectShow9 bakendi
    3372Comment[it]=Motore DirectShow9 di Phonon
    3473Comment[ja]=Phonon DirectShow9 バック゚ンド
    3574Comment[ko]=Phonon DirectShow9 백엔드
     75Comment[ku]=Binesaza Phonon DirectShow9
     76Comment[lt]=Phonon DirectShow9 galinė sÄ
     77saja
    3678Comment[lv]=Phonon DirectShow9 aizmugure
    3779Comment[nds]=Phonon-HÃŒlpprogrmm DirectShow9
     
    4284Comment[pt]=Infra-estrutura do DirectShow9 para o Phonon
    4385Comment[pt_BR]=Infraestrutura Phonon DirectShow9
     86Comment[se]=Phonon DirectShow9 duogášmohtor
    4487Comment[sk]=Phonon DirectShow 9 podsystém
    4588Comment[sl]=Phononova Hrbtenica DirectShow 9
  • trunk/src/3rdparty/phonon/ds9/effect.cpp

    r2 r561  
    8383                        current += wcslen(current) + 1; //skip the unit
    8484                        for(; *current; current += wcslen(current) + 1) {
    85                             values.append( QString::fromUtf16((unsigned short*)current) );
     85                            values.append( QString::fromWCharArray(current) );
    8686                        }
    8787                    }
     
    108108                    Phonon::EffectParameter::LogarithmicHint : Phonon::EffectParameter::Hints(0);
    109109
    110                 const QString n = QString::fromUtf16((unsigned short*)name);
     110                const QString n = QString::fromWCharArray(name);
    111111                ret.append(Phonon::EffectParameter(i, n, hint, def, min, max, values));
    112112                ::CoTaskMemFree(name); //let's free the memory
     
    139139                Q_ASSERT(params);
    140140
    141                 MP_DATA data = float(v.toDouble());
    142                 params->SetParam(p.id(), data);
     141                params->SetParam(p.id(), v.toFloat());
    143142            }
    144143        }
  • trunk/src/3rdparty/phonon/ds9/fakesource.cpp

    r2 r561  
    3030    {
    3131        static WAVEFORMATEX g_defaultWaveFormat = {WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, 0};
    32         static BITMAPINFOHEADER g_defautBitmapHeader = { sizeof(BITMAPINFOHEADER), 1, 1, 1, 0, 0, 0, 0, 0, 0, 0};
    33         static VIDEOINFOHEADER2 g_defaultVideoInfo = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
     32        static VIDEOINFOHEADER2 g_defaultVideoInfo = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, {0}, 0, {sizeof(BITMAPINFOHEADER), 1, 1, 1, 0, 0, 0, 0, 0, 0, 0} };
     33
     34        static const AM_MEDIA_TYPE g_fakeAudioType = {MEDIATYPE_Audio, MEDIASUBTYPE_PCM, 0, 0, 2, FORMAT_WaveFormatEx, 0, sizeof(WAVEFORMATEX), reinterpret_cast<BYTE*>(&g_defaultWaveFormat)};
     35        static const AM_MEDIA_TYPE g_fakeVideoType = {MEDIATYPE_Video, MEDIASUBTYPE_RGB32, TRUE, FALSE, 0, FORMAT_VideoInfo2, 0, sizeof(VIDEOINFOHEADER2), reinterpret_cast<BYTE*>(&g_defaultVideoInfo)};
    3436
    3537        class FakePin : public QPin
     
    129131        void FakeSource::createFakeAudioPin()
    130132        {
    131             AM_MEDIA_TYPE mt;
    132             qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE));
    133             mt.majortype = MEDIATYPE_Audio;
    134             mt.subtype = MEDIASUBTYPE_PCM;
    135             mt.formattype = FORMAT_WaveFormatEx;
    136             mt.lSampleSize = 2;
    137 
    138             //fake the format (stereo 44.1 khz stereo 16 bits)
    139             mt.cbFormat = sizeof(WAVEFORMATEX);
    140             mt.pbFormat = reinterpret_cast<BYTE*>(&g_defaultWaveFormat);
    141 
    142             new FakePin(this, mt);
     133            new FakePin(this, g_fakeAudioType);
    143134        }
    144135
    145136        void FakeSource::createFakeVideoPin()
    146137        {
    147             AM_MEDIA_TYPE mt;
    148             qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE));
    149             mt.majortype = MEDIATYPE_Video;
    150             mt.subtype = MEDIASUBTYPE_RGB32;
    151             mt.formattype = FORMAT_VideoInfo2;
    152             mt.bFixedSizeSamples = 1;
    153 
    154             g_defaultVideoInfo.bmiHeader = g_defautBitmapHeader;
    155 
    156             //fake the format
    157             mt.cbFormat = sizeof(VIDEOINFOHEADER2);
    158             mt.pbFormat = reinterpret_cast<BYTE*>(&g_defaultVideoInfo);
    159 
    160             new FakePin(this, mt);
     138            new FakePin(this, g_fakeVideoType);
    161139        }
    162140
  • trunk/src/3rdparty/phonon/ds9/iodevicereader.cpp

    r2 r561  
    3737        static QVector<AM_MEDIA_TYPE> getMediaTypes()
    3838        {
    39             AM_MEDIA_TYPE mt;
    40             mt.majortype = MEDIATYPE_Stream;
    41             mt.bFixedSizeSamples = TRUE;
    42             mt.bTemporalCompression = FALSE;
    43             mt.lSampleSize = 1;
    44             mt.formattype = GUID_NULL;
    45             mt.pUnk = 0;
    46             mt.cbFormat = 0;
    47             mt.pbFormat = 0;
     39            //the order here is important because otherwise,
     40            //directshow might not be able to detect the stream type correctly
     41
     42            AM_MEDIA_TYPE mt = { MEDIATYPE_Stream, MEDIASUBTYPE_Avi, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0};
    4843
    4944            QVector<AM_MEDIA_TYPE> ret;
    50             //normal auto-detect stream
    51             mt.subtype = MEDIASUBTYPE_NULL;
    52             ret << mt;
    5345            //AVI stream
    54             mt.subtype = MEDIASUBTYPE_Avi;
    5546            ret << mt;
    5647            //WAVE stream
    5748            mt.subtype = MEDIASUBTYPE_WAVE;
     49            ret << mt;
     50            //normal auto-detect stream (must be at the end!)
     51            mt.subtype = MEDIASUBTYPE_NULL;
    5852            ret << mt;
    5953            return ret;
     
    7367              void writeData(const QByteArray &data)
    7468              {
    75                   QWriteLocker locker(&m_lock);
    7669                  m_pos += data.size();
    7770                  m_buffer += data;
     
    8477              void setStreamSize(qint64 newSize)
    8578              {
    86                   QWriteLocker locker(&m_lock);
     79                  QMutexLocker locker(&m_mutex);
    8780                  m_size = newSize;
    88               }
    89 
    90               qint64 streamSize() const
    91               {
    92                   QReadLocker locker(&m_lock);
    93                   return m_size;
    9481              }
    9582
    9683              void setStreamSeekable(bool s)
    9784              {
    98                   QWriteLocker locker(&m_lock);
     85                  QMutexLocker locker(&m_mutex);
    9986                  m_seekable = s;
    100               }
    101 
    102               bool streamSeekable() const
    103               {
    104                   QReadLocker locker(&m_lock);
    105                   return m_seekable;
    106               }
    107 
    108               void setCurrentPos(qint64 pos)
    109               {
    110                   QWriteLocker locker(&m_lock);
    111                   m_pos = pos;
    112                   seekStream(pos);
    113                   m_buffer.clear();
    114               }
    115 
    116               qint64 currentPos() const
    117               {
    118                   QReadLocker locker(&m_lock);
    119                   return m_pos;
    120               }
    121 
    122               int currentBufferSize() const
    123               {
    124                   QReadLocker locker(&m_lock);
    125                   return m_buffer.size();
    12687              }
    12788
     
    13192              STDMETHODIMP Length(LONGLONG *total, LONGLONG *available)
    13293              {
    133                   QReadLocker locker(&m_lock);
     94                  QMutexLocker locker(&m_mutex);
    13495                  if (total) {
    13596                      *total = m_size;
     
    146107              HRESULT read(LONGLONG pos, LONG length, BYTE *buffer, LONG *actual)
    147108              {
    148                   QMutexLocker locker(&m_mutexRead);
    149 
     109                  Q_ASSERT(!m_mutex.tryLock());
    150110                  if (m_mediaGraph->isStopping()) {
    151111                      return VFW_E_WRONG_STATE;
    152112                  }
    153113
    154                   if(streamSize() != 1 && pos + length > streamSize()) {
     114                  if(m_size != 1 && pos + length > m_size) {
    155115                      //it tries to read outside of the boundaries
    156116                      return E_FAIL;
    157117                  }
    158118
    159                   if (currentPos() - currentBufferSize() != pos) {
    160                       if (!streamSeekable()) {
     119                  if (m_pos - m_buffer.size() != pos) {
     120                      if (!m_seekable) {
    161121                          return S_FALSE;
    162122                      }
    163                       setCurrentPos(pos);
     123                      m_pos = pos;
     124                      seekStream(pos);
     125                      m_buffer.clear();
    164126                  }
    165127
    166                   int oldSize = currentBufferSize();
    167                   while (currentBufferSize() < int(length)) {
     128                  int oldSize = m_buffer.size();
     129                  while (m_buffer.size() < int(length)) {
    168130                      needData();
    169131                      if (m_mediaGraph->isStopping()) {
     
    171133                      }
    172134
    173                       if (oldSize == currentBufferSize()) {
     135                      if (oldSize == m_buffer.size()) {
    174136                          break; //we didn't get any data
    175137                      }
    176                       oldSize = currentBufferSize();
     138                      oldSize = m_buffer.size();
    177139                  }
    178140
    179                   DWORD bytesRead = qMin(currentBufferSize(), int(length));
    180                   {
    181                       QWriteLocker locker(&m_lock);
    182                       qMemCopy(buffer, m_buffer.data(), bytesRead);
    183                       //truncate the buffer
    184                       m_buffer = m_buffer.mid(bytesRead);
    185                   }
     141                  int bytesRead = qMin(m_buffer.size(), int(length));
     142                  qMemCopy(buffer, m_buffer.data(), bytesRead);
     143                  //truncate the buffer
     144                  m_buffer = m_buffer.mid(bytesRead);
    186145
    187146                  if (actual) {
     
    199158            qint64 m_size;
    200159
    201             QMutex m_mutexRead;
    202160            const MediaGraph *m_mediaGraph;
    203161        };
     
    213171        {
    214172        }
    215 
    216         STDMETHODIMP IODeviceReader::Stop()
    217         {
    218             HRESULT hr = QBaseFilter::Stop();
    219             m_streamReader->enoughData(); //this asks to cancel any blocked call to needData
    220             return hr;
    221         }
    222 
    223173    }
    224174}
  • trunk/src/3rdparty/phonon/ds9/iodevicereader.h

    r2 r561  
    4242            IODeviceReader(const MediaSource &source, const MediaGraph *);
    4343            ~IODeviceReader();
    44             STDMETHODIMP Stop();
    4544
    4645        private:
  • trunk/src/3rdparty/phonon/ds9/mediagraph.cpp

    r2 r561  
    6969        }
    7070               
     71
     72/*
    7173        static HRESULT saveToFile(Graph graph, const QString &filepath)
    7274        {
     
    104106            return hr;
    105107        }
    106 
     108*/
    107109
    108110        MediaGraph::MediaGraph(MediaObject *mo, short index) :
     
    382384            if (info.pGraph) {
    383385                info.pGraph->Release();
    384                 return m_graph->RemoveFilter(filter);
     386                if (info.pGraph == m_graph)
     387                    return m_graph->RemoveFilter(filter);
    385388            }
    386389
     
    538541                    for(int i = 0; i < outputs.count(); ++i) {
    539542                        const OutputPin &pin = outputs.at(i);
    540                         if (VFW_E_NOT_CONNECTED == pin->ConnectedTo(inPin.pparam())) {
     543                        if (HRESULT(VFW_E_NOT_CONNECTED) == pin->ConnectedTo(inPin.pparam())) {
    541544                            return SUCCEEDED(pin->Connect(newIn, 0));
    542545                        }
     
    680683               } else if (source.discType() == Phonon::Cd) {
    681684                    m_realSource = Filter(new QAudioCDPlayer);
    682                     m_result = m_graph->AddFilter(m_realSource, 0);
    683685
    684686#endif //QT_NO_PHONON_MEDIACONTROLLER
     
    810812                    const OutputPin &out = outputs.at(i);
    811813                    InputPin pin;
    812                     if (out->ConnectedTo(pin.pparam()) == VFW_E_NOT_CONNECTED) {
     814                    if (out->ConnectedTo(pin.pparam()) == HRESULT(VFW_E_NOT_CONNECTED)) {
    813815                        m_decoderPins += out; //unconnected outputs can be decoded outputs
    814816                    }
     
    10071009                HRESULT hr = mediaContent->get_AuthorName(&str);
    10081010                if (SUCCEEDED(hr)) {
    1009                     ret.insert(QLatin1String("ARTIST"), QString::fromUtf16((const unsigned short*)str));
     1011                    ret.insert(QLatin1String("ARTIST"), QString::fromWCharArray(str));
    10101012                    SysFreeString(str);
    10111013                }
    10121014                hr = mediaContent->get_Title(&str);
    10131015                if (SUCCEEDED(hr)) {
    1014                     ret.insert(QLatin1String("TITLE"), QString::fromUtf16((const unsigned short*)str));
     1016                    ret.insert(QLatin1String("TITLE"), QString::fromWCharArray(str));
    10151017                    SysFreeString(str);
    10161018                }
    10171019                hr = mediaContent->get_Description(&str);
    10181020                if (SUCCEEDED(hr)) {
    1019                     ret.insert(QLatin1String("DESCRIPTION"), QString::fromUtf16((const unsigned short*)str));
     1021                    ret.insert(QLatin1String("DESCRIPTION"), QString::fromWCharArray(str));
    10201022                    SysFreeString(str);
    10211023                }
    10221024                hr = mediaContent->get_Copyright(&str);
    10231025                if (SUCCEEDED(hr)) {
    1024                     ret.insert(QLatin1String("COPYRIGHT"), QString::fromUtf16((const unsigned short*)str));
     1026                    ret.insert(QLatin1String("COPYRIGHT"), QString::fromWCharArray(str));
    10251027                    SysFreeString(str);
    10261028                }
    10271029                hr = mediaContent->get_MoreInfoText(&str);
    10281030                if (SUCCEEDED(hr)) {
    1029                     ret.insert(QLatin1String("MOREINFO"), QString::fromUtf16((const unsigned short*)str));
     1031                    ret.insert(QLatin1String("MOREINFO"), QString::fromWCharArray(str));
    10301032                    SysFreeString(str);
    10311033                }
  • trunk/src/3rdparty/phonon/ds9/mediaobject.cpp

    r2 r561  
    2424#ifndef Q_CC_MSVC
    2525#include <dshow.h>
    26 #endif //Q_CC_MSVC
     26#endif
    2727#include <objbase.h>
    2828#include <initguid.h>
     
    3737#include <QtCore/QDebug>
    3838
    39 #define TIMER_INTERVAL 16 //... ms for the timer that polls the current state (we use the multimedia timer
     39#define TIMER_INTERVAL 16 //... ms for the timer that polls the current state (we use the multimedia timer)
    4040#define PRELOAD_TIME 2000 // 2 seconds to load a source
    4141
     
    5050        //first the definition of the WorkerThread class
    5151        WorkerThread::WorkerThread()
    52           : QThread(), m_currentRenderId(0), m_finished(false), m_currentWorkId(1)
     52          : QThread(), m_finished(false), m_currentWorkId(1)
    5353        {
    5454        }
     
    5656        WorkerThread::~WorkerThread()
    5757        {
    58         }
    59 
    60         WorkerThread::Work WorkerThread::dequeueWork()
    61         {
    62             QMutexLocker locker(&m_mutex);
    63             if (m_finished) {
    64                 return Work();
    65             }
    66             Work ret = m_queue.dequeue();
    67 
    68             //we ensure to have the wait condition in the right state
    69             if (m_queue.isEmpty()) {
    70                 m_waitCondition.reset();
    71             } else {
    72                 m_waitCondition.set();
    73             }
    74 
    75             return ret;
    7658        }
    7759
     
    8971                DWORD result = ::WaitForMultipleObjects(count, handles, FALSE, INFINITE);
    9072                if (result == WAIT_OBJECT_0) {
    91                     if (m_finished) {
    92                         //that's the end if the thread execution
    93                         return;
    94                     }
    95 
    9673                    handleTask();
    9774                } else {
     
    181158            w.graph = Graph(CLSID_FilterGraph, IID_IGraphBuilder);
    182159            w.filter = filter;
     160            w.graph->AddFilter(filter, 0);
    183161            w.id = m_currentWorkId++;
    184162            m_queue.enqueue(w);
     
    200178        void WorkerThread::handleTask()
    201179        {
    202             const Work w = dequeueWork();
    203 
    204             if (m_finished) {
    205                 return;
     180            QMutexLocker locker(Backend::directShowMutex);
     181            {
     182                QMutexLocker locker(&m_mutex);
     183                if (m_finished || m_queue.isEmpty()) {
     184                    return;
     185                }
     186
     187                m_currentWork = m_queue.dequeue();
     188
     189                //we ensure to have the wait condition in the right state
     190                if (m_queue.isEmpty()) {
     191                    m_waitCondition.reset();
     192                } else {
     193                    m_waitCondition.set();
     194                }
    206195            }
    207196
    208197            HRESULT hr = S_OK;
    209198
    210             m_currentRender = w.graph;
    211                         m_currentRenderId = w.id;
    212             if (w.task == ReplaceGraph) {
    213                 QMutexLocker locker(&m_mutex);
    214                 HANDLE h;
    215 
     199            if (m_currentWork.task == ReplaceGraph) {
    216200                int index = -1;
    217201                for(int i = 0; i < FILTER_COUNT; ++i) {
    218                     if (m_graphHandle[i].graph == w.oldGraph) {
     202                    if (m_graphHandle[i].graph == m_currentWork.oldGraph) {
    219203                        m_graphHandle[i].graph = Graph();
    220204                        index = i;
     
    229213
    230214                //add the new graph
    231                 if (SUCCEEDED(ComPointer<IMediaEvent>(w.graph, IID_IMediaEvent)
     215                HANDLE h;
     216                if (SUCCEEDED(ComPointer<IMediaEvent>(m_currentWork.graph, IID_IMediaEvent)
    232217                    ->GetEventHandle(reinterpret_cast<OAEVENT*>(&h)))) {
    233                     m_graphHandle[index].graph = w.graph;
     218                    m_graphHandle[index].graph = m_currentWork.graph;
    234219                    m_graphHandle[index].handle = h;
    235220                }
    236             } else if (w.task == Render) {
    237                 if (w.filter) {
     221            } else if (m_currentWork.task == Render) {
     222                if (m_currentWork.filter) {
    238223                    //let's render pins
    239                     w.graph->AddFilter(w.filter, 0);
    240                     const QList<OutputPin> outputs = BackendNode::pins(w.filter, PINDIR_OUTPUT);
    241                     for (int i = 0; i < outputs.count(); ++i) {
    242                         //blocking call
    243                         hr = w.graph->Render(outputs.at(i));
    244                         if (FAILED(hr)) {
    245                             break;
    246                         }
    247                     }
    248                 } else if (!w.url.isEmpty()) {
     224                    const QList<OutputPin> outputs = BackendNode::pins(m_currentWork.filter, PINDIR_OUTPUT);
     225                    for (int i = 0; SUCCEEDED(hr) && i < outputs.count(); ++i) {
     226                        hr = m_currentWork.graph->Render(outputs.at(i));
     227                    }
     228                } else if (!m_currentWork.url.isEmpty()) {
    249229                    //let's render a url (blocking call)
    250                     hr = w.graph->RenderFile(reinterpret_cast<const wchar_t *>(w.url.utf16()), 0);
     230                    hr = m_currentWork.graph->RenderFile(reinterpret_cast<const wchar_t *>(m_currentWork.url.utf16()), 0);
    251231                }
    252232                if (hr != E_ABORT) {
    253                                         emit asyncRenderFinished(w.id, hr, w.graph);
    254                 }
    255             } else if (w.task == Seek) {
     233                    emit asyncRenderFinished(m_currentWork.id, hr, m_currentWork.graph);
     234                }
     235            } else if (m_currentWork.task == Seek) {
    256236                //that's a seekrequest
    257                 ComPointer<IMediaSeeking> mediaSeeking(w.graph, IID_IMediaSeeking);
    258                 qint64 newtime = w.time * 10000;
     237                ComPointer<IMediaSeeking> mediaSeeking(m_currentWork.graph, IID_IMediaSeeking);
     238                qint64 newtime = m_currentWork.time * 10000;
    259239                hr = mediaSeeking->SetPositions(&newtime, AM_SEEKING_AbsolutePositioning,
    260240                    0, AM_SEEKING_NoPositioning);
    261                 qint64 currentTime = -1;
    262                 if (SUCCEEDED(hr)) {
    263                     hr = mediaSeeking->GetCurrentPosition(&currentTime);
    264                     if (SUCCEEDED(hr)) {
    265                         currentTime /= 10000; //convert to ms
    266                     }
    267                 }
    268                 emit asyncSeekingFinished(w.id, currentTime);
    269                 hr = E_ABORT; //to avoid emitting asyncRenderFinished
    270             } else if (w.task == ChangeState) {
     241                emit asyncSeekingFinished(m_currentWork.id, newtime / 10000);
     242                hr = E_ABORT; //to avoid emitting asyncRenderFinished
     243            } else if (m_currentWork.task == ChangeState) {
    271244
    272245                //remove useless decoders
    273246                QList<Filter> unused;
    274                 for (int i = 0; i < w.decoders.count(); ++i) {
    275                     const Filter &filter = w.decoders.at(i);
     247                for (int i = 0; i < m_currentWork.decoders.count(); ++i) {
     248                    const Filter &filter = m_currentWork.decoders.at(i);
    276249                    bool used = false;
    277250                    const QList<OutputPin> pins = BackendNode::pins(filter, PINDIR_OUTPUT);
     
    290263                for (int i = 0; i < unused.count(); ++i) {
    291264                    //we should remove this filter from the graph
    292                     w.graph->RemoveFilter(unused.at(i));
     265                    m_currentWork.graph->RemoveFilter(unused.at(i));
    293266                }
    294267
    295268
    296269                //we can get the state
    297                 ComPointer<IMediaControl> mc(w.graph, IID_IMediaControl);
     270                ComPointer<IMediaControl> mc(m_currentWork.graph, IID_IMediaControl);
    298271
    299272                //we change the state here
    300                 switch(w.state)
     273                switch(m_currentWork.state)
    301274                {
    302275                case State_Stopped:
     
    316289                if (SUCCEEDED(hr)) {
    317290                    if (s == State_Stopped) {
    318                         emit stateReady(w.graph, Phonon::StoppedState);
     291                        emit stateReady(m_currentWork.graph, Phonon::StoppedState);
    319292                    } else if (s == State_Paused) {
    320                         emit stateReady(w.graph, Phonon::PausedState);
     293                        emit stateReady(m_currentWork.graph, Phonon::PausedState);
    321294                    } else /*if (s == State_Running)*/ {
    322                         emit stateReady(w.graph, Phonon::PlayingState);
    323                     }
    324                 }
    325             }
    326 
    327             m_currentRender = Graph();
    328                         m_currentRenderId = 0;
    329 
    330         }
    331 
    332                 void WorkerThread::abortCurrentRender(qint16 renderId)
    333                 {
     295                        emit stateReady(m_currentWork.graph, Phonon::PlayingState);
     296                    }
     297                }
     298            }
     299
     300            {
     301                QMutexLocker locker(&m_mutex);
     302                m_currentWork = Work(); //reinitialize
     303            }
     304        }
     305
     306        void WorkerThread::abortCurrentRender(qint16 renderId)
     307        {
    334308            QMutexLocker locker(&m_mutex);
     309            if (m_currentWork.id == renderId) {
     310                m_currentWork.graph->Abort();
     311            }
    335312            bool found = false;
    336             //we try to see if there is already an attempt to seek and we remove it
    337313            for(int i = 0; !found && i < m_queue.size(); ++i) {
    338314                const Work &w = m_queue.at(i);
     
    340316                    found = true;
    341317                    m_queue.removeAt(i);
    342                 }
    343             }
    344 
    345                         if (m_currentRender && m_currentRenderId == renderId) {
    346                                 m_currentRender->Abort();
    347                         }
    348                 }
     318                    if (m_queue.isEmpty()) {
     319                        m_waitCondition.reset();
     320                    }
     321                }
     322            }
     323        }
    349324
    350325        //tells the thread to stop processing
     
    353328            QMutexLocker locker(&m_mutex);
    354329            m_queue.clear();
    355             if (m_currentRender) {
     330            if (m_currentWork.graph) {
    356331                //in case we're currently rendering something
    357                 m_currentRender->Abort();
     332                m_currentWork.graph->Abort();
    358333
    359334            }
     
    384359
    385360            for(int i = 0; i < FILTER_COUNT; ++i) {
    386                 m_graphs[i] = new MediaGraph(this, i);               
    387             }
    388 
    389             connect(&m_thread, SIGNAL(stateReady(Graph, Phonon::State)),
    390                                SLOT(slotStateReady(Graph, Phonon::State)));
    391 
    392             connect(&m_thread, SIGNAL(eventReady(Graph, long, long)),
    393                                SLOT(handleEvents(Graph, long, long)));
    394 
    395             connect(&m_thread, SIGNAL(asyncRenderFinished(quint16, HRESULT, Graph)),
    396                 SLOT(finishLoading(quint16, HRESULT, Graph)));
    397 
    398             connect(&m_thread, SIGNAL(asyncSeekingFinished(quint16, qint64)),
    399                 SLOT(finishSeeking(quint16, qint64)));
     361                m_graphs[i] = new MediaGraph(this, i);
     362            }
     363
     364            connect(&m_thread, SIGNAL(stateReady(Graph,Phonon::State)),
     365                               SLOT(slotStateReady(Graph,Phonon::State)));
     366
     367            connect(&m_thread, SIGNAL(eventReady(Graph,long,long)),
     368                               SLOT(handleEvents(Graph,long,long)));
     369
     370            connect(&m_thread, SIGNAL(asyncRenderFinished(quint16,HRESULT,Graph)),
     371                SLOT(finishLoading(quint16,HRESULT,Graph)));
     372
     373            connect(&m_thread, SIGNAL(asyncSeekingFinished(quint16,qint64)),
     374                SLOT(finishSeeking(quint16,qint64)));
    400375            //really special case
    401376            m_mediaObject = this;
     
    485460
    486461                    if (!m_aboutToFinishSent && remaining < PRELOAD_TIME - m_transitionTime  + TIMER_INTERVAL/2) {
    487                         //let's take a 2 seconds time time to actually load the next file
     462                        //let's take a 2 seconds time to actually load the next file
    488463#ifdef GRAPH_DEBUG
    489464                        qDebug() << "DS9: emit aboutToFinish" << remaining << QTime::currentTime().toString();
     
    520495            qSwap(m_graphs[0], m_graphs[1]); //swap the graphs
    521496
     497            if (m_transitionTime >= 0)
     498                m_graphs[1]->stop(); //make sure we stop the previous graph
     499
     500            if (currentGraph()->mediaSource().type() != Phonon::MediaSource::Invalid &&
     501                catchComError(currentGraph()->renderResult())) {
     502                    setState(Phonon::ErrorState);
     503                    return;
     504            }
     505
     506            //we need to play the next media
     507            play();
     508
    522509            //we tell the video widgets to switch now to the new source
    523510#ifndef QT_NO_PHONON_VIDEO
     
    528515
    529516            emit currentSourceChanged(currentGraph()->mediaSource());
    530 
    531             if (currentGraph()->isLoading()) {
    532                 //will simply tell that when loading is finished
    533                 //it should start the playback
    534                 play();
    535             }
    536 
    537 
    538 
    539517            emit metaDataChanged(currentGraph()->metadata());
    540518
     
    549527            setTitles(currentGraph()->titles());
    550528#endif //QT_NO_PHONON_MEDIACONTROLLER
    551 
    552             //this manages only gapless transitions
    553             if (currentGraph()->mediaSource().type() != Phonon::MediaSource::Invalid) {
    554                 if (catchComError(currentGraph()->renderResult())) {
    555                     setState(Phonon::ErrorState);
    556                 } else {
    557                     play();
    558                 }
    559             }
    560529        }
    561530
     
    583552#ifndef QT_NO_PHONON_MEDIACONTROLLER
    584553            //1st, check if there is more titles after
    585             const qint64 ret = (m_currentTitle < _iface_availableTitles() - 1) ? 
     554            const qint64 ret = (m_currentTitle < _iface_availableTitles() - 1) ?
    586555                titleAbsolutePosition(m_currentTitle+1) : currentGraph()->absoluteTotalTime();
    587556
     
    596565        {
    597566            //this handles inaccuracy when stopping on a title
    598             return currentGraph()->absoluteCurrentTime() 
     567            return currentGraph()->absoluteCurrentTime()
    599568#ifndef QT_NO_PHONON_MEDIACONTROLLER
    600569                - titleAbsolutePosition(m_currentTitle)
     
    746715            setState(Phonon::LoadingState);
    747716            //After loading we go into stopped state
    748             m_nextState = Phonon::StoppedState; 
     717            m_nextState = Phonon::StoppedState;
    749718            catchComError(currentGraph()->loadSource(source));
    750719            emit currentSourceChanged(source);
     
    760729        void MediaObject::loadingFinished(MediaGraph *mg)
    761730        {
    762             if (mg == currentGraph()) { 
     731            if (mg == currentGraph()) {
    763732#ifndef QT_NO_PHONON_MEDIACONTROLLER
    764733                //Title interface
     
    791760                case Phonon::PausedState:
    792761                    pause();
    793                     break;
    794                 case Phonon::StoppedState:
    795                     stop();
    796762                    break;
    797763                case Phonon::PlayingState:
     
    801767                    setState(Phonon::ErrorState);
    802768                    break;
     769                case Phonon::StoppedState:
     770                default:
     771                    stop();
     772                    break;
    803773                }
    804774            }
     
    817787        void MediaObject::seekingFinished(MediaGraph *mg)
    818788        {
    819             if (mg == currentGraph()) { 
     789            if (mg == currentGraph()) {
    820790
    821791                updateTargetTick();
     
    848818                LPAMGETERRORTEXT getErrorText = (LPAMGETERRORTEXT)QLibrary::resolve(QLatin1String("quartz"), "AMGetErrorTextW");
    849819
    850                 ushort buffer[MAX_ERROR_TEXT_LEN];
    851                 if (getErrorText && getErrorText(hr, (WCHAR*)buffer, MAX_ERROR_TEXT_LEN)) {
    852                     m_errorString = QString::fromUtf16(buffer);
     820                WCHAR buffer[MAX_ERROR_TEXT_LEN];
     821                if (getErrorText && getErrorText(hr, buffer, MAX_ERROR_TEXT_LEN)) {
     822                    m_errorString = QString::fromWCharArray(buffer);
    853823                } else {
    854824                    m_errorString = QString::fromLatin1("Unknown error");
     
    892862                if (VideoWidget *video = qobject_cast<VideoWidget*>(sink)) {
    893863                    m_videoWidgets += video;
    894                 } else 
     864                } else
    895865#endif //QT_NO_PHONON_VIDEO
    896866                    if (AudioOutput *audio = qobject_cast<AudioOutput*>(sink)) {
     
    911881                if (VideoWidget *video = qobject_cast<VideoWidget*>(sink)) {
    912882                    m_videoWidgets.removeOne(video);
    913                 } else 
     883                } else
    914884#endif //QT_NO_PHONON_VIDEO
    915885                    if (AudioOutput *audio = qobject_cast<AudioOutput*>(sink)) {
     
    993963                }
    994964                break;
    995             case EC_LENGTH_CHANGED: 
     965            case EC_LENGTH_CHANGED:
    996966                if (graph == currentGraph()->graph()) {
    997967                    emit totalTimeChanged( totalTime() );
  • trunk/src/3rdparty/phonon/ds9/mediaobject.h

    r2 r561  
    115115            enum Task
    116116            {
     117                None,
    117118                Render,
    118119                Seek,
     
    123124            struct Work
    124125            {
     126                Work() : task(None), id(0), time(0) { }
    125127                Task task;
    126128                quint16 id;
     
    136138                QList<Filter> decoders; //for the state change requests
    137139            };
    138             Work dequeueWork();
    139140            void handleTask();
    140141
    141             Graph m_currentRender;
    142                         qint16 m_currentRenderId;
     142            Work m_currentWork;
    143143            QQueue<Work> m_queue;
    144144            bool m_finished;
    145145            quint16 m_currentWorkId;
    146146            QWinWaitCondition m_waitCondition;
    147             QMutex m_mutex;
     147            QMutex m_mutex; // mutex for the m_queue, m_finished and m_currentWorkId
    148148
    149149            //this is for WaitForMultipleObjects
  • trunk/src/3rdparty/phonon/ds9/qasyncreader.cpp

    r2 r561  
    1515along with this library.  If not, see <http://www.gnu.org/licenses/>.
    1616*/
    17 
    18 #include <QtCore/QFile>
    1917
    2018#include "qasyncreader.h"
     
    8179        STDMETHODIMP QAsyncReader::Request(IMediaSample *sample,DWORD_PTR user)
    8280        {
    83             QMutexLocker mutexLocker(&m_mutexWait);
    84             QWriteLocker locker(&m_lock);
     81            QMutexLocker locker(&m_mutex);
    8582            if (m_flushing) {
    8683                return VFW_E_WRONG_STATE;
     
    9491        STDMETHODIMP QAsyncReader::WaitForNext(DWORD timeout, IMediaSample **sample, DWORD_PTR *user)
    9592        {
    96             QMutexLocker locker(&m_mutexWait);
     93            QMutexLocker locker(&m_mutex);
    9794            if (!sample ||!user) {
    9895                return E_POINTER;
    9996            }
    10097
     98            //msdn says to return immediately if we're flushing but that doesn't seem to be true
     99            //since it triggers a dead-lock somewhere inside directshow (see task 258830)
     100
    101101            *sample = 0;
    102102            *user = 0;
    103103
    104             AsyncRequest r = getNextRequest();
    105 
    106             if (r.sample == 0) {
    107                 //there is no request in the queue
    108                 if (isFlushing()) {
     104            if (m_requestQueue.isEmpty()) {
     105                if (m_requestWait.wait(&m_mutex, timeout) == false) {
     106                    return VFW_E_TIMEOUT;
     107                }
     108                if (m_requestQueue.isEmpty()) {
    109109                    return VFW_E_WRONG_STATE;
    110                 } else {
    111                     //First we need to lock the mutex
    112                     if (m_requestWait.wait(&m_mutexWait, timeout) == false) {
    113                         return VFW_E_TIMEOUT;
    114                     }
    115                     if (isFlushing()) {
    116                         return VFW_E_WRONG_STATE;
    117                     }
    118 
    119                     r = getNextRequest();
    120110                }
    121111            }
     112
     113            AsyncRequest r = m_requestQueue.dequeue();
    122114
    123115            //at this point we're sure to have a request to proceed
     
    128120            *sample = r.sample;
    129121            *user = r.user;
    130 
    131             return SyncReadAligned(r.sample);
     122            return syncReadAlignedUnlocked(r.sample);
    132123        }
    133124
    134125        STDMETHODIMP QAsyncReader::BeginFlush()
    135126        {
    136             QMutexLocker mutexLocker(&m_mutexWait);
    137             QWriteLocker locker(&m_lock);
     127            QMutexLocker locker(&m_mutex);
    138128            m_flushing = true;
    139129            m_requestWait.wakeOne();
     
    143133        STDMETHODIMP QAsyncReader::EndFlush()
    144134        {
    145             QWriteLocker locker(&m_lock);
     135            QMutexLocker locker(&m_mutex);
    146136            m_flushing = false;
    147137            return S_OK;
     
    150140        STDMETHODIMP QAsyncReader::SyncReadAligned(IMediaSample *sample)
    151141        {
     142            QMutexLocker locker(&m_mutex);
     143            return syncReadAlignedUnlocked(sample);
     144        }
     145
     146        STDMETHODIMP QAsyncReader::SyncRead(LONGLONG pos, LONG length, BYTE *buffer)
     147        {
     148            QMutexLocker locker(&m_mutex);
     149            return read(pos, length, buffer, 0);
     150        }
     151
     152
     153        STDMETHODIMP QAsyncReader::syncReadAlignedUnlocked(IMediaSample *sample)
     154        {
     155            Q_ASSERT(!m_mutex.tryLock());
     156
    152157            if (!sample) {
    153158                return E_POINTER;
     
    176181        }
    177182
    178         STDMETHODIMP QAsyncReader::SyncRead(LONGLONG pos, LONG length, BYTE *buffer)
    179         {
    180             return read(pos, length, buffer, 0);
    181         }
    182 
    183 
    184         //addition
    185         QAsyncReader::AsyncRequest QAsyncReader::getNextRequest()
    186         {
    187             QWriteLocker locker(&m_lock);
    188             AsyncRequest ret;
    189             if (!m_requestQueue.isEmpty()) {
    190                 ret = m_requestQueue.dequeue();
    191             }
    192 
    193             return ret;
    194         }
    195183    }
    196184}
  • trunk/src/3rdparty/phonon/ds9/qasyncreader.h

    r2 r561  
    4949            STDMETHODIMP SyncReadAligned(IMediaSample *);
    5050            STDMETHODIMP SyncRead(LONGLONG,LONG,BYTE *);
    51             virtual STDMETHODIMP Length(LONGLONG *,LONGLONG *) = 0;
     51            STDMETHODIMP Length(LONGLONG *,LONGLONG *) = 0;
    5252            STDMETHODIMP BeginFlush();
    5353            STDMETHODIMP EndFlush();
    5454
    5555        protected:
     56            STDMETHODIMP syncReadAlignedUnlocked(IMediaSample *);
    5657            virtual HRESULT read(LONGLONG pos, LONG length, BYTE *buffer, LONG *actual) = 0;
    5758
     
    6364                DWORD_PTR user;
    6465            };
    65             AsyncRequest getNextRequest();
    66 
    67             QMutex m_mutexWait;
    6866
    6967            QQueue<AsyncRequest> m_requestQueue;
  • trunk/src/3rdparty/phonon/ds9/qaudiocdreader.cpp

    r2 r561  
    104104        private:
    105105            HANDLE m_cddrive;
    106             CDROM_TOC *m_toc;
    107             WaveStructure *m_waveHeader;
     106            CDROM_TOC m_toc;
     107            WaveStructure m_waveHeader;
    108108            qint64 m_trackAddress;
    109109        };
     
    113113#define NB_SECTORS_READ 20
    114114
    115         static AM_MEDIA_TYPE getAudioCDMediaType()
    116         {
    117             AM_MEDIA_TYPE mt;
    118             qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE));
    119             mt.majortype = MEDIATYPE_Stream;
    120             mt.subtype = MEDIASUBTYPE_WAVE;
    121             mt.bFixedSizeSamples = TRUE;
    122             mt.bTemporalCompression = FALSE;
    123             mt.lSampleSize = 1;
    124             mt.formattype = GUID_NULL;
    125             return mt;
    126         }
    127 
     115        static const AM_MEDIA_TYPE audioCDMediaType = { MEDIATYPE_Stream, MEDIASUBTYPE_WAVE, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0};
     116 
    128117        int addressToSectors(UCHAR address[4])
    129118        {
     
    142131
    143132
    144         QAudioCDReader::QAudioCDReader(QBaseFilter *parent, QChar drive) : QAsyncReader(parent, QVector<AM_MEDIA_TYPE>() << getAudioCDMediaType())
    145         {
    146             m_toc = new CDROM_TOC;
    147             m_waveHeader = new WaveStructure;
    148 
     133        QAudioCDReader::QAudioCDReader(QBaseFilter *parent, QChar drive) : QAsyncReader(parent, QVector<AM_MEDIA_TYPE>() << audioCDMediaType)
     134        {
    149135            //now open the cd-drive
    150136            QString path;
     
    155141            }
    156142
    157             m_cddrive = QT_WA_INLINE (
    158                         ::CreateFile( (TCHAR*)path.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ),
    159                         ::CreateFileA( path.toLocal8Bit().constData(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL )
    160                         );
    161 
    162             qMemSet(m_toc, 0, sizeof(CDROM_TOC));
     143            m_cddrive = ::CreateFile((const wchar_t *)path.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
     144
     145            qMemSet(&m_toc, 0, sizeof(CDROM_TOC));
    163146            //read the TOC
    164147            DWORD bytesRead = 0;
    165             bool tocRead = ::DeviceIoControl(m_cddrive, IOCTL_CDROM_READ_TOC, 0, 0, m_toc, sizeof(CDROM_TOC), &bytesRead, 0);
     148            bool tocRead = ::DeviceIoControl(m_cddrive, IOCTL_CDROM_READ_TOC, 0, 0, &m_toc, sizeof(CDROM_TOC), &bytesRead, 0);
    166149
    167150            if (!tocRead) {
     
    170153            }
    171154
    172             m_trackAddress = addressToSectors(m_toc->TrackData[0].Address);
    173             const qint32 nbSectorsToRead = (addressToSectors(m_toc->TrackData[m_toc->LastTrack + 1 - m_toc->FirstTrack].Address)
     155            m_trackAddress = addressToSectors(m_toc.TrackData[0].Address);
     156            const qint32 nbSectorsToRead = (addressToSectors(m_toc.TrackData[m_toc.LastTrack + 1 - m_toc.FirstTrack].Address)
    174157                - m_trackAddress);
    175158            const qint32 dataLength = nbSectorsToRead * SECTOR_SIZE;
    176159
    177             m_waveHeader->chunksize = 4 + (8 + m_waveHeader->chunksize2) + (8 + dataLength);
    178             m_waveHeader->dataLength = dataLength;
     160            m_waveHeader.chunksize = 4 + (8 + m_waveHeader.chunksize2) + (8 + dataLength);
     161            m_waveHeader.dataLength = dataLength;
    179162        }
    180163
     
    182165        {
    183166            ::CloseHandle(m_cddrive);
    184             delete m_toc;
    185             delete m_waveHeader;
    186 
    187167        }
    188168
     
    200180        STDMETHODIMP QAudioCDReader::Length(LONGLONG *total,LONGLONG *available)
    201181        {
    202             const LONGLONG length = sizeof(WaveStructure) + m_waveHeader->dataLength;
     182            const LONGLONG length = sizeof(WaveStructure) + m_waveHeader.dataLength;
    203183            if (total) {
    204184                *total = length;
     
    239219                //we first copy the content of the structure
    240220                nbRead = qMin(LONG(sizeof(WaveStructure) - pos), length);
    241                 qMemCopy(buffer, reinterpret_cast<char*>(m_waveHeader) + pos, nbRead);
     221                qMemCopy(buffer, reinterpret_cast<char*>(&m_waveHeader) + pos, nbRead);
    242222            }
    243223
    244224            const LONGLONG posInTrack = pos - sizeof(WaveStructure) + nbRead;
    245             const int bytesLeft = qMin(m_waveHeader->dataLength - posInTrack, LONGLONG(length - nbRead));
     225            const int bytesLeft = qMin(m_waveHeader.dataLength - posInTrack, LONGLONG(length - nbRead));
    246226
    247227            if (bytesLeft > 0) {
     
    298278            QList<qint64> ret;
    299279            ret << 0;
    300             for(int i = m_toc->FirstTrack; i <= m_toc->LastTrack ; ++i) {
    301                 const uchar *address = m_toc->TrackData[i].Address;
     280            for(int i = m_toc.FirstTrack; i <= m_toc.LastTrack ; ++i) {
     281                const uchar *address = m_toc.TrackData[i].Address;
    302282                ret << ((address[0] * 60 + address[1]) * 60 + address[2]) * 1000 + address[3]*1000/75 - 2000;
    303283
  • trunk/src/3rdparty/phonon/ds9/qbasefilter.cpp

    r2 r561  
    9393                }
    9494
    95                 int nbfetched = 0;
    96                 while (nbfetched < int(count) && m_index < m_pins.count()) {
     95                uint nbfetched = 0;
     96                while (nbfetched < count && m_index < m_pins.count()) {
    9797                    IPin *current = m_pins[m_index];
    9898                    current->AddRef();
     
    167167        const QList<QPin *> QBaseFilter::pins() const
    168168        {
    169             QReadLocker locker(&m_lock);
     169            QMutexLocker locker(&m_mutex);
    170170            return m_pins;
    171171        }
     
    173173        void QBaseFilter::addPin(QPin *pin)
    174174        {
    175             QWriteLocker locker(&m_lock);
     175            QMutexLocker locker(&m_mutex);
    176176            m_pins.append(pin);
    177177        }
     
    179179        void QBaseFilter::removePin(QPin *pin)
    180180        {
    181             QWriteLocker locker(&m_lock);
     181            QMutexLocker locker(&m_mutex);
    182182            m_pins.removeAll(pin);
    183183        }
     
    212212            else if (iid == IID_IMediaPosition || iid == IID_IMediaSeeking) {
    213213                if (inputPins().isEmpty()) {
    214                     if (*out = getUpStreamInterface(iid)) {
     214                    *out = getUpStreamInterface(iid);
     215                    if (*out) {
    215216                        return S_OK; //we return here to avoid adding a reference
    216217                    } else {
     
    251252        STDMETHODIMP QBaseFilter::GetClassID(CLSID *clsid)
    252253        {
    253             QReadLocker locker(&m_lock);
     254            QMutexLocker locker(&m_mutex);
    254255            *clsid = m_clsid;
    255256            return S_OK;
     
    258259        STDMETHODIMP QBaseFilter::Stop()
    259260        {
    260             QWriteLocker locker(&m_lock);
     261            QMutexLocker locker(&m_mutex);
    261262            m_state = State_Stopped;
    262263            return S_OK;
     
    265266        STDMETHODIMP QBaseFilter::Pause()
    266267        {
    267             QWriteLocker locker(&m_lock);
     268            QMutexLocker locker(&m_mutex);
    268269            m_state = State_Paused;
    269270            return S_OK;
     
    272273        STDMETHODIMP QBaseFilter::Run(REFERENCE_TIME)
    273274        {
    274             QWriteLocker locker(&m_lock);
     275            QMutexLocker locker(&m_mutex);
    275276            m_state = State_Running;
    276277            return S_OK;
     
    279280        STDMETHODIMP QBaseFilter::GetState(DWORD, FILTER_STATE *state)
    280281        {
    281             QReadLocker locker(&m_lock);
     282            QMutexLocker locker(&m_mutex);
    282283            if (!state) {
    283284                return E_POINTER;
     
    290291        STDMETHODIMP QBaseFilter::SetSyncSource(IReferenceClock *clock)
    291292        {
    292             QWriteLocker locker(&m_lock);
     293            QMutexLocker locker(&m_mutex);
    293294            if (clock) {
    294295                clock->AddRef();
     
    303304        STDMETHODIMP QBaseFilter::GetSyncSource(IReferenceClock **clock)
    304305        {
    305             QReadLocker locker(&m_lock);
     306            QMutexLocker locker(&m_mutex);
    306307            if (!clock) {
    307308                return E_POINTER;
     
    342343        STDMETHODIMP QBaseFilter::QueryFilterInfo(FILTER_INFO *info )
    343344        {
    344             QReadLocker locker(&m_lock);
     345            QMutexLocker locker(&m_mutex);
    345346            if (!info) {
    346347                return E_POINTER;
     
    356357        STDMETHODIMP QBaseFilter::JoinFilterGraph(IFilterGraph *graph, LPCWSTR name)
    357358        {
    358             QWriteLocker locker(&m_lock);
     359            QMutexLocker locker(&m_mutex);
    359360            m_graph = graph;
    360             m_name = QString::fromUtf16((const unsigned short*)name);
     361            m_name = QString::fromWCharArray(name);
    361362            return S_OK;
    362363        }
  • trunk/src/3rdparty/phonon/ds9/qbasefilter.h

    r2 r561  
    2323#include <QtCore/QString>
    2424#include <QtCore/QList>
    25 #include <QtCore/QReadWriteLock>
     25#include <QtCore/QMutex>
    2626
    2727#include <dshow.h>
     
    128128            FILTER_STATE m_state;
    129129            QList<QPin *> m_pins;
    130             mutable QReadWriteLock m_lock;
     130            mutable QMutex m_mutex;
    131131        };
    132132    }
  • trunk/src/3rdparty/phonon/ds9/qmeminputpin.cpp

    r2 r561  
    2929    {
    3030
    31         QMemInputPin::QMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, bool transform) :
    32             QPin(parent, PINDIR_INPUT, mt), m_shouldDuplicateSamples(true), m_transform(transform)
     31        QMemInputPin::QMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, bool transform, QPin *output) :
     32            QPin(parent, PINDIR_INPUT, mt), m_shouldDuplicateSamples(true), m_transform(transform), m_output(output)
    3333        {
    3434        }
     
    6767            //this allows to serialize with Receive calls
    6868            QMutexLocker locker(&m_mutexReceive);
    69             for(int i = 0; i < m_outputs.count(); ++i) {
    70                 IPin *conn = m_outputs.at(i)->connected();
    71                 if (conn) {
    72                     conn->EndOfStream();
    73                 }
     69            IPin *conn = m_output ? m_output->connected() : 0;
     70            if (conn) {
     71                conn->EndOfStream();
    7472            }
    7573            return S_OK;
     
    7977        {
    8078            //pass downstream
    81             for(int i = 0; i < m_outputs.count(); ++i) {
    82                 IPin *conn = m_outputs.at(i)->connected();
    83                 if (conn) {
    84                     conn->BeginFlush();
    85                 }
    86             }
    87             QWriteLocker locker(&m_lock);
     79            IPin *conn = m_output ? m_output->connected() : 0;
     80            if (conn) {
     81                conn->BeginFlush();
     82            }
     83            QMutexLocker locker(&m_mutex);
    8884            m_flushing = true;
    8985            return S_OK;
     
    9389        {
    9490            //pass downstream
    95             for(int i = 0; i < m_outputs.count(); ++i) {
    96                 IPin *conn = m_outputs.at(i)->connected();
    97                 if (conn) {
    98                     conn->EndFlush();
    99                 }
    100             }
    101             QWriteLocker locker(&m_lock);
     91            IPin *conn = m_output ? m_output->connected() : 0;
     92            if (conn) {
     93                conn->EndFlush();
     94            }
     95            QMutexLocker locker(&m_mutex);
    10296            m_flushing = false;
    10397            return S_OK;
     
    106100        STDMETHODIMP QMemInputPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
    107101        {
    108             for(int i = 0; i < m_outputs.count(); ++i) {
    109                 m_outputs.at(i)->NewSegment(start, stop, rate);
    110             }
     102            if (m_output)
     103                m_output->NewSegment(start, stop, rate);
    111104            return S_OK;
    112105        }
     
    120113                mt->majortype != MEDIATYPE_NULL &&
    121114                mt->subtype != MEDIASUBTYPE_NULL &&
    122                 mt->formattype != GUID_NULL) {
    123                     //we tell the output pins that they should connect with this type
    124                     for(int i = 0; i < m_outputs.count(); ++i) {
    125                         hr = m_outputs.at(i)->setAcceptedMediaType(connectedType());
    126                         if (FAILED(hr)) {
    127                             break;
    128                         }
    129                     }
     115                mt->formattype != GUID_NULL && m_output) {
     116                    //we tell the output pin that it should connect with this type
     117                    hr = m_output->setAcceptedMediaType(connectedType());
    130118            }
    131119            return hr;
     
    138126            }
    139127
    140             if (*alloc = memoryAllocator(true)) {
     128            *alloc = memoryAllocator(true);
     129            if (*alloc) {
    141130                return S_OK;
    142131            }
     
    152141
    153142            {
    154                 QWriteLocker locker(&m_lock);
     143                QMutexLocker locker(&m_mutex);
    155144                m_shouldDuplicateSamples = m_transform && readonly;
    156145            }
     
    158147            setMemoryAllocator(alloc);
    159148
    160             for(int i = 0; i < m_outputs.count(); ++i) {
    161                 IPin *pin = m_outputs.at(i)->connected();
    162                 if (pin) {
    163                     ComPointer<IMemInputPin> input(pin, IID_IMemInputPin);
    164                     input->NotifyAllocator(alloc, m_shouldDuplicateSamples);
    165                 }
     149            if (m_output) {
     150                ComPointer<IMemInputPin> input(m_output, IID_IMemInputPin);
     151                input->NotifyAllocator(alloc, m_shouldDuplicateSamples);
    166152            }
    167153
     
    202188            }
    203189
    204             for (int i = 0; i < m_outputs.count(); ++i) {
    205                 QPin *current = m_outputs.at(i);
    206                 IMediaSample *outSample = m_shouldDuplicateSamples ?
    207                     duplicateSampleForOutput(sample, current->memoryAllocator())
     190            if (m_output) {
     191                IMediaSample *outSample = m_shouldDuplicateSamples ?
     192                    duplicateSampleForOutput(sample, m_output->memoryAllocator())
    208193                    : sample;
    209194
     
    212197                }
    213198
    214                 IPin *pin = current->connected();
    215                 if (pin) {
    216                     ComPointer<IMemInputPin> input(pin, IID_IMemInputPin);
    217                     if (input) {
    218                         input->Receive(outSample);
    219                     }
     199                ComPointer<IMemInputPin> input(m_output->connected(), IID_IMemInputPin);
     200                if (input) {
     201                    input->Receive(outSample);
    220202                }
    221203
     
    248230        STDMETHODIMP QMemInputPin::ReceiveCanBlock()
    249231        {
    250             //we test the output to see if they can block
    251             for(int i = 0; i < m_outputs.count(); ++i) {
    252                 IPin *input = m_outputs.at(i)->connected();
    253                 if (input) {
    254                     ComPointer<IMemInputPin> meminput(input, IID_IMemInputPin);
    255                     if (meminput && meminput->ReceiveCanBlock() != S_FALSE) {
    256                         return S_OK;
    257                     }
     232            //we test the output to see if it can block
     233            if (m_output) {
     234                ComPointer<IMemInputPin> meminput(m_output->connected(), IID_IMemInputPin);
     235                if (meminput && meminput->ReceiveCanBlock() != S_FALSE) {
     236                    return S_OK;
    258237                }
    259238            }
     
    261240        }
    262241
    263         //addition
    264         //this should be used by the filter to tell it's input pins to which output they should route the samples
    265 
    266         void QMemInputPin::addOutput(QPin *output)
    267         {
    268             QWriteLocker locker(&m_lock);
    269             m_outputs += output;
    270         }
    271 
    272         void QMemInputPin::removeOutput(QPin *output)
    273         {
    274             QWriteLocker locker(&m_lock);
    275             m_outputs.removeOne(output);
    276         }
    277 
    278         QList<QPin*> QMemInputPin::outputs() const
    279         {
    280             QReadLocker locker(&m_lock);
    281             return m_outputs;
    282         }
    283242
    284243        ALLOCATOR_PROPERTIES QMemInputPin::getDefaultAllocatorProperties() const
     
    295254
    296255            HRESULT hr = alloc->Commit();
    297             if (hr == VFW_E_SIZENOTSET) {
     256            if (hr == HRESULT(VFW_E_SIZENOTSET)) {
    298257                ALLOCATOR_PROPERTIES prop = getDefaultAllocatorProperties();
    299258                prop.cbBuffer = qMax(prop.cbBuffer, length);
     
    325284                LONGLONG start, end;
    326285                hr = sample->GetMediaTime(&start, &end);
    327                 if (hr != VFW_E_MEDIA_TIME_NOT_SET) {
     286                if (hr != HRESULT(VFW_E_MEDIA_TIME_NOT_SET)) {
    328287                    hr = out->SetMediaTime(&start, &end);
    329288                    Q_ASSERT(SUCCEEDED(hr));
  • trunk/src/3rdparty/phonon/ds9/qmeminputpin.h

    r2 r561  
    3838        {
    3939        public:
    40             QMemInputPin(QBaseFilter *, const QVector<AM_MEDIA_TYPE> &, bool transform);
     40            QMemInputPin(QBaseFilter *, const QVector<AM_MEDIA_TYPE> &, bool transform, QPin *output);
    4141            ~QMemInputPin();
    4242
     
    6161            STDMETHODIMP ReceiveCanBlock();
    6262
    63             //addition
    64             void addOutput(QPin *output);
    65             void removeOutput(QPin *output);
    66             QList<QPin*> outputs() const;
    67 
    6863        private:
    6964            IMediaSample *duplicateSampleForOutput(IMediaSample *, IMemAllocator *);
     
    7267            bool m_shouldDuplicateSamples;
    7368            const bool m_transform; //defines if the pin is transforming the samples
    74             QList<QPin*> m_outputs;
     69            QPin* const m_output;
    7570            QMutex m_mutexReceive;
    7671        };
  • trunk/src/3rdparty/phonon/ds9/qpin.cpp

    r2 r561  
    2929    {
    3030
    31         static const AM_MEDIA_TYPE defaultMediaType()
    32         {
    33             AM_MEDIA_TYPE ret;
    34             ret.majortype = MEDIATYPE_NULL;
    35             ret.subtype = MEDIASUBTYPE_NULL;
    36             ret.bFixedSizeSamples = TRUE;
    37             ret.bTemporalCompression = FALSE;
    38             ret.lSampleSize = 1;
    39             ret.formattype = GUID_NULL;
    40             ret.pUnk = 0;
    41             ret.cbFormat = 0;
    42             ret.pbFormat = 0;
    43             return ret;
    44         }
     31        static const AM_MEDIA_TYPE defaultMediaType = { MEDIATYPE_NULL, MEDIASUBTYPE_NULL, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0};
    4532
    4633        class QEnumMediaTypes : public IEnumMediaTypes
     
    10592                }
    10693
    107                 int nbFetched = 0;
    108                 while (nbFetched < int(count) && m_index < m_pin->mediaTypes().count()) {
     94                uint nbFetched = 0;
     95                while (nbFetched < count && m_index < m_pin->mediaTypes().count()) {
    10996                    //the caller will deallocate the memory
    11097                    *out = static_cast<AM_MEDIA_TYPE *>(::CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)));
     
    159146
    160147        QPin::QPin(QBaseFilter *parent, PIN_DIRECTION dir, const QVector<AM_MEDIA_TYPE> &mt) :
    161         m_memAlloc(0), m_parent(parent), m_refCount(1),  m_connected(0),
    162             m_direction(dir), m_mediaTypes(mt), m_connectedType(defaultMediaType()),
    163             m_flushing(false)
     148            m_parent(parent), m_flushing(false), m_refCount(1),  m_connected(0),
     149            m_direction(dir), m_mediaTypes(mt), m_connectedType(defaultMediaType),
     150            m_memAlloc(0)
    164151        {
    165152            Q_ASSERT(m_parent);
     
    274261            if (FAILED(hr)) {
    275262                setConnected(0);
    276                 setConnectedType(defaultMediaType());
     263                setConnectedType(defaultMediaType);
    277264            } else {
    278265                ComPointer<IMemInputPin> input(pin, IID_IMemInputPin);
     
    316303
    317304            setConnected(0);
    318             setConnectedType(defaultMediaType());
    319             if (m_direction == PINDIR_INPUT) {
    320                 setMemoryAllocator(0);
    321             }
     305            setConnectedType(defaultMediaType);
     306            setMemoryAllocator(0);
    322307            return S_OK;
    323308        }
     
    339324        STDMETHODIMP QPin::ConnectionMediaType(AM_MEDIA_TYPE *type)
    340325        {
    341             QReadLocker locker(&m_lock);
     326            QMutexLocker locker(&m_mutex);
    342327            if (!type) {
    343328                return E_POINTER;
     
    354339        STDMETHODIMP QPin::QueryPinInfo(PIN_INFO *info)
    355340        {
    356             QReadLocker locker(&m_lock);
    357341            if (!info) {
    358342                return E_POINTER;
     
    362346            info->pFilter = m_parent;
    363347            m_parent->AddRef();
    364             qMemCopy(info->achName, m_name.utf16(), qMin(MAX_FILTER_NAME, m_name.length()+1) *2);
    365 
     348            info->achName[0] = 0;
    366349            return S_OK;
    367350        }
     
    369352        STDMETHODIMP QPin::QueryDirection(PIN_DIRECTION *dir)
    370353        {
    371             QReadLocker locker(&m_lock);
    372354            if (!dir) {
    373355                return E_POINTER;
     
    380362        STDMETHODIMP QPin::QueryId(LPWSTR *id)
    381363        {
    382             QReadLocker locker(&m_lock);
    383364            if (!id) {
    384365                return E_POINTER;
    385366            }
    386367
    387             int nbBytes = (m_name.length()+1)*2;
    388             *id = static_cast<LPWSTR>(::CoTaskMemAlloc(nbBytes));
    389             qMemCopy(*id, m_name.utf16(), nbBytes);
     368            *id = static_cast<LPWSTR>(::CoTaskMemAlloc(2));
     369            *id[0] = 0;
    390370            return S_OK;
    391371        }
     
    393373        STDMETHODIMP QPin::QueryAccept(const AM_MEDIA_TYPE *type)
    394374        {
    395             QReadLocker locker(&m_lock);
     375            QMutexLocker locker(&m_mutex);
    396376            if (!type) {
    397377                return E_POINTER;
     
    440420        STDMETHODIMP QPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
    441421        {
    442             QReadLocker locker(&m_lock);
     422            QMutexLocker locker(&m_mutex);
    443423            if (m_direction == PINDIR_OUTPUT && m_connected) {
    444424                //we deliver this downstream
     
    457437        HRESULT QPin::checkOutputMediaTypesConnection(IPin *pin)
    458438        {
    459             IEnumMediaTypes *emt = 0;
    460             HRESULT hr = pin->EnumMediaTypes(&emt);
     439            ComPointer<IEnumMediaTypes> emt;
     440            HRESULT hr = pin->EnumMediaTypes(emt.pparam());
    461441            if (hr != S_OK) {
    462442                return hr;
     
    471451                        return S_OK;
    472452                    } else {
    473                         setConnectedType(defaultMediaType());
     453                        setConnectedType(defaultMediaType);
    474454                        freeMediaType(type);
    475455                    }
     
    521501        void QPin::setConnectedType(const AM_MEDIA_TYPE &type)
    522502        {
    523             QWriteLocker locker(&m_lock);
     503            QMutexLocker locker(&m_mutex);
    524504
    525505            //1st we free memory
     
    531511        const AM_MEDIA_TYPE &QPin::connectedType() const
    532512        {
    533             QReadLocker locker(&m_lock);
     513            QMutexLocker locker(&m_mutex);
    534514            return m_connectedType;
    535515        }
     
    537517        void QPin::setConnected(IPin *pin)
    538518        {
    539             QWriteLocker locker(&m_lock);
     519            QMutexLocker locker(&m_mutex);
    540520            if (pin) {
    541521                pin->AddRef();
     
    549529        IPin *QPin::connected(bool addref) const
    550530        {
    551             QReadLocker locker(&m_lock);
     531            QMutexLocker locker(&m_mutex);
    552532            if (addref && m_connected) {
    553533                m_connected->AddRef();
     
    558538        bool QPin::isFlushing() const
    559539        {
    560             QReadLocker locker(&m_lock);
     540            QMutexLocker locker(&m_mutex);
    561541            return m_flushing;
    562542        }
     
    564544        FILTER_STATE QPin::filterState() const
    565545        {
    566             QReadLocker locker(&m_lock);
    567546            FILTER_STATE fstate = State_Stopped;
    568547            m_parent->GetState(0, &fstate);
     
    572551        QVector<AM_MEDIA_TYPE> QPin::mediaTypes() const
    573552        {
    574             QReadLocker locker(&m_lock);
     553            QMutexLocker locker(&m_mutex);
    575554            return m_mediaTypes;
    576555        }
     
    608587        void QPin::setMemoryAllocator(IMemAllocator *alloc)
    609588        {
    610             QWriteLocker locker(&m_lock);
     589            QMutexLocker locker(&m_mutex);
    611590            if (alloc) {
    612591                alloc->AddRef();
     
    620599        IMemAllocator *QPin::memoryAllocator(bool addref) const
    621600        {
    622             QReadLocker locker(&m_lock);
     601            QMutexLocker locker(&m_mutex);
    623602            if (addref && m_memAlloc) {
    624603                m_memAlloc->AddRef();
  • trunk/src/3rdparty/phonon/ds9/qpin.h

    r2 r561  
    2323#include <QtCore/QString>
    2424#include <QtCore/QVector>
    25 #include <QtCore/QReadWriteLock>
     25#include <QtCore/QMutex>
    2626
    2727#include <dshow.h>
     
    8686        protected:
    8787            //this can be used by sub-classes
    88             mutable QReadWriteLock m_lock;
    89             QBaseFilter *m_parent;
     88            mutable QMutex m_mutex;
     89            QBaseFilter * const m_parent;
    9090            bool m_flushing;
    9191
     
    9999            QVector<AM_MEDIA_TYPE> m_mediaTypes; //accepted media types
    100100            AM_MEDIA_TYPE m_connectedType;
    101             QString m_name;
    102101            IMemAllocator *m_memAlloc;
    103102        };
  • trunk/src/3rdparty/phonon/ds9/videorenderer_soft.cpp

    r2 r561  
    6464"!!ARBfp1.0"
    6565"PARAM c[5] = { program.local[0..1],"
    66 "                { 1.164, 0, 1.596, 0.5 },"
    67 "                { 0.0625, 1.164, -0.391, -0.81300002 },"
    68 "                { 1.164, 2.0179999, 0 } };"
     66"{ 1.164, 0, 1.596, 0.5 },"
     67"{ 0.0625, 1.164, -0.391, -0.81300002 },"
     68"{ 1.164, 2.0179999, 0 } };"
    6969"TEMP R0;"
    7070"TEX R0.x, fragment.texcoord[0], texture[1], 2D;"
     
    9090
    9191static const char yuy2ToRgb[] =
    92     "!!ARBfp1.0"
     92"!!ARBfp1.0"
    9393"PARAM c[5] = { program.local[0..1],"
    94 "                { 0.5, 2, 1, 0.0625 },"
    95 "                { 1.164, 0, 1.596, 2.0179999 },"
    96 "                { 1.164, -0.391, -0.81300002 } };"
     94"{ 0.5, 2, 1, 0.0625 },"
     95"{ 1.164, 0, 1.596, 2.0179999 },"
     96"{ 1.164, -0.391, -0.81300002 } };"
    9797"TEMP R0;"
    9898"TEMP R1;"
     
    150150        static const QVector<AM_MEDIA_TYPE> videoMediaTypes()
    151151        {
    152             AM_MEDIA_TYPE mt;
    153             qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE));
    154             mt.majortype = MEDIATYPE_Video;
    155 
    156             //we accept any video format
    157             mt.formattype = GUID_NULL;
    158             mt.cbFormat = 0;
    159             mt.pbFormat = 0;
     152            AM_MEDIA_TYPE mt = { MEDIATYPE_Video, MEDIASUBTYPE_YV12, 0, 0, 0, GUID_NULL, 0, 0, 0 };
    160153
    161154            QVector<AM_MEDIA_TYPE> ret;
    162155
    163             //we support YUV (YV12 and YUY2) and RGB32
    164             mt.subtype = MEDIASUBTYPE_YV12;
    165             ret << mt;
     156            //we add all the subtypes we support
     157            ret << mt; //YV12
    166158            mt.subtype = MEDIASUBTYPE_YUY2;
    167             ret << mt;
     159            ret << mt; //YUY2
    168160            mt.subtype = MEDIASUBTYPE_RGB32;
    169             ret << mt;
     161            ret << mt; //RGB32
    170162
    171163            return ret;
     
    203195#ifndef QT_NO_OPENGL
    204196                freeGLResources();
     197                m_textureUploaded = false;
    205198#endif // QT_NO_OPENGL
    206                 m_textureUploaded = false;
    207199            }
    208200
     
    323315            HANDLE m_renderEvent, m_receiveCanWait;         // Signals sample to render
    324316            QSize m_size;
    325             bool m_textureUploaded;
    326317
    327318            //mixer settings
     
    365356            bool m_checkedPrograms;
    366357            bool m_usingOpenGL;
     358            bool m_textureUploaded;
    367359            GLuint m_program[2];
    368360            GLuint m_texture[3];
     
    374366        public:
    375367            VideoRendererSoftPin(VideoRendererSoftFilter *parent) :
    376               QMemInputPin(parent, videoMediaTypes(), false /*no transformation of the samples*/),
     368              QMemInputPin(parent, videoMediaTypes(), false /*no transformation of the samples*/, 0),
    377369                  m_renderer(parent)
    378370              {
     
    445437            m_renderer(renderer), m_start(0)
    446438#ifndef QT_NO_OPENGL
    447             ,m_usingOpenGL(false), m_checkedPrograms(false), m_textureUploaded(false)
     439            , m_checkedPrograms(false), m_usingOpenGL(false), m_textureUploaded(false)
    448440#endif
    449441        {
     
    670662
    671663#ifndef QT_NO_OPENGL
    672             if (painter.paintEngine() && painter.paintEngine()->type() == QPaintEngine::OpenGL && checkGLPrograms()) {
     664            if (painter.paintEngine() &&
     665                (painter.paintEngine()->type() == QPaintEngine::OpenGL || painter.paintEngine()->type() == QPaintEngine::OpenGL2)
     666                && checkGLPrograms()) {
     667
    673668                //for now we only support YUV (both YV12 and YUY2)
    674669                updateTexture();
     
    682677
    683678                //let's draw the texture
     679                painter.beginNativePainting();
    684680
    685681                //Let's pass the other arguments
     
    731727
    732728                glDisable(GL_FRAGMENT_PROGRAM_ARB);
     729                painter.endNativePainting();
    733730                return;
    734731            } else
  • trunk/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp

    r2 r561  
    170170            ComPointer<IVMRWindowlessControl9> windowlessControl(m_filter, IID_IVMRWindowlessControl9);
    171171            windowlessControl->SetVideoClippingWindow(reinterpret_cast<HWND>(target->winId()));
     172            windowlessControl->SetAspectRatioMode(VMR9ARMode_None); //we're in control of the size
    172173        }
    173174
  • trunk/src/3rdparty/phonon/ds9/videowidget.cpp

    r2 r561  
    8585            {
    8686                m_currentRenderer = renderer;
    87                 update();
     87                //we disallow repaint on that widget for just a fraction of second
     88                //this allows better transition between videos
     89                setUpdatesEnabled(false);
     90                m_flickerFreeTimer.start(20, this);
     91            }
     92
     93            void timerEvent(QTimerEvent *e)
     94            {
     95                if (e->timerId() == m_flickerFreeTimer.timerId()) {
     96                    m_flickerFreeTimer.stop();
     97                    setUpdatesEnabled(true);
     98                }
     99                QWidget::timerEvent(e);
    88100            }
    89101
     
    107119            void paintEvent(QPaintEvent *e)
    108120            {
     121                if (!updatesEnabled())
     122                    return; //this avoids repaint from native events
    109123                checkCurrentRenderingMode();
    110124                m_currentRenderer->repaintCurrentFrame(this, e->rect());
     
    154168                } else if (!isEmbedded()) {
    155169                    m_currentRenderer = m_node->switchRendering(m_currentRenderer);
    156                     setAttribute(Qt::WA_PaintOnScreen, true);
     170                    setAttribute(Qt::WA_PaintOnScreen, false);
    157171                }
    158172            }
     
    161175            AbstractVideoRenderer *m_currentRenderer;
    162176            QVariant m_restoreScreenSaverActive;
     177            QBasicTimer m_flickerFreeTimer;
    163178        };
    164179
     
    262277            m_aspectRatio = aspectRatio;
    263278            updateVideoSize();
     279            m_widget->update();
    264280        }
    265281
     
    280296            m_scaleMode = scaleMode;
    281297            updateVideoSize();
     298            m_widget->update();
    282299        }
    283300
  • trunk/src/3rdparty/phonon/ds9/volumeeffect.cpp

    r2 r561  
    6969        {
    7070            QVector<AM_MEDIA_TYPE> ret;
    71 
    72             AM_MEDIA_TYPE mt;
    73             mt.majortype = MEDIATYPE_Audio;
    74             mt.subtype = MEDIASUBTYPE_PCM;
    75             mt.bFixedSizeSamples = 1;
    76             mt.bTemporalCompression = 0;
    77             mt.pUnk = 0;
    78             mt.lSampleSize = 1;
    79             mt.cbFormat = 0;
    80             mt.pbFormat = 0;
    81             mt.formattype = GUID_NULL;
     71            AM_MEDIA_TYPE mt = { MEDIATYPE_Audio, MEDIASUBTYPE_PCM, 1, 0, 1, GUID_NULL, 0, 0, 0};
    8272            ret << mt;
    8373            return ret;
     
    8777        {
    8878        public:
    89             VolumeMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt) : QMemInputPin(parent, mt, true /*transform*/)
     79            VolumeMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, QPin *output) : QMemInputPin(parent, mt, true /*transform*/, output)
    9080            {
    9181            }
     
    150140            //then creating the input
    151141            mt << audioMediaType();
    152             m_input = new VolumeMemInputPin(this, mt);
    153             m_input->addOutput(m_output); //make the connection here
     142            m_input = new VolumeMemInputPin(this, mt, m_output);
    154143        }
    155144
  • trunk/src/3rdparty/phonon/gstreamer/CMakeLists.txt

    r2 r561  
    1818
    1919if (BUILD_PHONON_GSTREAMER)
    20    include_directories(${GSTREAMER_INCLUDE_DIR} ${GLIB2_INCLUDE_DIR}
    21       ${LIBXML2_INCLUDE_DIR})
     20   include_directories(
     21          ${CMAKE_CURRENT_BINARY_DIR}
     22          ${GSTREAMER_INCLUDE_DIR}
     23          ${GLIB2_INCLUDE_DIR}
     24      ${LIBXML2_INCLUDE_DIR}
     25          ${X11_X11_INCLUDE_PATH})
     26   add_definitions(-DPHONON_BACKEND_VERSION_4_2)
     27
     28   # configure plugin api
     29   if(USE_INSTALL_PLUGIN)
     30      set(PLUGIN_INSTALL_API TRUE)
     31   endif(USE_INSTALL_PLUGIN)
     32
     33   configure_file(phonon-config-gstreamer.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/phonon-config-gstreamer.h )
    2234
    2335   set(phonon_gstreamer_SRCS
     
    4658
    4759   find_package(Alsa)
    48    if(ALSA_FOUND)
     60   macro_ensure_version("0.10.22" ${GSTREAMER_VERSION} GSTREAMER_HAS_NONBLOCKING_ALSASINK)
     61   if(ALSA_FOUND AND NOT GSTREAMER_HAS_NONBLOCKING_ALSASINK)
    4962      add_definitions(-DUSE_ALSASINK2)
    5063      include_directories(${ALSA_INCLUDES})
     
    5366         alsasink2.c
    5467         )
    55    endif(ALSA_FOUND)
     68   endif(ALSA_FOUND AND NOT GSTREAMER_HAS_NONBLOCKING_ALSASINK)
    5669
    57    automoc4(phonon_gstreamer phonon_gstreamer_SRCS)
    58    add_library(phonon_gstreamer SHARED ${phonon_gstreamer_SRCS})
     70   automoc4_add_library(phonon_gstreamer MODULE ${phonon_gstreamer_SRCS})
    5971   set_target_properties(phonon_gstreamer PROPERTIES PREFIX "")
    6072   target_link_libraries(phonon_gstreamer
  • trunk/src/3rdparty/phonon/gstreamer/abstractrenderer.cpp

    r2 r561  
    1818#include "abstractrenderer.h"
    1919
     20#ifndef QT_NO_PHONON_VIDEO
    2021QT_BEGIN_NAMESPACE
    2122
     
    5354
    5455QT_END_NAMESPACE
     56#endif //QT_NO_PHONON_VIDEO
    5557
    56 
  • trunk/src/3rdparty/phonon/gstreamer/abstractrenderer.h

    r2 r561  
    2424#include <phonon/videowidget.h>
    2525
     26#ifndef QT_NO_PHONON_VIDEO
    2627QT_BEGIN_NAMESPACE
    2728
     
    5960
    6061QT_END_NAMESPACE
    61 
     62#endif //QT_NO_PHONON_VIDEO
    6263#endif // Phonon_GSTREAMER_ABSTRACTRENDERER_H
  • trunk/src/3rdparty/phonon/gstreamer/artssink.cpp

    r2 r561  
    234234    GST_DEBUG_OBJECT (src, "initializing artssink");
    235235    src->stream = 0;
    236 
     236#ifndef QT_NO_LIBRARY
    237237    p_arts_init =  (Ptr_arts_init)QLibrary::resolve(QLatin1String("artsc"), 0, "arts_init");
    238238    p_arts_play_stream =  (Ptr_arts_play_stream)QLibrary::resolve(QLatin1String("artsc"), 0, "arts_play_stream");
     
    251251    }
    252252    sinkCount ++;
     253#endif //QT_NO_LIBRARY
    253254}
    254255
  • trunk/src/3rdparty/phonon/gstreamer/audioeffect.cpp

    r2 r561  
    2424
    2525#include <gst/gst.h>
    26 
     26#ifndef QT_NO_PHONON_EFFECT
    2727QT_BEGIN_NAMESPACE
    2828
     
    7676
    7777QT_END_NAMESPACE
     78#endif //QT_NO_PHONON_EFFECT
    7879#include "moc_audioeffect.cpp"
  • trunk/src/3rdparty/phonon/gstreamer/audioeffect.h

    r2 r561  
    3030#include <gst/gst.h>
    3131
     32#ifndef QT_NO_PHONON_EFFECT
    3233QT_BEGIN_NAMESPACE
    33 
    3434namespace Phonon
    3535{
     
    5050    };
    5151}} //namespace Phonon::Gstreamer
    52 
    5352QT_END_NAMESPACE
     53#endif //QT_NO_PHONON_EFFECT
    5454
    5555#endif // Phonon_GSTREAMER_AUDIOEFFECT_H
  • trunk/src/3rdparty/phonon/gstreamer/audiooutput.cpp

    r2 r561  
    4343    m_name = "AudioOutput" + QString::number(count++);
    4444    if (m_backend->isValid()) {
    45         g_set_application_name(qApp->applicationName().toUtf8());
    4645        m_audioBin = gst_bin_new (NULL);
    4746        gst_object_ref (GST_OBJECT (m_audioBin));
     
    138137    bool success = false;
    139138    const QList<AudioDevice> deviceList = m_backend->deviceManager()->audioOutputDevices();
    140     if (m_audioSink &&  newDevice >= 0 && newDevice < deviceList.size()) {
     139    int deviceIdx = -1;
     140    for (int i=0; i<deviceList.size(); i++) {
     141        if (deviceList.at(i).id == newDevice) {
     142            deviceIdx = i;
     143            break;
     144        }
     145    }
     146
     147    if (m_audioSink && deviceIdx >= 0) {
    141148        // Save previous state
    142149        GstState oldState = GST_STATE(m_audioSink);
    143150        const QByteArray oldDeviceValue = GstHelper::property(m_audioSink, "device");
    144         const QByteArray deviceId = deviceList.at(newDevice).gstId;
     151        const QByteArray deviceId = deviceList.at(deviceIdx).gstId;
    145152        m_device = newDevice;
    146153
  • trunk/src/3rdparty/phonon/gstreamer/backend.cpp

    r2 r561  
    5050        , m_isValid(false)
    5151{
     52    // In order to support reloading, we only set the app name once...
     53    static bool first = true;
     54    if (first) {
     55        first = false;
     56        g_set_application_name(qApp->applicationName().toUtf8());
     57    }
     58
    5259    GError *err = 0;
    5360    bool wasInit = gst_init_check(0, 0, &err);  //init gstreamer: must be called before any gst-related functions
     
    5663
    5764    qRegisterMetaType<Message>("Message");
    58 
     65#ifndef QT_NO_PROPERTIES
    5966    setProperty("identifier",     QLatin1String("phonon_gstreamer"));
    6067    setProperty("backendName",    QLatin1String("Gstreamer"));
    6168    setProperty("backendComment", QLatin1String("Gstreamer plugin for Phonon"));
    6269    setProperty("backendVersion", QLatin1String("0.2"));
    63     setProperty("backendWebsite", QLatin1String("http://qtsoftware.com/"));
     70    setProperty("backendWebsite", QLatin1String("http://qt.nokia.com/"));
     71#endif //QT_NO_PROPERTIES
    6472
    6573    //check if we should enable debug output
     
    8593Backend::~Backend()
    8694{
    87     gst_deinit();
    8895}
    8996
     
    118125            return ao;
    119126        }
     127#ifndef QT_NO_PHONON_EFFECT
    120128    case EffectClass:
    121129        return new AudioEffect(this, args[0].toInt(), parent);
    122 
     130#endif //QT_NO_PHONON_EFFECT
    123131    case AudioDataOutputClass:
    124132        logMessage("createObject() : AudioDataOutput not implemented");
    125133        break;
    126134
     135#ifndef QT_NO_PHONON_VIDEO
    127136    case VideoDataOutputClass:
    128137        logMessage("createObject() : VideoDataOutput not implemented");
     
    133142            return new VideoWidget(this, widget);
    134143        }
    135 
     144#endif //QT_NO_PHONON_VIDEO
     145#ifndef QT_NO_PHONON_VOLUMEFADEREFFECT
    136146    case VolumeFaderEffectClass:
    137147        return new VolumeFaderEffect(this, parent);
     148#endif //QT_NO_PHONON_VOLUMEFADEREFFECT
    138149
    139150    case VisualizationClass:  //Fall through
     
    204215        QString klass = gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature));
    205216
    206         if (klass == QLatin1String("Codec/Decoder/Audio") ||
    207             klass == QLatin1String("Codec/Decoder/Video")) {
     217        if (klass == QLatin1String("Codec/Decoder") ||
     218            klass == QLatin1String("Codec/Decoder/Audio") ||
     219            klass == QLatin1String("Codec/Decoder/Video") ||
     220            klass == QLatin1String("Codec/Demuxer") ||
     221            klass == QLatin1String("Codec/Demuxer/Audio") ||
     222            klass == QLatin1String("Codec/Demuxer/Video") ||
     223            klass == QLatin1String("Codec/Parser") ||
     224            klass == QLatin1String("Codec/Parser/Audio") ||
     225            klass == QLatin1String("Codec/Parser/Video")) {
    208226
    209227            const GList *static_templates;
     
    277295    case Phonon::AudioOutputDeviceType: {
    278296            QList<AudioDevice> audioDevices = deviceManager()->audioOutputDevices();
    279             if (index >= 0 && index < audioDevices.size()) {
    280                 ret.insert("name", audioDevices[index].gstId);
    281                 ret.insert("description", audioDevices[index].description);
    282                 ret.insert("icon", QLatin1String("audio-card"));
     297            foreach(const AudioDevice &device, audioDevices) {
     298                if (device.id == index) {
     299                    ret.insert("name", device.gstId);
     300                    ret.insert("description", device.description);
     301                    ret.insert("icon", QLatin1String("audio-card"));
     302                    break;
     303                }
    283304            }
    284305        }
  • trunk/src/3rdparty/phonon/gstreamer/devicemanager.cpp

    r2 r561  
    7373        , m_backend(backend)
    7474{
     75    m_audioSink = qgetenv("PHONON_GST_AUDIOSINK");
     76    m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE");
     77
     78#ifndef QT_NO_SETTINGS
    7579    QSettings settings(QLatin1String("Trolltech"));
    7680    settings.beginGroup(QLatin1String("Qt"));
    7781
    78     m_audioSink = qgetenv("PHONON_GST_AUDIOSINK");
    7982    if (m_audioSink.isEmpty()) {
    8083        m_audioSink = settings.value(QLatin1String("audiosink"), "Auto").toByteArray().toLower();
    8184    }
    8285
    83     m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE");
    8486    if (m_videoSinkWidget.isEmpty()) {
    8587        m_videoSinkWidget = settings.value(QLatin1String("videomode"), "Auto").toByteArray().toLower();
    8688    }
     89#endif //QT_NO_SETTINGS
    8790
    8891    if (m_backend->isValid())
     
    244247}
    245248
     249#ifndef QT_NO_PHONON_VIDEO
    246250AbstractRenderer *DeviceManager::createVideoRenderer(VideoWidget *parent)
    247251{
     
    266270    return new WidgetRenderer(parent);
    267271}
     272#endif //QT_NO_PHONON_VIDEO
    268273
    269274/*
  • trunk/src/3rdparty/phonon/gstreamer/effect.cpp

    r2 r561  
    2626#include <gst/gst.h>
    2727
     28#ifndef QT_NO_PHONON_EFFECT
    2829QT_BEGIN_NAMESPACE
    29 
    3030namespace Phonon
    3131{
     
    242242}
    243243} //namespace Phonon::Gstreamer
    244 
    245244QT_END_NAMESPACE
     245#endif //QT_NO_PHONON_EFFECT
    246246#include "moc_effect.cpp"
  • trunk/src/3rdparty/phonon/gstreamer/effect.h

    r2 r561  
    2929#include <gst/gst.h>
    3030
     31#ifndef QT_NO_PHONON_EFFECT
    3132QT_BEGIN_NAMESPACE
    32 
    3333namespace Phonon
    3434{
     
    5959    };
    6060}} //namespace Phonon::Gstreamer
    61 
    6261QT_END_NAMESPACE
     62#endif //QT_NO_PHONON_EFFECT
    6363
    6464#endif // Phonon_GSTREAMER_EFFECT_H
  • trunk/src/3rdparty/phonon/gstreamer/mediaobject.cpp

    r2 r561  
    8888
    8989    if (!m_backend->isValid()) {
    90         setError(tr("Cannot start playback. \n\nCheck your Gstreamer installation and make sure you "
     90        setError(tr("Cannot start playback. \n\nCheck your GStreamer installation and make sure you "
    9191                    "\nhave libgstreamer-plugins-base installed."), Phonon::FatalError);
    9292    } else {
     
    9696        connect(m_tickTimer, SIGNAL(timeout()), SLOT(emitTick()));
    9797    }
    98     connect(this, SIGNAL(stateChanged(Phonon::State, Phonon::State)),
    99             this, SLOT(notifyStateChange(Phonon::State, Phonon::State)));
     98    connect(this, SIGNAL(stateChanged(Phonon::State,Phonon::State)),
     99            this, SLOT(notifyStateChange(Phonon::State,Phonon::State)));
    100100
    101101}
     
    227227
    228228    // These functions require GStreamer > 0.10.12
     229#ifndef QT_NO_LIBRARY
    229230    static Ptr_gst_pb_utils_init p_gst_pb_utils_init = 0;
    230231    static Ptr_gst_pb_utils_get_codec_description p_gst_pb_utils_get_codec_description = 0;
     
    240241        value = QString::fromUtf8(codecName);
    241242        g_free (codecName);
    242     } else {
     243    } else
     244#endif //QT_NO_LIBRARY
     245    {
    243246        // For GStreamer versions < 0.10.12
    244247        GstStructure *str = gst_caps_get_structure (caps, 0);
    245248        value = QString::fromUtf8(gst_structure_get_name (str));
     249
    246250    }
    247251    media->addMissingCodecName(value);
     
    341345    GstPad *decodepad = static_cast<GstPad*>(data);
    342346    gst_pad_link (pad, decodepad);
    343     gst_object_unref (decodepad);
     347    //gst_object_unref (decodepad);
    344348}
    345349
     
    369373    if (!m_datasource)
    370374        return false;
     375
     376    // Set the device for MediaSource::Disc
     377    if (m_source.type() == MediaSource::Disc) {
     378
     379        if (g_object_class_find_property (G_OBJECT_GET_CLASS (m_datasource), "device")) {
     380            QByteArray mediaDevice = QFile::encodeName(m_source.deviceName());
     381            if (!mediaDevice.isEmpty())
     382                g_object_set (G_OBJECT (m_datasource), "device", mediaDevice.constData(), (const char*)NULL);
     383        }
     384
     385        // Also Set optical disc speed to 2X for Audio CD
     386        if (m_source.discType() == Phonon::Cd
     387            && (g_object_class_find_property (G_OBJECT_GET_CLASS (m_datasource), "read-speed"))) {
     388            g_object_set (G_OBJECT (m_datasource), "read-speed", 2, (const char*)NULL);
     389            m_backend->logMessage(QString("new device speed : 2X"), Backend::Info, this);
     390        }
     391    }
    371392
    372393    // Link data source into pipeline
     
    388409bool MediaObject::createPipefromStream(const MediaSource &source)
    389410{
     411#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    390412    // Remove any existing data source
    391413    if (m_datasource) {
     
    409431    }
    410432    return true;
     433#else //QT_NO_PHONON_ABSTRACTMEDIASTREAM
     434    Q_UNUSED(source);
     435    return false;
     436#endif
    411437}
    412438
     
    903929        break;
    904930
    905     case MediaSource::Disc: // CD tracks can be specified by setting the url in the following way uri=cdda:4
     931    case MediaSource::Disc:
    906932        {
    907             QUrl cdurl(QLatin1String("cdda://"));
    908             if (createPipefromURL(cdurl))
     933            QString mediaUrl;
     934            switch (source.discType()) {
     935            case Phonon::NoDisc:
     936                qWarning() << "I should never get to see a MediaSource that is a disc but doesn't specify which one";
     937                return;
     938            case Phonon::Cd:  // CD tracks can be specified by setting the url in the following way uri=cdda:4
     939                mediaUrl = QLatin1String("cdda://");
     940                break;
     941            case Phonon::Dvd:
     942                mediaUrl = QLatin1String("dvd://");
     943                break;
     944            case Phonon::Vcd:
     945                mediaUrl = QLatin1String("vcd://");
     946                break;
     947            default:
     948                qWarning() <<  "media " << source.discType() << " not implemented";
     949                return;
     950            }
     951            if (!mediaUrl.isEmpty() && createPipefromURL(QUrl(mediaUrl)))
    909952                m_loading = true;
    910953            else
     
    9661009    GstFormat format = gst_format_get_by_nick("track");
    9671010    if (gst_element_query_duration (m_pipeline, &format, &titleCount)) {
    968         int oldAvailableTitles = m_availableTitles;
    969         m_availableTitles = (int)titleCount;
    970         if (m_availableTitles != oldAvailableTitles) {
    971             emit availableTitlesChanged(m_availableTitles);
    972             m_backend->logMessage(QString("Available titles changed: %0").arg(m_availableTitles), Backend::Info, this);
     1011        //check if returned format is still "track",
     1012        //gstreamer sometimes returns the total time, if tracks information is not available.
     1013        if (qstrcmp(gst_format_get_name(format), "track") == 0)  {
     1014            int oldAvailableTitles = m_availableTitles;
     1015            m_availableTitles = (int)titleCount;
     1016            if (m_availableTitles != oldAvailableTitles) {
     1017                emit availableTitlesChanged(m_availableTitles);
     1018                m_backend->logMessage(QString("Available titles changed: %0").arg(m_availableTitles), Backend::Info, this);
     1019            }
    9731020        }
    9741021    }
  • trunk/src/3rdparty/phonon/gstreamer/phononsrc.cpp

    r2 r561  
    110110{
    111111    Q_UNUSED(g_class);
     112#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    112113    src->device = 0;
     114#else
     115    Q_UNUSED(src);
     116#endif
    113117}
    114118
    115119static void phonon_src_finalize (GObject * object)
    116120{
     121#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    117122    PhononSrc *src;
    118123    src = GST_PHONON_SRC (object);
    119124    delete src->device;
    120125    src->device = 0;
     126#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
    121127    G_OBJECT_CLASS (parent_class)->finalize (object);
    122128}
    123129
     130#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    124131static gboolean phonon_src_set_device(PhononSrc * src, StreamReader* device)
    125132{
     
    146153    }
    147154}
     155#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
    148156
    149157static void phonon_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
     
    154162
    155163    switch (prop_id) {
     164#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    156165    case ARG_PHONONSRC:
    157166    {
     
    161170        break;
    162171    }
     172#else
     173    Q_UNUSED(value);
     174#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
    163175   default:
    164176       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     
    175187
    176188    switch (prop_id) {
     189#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    177190    case ARG_PHONONSRC:
    178191        g_value_set_pointer(value, src->device);
    179192        break;
     193#else //QT_NO_PHONON_ABSTRACTMEDIASTREAM
     194    Q_UNUSED(value);
     195#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
    180196    default:
    181197        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     
    186202static GstFlowReturn phonon_src_create_read (PhononSrc * src, guint64 offset, guint length, GstBuffer ** buffer)
    187203{
     204#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    188205    Q_ASSERT(src->device);
    189206    if (!src->device)
     
    205222    gst_mini_object_unref(GST_MINI_OBJECT(buf));
    206223    return GST_FLOW_ERROR;
     224#else //QT_NO_PHONON_ABSTRACTMEDIASTREAM
     225    Q_UNUSED(src);
     226    Q_UNUSED(offset);
     227    Q_UNUSED(length);
     228    Q_UNUSED(buffer);
     229    return GST_FLOW_ERROR;
     230#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
    207231}
    208232
     
    219243{
    220244    PhononSrc *src = GST_PHONON_SRC (basesrc);
     245#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    221246    if (src->device)
    222247        return src->device->streamSeekable();
     248#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
    223249    return false;
    224250}
     
    226252static gboolean phonon_src_get_size (GstBaseSrc * basesrc, guint64 * size)
    227253{
     254#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    228255    PhononSrc *src;
    229256    src = GST_PHONON_SRC (basesrc);
     
    232259        return TRUE;
    233260    }
     261#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
    234262    *size = 0;
    235263    return FALSE;
  • trunk/src/3rdparty/phonon/gstreamer/phononsrc.h

    r2 r561  
    5050struct _PhononSrc {
    5151    GstBaseSrc element;
     52#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    5253    StreamReader *device;
     54#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
    5355};
    5456
  • trunk/src/3rdparty/phonon/gstreamer/streamreader.cpp

    r2 r561  
    2121
    2222QT_BEGIN_NAMESPACE
    23 
     23#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    2424namespace Phonon
    2525{
     
    5050}
    5151}
     52#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
    5253
    5354QT_END_NAMESPACE
  • trunk/src/3rdparty/phonon/gstreamer/streamreader.h

    r2 r561  
    2323
    2424QT_BEGIN_NAMESPACE
     25
     26#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    2527
    2628namespace Phonon
     
    9294}
    9395
     96#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
     97
    9498QT_END_NAMESPACE
    9599
  • trunk/src/3rdparty/phonon/gstreamer/videowidget.cpp

    r2 r561  
    3434#include "x11renderer.h"
    3535
     36#ifndef QT_NO_PHONON_VIDEO
    3637QT_BEGIN_NAMESPACE
    3738
     
    384385
    385386QT_END_NAMESPACE
     387#endif //QT_NO_PHONON_VIDEO
    386388
    387389#include "moc_videowidget.cpp"
  • trunk/src/3rdparty/phonon/gstreamer/videowidget.h

    r2 r561  
    2929#include <gst/gst.h>
    3030
     31#ifndef QT_NO_PHONON_VIDEO
    3132QT_BEGIN_NAMESPACE
    3233
     
    103104
    104105QT_END_NAMESPACE
    105 
     106#endif //QT_NO_PHONON_VIDEO
    106107#endif // Phonon_GSTREAMER_VIDEOWIDGET_H
  • trunk/src/3rdparty/phonon/gstreamer/volumefadereffect.cpp

    r2 r561  
    2222QT_BEGIN_NAMESPACE
    2323
     24#ifndef QT_NO_PHONON_VOLUMEFADEREFFECT
    2425namespace Phonon
    2526{
    2627namespace Gstreamer
    2728{
    28 
    2929VolumeFaderEffect::VolumeFaderEffect(Backend *backend, QObject *parent)
    3030    : Effect(backend, parent, AudioSource | AudioSink)
     
    157157
    158158}} //namespace Phonon::Gstreamer
    159 
     159#endif //QT_NO_PHONON_VOLUMEFADEREFFECT
    160160QT_END_NAMESPACE
    161161
  • trunk/src/3rdparty/phonon/gstreamer/volumefadereffect.h

    r2 r561  
    3131
    3232QT_BEGIN_NAMESPACE
    33 
     33#ifndef QT_NO_PHONON_VOLUMEFADEREFFECT
    3434namespace Phonon
    3535{
     
    6565    };
    6666}} //namespace Phonon::Gstreamer
    67 
     67#endif //QT_NO_PHONON_VOLUMEFADEREFFECT
    6868QT_END_NAMESPACE
    6969
  • trunk/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp

    r2 r561  
    3333#endif
    3434
     35#ifndef QT_NO_PHONON_VIDEO
    3536QT_BEGIN_NAMESPACE
    3637
     
    149150
    150151QT_END_NAMESPACE
     152#endif //QT_NO_PHONON_VIDEO
  • trunk/src/3rdparty/phonon/gstreamer/widgetrenderer.h

    r2 r561  
    2727#endif
    2828
     29#ifndef QT_NO_PHONON_VIDEO
    2930QT_BEGIN_NAMESPACE
    3031
     
    6061
    6162QT_END_NAMESPACE
    62 
     63#endif //QT_NO_PHONON_VIDEO
    6364#endif // Phonon_GSTREAMER_WIDGETRENDERER_H
  • trunk/src/3rdparty/phonon/includes/CMakeLists.txt

    r2 r561  
    3636  Phonon/VolumeFaderInterface
    3737  Phonon/VolumeSlider
    38 DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Phonon)
     38DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Phonon COMPONENT Devel)
    3939
    4040install(FILES
     
    4747  Phonon/Experimental/VideoFrame2
    4848  Phonon/Experimental/Visualization
    49 DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Phonon/Experimental)
     49DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Phonon/Experimental COMPONENT Devel)
  • trunk/src/3rdparty/phonon/phonon/abstractaudiooutput.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/abstractaudiooutput.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/abstractaudiooutput_p.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/abstractaudiooutput_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/abstractmediastream.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    5050AbstractMediaStream::~AbstractMediaStream()
    5151{
    52     delete d_ptr;
    5352}
    5453
  • trunk/src/3rdparty/phonon/phonon/abstractmediastream.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    215215
    216216        AbstractMediaStream(AbstractMediaStreamPrivate &dd, QObject *parent);
    217         AbstractMediaStreamPrivate *d_ptr;
     217        QScopedPointer<AbstractMediaStreamPrivate> d_ptr;
    218218};
    219219
  • trunk/src/3rdparty/phonon/phonon/abstractmediastream_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    4646        void setStreamInterface(StreamInterface *);
    4747        void setMediaObjectPrivate(MediaObjectPrivate *);
     48        ~AbstractMediaStreamPrivate();
    4849
    4950    protected:
     
    5758        {
    5859        }
    59         ~AbstractMediaStreamPrivate();
    6060
    6161        virtual void setStreamSize(qint64 newSize);
  • trunk/src/3rdparty/phonon/phonon/abstractvideooutput.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/abstractvideooutput.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/abstractvideooutput_p.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/abstractvideooutput_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/addoninterface.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/audiooutput.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    3030#include "platform_p.h"
    3131
    32 #include <qmath.h>
     32#include <QtCore/qmath.h>
    3333
    3434#define PHONON_CLASSNAME AudioOutput
     
    127127    setVolume(Platform::loadVolume(newName));
    128128#ifndef QT_NO_DBUS
    129     emit d->adaptor->nameChanged(newName);
     129    if (d->adaptor) {
     130        emit d->adaptor->nameChanged(newName);
     131    }
    130132#endif
    131133}
     
    258260    pINTERFACE_CALL(setVolume(pow(volume, VOLTAGE_TO_LOUDNESS_EXPONENT)));
    259261
     262#ifndef QT_NO_PHONON_SETTINGSGROUP
    260263    // if the output device is not available and the device was not explicitly set
    261264    if (!callSetOutputDevice(this, device) && !outputDeviceOverridden) {
     
    265268            return;
    266269        }
    267         foreach (int devIndex, deviceList) {
    268             const AudioOutputDevice &dev = AudioOutputDevice::fromIndex(devIndex);
     270        for (int i = 0; i < deviceList.count(); ++i) {
     271            const AudioOutputDevice &dev = AudioOutputDevice::fromIndex(deviceList.at(i));
    269272            if (callSetOutputDevice(this, dev)) {
    270273                handleAutomaticDeviceChange(dev, AudioOutputPrivate::FallbackChange);
     
    277280        handleAutomaticDeviceChange(none, FallbackChange);
    278281    }
     282#endif //QT_NO_PHONON_SETTINGSGROUP
    279283}
    280284
     
    306310    // outputDeviceIndex identifies a failing device
    307311    // fall back in the preference list of output devices
    308     QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices);
    309     foreach (int devIndex, deviceList) {
     312#ifndef QT_NO_PHONON_SETTINGSGROUP
     313    const QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices);
     314    for (int i = 0; i < deviceList.count(); ++i) {
     315        const int devIndex = deviceList.at(i);
    310316        // if it's the same device as the one that failed, ignore it
    311317        if (device.index() != devIndex) {
     
    317323        }
    318324    }
     325#endif //QT_NO_PHONON_SETTINGSGROUP
    319326    // if we get here there is no working output device. Tell the backend.
    320327    const AudioOutputDevice none;
     
    326333{
    327334    pDebug() << Q_FUNC_INFO;
     335#ifndef QT_NO_PHONON_SETTINGSGROUP
    328336    // let's see if there's a usable device higher in the preference list
    329     QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings);
     337    const QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings);
    330338    DeviceChangeType changeType = HigherPreferenceChange;
    331     foreach (int devIndex, deviceList) {
     339    for (int i = 0; i < deviceList.count(); ++i) {
     340        const int devIndex = deviceList.at(i);
    332341        const AudioOutputDevice &info = AudioOutputDevice::fromIndex(devIndex);
    333342        if (!info.property("available").toBool()) {
     
    350359        }
    351360    }
     361#endif //QT_NO_PHONON_SETTINGSGROUP
    352362}
    353363
     
    402412{
    403413#ifndef QT_NO_DBUS
    404     emit adaptor->outputDestroyed();
     414    if (adaptor) {
     415        emit adaptor->outputDestroyed();
     416    }
    405417#endif
    406418}
  • trunk/src/3rdparty/phonon/phonon/audiooutput.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/audiooutput_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/audiooutputinterface.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/audiooutputinterface.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/backendcapabilities.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    7676{
    7777    QList<AudioOutputDevice> ret;
     78#ifndef QT_NO_PHONON_SETTINGSGROUP
    7879    const QList<int> deviceIndexes = GlobalConfig().audioOutputDeviceListFor(Phonon::NoCategory);
    79     foreach (int i, deviceIndexes) {
    80         ret.append(AudioOutputDevice::fromIndex(i));
     80    for (int i = 0; i < deviceIndexes.count(); ++i) {
     81        ret.append(AudioOutputDevice::fromIndex(deviceIndexes.at(i)));
    8182    }
     83#endif //QT_NO_PHONON_SETTINGSGROUP
    8284    return ret;
    8385}
     
    8991    QList<AudioCaptureDevice> ret;
    9092    const QList<int> deviceIndexes = GlobalConfig().audioCaptureDeviceListFor(Phonon::NoCategory);
    91     foreach (int i, deviceIndexes) {
    92         ret.append(AudioCaptureDevice::fromIndex(i));
     93    for (int i = 0; i < deviceIndexes.count(); ++i) {
     94        ret.append(AudioCaptureDevice::fromIndex(deviceIndexes.at(i)));
    9395    }
    9496    return ret;
     
    102104    QList<EffectDescription> ret;
    103105    if (backendIface) {
    104         QList<int> deviceIndexes = backendIface->objectDescriptionIndexes(Phonon::EffectType);
    105         foreach (int i, deviceIndexes) {
    106             ret.append(EffectDescription::fromIndex(i));
     106        const QList<int> deviceIndexes = backendIface->objectDescriptionIndexes(Phonon::EffectType);
     107        for (int i = 0; i < deviceIndexes.count(); ++i) {
     108            ret.append(EffectDescription::fromIndex(deviceIndexes.at(i)));
    107109        }
    108110    }
  • trunk/src/3rdparty/phonon/phonon/backendcapabilities.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    1616    Lesser General Public License for more details.
    1717
    18     You should have received a copy of the GNU Lesser General Public 
     18    You should have received a copy of the GNU Lesser General Public
    1919    License along with this library.  If not, see <http://www.gnu.org/licenses/>.
    2020
     
    8989
    9090    /**
    91      * Use this function to get a QObject pointer to connect to the capabilitiesChanged signal.
     91     * Use this function to get a QObject pointer to connect to one of the Notifier signals.
    9292     *
    9393     * \return a pointer to a QObject.
    9494     *
    95      * The capabilitiesChanged signal is emitted if the capabilities have changed. This can
    96      * happen if the user has requested a backend change.
    97      *
    98      * To connect to this signal do the following:
     95     * To connect to the signal do the following:
    9996     * \code
    10097     * QObject::connect(BackendCapabilities::notifier(), SIGNAL(capabilitiesChanged()), ...
     
    10299     *
    103100     * \see Notifier::capabilitiesChanged()
     101     * \see Notifier::availableAudioOutputDevicesChanged()
     102     * \see Notifier::availableAudioCaptureDevicesChanged()
    104103     */
    105104    PHONON_EXPORT Notifier *notifier();
  • trunk/src/3rdparty/phonon/phonon/backendcapabilities_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/backendinterface.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/effect.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    108108    if (m_backendObject) {
    109109        const QList<EffectParameter> parameters = pINTERFACE_CALL(parameters());
    110         foreach (const EffectParameter &p, parameters) {
     110        for (int i = 0; i < parameters.count(); ++i) {
     111            const EffectParameter &p = parameters.at(i);
    111112            parameterValues[p] = pINTERFACE_CALL(parameterValue(p));
    112113        }
     
    121122    // set up attributes
    122123    const QList<EffectParameter> parameters = pINTERFACE_CALL(parameters());
    123     foreach (const EffectParameter &p, parameters) {
     124    for (int i = 0; i < parameters.count(); ++i) {
     125        const EffectParameter &p = parameters.at(i);
    124126        pINTERFACE_CALL(setParameterValue(p, parameterValues[p]));
    125127    }
  • trunk/src/3rdparty/phonon/phonon/effect.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/effect_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/effectinterface.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/effectparameter.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/effectparameter.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/effectparameter_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/effectwidget.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    9898    QVBoxLayout *mainLayout = new QVBoxLayout(q);
    9999    mainLayout->setMargin(0);
    100     foreach (const EffectParameter &para, effect->parameters()) {
     100    const QList<Phonon::EffectParameter> parameters = effect->parameters();
     101    for (int i = 0; i < parameters.count(); ++i) {
     102        const EffectParameter &para = parameters.at(i);
    101103        QVariant value = effect->parameterValue(para);
    102104        QHBoxLayout *pLayout = new QHBoxLayout;
     
    118120                if (value.type() == QVariant::Int) {
    119121                    //value just defines the item index
    120                     foreach (const QVariant &item, para.possibleValues()) {
    121                         cb->addItem(item.toString());
     122                    for (int i = 0; i < para.possibleValues().count(); ++i) {
     123                        cb->addItem(para.possibleValues().at(i).toString());
    122124                    }
    123125                    cb->setCurrentIndex(value.toInt());
    124126                    QObject::connect(cb, SIGNAL(currentIndexChanged(int)), q, SLOT(_k_setIntParameter(int)));
    125127                } else {
    126                     foreach (const QVariant &item, para.possibleValues()) {
     128                    for (int i = 0; i < para.possibleValues().count(); ++i) {
     129                        const QVariant &item = para.possibleValues().at(i);
    127130                        cb->addItem(item.toString());
    128131                        if (item == value) {
     
    156159            }
    157160            break;
     161        case QMetaType::Float:
    158162        case QVariant::Double:
    159163            {
    160                 const double minValue = (para.minimumValue().type() == QVariant::Double ?
    161                     para.minimumValue().toDouble() : DEFAULT_MIN);
    162                 const double maxValue = (para.maximumValue().type() == QVariant::Double ?
    163                     para.maximumValue().toDouble() : DEFAULT_MAX);
     164                const qreal minValue = para.minimumValue().canConvert(QVariant::Double) ?
     165                    para.minimumValue().toReal() : DEFAULT_MIN;
     166                const qreal maxValue = para.maximumValue().canConvert(QVariant::Double) ?
     167                    para.maximumValue().toReal() : DEFAULT_MAX;
    164168
    165169                if (minValue == -1. && maxValue == 1.) {
    166170                    //Special case values between -1 and 1.0 to use a slider for improved usability
    167171                    QSlider *slider = new QSlider(Qt::Horizontal, q);
     172                    control = slider;
    168173                    slider->setRange(-SLIDER_RANGE, +SLIDER_RANGE);
    169                     slider->setValue(int(SLIDER_RANGE * value.toDouble()));
     174                    slider->setValue(int(SLIDER_RANGE * value.toReal()));
    170175                    slider->setTickPosition(QSlider::TicksBelow);
    171176                    slider->setTickInterval(TICKINTERVAL);
     
    189194        }
    190195
     196        if (control) {
    191197#ifndef QT_NO_TOOLTIP
    192198        control->setToolTip(para.description());
    193199#endif
    194         if (control) {
    195200#ifndef QT_NO_SHORTCUT
    196201            label->setBuddy(control);
  • trunk/src/3rdparty/phonon/phonon/effectwidget.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    4040
    4141    /** \class EffectWidget effectwidget.h Phonon/EffectWidget
    42      * \brief Widget to control the parameters of an \ref Effect.
     42     * \brief Widget to control the parameters of an Effect.
    4343     *
    4444     * \ingroup PhononWidgets
  • trunk/src/3rdparty/phonon/phonon/effectwidget_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/factory.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    112112bool FactoryPrivate::createBackend()
    113113{
     114#ifndef QT_NO_LIBRARY
    114115    Q_ASSERT(m_backendObject == 0);
    115116#ifndef QT_NO_PHONON_PLATFORMPLUGIN
     
    125126        // (finding the first loadable backend).
    126127        const QLatin1String suffix("/phonon_backend/");
    127         foreach (QString libPath, QCoreApplication::libraryPaths()) {
    128             libPath += suffix;
     128        const QStringList paths = QCoreApplication::libraryPaths();
     129        for (int i = 0; i < paths.count(); ++i) {
     130            const QString libPath = paths.at(i) + suffix;
    129131            const QDir dir(libPath);
    130132            if (!dir.exists()) {
     
    132134                continue;
    133135            }
    134             foreach (const QString &pluginName, dir.entryList(QDir::Files)) {
    135                 QPluginLoader pluginLoader(libPath + pluginName);
     136
     137                        QStringList plugins(dir.entryList(QDir::Files));
     138
     139#ifdef Q_OS_SYMBIAN
     140            /* On Symbian OS we might have two plugins, one which uses Symbian
     141             * MMF framework("phonon_mmf"), and one which uses Real Networks's
     142             * Helix("hxphonon"). We prefer the latter because it's more
     143             * sophisticated, so we make sure the Helix backend is attempted
     144             * to be loaded first, and the MMF backend is used for backup. */
     145            {
     146
     147                const int hxphonon = plugins.indexOf(QLatin1String("hxphonon"));
     148                if (hxphonon != -1)
     149                    plugins.move(hxphonon, 0);
     150
     151                // Code for debugging the MMF backend.
     152                if(hxphonon != -1) {
     153                    qDebug() << "Found hxphonon backend and removed it from the lookup list.";
     154                    plugins.removeAll(QLatin1String("hxphonon"));
     155                }
     156            }
     157#endif
     158
     159            for (int i = 0; i < plugins.count(); ++i) {
     160                QPluginLoader pluginLoader(libPath + plugins.at(i));
    136161                if (!pluginLoader.load()) {
    137162                    pDebug() << Q_FUNC_INFO << "  load failed:"
     
    163188
    164189    return true;
     190#else //QT_NO_LIBRARY
     191    pWarning() << Q_FUNC_INFO << "Trying to use Phonon with QT_NO_LIBRARY defined. "
     192                                 "That is currently not supported";
     193    return false;
     194#endif
    165195}
    166196
    167197FactoryPrivate::FactoryPrivate()
    168 #ifndef QT_NO_PHONON_PLATFORMPLUGIN
    169     : m_platformPlugin(0),
    170     m_noPlatformPlugin(false)
     198    :
     199#ifndef QT_NO_PHONON_PLATFORMPLUGIN
     200    m_platformPlugin(0),
     201    m_noPlatformPlugin(false),
    171202#endif //QT_NO_PHONON_PLATFORMPLUGIN
    172     , m_backendObject(0)
     203    m_backendObject(0)
    173204{
    174205    // Add the post routine to make sure that all other global statics (especially the ones from Qt)
     
    184215FactoryPrivate::~FactoryPrivate()
    185216{
    186     foreach (QObject *o, objects) {
    187         MediaObject *m = qobject_cast<MediaObject *>(o);
    188         if (m) {
    189             m->stop();
    190         }
    191     }
    192     foreach (MediaNodePrivate *bp, mediaNodePrivateList) {
    193         bp->deleteBackendObject();
     217    for (int i = 0; i < mediaNodePrivateList.count(); ++i) {
     218        mediaNodePrivateList.at(i)->deleteBackendObject();
    194219    }
    195220    if (objects.size() > 0) {
     
    259284{
    260285    if (m_backendObject) {
    261         foreach (MediaNodePrivate *bp, mediaNodePrivateList) {
    262             bp->deleteBackendObject();
     286        for (int i = 0; i < mediaNodePrivateList.count(); ++i) {
     287            mediaNodePrivateList.at(i)->deleteBackendObject();
    263288        }
    264289        if (objects.size() > 0) {
     
    269294            // in case there were objects deleted give 'em a chance to recreate
    270295            // them now
    271             foreach (MediaNodePrivate *bp, mediaNodePrivateList) {
    272                 bp->createBackendObject();
     296            for (int i = 0; i < mediaNodePrivateList.count(); ++i) {
     297                mediaNodePrivateList.at(i)->createBackendObject();
    273298            }
    274299            return;
     
    278303    }
    279304    createBackend();
    280     foreach (MediaNodePrivate *bp, mediaNodePrivateList) {
    281         bp->createBackendObject();
     305    for (int i = 0; i < mediaNodePrivateList.count(); ++i) {
     306        mediaNodePrivateList.at(i)->createBackendObject();
    282307    }
    283308    emit backendChanged();
     
    363388            );
    364389    dir.setFilter(QDir::Files);
     390    const QStringList libPaths = QCoreApplication::libraryPaths();
    365391    forever {
    366         foreach (QString libPath, QCoreApplication::libraryPaths()) {
    367             libPath += suffix;
     392        for (int i = 0; i < libPaths.count(); ++i) {
     393            const QString libPath = libPaths.at(i) + suffix;
    368394            dir.setPath(libPath);
    369395            if (!dir.exists()) {
    370396                continue;
    371397            }
    372             foreach (const QString &pluginName, dir.entryList()) {
    373                 QPluginLoader pluginLoader(libPath + pluginName);
     398            const QStringList files = dir.entryList(QDir::Files);
     399            for (int i = 0; i < files.count(); ++i) {
     400                QPluginLoader pluginLoader(libPath + files.at(i));
    374401                if (!pluginLoader.load()) {
    375402                    pDebug() << Q_FUNC_INFO << "  platform plugin load failed:"
     
    423450}
    424451
     452#ifndef QT_NO_PROPERTIES
    425453#define GET_STRING_PROPERTY(name) \
    426454QString Factory::name() \
     
    438466GET_STRING_PROPERTY(backendIcon)
    439467GET_STRING_PROPERTY(backendWebsite)
    440 
     468#endif //QT_NO_PROPERTIES
    441469QObject *Factory::registerQObject(QObject *o)
    442470{
    443471    if (o) {
    444         QObject::connect(o, SIGNAL(destroyed(QObject *)), globalFactory, SLOT(objectDestroyed(QObject *)), Qt::DirectConnection);
     472        QObject::connect(o, SIGNAL(destroyed(QObject*)), globalFactory, SLOT(objectDestroyed(QObject*)), Qt::DirectConnection);
    445473        globalFactory->objects.append(o);
    446474    }
  • trunk/src/3rdparty/phonon/phonon/factory_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/frontendinterface_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/globalconfig.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    3939{
    4040
    41 GlobalConfig::GlobalConfig() : m_config(QLatin1String("kde.org"), QLatin1String("libphonon"))
     41GlobalConfig::GlobalConfig()
     42#ifndef QT_NO_SETTINGS
     43    : m_config(QLatin1String("kde.org"), QLatin1String("libphonon"))
     44#endif //QT_NO_SETTINGS
    4245{
    4346}
     
    8386}
    8487
     88#ifndef QT_NO_PHONON_SETTINGSGROUP
    8589static QList<int> listSortedByConfig(const QSettingsGroup &backendConfig, Phonon::Category category, QList<int> &defaultList)
    8690{
     
    127131    return deviceList;
    128132}
    129 
     133#endif //QT_NO_PHONON_SETTINGSGROUP
     134
     135#ifndef QT_NO_PHONON_SETTINGSGROUP
    130136QList<int> GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, int override) const
    131137{
     
    173179    return listSortedByConfig(backendConfig, category, defaultList);
    174180}
    175 
     181#endif //QT_NO_PHONON_SETTINGSGROUP
    176182int GlobalConfig::audioOutputDeviceFor(Phonon::Category category, int override) const
    177183{
     184#ifndef QT_NO_PHONON_SETTINGSGROUP
    178185    QList<int> ret = audioOutputDeviceListFor(category, override);
    179     if (ret.isEmpty())
    180         return -1;
    181     return ret.first();
     186    if (!ret.isEmpty())
     187        return ret.first();
     188#endif //QT_NO_PHONON_SETTINGSGROUP
     189    return -1;
    182190}
    183191
     
    185193QList<int> GlobalConfig::audioCaptureDeviceListFor(Phonon::Category category, int override) const
    186194{
     195#ifndef QT_NO_PHONON_SETTINGSGROUP
    187196    //The devices need to be stored independently for every backend
    188197    const QSettingsGroup backendConfig(&m_config, QLatin1String("AudioCaptureDevice")); // + Factory::identifier());
     
    227236
    228237    return listSortedByConfig(backendConfig, category, defaultList);
     238#else //QT_NO_SETTINGSGROUP
     239    return QList<int>();
     240#endif //QT_NO_SETTINGSGROUP
    229241}
    230242
  • trunk/src/3rdparty/phonon/phonon/globalconfig_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    4747            HideUnavailableDevices = 4
    4848        };
     49#ifndef QT_NO_PHONON_SETTINGSGROUP
    4950        QList<int> audioOutputDeviceListFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const;
     51#endif //QT_NO_PHONON_SETTINGSGROUP
    5052        int audioOutputDeviceFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const;
    5153
     
    5658
    5759    protected:
     60#ifndef QT_NO_SETTINGS
    5861        QSettings m_config;
     62#endif //QT_NO_SETTINGS
    5963    };
    6064} // namespace Phonon
  • trunk/src/3rdparty/phonon/phonon/globalstatic_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/iodevicestream.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/iodevicestream_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/mediacontroller.cpp

    r2 r561  
    88    version 2.1 of the License, or (at your option) version 3, or any
    99    later version accepted by the membership of KDE e.V. (or its
    10     successor approved by the membership of KDE e.V.), Trolltech ASA
     10    successor approved by the membership of KDE e.V.), Nokia Corporation
    1111    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1212    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/mediacontroller.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/medianode.cpp

    r2 r561  
    88    version 2.1 of the License, or (at your option) version 3, or any
    99    later version accepted by the membership of KDE e.V. (or its
    10     successor approved by the membership of KDE e.V.), Trolltech ASA
     10    successor approved by the membership of KDE e.V.), Nokia Corporation
    1111    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1212    act as a proxy defined in Section 6 of version 3 of the license.
     
    6868    MediaNodePrivate::~MediaNodePrivate()
    6969    {
    70         foreach (MediaNodeDestructionHandler *handler, handlers) {
    71             handler->phononObjectDestroyed(this);
     70        for (int i = 0 ; i < handlers.count(); ++i) {
     71            handlers.at(i)->phononObjectDestroyed(this);
    7272        }
    7373        Factory::deregisterFrontendObject(this);
  • trunk/src/3rdparty/phonon/phonon/medianode.h

    r2 r561  
    88    version 2.1 of the License, or (at your option) version 3, or any
    99    later version accepted by the membership of KDE e.V. (or its
    10     successor approved by the membership of KDE e.V.), Trolltech ASA
     10    successor approved by the membership of KDE e.V.), Nokia Corporation
    1111    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1212    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/medianode_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/medianodedestructionhandler_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/mediaobject.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    301301void MediaObject::enqueue(const QList<MediaSource> &sources)
    302302{
    303     foreach (const MediaSource &m, sources) {
    304         enqueue(m);
     303    for (int i = 0; i < sources.count(); ++i) {
     304        enqueue(sources.at(i));
    305305    }
    306306}
     
    308308void MediaObject::enqueue(const QList<QUrl> &urls)
    309309{
    310     foreach (const QUrl &url, urls) {
    311         enqueue(url);
     310    for (int i = 0; i < urls.count(); ++i) {
     311        enqueue(urls.at(i));
    312312    }
    313313}
     
    454454
    455455#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    456     QObject::connect(m_backendObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), q, SLOT(_k_stateChanged(Phonon::State, Phonon::State)));
     456    QObject::connect(m_backendObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), q, SLOT(_k_stateChanged(Phonon::State,Phonon::State)));
    457457#else
    458     QObject::connect(m_backendObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), q, SIGNAL(stateChanged(Phonon::State, Phonon::State)));
     458    QObject::connect(m_backendObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), q, SIGNAL(stateChanged(Phonon::State,Phonon::State)));
    459459#endif // QT_NO_PHONON_ABSTRACTMEDIASTREAM
    460460    QObject::connect(m_backendObject, SIGNAL(tick(qint64)),             q, SIGNAL(tick(qint64)));
     
    468468    QObject::connect(m_backendObject, SIGNAL(prefinishMarkReached(qint32)), q, SIGNAL(prefinishMarkReached(qint32)));
    469469    QObject::connect(m_backendObject, SIGNAL(totalTimeChanged(qint64)), q, SIGNAL(totalTimeChanged(qint64)));
    470     QObject::connect(m_backendObject, SIGNAL(metaDataChanged(const QMultiMap<QString, QString> &)),
    471             q, SLOT(_k_metaDataChanged(const QMultiMap<QString, QString> &)));
    472     QObject::connect(m_backendObject, SIGNAL(currentSourceChanged(const MediaSource&)),
    473         q, SLOT(_k_currentSourceChanged(const MediaSource&)));
     470    QObject::connect(m_backendObject, SIGNAL(metaDataChanged(QMultiMap<QString,QString>)),
     471            q, SLOT(_k_metaDataChanged(QMultiMap<QString,QString>)));
     472    QObject::connect(m_backendObject, SIGNAL(currentSourceChanged(MediaSource)),
     473        q, SLOT(_k_currentSourceChanged(MediaSource)));
    474474
    475475    // set up attributes
     
    503503
    504504#ifndef QT_NO_PHONON_MEDIACONTROLLER
    505     foreach (FrontendInterfacePrivate *f, interfaceList) {
    506         f->_backendObjectChanged();
     505    for (int i = 0 ; i < interfaceList.count(); ++i) {
     506        interfaceList.at(i)->_backendObjectChanged();
    507507    }
    508508#endif //QT_NO_PHONON_MEDIACONTROLLER
  • trunk/src/3rdparty/phonon/phonon/mediaobject.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    1616    Lesser General Public License for more details.
    1717
    18     You should have received a copy of the GNU Lesser General Public 
     18    You should have received a copy of the GNU Lesser General Public
    1919    License along with this library.  If not, see <http://www.gnu.org/licenses/>.
    2020
     
    5959     * \endcode
    6060     *
    61      * If you want to play more that one media file (one after another) you can
     61     * If you want to play more than one media file (one after another) you can
    6262     * either tell MediaObject about all those files
    6363     * \code
     
    199199             *
    200200             * \warning This information cannot be known immediately. It is best
    201              * to also listen to the hasVideoChanged signal.
     201             * to also listen to the seekableChanged signal.
    202202             *
    203203             * \code
    204              *   connect(media, SIGNAL(hasVideoChanged(bool)), hasVideoChanged(bool));
     204             *   connect(media, SIGNAL(seekableChanged(bool)), seekableChanged(bool));
    205205             *   media->setCurrentSource("somevideo.avi");
    206              *   media->hasVideo(); // returns false;
     206             *   media->isSeekable(); // returns false;
    207207             * }
    208208             *
    209              * void hasVideoChanged(bool b)
     209             * void seekableChanged(bool b)
    210210             * {
    211211             *   // b == true
    212              *   media->hasVideo(); // returns true;
     212             *   media->isSeekable(); // returns true;
    213213             * }
    214214             * \endcode
     
    302302
    303303            /**
    304              * Returns the queued media sources. This does list does not include
     304             * Returns the queued media sources. This list does not include
    305305             * the current source (returned by currentSource).
    306306             */
     
    457457            /**
    458458             * Emitted when the state of the MediaObject has changed.
    459              * In case you're not interested in the old state you can also
    460              * connect to a slot that only has one State argument.
    461459             *
    462460             * @param newstate The state the Player is in now.
     
    588586             * This signal is emitted as soon as the total time of the media file is
    589587             * known or has changed. For most non-local media data the total
    590              * time of the media can only be known after some time. At that time the
     588             * time of the media can only be known after some time. Initially the
    591589             * totalTime function can not return useful information. You have
    592590             * to wait for this signal to know the real total time.
  • trunk/src/3rdparty/phonon/phonon/mediaobject_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/mediaobjectinterface.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/mediasource.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    141141#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    142142    if (autoDelete) {
    143         delete stream;
    144         delete ioDevice;
     143        //here we use deleteLater because this object
     144        //might be destroyed from another thread
     145        if (stream)
     146            stream->deleteLater();
     147        if (ioDevice)
     148            ioDevice->deleteLater();
    145149    }
    146150#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
  • trunk/src/3rdparty/phonon/phonon/mediasource.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/mediasource_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/objectdescription.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/objectdescription.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/objectdescription_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    322322    }
    323323    d->model->beginInsertRows(QModelIndex(), row, row + toInsert.size() - 1);
    324     foreach (const QExplicitlySharedDataPointer<ObjectDescriptionData> &obj, toInsert) {
    325         d->data.insert(row, obj);
     324    for (int i = 0 ; i < toInsert.count(); ++i) {
     325        d->data.insert(row, toInsert.at(i));
    326326    }
    327327    d->model->endInsertRows();
  • trunk/src/3rdparty/phonon/phonon/objectdescriptionmodel.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    139139            ObjectDescriptionModelDataPrivate *const d;
    140140    };
     141
     142/* Required to ensure template class vtables are exported on both symbian
     143and existing builds. */
     144#if defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)
     145// RVCT compiler (2.2.686) requires the export declaration to be on the class to export vtables
     146// MWC compiler works both ways
     147// GCCE compiler is unknown (it can't compile QtCore yet)
     148#define PHONON_TEMPLATE_CLASS_EXPORT PHONON_EXPORT
     149#define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT
     150#else
     151// Windows builds (at least) do not support export declaration on templated class
     152// But if you export a member function, the vtable is implicitly exported
     153#define PHONON_TEMPLATE_CLASS_EXPORT
     154#define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT PHONON_EXPORT
     155#endif
    141156
    142157    /** \class ObjectDescriptionModel objectdescriptionmodel.h Phonon/ObjectDescriptionModel
     
    176191     */
    177192    template<ObjectDescriptionType type>
    178     class ObjectDescriptionModel : public QAbstractListModel
     193    class PHONON_TEMPLATE_CLASS_EXPORT ObjectDescriptionModel : public QAbstractListModel
    179194    {
    180195        public:
     
    189204#if !defined(Q_CC_MINGW) || __MINGW32_MAJOR_VERSION >= 4
    190205            /** \internal */
    191             static PHONON_EXPORT const QMetaObject staticMetaObject;
     206            static PHONON_TEMPLATE_CLASS_MEMBER_EXPORT const QMetaObject staticMetaObject;
    192207            /** \internal */
    193             PHONON_EXPORT const QMetaObject *metaObject() const;
     208            PHONON_TEMPLATE_CLASS_MEMBER_EXPORT const QMetaObject *metaObject() const;
    194209            /** \internal */
    195             PHONON_EXPORT void *qt_metacast(const char *_clname);
     210            PHONON_TEMPLATE_CLASS_MEMBER_EXPORT void *qt_metacast(const char *_clname);
    196211            //int qt_metacall(QMetaObject::Call _c, int _id, void **_a);
    197212#endif
     
    293308            inline void setModelData(const QList<ObjectDescription<type> > &data) { //krazy:exclude=inline
    294309                QList<QExplicitlySharedDataPointer<ObjectDescriptionData> > list;
    295                 Q_FOREACH (const ObjectDescription<type> &desc, data) {
    296                     list << desc.d;
     310                for (int i = 0; i < data.count(); ++i) {
     311                    list += data.at(i).d;
    297312                }
    298313                d->setModelData(list);
     
    308323                QList<ObjectDescription<type> > ret;
    309324                QList<QExplicitlySharedDataPointer<ObjectDescriptionData> > list = d->modelData();
    310                 Q_FOREACH (const QExplicitlySharedDataPointer<ObjectDescriptionData> &data, list) {
    311                     ret << ObjectDescription<type>(data);
     325                for (int i = 0; i < list.count(); ++i) {
     326                    ret << ObjectDescription<type>(list.at(i));
    312327                }
    313328                return ret;
  • trunk/src/3rdparty/phonon/phonon/objectdescriptionmodel_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/path.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    5959{
    6060#ifndef QT_NO_PHONON_EFFECT
    61     foreach (Effect *e, effects) {
    62         e->k_ptr->removeDestructionHandler(this);
     61    for (int i = 0; i < effects.count(); ++i) {
     62        effects.at(i)->k_ptr->removeDestructionHandler(this);
    6363    }
    6464    delete effectsParent;
     
    234234        list << d->sourceNode->k_ptr->backendObject();
    235235#ifndef QT_NO_PHONON_EFFECT
    236     foreach(Effect *e, d->effects) {
    237         list << e->k_ptr->backendObject();
     236    for (int i = 0; i < d->effects.count(); ++i) {
     237        list << d->effects.at(i)->k_ptr->backendObject();
    238238    }
    239239#endif
     
    245245    QList<QObjectPair> disco;
    246246    if (list.count() >=2 ) {
    247         QObjectList::const_iterator it = list.begin();
    248         for(;it+1 != list.end();++it) {
     247        QObjectList::const_iterator it = list.constBegin();
     248        for(;it+1 != list.constEnd();++it) {
    249249            disco << QObjectPair(*it, *(it+1));
    250250        }
     
    261261
    262262#ifndef QT_NO_PHONON_EFFECT
    263         foreach(Effect *e, d->effects) {
    264             e->k_ptr->removeDestructionHandler(d.data());
     263        for (int i = 0; i < d->effects.count(); ++i) {
     264            d->effects.at(i)->k_ptr->removeDestructionHandler(d.data());
    265265        }
    266266        d->effects.clear();
     
    293293{
    294294    QSet<QObject*> nodesForTransaction;
    295     foreach(const QObjectPair &pair, disconnections) {
     295    for (int i = 0; i < disconnections.count(); ++i) {
     296        const QObjectPair &pair = disconnections.at(i);
    296297        nodesForTransaction << pair.first;
    297298        nodesForTransaction << pair.second;
    298299    }
    299     foreach(const QObjectPair &pair, connections) {
     300    for (int i = 0; i < connections.count(); ++i) {
     301        const QObjectPair &pair = connections.at(i);
    300302        nodesForTransaction << pair.first;
    301303        nodesForTransaction << pair.second;
     
    309311        return false;
    310312
    311     QList<QObjectPair>::const_iterator it = disconnections.begin();
    312     for(;it != disconnections.end();++it) {
     313    QList<QObjectPair>::const_iterator it = disconnections.constBegin();
     314    for(;it != disconnections.constEnd();++it) {
    313315        const QObjectPair &pair = *it;
    314316        if (!backend->disconnectNodes(pair.first, pair.second)) {
     
    326328    }
    327329
    328     for(it = connections.begin(); it != connections.end();++it) {
    329         const QObjectPair &pair = *it;
     330    for(it = connections.constBegin(); it != connections.constEnd(); ++it) {
     331        const QObjectPair pair = *it;
    330332        if (!backend->connectNodes(pair.first, pair.second)) {
    331333            //Error: a connection failed
     
    339341
    340342            //and now let's reconnect the nodes that were disconnected: rollback
    341             foreach(const QObjectPair &pair, disconnections) {
     343            for (int i = 0; i < disconnections.count(); ++i) {
     344                const QObjectPair &pair = disconnections.at(i);
    342345                bool success = backend->connectNodes(pair.first, pair.second);
    343346                Q_ASSERT(success); //a failure here means it is impossible to reestablish the connection
     
    418421    } else {
    419422#ifndef QT_NO_PHONON_EFFECT
    420         foreach (Effect *e, effects) {
     423        for (int i = 0; i < effects.count(); ++i) {
     424            Effect *e = effects.at(i);
    421425            if (e->k_ptr == mediaNodePrivate) {
    422426                removeEffect(e);
  • trunk/src/3rdparty/phonon/phonon/path.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/path_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/phonon_export.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    3333#  endif
    3434# else /* UNIX */
    35 #  define PHONON_EXPORT Q_DECL_EXPORT
     35#  ifdef MAKE_PHONON_LIB /* We are building this library */
     36#   define PHONON_EXPORT Q_DECL_EXPORT
     37#  else /* We are using this library */
     38#   define PHONON_EXPORT Q_DECL_IMPORT
     39#  endif
    3640# endif
    3741#endif
  • trunk/src/3rdparty/phonon/phonon/phonondefs.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/phonondefs_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/phononnamespace.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/phononnamespace.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    2525
    2626#include "phonon_export.h"
     27
     28#ifdef __QT_SYNCQT__
     29// Tell syncqt to create a "Global" header here
     30#pragma qt_class(Phonon::Global)
     31#endif
    2732
    2833/**
  • trunk/src/3rdparty/phonon/phonon/phononnamespace.h.in

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    9191
    9292    /**
    93      * Provided as keys for \ref MediaObject::metaData for convenience, in addition to the strings defined in
     93     * Provided as keys for MediaObject::metaData for convenience, in addition to the strings defined in
    9494     * the Ogg Vorbis specification.
    9595     */
  • trunk/src/3rdparty/phonon/phonon/phononnamespace_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/platform.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/platform_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/platformplugin.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/qsettingsgroup_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    2727#include <QtCore/QString>
    2828#include <QtCore/QVariant>
     29
     30#ifndef QT_NO_PHONON_SETTINGSGROUP
    2931
    3032QT_BEGIN_HEADER
     
    8890QT_END_NAMESPACE
    8991QT_END_HEADER
     92#endif //QT_NO_PHONON_SETTINGSGROUP
    9093
    9194#endif // PHONON_QSETTINGSGROUP_P_H
  • trunk/src/3rdparty/phonon/phonon/seekslider.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    7373
    7474    if (media) {
    75         connect(media, SIGNAL(stateChanged(Phonon::State, Phonon::State)),
     75        connect(media, SIGNAL(stateChanged(Phonon::State,Phonon::State)),
    7676                SLOT(_k_stateChanged(Phonon::State)));
    7777        connect(media, SIGNAL(totalTimeChanged(qint64)), SLOT(_k_length(qint64)));
    7878        connect(media, SIGNAL(tick(qint64)), SLOT(_k_tick(qint64)));
    7979        connect(media, SIGNAL(seekableChanged(bool)), SLOT(_k_seekableChanged(bool)));
    80         connect(media, SIGNAL(currentSourceChanged(const Phonon::MediaSource&)), SLOT(_k_currentSourceChanged()));
     80        connect(media, SIGNAL(currentSourceChanged(Phonon::MediaSource)), SLOT(_k_currentSourceChanged()));
    8181        d->_k_stateChanged(media->state());
    8282        d->_k_seekableChanged(media->isSeekable());
  • trunk/src/3rdparty/phonon/phonon/seekslider.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/seekslider_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/streaminterface.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/streaminterface.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/streaminterface_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/videoplayer.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/videoplayer.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/videowidget.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/videowidget.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/videowidget_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/videowidgetinterface.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/volumefadereffect.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/volumefadereffect.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/volumefadereffect_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/volumefaderinterface.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/volumeslider.cpp

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
     
    8686bool VolumeSlider::isMuteVisible() const
    8787{
    88     return k_ptr->muteButton.isVisible();
     88    return !k_ptr->muteButton.isHidden();
    8989}
    9090
  • trunk/src/3rdparty/phonon/phonon/volumeslider.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/phonon/volumeslider_p.h

    r2 r561  
    77    version 2.1 of the License, or (at your option) version 3, or any
    88    later version accepted by the membership of KDE e.V. (or its
    9     successor approved by the membership of KDE e.V.), Trolltech ASA
     9    successor approved by the membership of KDE e.V.), Nokia Corporation
    1010    (or its successors, if any) and the KDE Free Qt Foundation, which shall
    1111    act as a proxy defined in Section 6 of version 3 of the license.
  • trunk/src/3rdparty/phonon/qt7/backend.mm

    r2 r561  
    6060    setProperty("backendVersion", QLatin1String("0.1"));
    6161    setProperty("backendIcon",    QLatin1String(""));
    62     setProperty("backendWebsite", QLatin1String("http://qtsoftware.com/"));
     62    setProperty("backendWebsite", QLatin1String("http://qt.nokia.com/"));
    6363}
    6464
  • trunk/src/3rdparty/phonon/qt7/mediaobject.h

    r2 r561  
    2525
    2626#include "medianode.h"
     27
     28#if QT_ALLOW_QUICKTIME
     29    #include <QuickTime/QuickTime.h>
     30#endif
    2731
    2832QT_BEGIN_NAMESPACE
     
    3943
    4044    class MediaObject : public MediaNode,
    41         public Phonon::MediaObjectInterface, public Phonon::AddonInterface
     45        public Phonon::MediaObjectInterface
     46#ifndef QT_NO_PHONON_MEDIACONTROLLER
     47        , public Phonon::AddonInterface
     48#endif
    4249    {
    4350        Q_OBJECT
     
    9299
    93100                int videoOutputCount();
     101
     102#if QT_ALLOW_QUICKTIME
     103        void displayLinkEvent();
     104#endif
    94105
    95106    signals:
     
    106117        void currentSourceChanged(const MediaSource &newSource);
    107118
     119        // Add-on interface:
     120        void availableSubtitlesChanged();
     121        void availableAudioChannelsChanged();
     122        void titleChanged(int);
     123        void availableTitlesChanged(int);
     124        void chapterChanged(int);
     125        void availableChaptersChanged(int);
     126        void angleChanged(int);
     127        void availableAnglesChanged(int);
     128
    108129    protected:
    109130        void mediaNodeEvent(const MediaNodeEvent *event);
     
    119140        QuickTimeAudioPlayer *m_nextAudioPlayer;
    120141        MediaObjectAudioNode *m_mediaObjectAudioNode;
    121         QuickTimeMetaData *m_metaData;
     142
     143#if QT_ALLOW_QUICKTIME
     144        CVDisplayLinkRef m_displayLink;
     145        QMutex m_displayLinkMutex;
     146        bool m_pendingDisplayLinkEvent;
     147        void startDisplayLink();
     148        void stopDisplayLink();
     149#endif
    122150
    123151        qint32 m_tickInterval;
     
    128156
    129157        int m_tickTimer;
    130         int m_bufferTimer;
     158        int m_videoTimer;
     159        int m_audioTimer;
    131160        int m_rapidTimer;
    132161
     
    134163        int m_swapTimeLeft;
    135164        QTime m_swapTime;
     165        bool m_autoplayTitles;
    136166
    137167        void synchAudioVideo();
     
    142172        void play_internal();
    143173        void setupAudioSystem();
    144         void updateTimer(int &timer, int interval);
    145         void bufferAudioVideo();
     174        void restartAudioVideoTimers();
    146175        void updateRapidly();
    147176        void updateCrossFade();
     
    155184        void inspectGraph();
    156185        bool isCrossFading();
     186        void setCurrentTrack(int track);
    157187
    158188        QString m_errorString;
  • trunk/src/3rdparty/phonon/qt7/mediaobject.mm

    r2 r561  
    4747    setAudioNode(m_mediaObjectAudioNode);
    4848
    49     m_metaData = new QuickTimeMetaData();
    5049    m_audioGraph = new AudioGraph(this);
    5150
     
    5655    m_percentageLoaded = 0;
    5756    m_waitNextSwap = false;
     57    m_autoplayTitles = true;
    5858    m_audioEffectCount = 0;
    5959    m_audioOutputCount = 0;
     
    6464
    6565    m_tickTimer = 0;
    66     m_bufferTimer = 0;
     66    m_videoTimer = 0;
     67    m_audioTimer = 0;
    6768    m_rapidTimer = 0;
    6869
     70#if QT_ALLOW_QUICKTIME
     71    m_displayLink = 0;
     72    m_pendingDisplayLinkEvent = false;
     73#endif
     74
    6975    checkForError();
    7076}
    7177
    7278MediaObject::~MediaObject()
    73 {   
    74     // m_mediaObjectAudioNode is owned by super class.   
     79{
     80    // m_mediaObjectAudioNode is owned by super class.
     81#if QT_ALLOW_QUICKTIME
     82    stopDisplayLink();
     83#endif
    7584    m_audioPlayer->unsetVideoPlayer();
    7685    m_nextAudioPlayer->unsetVideoPlayer();
    7786    delete m_videoPlayer;
    7887    delete m_nextVideoPlayer;
    79     delete m_metaData;
    8088    checkForError();
    8189}
     
    8997        if (m_state != state){
    9098            // End-application did something
    91             // upon  receiving the signal. 
     99            // upon  receiving the signal.
    92100            return false;
    93101        }
     
    123131    // effects or outputs connected. This will have
    124132    // influence on the audio system and video system that ends up beeing used:
    125     int prevVideoOutputCount = m_videoOutputCount;     
     133    int prevVideoOutputCount = m_videoOutputCount;
    126134    m_audioEffectCount = 0;
    127135    m_audioOutputCount = 0;
     
    135143            MediaNodeEvent e1(MediaNodeEvent::VideoOutputCountChanged, &m_videoOutputCount);
    136144            notify(&e1);
    137         }       
     145    }
    138146}
    139147
     
    168176    if (newAudioSystem == m_audioSystem)
    169177        return;
    170  
     178
    171179    // Enable selected audio system:
    172     m_audioSystem = newAudioSystem; 
     180    m_audioSystem = newAudioSystem;
    173181    switch (newAudioSystem){
    174182        case AS_Silent:
    175183            m_audioGraph->stop();
    176184            m_videoPlayer->enableAudio(false);
    177             m_nextVideoPlayer->enableAudio(false);   
     185            m_nextVideoPlayer->enableAudio(false);
    178186            m_audioPlayer->enableAudio(false);
    179187            m_nextAudioPlayer->enableAudio(false);
     
    215223        PhononAutoReleasePool pool;
    216224    setState(Phonon::LoadingState);
    217    
     225
    218226    // Save current state for event/signal handling below:
    219227    bool prevHasVideo = m_videoPlayer->hasVideo();
    220228    qint64 prevTotalTime = totalTime();
     229    int prevTrackCount = m_videoPlayer->trackCount();
    221230    m_waitNextSwap = false;
    222        
     231
    223232    // Cancel cross-fade if any:
    224233    m_nextVideoPlayer->pause();
    225234    m_nextAudioPlayer->pause();
    226235    m_mediaObjectAudioNode->cancelCrossFade();
    227    
     236
    228237    // Set new source:
    229238    m_audioPlayer->unsetVideoPlayer();
    230239    m_videoPlayer->setMediaSource(source);
    231240    m_audioPlayer->setVideoPlayer(m_videoPlayer);
    232     m_metaData->setVideo(m_videoPlayer);       
    233 
    234     m_audioGraph->updateStreamSpecifications();       
     241
     242    m_audioGraph->updateStreamSpecifications();
    235243    m_nextAudioPlayer->unsetVideoPlayer();
    236     m_nextVideoPlayer->unsetVideo();
     244    m_nextVideoPlayer->unsetCurrentMediaSource();
    237245    m_currentTime = 0;
    238        
     246
    239247    // Emit/notify information about the new source:
    240248    QRect videoRect = m_videoPlayer->videoRect();
     
    247255
    248256    emit currentSourceChanged(source);
    249     emit metaDataChanged(m_metaData->metaData());
     257    emit metaDataChanged(m_videoPlayer->metaData());
    250258
    251259    if (prevHasVideo != m_videoPlayer->hasVideo())
    252         emit hasVideoChanged(m_videoPlayer->hasVideo());       
     260        emit hasVideoChanged(m_videoPlayer->hasVideo());
    253261    if (prevTotalTime != totalTime())
    254         emit totalTimeChanged(totalTime());       
     262        emit totalTimeChanged(totalTime());
     263    if (prevTrackCount != m_videoPlayer->trackCount())
     264        emit availableTitlesChanged(m_videoPlayer->trackCount());
    255265    if (checkForError())
    256266        return;
     
    261271    if (!m_videoPlayer->canPlayMedia())
    262272        SET_ERROR("Cannot play media.", FATAL_ERROR)
    263        
     273
    264274    // The state might have changed from LoadingState
    265275    // as a response to an error state change. So we
     
    288298    bool prevHasVideo = m_videoPlayer->hasVideo();
    289299    qint64 prevTotalTime = totalTime();
     300    int prevTrackCount = m_videoPlayer->trackCount();
    290301
    291302    qSwap(m_audioPlayer, m_nextAudioPlayer);
     
    293304    m_mediaObjectAudioNode->startCrossFade(transitionTime);
    294305    m_audioGraph->updateStreamSpecifications();
    295     m_metaData->setVideo(m_videoPlayer);
    296306
    297307    m_waitNextSwap = false;
    298308    m_currentTime = 0;
    299        
     309
    300310    // Emit/notify information about the new source:
    301311    QRect videoRect = m_videoPlayer->videoRect();
     
    304314
    305315    emit currentSourceChanged(m_videoPlayer->mediaSource());
    306     emit metaDataChanged(m_metaData->metaData());
     316    emit metaDataChanged(m_videoPlayer->metaData());
    307317
    308318    if (prevHasVideo != m_videoPlayer->hasVideo())
    309         emit hasVideoChanged(m_videoPlayer->hasVideo());       
     319        emit hasVideoChanged(m_videoPlayer->hasVideo());
    310320    if (prevTotalTime != totalTime())
    311321        emit totalTimeChanged(totalTime());
     322    if (prevTrackCount != m_videoPlayer->trackCount())
     323        emit availableTitlesChanged(m_videoPlayer->trackCount());
    312324    if (checkForError())
    313325        return;
     
    328340}
    329341
    330 void MediaObject::updateTimer(int &timer, int interval)
    331 {
    332     if (timer)
    333         killTimer(timer);
    334     timer = 0;
    335     if (interval >= 0)   
    336         timer = startTimer(interval);
     342#if QT_ALLOW_QUICKTIME
     343static CVReturn displayLinkCallback(CVDisplayLinkRef /*displayLink*/,
     344                                                                 const CVTimeStamp */*inNow*/,
     345                                                                 const CVTimeStamp */*inOutputTime*/,
     346                                                                 CVOptionFlags /*flagsIn*/,
     347                                                                 CVOptionFlags */*flagsOut*/,
     348                                 void *userData)
     349{
     350    MediaObject *mediaObject = static_cast<MediaObject *>(userData);
     351    mediaObject->displayLinkEvent();
     352    return kCVReturnSuccess;
     353}
     354
     355void MediaObject::displayLinkEvent()
     356{
     357    // This function is called from a
     358    // thread != gui thread. So we post the event.
     359    // But we need to make sure that we don't post faster
     360    // than the event loop can eat:
     361    m_displayLinkMutex.lock();
     362    bool pending = m_pendingDisplayLinkEvent;
     363    m_pendingDisplayLinkEvent = true;
     364    m_displayLinkMutex.unlock();
     365
     366    if (!pending)
     367        qApp->postEvent(this, new QEvent(QEvent::User), Qt::HighEventPriority);
     368}
     369
     370void MediaObject::startDisplayLink()
     371{
     372    if (m_displayLink)
     373        return;
     374    OSStatus err = CVDisplayLinkCreateWithCGDisplay(kCGDirectMainDisplay, &m_displayLink);
     375    if (err != noErr)
     376        goto fail;
     377    err = CVDisplayLinkSetCurrentCGDisplay(m_displayLink, kCGDirectMainDisplay);
     378    if (err != noErr)
     379        goto fail;
     380    err = CVDisplayLinkSetOutputCallback(m_displayLink, displayLinkCallback, this);
     381    if (err != noErr)
     382        goto fail;
     383    err = CVDisplayLinkStart(m_displayLink);
     384    if (err != noErr)
     385        goto fail;
     386    return;
     387fail:
     388    stopDisplayLink();
     389}
     390
     391void MediaObject::stopDisplayLink()
     392{
     393    if (!m_displayLink)
     394        return;
     395    CVDisplayLinkStop(m_displayLink);
     396    CFRelease(m_displayLink);
     397    m_displayLink = 0;
     398}
     399#endif
     400
     401void MediaObject::restartAudioVideoTimers()
     402{
     403    if (m_videoTimer)
     404        killTimer(m_videoTimer);
     405    if (m_audioTimer)
     406        killTimer(m_audioTimer);
     407
     408#if QT_ALLOW_QUICKTIME
     409    // We prefer to use a display link as timer if available, since
     410    // it is more steady, and results in better and smoother frame drawing:
     411    startDisplayLink();
     412    if (!m_displayLink){
     413        float fps = m_videoPlayer->staticFps();
     414        long videoUpdateFrequency = fps ? long(1000.0f / fps) : 0.001;
     415        m_videoTimer = startTimer(videoUpdateFrequency);
     416    }
     417#else
     418    float fps = m_videoPlayer->staticFps();
     419    long videoUpdateFrequency = fps ? long(1000.0f / fps) : 0.001;
     420    m_videoTimer = startTimer(videoUpdateFrequency);
     421#endif
     422
     423    long audioUpdateFrequency = m_audioPlayer->regularTaskFrequency();
     424    m_audioTimer = startTimer(audioUpdateFrequency);
     425    updateVideoFrames();
     426    updateAudioBuffers();
    337427}
    338428
     
    341431    // Play main audio/video:
    342432    m_videoPlayer->play();
    343     m_audioPlayer->play();     
     433    m_audioPlayer->play();
    344434    updateLipSynch(0);
    345435    // Play old audio/video to finish cross-fade:
     
    348438        m_nextAudioPlayer->play();
    349439    }
    350     bufferAudioVideo();
    351     updateTimer(m_rapidTimer, 100);
     440    restartAudioVideoTimers();
     441    if (!m_rapidTimer)
     442        m_rapidTimer = startTimer(100);
    352443}
    353444
     
    359450    m_videoPlayer->pause();
    360451    m_nextVideoPlayer->pause();
    361     updateTimer(m_rapidTimer, -1);
    362     updateTimer(m_bufferTimer, -1);
    363 
     452    killTimer(m_rapidTimer);
     453    killTimer(m_videoTimer);
     454    killTimer(m_audioTimer);
     455    m_rapidTimer = 0;
     456    m_videoTimer = 0;
     457    m_audioTimer = 0;
     458#if QT_ALLOW_QUICKTIME
     459    stopDisplayLink();
     460#endif
    364461    if (m_waitNextSwap)
    365462        m_swapTimeLeft = m_swapTime.msecsTo(QTime::currentTime());
     
    383480        return;
    384481    if (!setState(Phonon::PlayingState))
    385         return;       
     482        return;
    386483    if (m_audioSystem == AS_Graph){
    387484        m_audioGraph->start();
     
    424521        return;
    425522    m_waitNextSwap = false;
    426     m_nextVideoPlayer->unsetVideo();
     523    m_nextVideoPlayer->unsetCurrentMediaSource();
    427524    m_nextAudioPlayer->unsetVideoPlayer();
    428525    pause_internal();
     
    436533    if (m_state == Phonon::ErrorState)
    437534        return;
    438        
     535
    439536    // Stop cross-fade if any:
    440     m_nextVideoPlayer->unsetVideo();
     537    m_nextVideoPlayer->unsetCurrentMediaSource();
    441538    m_nextAudioPlayer->unsetVideoPlayer();
    442539    m_mediaObjectAudioNode->cancelCrossFade();
     
    447544    m_audioPlayer->seek(m_videoPlayer->currentTime());
    448545    m_mediaObjectAudioNode->setMute(false);
    449    
     546
    450547    // Update time and cancel pending swap:
    451548    if (m_currentTime < m_videoPlayer->duration())
     
    558655{
    559656    IMPLEMENTED_SILENT;
    560     const_cast<MediaObject *>(this)->updateCurrentTime(); 
     657    const_cast<MediaObject *>(this)->updateCurrentTime();
    561658    return m_currentTime;
    562659}
     
    568665    quint64 total = m_videoPlayer->duration();
    569666
    570     // Check if it's time to emit aboutToFinish:
    571     quint32 mark = qMax(quint64(0), qMin(total, total + m_transitionTime - 2000));
    572     if (lastUpdateTime < mark && mark <= m_currentTime)
    573         emit aboutToFinish();
    574 
    575     // Check if it's time to emit prefinishMarkReached:
    576     mark = qMax(quint64(0), total - m_prefinishMark);
    577     if (lastUpdateTime < mark && mark <= m_currentTime)
    578         emit prefinishMarkReached(total - m_currentTime);
    579 
    580     if (m_nextVideoPlayer->state() == QuickTimeVideoPlayer::NoMedia){
    581         // There is no next source in que.
    582         // Check if it's time to emit finished:
     667    if (m_videoPlayer->currentTrack() < m_videoPlayer->trackCount() - 1){
     668        // There are still more tracks to play after the current track.
     669        if (m_autoplayTitles) {
     670            if (lastUpdateTime < m_currentTime && m_currentTime == total)
     671                setCurrentTrack(m_videoPlayer->currentTrack() + 1);
     672        }
     673    } else if (m_nextVideoPlayer->state() == QuickTimeVideoPlayer::NoMedia){
     674        // There is no more sources or tracks to play after the current source.
     675        // Check if it's time to emit aboutToFinish:
     676        quint32 mark = qMax(quint64(0), qMin(total, total + m_transitionTime - 2000));
     677        if (lastUpdateTime < mark && mark <= m_currentTime)
     678            emit aboutToFinish();
     679
     680        // Check if it's time to emit prefinishMarkReached:
     681        mark = qMax(quint64(0), total - m_prefinishMark);
     682        if (lastUpdateTime < mark && mark <= m_currentTime)
     683            emit prefinishMarkReached(total - m_currentTime);
     684
    583685        if (lastUpdateTime < m_currentTime && m_currentTime == total){
    584686            emit finished();
     
    590692        // We have a next source.
    591693        // Check if it's time to swap to next source:
    592         mark = qMax(quint64(0), total + m_transitionTime);
     694        quint32 mark = qMax(quint64(0), total + m_transitionTime);
    593695        if (m_waitNextSwap && m_state == Phonon::PlayingState &&
    594696            m_transitionTime < m_swapTime.msecsTo(QTime::currentTime())){
     
    693795void MediaObject::updateCrossFade()
    694796{
    695     m_mediaObjectAudioNode->updateCrossFade(m_currentTime);   
     797    m_mediaObjectAudioNode->updateCrossFade(m_currentTime);
    696798    // Clean-up previous movie if done fading:
    697799    if (m_mediaObjectAudioNode->m_fadeDuration == 0){
    698800        if (m_nextVideoPlayer->isPlaying() || m_nextAudioPlayer->isPlaying()){
    699             m_nextVideoPlayer->unsetVideo();
     801            m_nextVideoPlayer->unsetCurrentMediaSource();
    700802            m_nextAudioPlayer->unsetVideoPlayer();
    701803        }
    702     }       
     804    }
    703805}
    704806
     
    729831    if (m_videoPlayer->videoFrameChanged()){
    730832        updateLipSynch(50);
    731         VideoFrame frame(m_videoPlayer);           
     833        VideoFrame frame(m_videoPlayer);
    732834        if (m_nextVideoPlayer->isPlaying()
    733835            && m_nextVideoPlayer->hasVideo()
     
    737839            frame.setBaseOpacity(m_mediaObjectAudioNode->m_volume1);
    738840        }
    739        
     841
    740842        // Send the frame through the graph:
    741         updateVideo(frame);   
     843        updateVideo(frame);
    742844        checkForError();
    743845    }
     
    750852    if (m_videoSinkList.isEmpty() || m_audioSinkList.isEmpty())
    751853        return;
    752        
     854
    753855    if (m_videoPlayer->hasVideo()){
    754856        qint64 diff = m_audioPlayer->currentTime() - m_videoPlayer->currentTime();
     
    762864            m_nextAudioPlayer->seek(m_nextVideoPlayer->currentTime());
    763865    }
    764 }
    765 
    766 void MediaObject::bufferAudioVideo()
    767 {
    768     long nextVideoUpdate = m_videoPlayer->hasVideo() ? 30 : INT_MAX;
    769     long nextAudioUpdate = m_audioPlayer->regularTaskFrequency();
    770     updateAudioBuffers();
    771     updateVideoFrames();
    772     if (m_state == Phonon::PlayingState)
    773         updateTimer(m_bufferTimer, qMin(nextVideoUpdate, nextAudioUpdate));
    774866}
    775867
     
    798890            checkForError();
    799891            m_mediaObjectAudioNode->setMute(false);
    800              if (m_state == Phonon::PlayingState)
    801                 bufferAudioVideo();
     892            if (m_state == Phonon::PlayingState)
     893                restartAudioVideoTimers();
    802894            break;
    803895        case MediaNodeEvent::AudioGraphCannotPlay:
     
    810902                m_mediaObjectAudioNode->setMute(false);
    811903            }
    812             break;
    813         default:
    814             break;
    815     }
    816 }
    817 
    818 bool MediaObject::event(QEvent *event)
    819 {
    820     switch (event->type()){
    821         case QEvent::Timer: {
    822             QTimerEvent *timerEvent = static_cast<QTimerEvent *>(event);
    823             if (timerEvent->timerId() == m_rapidTimer)
    824                 updateRapidly();
    825             else if (timerEvent->timerId() == m_tickTimer)
    826                 emit tick(currentTime());
    827             else if (timerEvent->timerId() == m_bufferTimer)
    828                 bufferAudioVideo();
    829             }
    830904            break;
    831905        default:
    832906            break;
    833907    }
     908}
     909
     910bool MediaObject::event(QEvent *event)
     911{
     912    switch (event->type()){
     913#if QT_ALLOW_QUICKTIME
     914        case QEvent::User:{
     915            m_displayLinkMutex.lock();
     916            m_pendingDisplayLinkEvent = false;
     917            m_displayLinkMutex.unlock();
     918            updateVideoFrames();
     919            break; }
     920#endif
     921        case QEvent::Timer:{
     922            int timerId = static_cast<QTimerEvent *>(event)->timerId();
     923            if (timerId == m_rapidTimer)
     924                updateRapidly();
     925            else if (timerId == m_tickTimer)
     926                emit tick(currentTime());
     927            else if (timerId == m_videoTimer)
     928                updateVideoFrames();
     929            else if (timerId == m_audioTimer)
     930                updateAudioBuffers();
     931            break; }
     932        default:
     933            break;
     934    }
    834935    return QObject::event(event);
    835936}
    836937
    837 bool MediaObject::hasInterface(Interface /*interface*/) const
    838 {
    839     return false;
    840 }
    841 
    842 QVariant MediaObject::interfaceCall(Interface /*interface*/, int /*command*/, const QList<QVariant> &/*arguments*/)
    843 {
     938void MediaObject::setCurrentTrack(int track)
     939{
     940    if (track == m_videoPlayer->currentTrack() || track < 0 || track >= m_videoPlayer->trackCount())
     941        return;
     942
     943    m_videoPlayer->setCurrentTrack(track);
     944    emit titleChanged(track);
     945    emit metaDataChanged(m_videoPlayer->metaData());
     946}
     947
     948bool MediaObject::hasInterface(Interface iface) const
     949{
     950    return iface == AddonInterface::TitleInterface;
     951}
     952
     953QVariant MediaObject::interfaceCall(Interface iface, int command, const QList<QVariant> &params)
     954{
     955    switch (iface) {
     956        case TitleInterface:
     957            switch (command) {
     958                case availableTitles:
     959                    return m_videoPlayer->trackCount();
     960                case title:
     961                    return m_videoPlayer->currentTrack();
     962                case setTitle:
     963                    setCurrentTrack(params.first().toInt());
     964                    break;
     965                case autoplayTitles:
     966                    return m_autoplayTitles;
     967                case setAutoplayTitles:
     968                    m_autoplayTitles = params.first().toBool();
     969                    break;
     970            }
     971        default:
     972            break;
     973    }
    844974    return QVariant();
    845975}
  • trunk/src/3rdparty/phonon/qt7/quicktimemetadata.h

    r2 r561  
    3939    {
    4040        public:
    41             QuickTimeMetaData();
    42             virtual ~QuickTimeMetaData();
    43 
    44             void setVideo(QuickTimeVideoPlayer *videoPlayer);
     41            QuickTimeMetaData(QuickTimeVideoPlayer *videoPlayer);
     42            void update();
    4543            QMultiMap<QString, QString> metaData();
    4644
     
    5048            QuickTimeVideoPlayer *m_videoPlayer;
    5149            void readMetaData();
     50            void guessMetaDataForCD();
     51            void readMetaDataFromMovie();
    5252
    5353#ifdef QUICKTIME_C_API_AVAILABLE
  • trunk/src/3rdparty/phonon/qt7/quicktimemetadata.mm

    r2 r561  
    1616*/
    1717
     18#include <QtCore/QFileInfo>
    1819#include "quicktimemetadata.h"
    1920#include "quicktimevideoplayer.h"
     
    2627{
    2728
    28 QuickTimeMetaData::QuickTimeMetaData()
    29 {
    30     m_videoPlayer = 0;
     29QuickTimeMetaData::QuickTimeMetaData(QuickTimeVideoPlayer *videoPlayer)
     30{
     31    m_videoPlayer = videoPlayer;
    3132    m_movieChanged = false;
    3233}
    3334
    34 QuickTimeMetaData::~QuickTimeMetaData()
    35 {
    36 }
    37 
    38 void QuickTimeMetaData::setVideo(QuickTimeVideoPlayer *videoPlayer)
    39 {
    40     m_videoPlayer = videoPlayer;
     35void QuickTimeMetaData::update()
     36{
    4137    m_movieChanged = true;
    4238    m_metaData.clear();
     
    146142#endif // QUICKTIME_C_API_AVAILABLE
    147143
    148 void QuickTimeMetaData::readMetaData()
    149 {
    150         if (!m_videoPlayer)
    151         return;
     144void QuickTimeMetaData::guessMetaDataForCD()
     145{
     146    QString album = QFileInfo(m_videoPlayer->movieCompactDiscPath()).fileName();
     147    QString title = QFileInfo(m_videoPlayer->currentTrackPath()).fileName();
     148    title = title.left(title.lastIndexOf('.'));
     149    m_metaData.insert(QLatin1String("ALBUM"), album);
     150    m_metaData.insert(QLatin1String("TITLE"), title);
     151    m_metaData.insert(QLatin1String("TRACKNUMBER"), QString::number(m_videoPlayer->currentTrack()));
     152}
     153
     154void QuickTimeMetaData::readMetaDataFromMovie()
     155{
    152156    QMultiMap<QString, QString> metaMap;
    153    
     157
    154158#ifdef QUICKTIME_C_API_AVAILABLE
    155         QTMetaDataRef metaDataRef;       
     159    QTMetaDataRef metaDataRef;
    156160        OSStatus err = QTCopyMovieMetaData([m_videoPlayer->qtMovie() quickTimeMovie], &metaDataRef);
    157161    BACKEND_ASSERT2(err == noErr, "Could not read QuickTime meta data", NORMAL_ERROR)
     
    174178}
    175179
     180void QuickTimeMetaData::readMetaData()
     181{
     182        if (!m_videoPlayer)
     183        return;
     184
     185    if (m_videoPlayer->mediaSource().type() == Phonon::MediaSource::Disc)
     186        guessMetaDataForCD();
     187    else
     188        readMetaDataFromMovie();
     189}
     190
    176191QMultiMap<QString, QString> QuickTimeMetaData::metaData()
    177192{
  • trunk/src/3rdparty/phonon/qt7/quicktimevideoplayer.h

    r2 r561  
    4040{
    4141    class QuickTimeStreamReader;
     42    class QuickTimeMetaData;
    4243        class VideoRenderWidgetQTMovieView;
    4344
     
    5758            void setMediaSource(const MediaSource &source);
    5859            MediaSource mediaSource() const;
    59             void unsetVideo();
     60            void unsetCurrentMediaSource();
    6061
    6162            void play();
     
    6869                        void *currentFrameAsCIImage();
    6970            QImage currentFrameAsQImage();
     71            void releaseImageCache();
    7072            QRect videoRect() const;
    7173
     
    7375            quint64 currentTime() const;
    7476            long timeScale() const;
     77            float staticFps();
    7578            QString currentTimeString();
    7679
     
    8588            void setPlaybackRate(float rate);
    8689            QTMovie *qtMovie() const;
     90            QMultiMap<QString, QString> metaData();
    8791
    8892            float playbackRate() const;
     
    104108            quint64 timeLoaded();
    105109
     110            int trackCount() const;
     111            int currentTrack() const;
     112            void setCurrentTrack(int track);
     113            QString movieCompactDiscPath() const;
     114            QString currentTrackPath() const;
     115
    106116            static QString timeToString(quint64 ms);
    107117
     
    117127            State m_state;
    118128            QGLPixelBuffer *m_QImagePixelBuffer;
     129            QuickTimeMetaData *m_metaData;
     130
     131            CVOpenGLTextureRef m_cachedCVTextureRef;
     132            QImage m_cachedQImage;
    119133
    120134            bool m_playbackRateSat;
     
    127141            float m_relativeVolume;
    128142            float m_playbackRate;
     143            float m_staticFps;
    129144            quint64 m_currentTime;
    130145            MediaSource m_mediaSource;
     146
    131147                        void *m_primaryRenderingCIImage;
    132148                        qreal m_brightness;
     
    134150                        qreal m_hue;
    135151                        qreal m_saturation;
     152            NSArray *m_folderTracks;
     153            int m_currentTrack;
     154            QString m_movieCompactDiscPath;
    136155
    137156#ifdef QUICKTIME_C_API_AVAILABLE
     
    141160            QuickTimeStreamReader *m_streamReader;
    142161
     162            void prepareCurrentMovieForPlayback();
    143163            void createVisualContext();
    144164            void openMovieFromCurrentMediaSource();
     
    147167            void openMovieFromUrl();
    148168            void openMovieFromStream();
     169            void openMovieFromCompactDisc();
    149170            void openMovieFromData(QByteArray *data, char *fileType);
    150171            void openMovieFromDataGuessType(QByteArray *data);
    151172                        QString mediaSourcePath();
    152173                        bool codecExistsAccordingToSuffix(const QString &fileName);
     174            NSString* pathToCompactDisc();
     175            bool isCompactDisc(NSString *path);
     176            NSArray* scanFolder(NSString *path);
    153177
    154178            void setError(NSError *error);
    155179            bool errorOccured();
    156180            void readProtection();
     181            void calculateStaticFps();
    157182            void checkIfVideoAwailable();
    158183            bool movieNotLoaded();
  • trunk/src/3rdparty/phonon/qt7/quicktimevideoplayer.mm

    r2 r561  
    2121#include "audiodevice.h"
    2222#include "quicktimestreamreader.h"
     23#include "quicktimemetadata.h"
    2324
    2425#include <QtCore/QCoreApplication>
     
    5354    m_state = NoMedia;
    5455    m_mediaSource = MediaSource();
     56    m_metaData = new QuickTimeMetaData(this);
    5557    m_QTMovie = 0;
    5658    m_streamReader = 0;
     
    6264    m_audioEnabled = false;
    6365    m_hasVideo = false;
     66    m_staticFps = 0;
    6467    m_playbackRateSat = false;
    6568    m_isDrmProtected = false;
     
    6871        m_primaryRenderingCIImage = 0;
    6972    m_QImagePixelBuffer = 0;
     73    m_cachedCVTextureRef = 0;
     74    m_folderTracks = 0;
     75    m_currentTrack = 0;
    7076
    7177#ifdef QUICKTIME_C_API_AVAILABLE
     
    7884QuickTimeVideoPlayer::~QuickTimeVideoPlayer()
    7985{
    80     unsetVideo();
     86        PhononAutoReleasePool pool;
     87    unsetCurrentMediaSource();
     88    delete m_metaData;
    8189    [(NSObject*)m_primaryRenderingTarget release];
    8290    m_primaryRenderingTarget = 0;
     
    8593        CFRelease(m_visualContext);
    8694#endif
     95}
     96
     97void QuickTimeVideoPlayer::releaseImageCache()
     98{
     99    if (m_cachedCVTextureRef){
     100        CVOpenGLTextureRelease(m_cachedCVTextureRef);
     101        m_cachedCVTextureRef = 0;
     102    }
     103    m_cachedQImage = QImage();
    87104}
    88105
     
    126143
    127144    QTVisualContextTask(m_visualContext);
    128     return QTVisualContextIsNewImageAvailable(m_visualContext, 0);
     145    bool changed = QTVisualContextIsNewImageAvailable(m_visualContext, 0);
     146    if (changed)
     147        releaseImageCache();
     148    return changed;
    129149
    130150#elif defined(QT_MAC_USE_COCOA)
     
    141161    if (!m_visualContext)
    142162        return 0;
    143     CVOpenGLTextureRef texture = 0;
    144     OSStatus err = QTVisualContextCopyImageForTime(m_visualContext, 0, 0, &texture);
    145     BACKEND_ASSERT3(err == noErr, "Could not copy image for time in QuickTime player", FATAL_ERROR, 0)
    146     return texture;
     163    if (!m_cachedCVTextureRef){
     164        OSStatus err = QTVisualContextCopyImageForTime(m_visualContext, 0, 0, &m_cachedCVTextureRef);
     165        BACKEND_ASSERT3(err == noErr, "Could not copy image for time in QuickTime player", FATAL_ERROR, 0)
     166    }
     167    return m_cachedCVTextureRef;
    147168
    148169#else
     
    153174QImage QuickTimeVideoPlayer::currentFrameAsQImage()
    154175{
     176    if (!m_cachedQImage.isNull())
     177        return m_cachedQImage;
     178
    155179#ifdef QUICKTIME_C_API_AVAILABLE
    156180    QGLContext *prevContext = const_cast<QGLContext *>(QGLContext::currentContext());
     
    182206    glEnd();
    183207
    184     QImage image = m_QImagePixelBuffer->toImage();
    185     CVOpenGLTextureRelease(texture);
     208    m_cachedQImage = m_QImagePixelBuffer->toImage();
    186209    // Because of QuickTime, m_QImagePixelBuffer->doneCurrent() will fail.
    187210    // So we store, and restore, the context our selves:
    188211    prevContext->makeCurrent();
    189     return image;
     212    return m_cachedQImage;
    190213#else
    191214        CIImage *img = (CIImage *)currentFrameAsCIImage();
     
    196219        CGRect bounds = [img extent];
    197220        QImage qImg([bitmap bitmapData], bounds.size.width, bounds.size.height, QImage::Format_ARGB32);
    198         QImage swapped = qImg.rgbSwapped();
     221        m_cachedQImage = qImg.rgbSwapped();
    199222        [bitmap release];
    200223        [img release];
    201         return swapped;
     224        return m_cachedQImage;
    202225#endif
    203226}
     
    251274        CVOpenGLTextureRef cvImg = currentFrameAsCVTexture();
    252275        CIImage *img = [[CIImage alloc] initWithCVImageBuffer:cvImg];
    253         CVOpenGLTextureRelease(cvImg);
    254         return img;     
     276        return img;
    255277#else
    256278        return 0;
     
    274296    int samplesPerPixel = [bitmap samplesPerPixel];
    275297    if (![bitmap isPlanar] && (samplesPerPixel == 3 || samplesPerPixel == 4)){
    276         glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 
     298        glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0,
    277299            samplesPerPixel == 4 ? GL_RGBA8 : GL_RGB8,
    278300            [bitmap pixelsWide], [bitmap pixelsHigh],
     
    303325    m_relativeVolume = relativeVolume;
    304326    if (!m_QTMovie || !m_audioEnabled || m_mute)
    305         return;               
     327        return;
    306328    [m_QTMovie setVolume:(m_masterVolume * m_relativeVolume)];
    307329}
     
    314336
    315337    // Work-around bug that happends if you set/unset mute
    316     // before movie is playing, and audio is not played 
     338    // before movie is playing, and audio is not played
    317339    // through graph. Then audio is delayed.
    318340    [m_QTMovie setMuted:mute];
     
    327349
    328350    // Work-around bug that happends if you set/unset mute
    329     // before movie is playing, and audio is not played 
     351    // before movie is playing, and audio is not played
    330352    // through graph. Then audio is delayed.
    331353    [m_QTMovie setMuted:(!enable || m_mute)];
     
    346368    // The following code will not work for some media codecs that
    347369    // typically mingle audio/video frames (e.g mpeg).
    348     CFStringRef idString = PhononCFString::toCFStringRef(AudioDevice::deviceUID(id));       
     370    CFStringRef idString = PhononCFString::toCFStringRef(AudioDevice::deviceUID(id));
    349371    QTAudioContextRef context;
    350372    QTAudioContextCreateForAudioDevice(kCFAllocatorDefault, idString, 0, &context);
     
    370392    saturation += 1;
    371393
     394    if (m_brightness == brightness
     395        && m_contrast == contrast
     396        && m_hue == hue
     397        && m_saturation == saturation)
     398        return;
     399
    372400        m_brightness = brightness;
    373401        m_contrast = contrast;
    374402        m_hue = hue;
    375403        m_saturation = saturation;
    376        
    377404#ifdef QUICKTIME_C_API_AVAILABLE
    378405    Float32 value;
     
    386413    SetMovieVisualSaturation([m_QTMovie quickTimeMovie], value, 0);
    387414#endif
     415    releaseImageCache();
    388416}
    389417
     
    398426}
    399427
    400 void QuickTimeVideoPlayer::unsetVideo()
     428void QuickTimeVideoPlayer::unsetCurrentMediaSource()
    401429{
    402430    if (!m_QTMovie)
     
    411439    m_isDrmProtected = false;
    412440    m_isDrmAuthorized = true;
     441    m_hasVideo = false;
     442    m_staticFps = 0;
    413443    m_mediaSource = MediaSource();
     444    m_movieCompactDiscPath.clear();
    414445        [(CIImage *)m_primaryRenderingCIImage release];
    415446        m_primaryRenderingCIImage = 0;
    416447    delete m_QImagePixelBuffer;
    417448    m_QImagePixelBuffer = 0;
     449    releaseImageCache();
     450    [m_folderTracks release];
     451    m_folderTracks = 0;
    418452}
    419453
     
    525559{
    526560    PhononAutoReleasePool pool;
    527     unsetVideo();
     561    unsetCurrentMediaSource();
     562
    528563    m_mediaSource = mediaSource;
    529564    if (mediaSource.type() == MediaSource::Empty || mediaSource.type() == MediaSource::Invalid){
     
    531566        return;
    532567    }
     568
    533569    openMovieFromCurrentMediaSource();
    534570    if (errorOccured()){
    535         unsetVideo();
    536         return;
    537     }
    538 
     571        unsetCurrentMediaSource();
     572        return;
     573    }
     574
     575    prepareCurrentMovieForPlayback();
     576}
     577
     578void QuickTimeVideoPlayer::prepareCurrentMovieForPlayback()
     579{
    539580#ifdef QUICKTIME_C_API_AVAILABLE
    540581    if (m_visualContext)
     
    544585    waitStatePlayable();
    545586    if (errorOccured()){
    546         unsetVideo();
     587        unsetCurrentMediaSource();
    547588        return;
    548589    }
     
    551592    preRollMovie();
    552593    if (errorOccured()){
    553         unsetVideo();
     594        unsetCurrentMediaSource();
    554595        return;
    555596    }
     
    558599        m_playbackRate = prefferedPlaybackRate();
    559600    checkIfVideoAwailable();
     601    calculateStaticFps();
    560602    enableAudio(m_audioEnabled);
    561603    setMute(m_mute);
    562604    setVolume(m_masterVolume, m_relativeVolume);
     605    m_metaData->update();
    563606    pause();
    564607}
     
    574617        break;
    575618    case MediaSource::Disc:
    576         CASE_UNSUPPORTED("Could not open media source.", FATAL_ERROR)
     619        openMovieFromCompactDisc();
    577620        break;
    578621    case MediaSource::Stream:
     
    636679    // codecs *think* they can decode the stream, and crash...
    637680#define TryOpenMovieWithCodec(type) gClearError(); \
    638     openMovieFromData(data, "."type); \
     681    openMovieFromData(data, (char *)"."type); \
    639682    if (m_QTMovie) return;
    640683
     
    676719}
    677720
     721typedef void (*qt_sighandler_t)(int);
     722static void sigtest(int) {
     723    qApp->exit(0);
     724}
     725
     726void QuickTimeVideoPlayer::openMovieFromCompactDisc()
     727{
     728    // Interrupting the application while the device is open
     729    // causes the application to hang. So we need to handle
     730    // this in a more graceful way:
     731    qt_sighandler_t hndl = signal(SIGINT, sigtest);
     732    if (hndl)
     733        signal(SIGINT, hndl);
     734
     735    PhononAutoReleasePool pool;
     736    NSString *cd = 0;
     737    QString devName = m_mediaSource.deviceName();
     738    if (devName.isEmpty()) {
     739        cd = pathToCompactDisc();
     740        if (!cd) {
     741            SET_ERROR("Could not open media source.", NORMAL_ERROR)
     742            return;
     743        }
     744        m_movieCompactDiscPath = PhononCFString::toQString(reinterpret_cast<CFStringRef>(cd));
     745    } else {
     746       if (!QFileInfo(devName).isAbsolute())
     747           devName = QLatin1String("/Volumes/") + devName;
     748       cd = [reinterpret_cast<const NSString *>(PhononCFString::toCFStringRef(devName)) autorelease];
     749       if (!isCompactDisc(cd)) {
     750           SET_ERROR("Could not open media source.", NORMAL_ERROR)
     751           return;
     752       }
     753       m_movieCompactDiscPath = devName;
     754    }
     755
     756    m_folderTracks = [scanFolder(cd) retain];
     757    setCurrentTrack(0);
     758}
     759
     760QString QuickTimeVideoPlayer::movieCompactDiscPath() const
     761{
     762    return m_movieCompactDiscPath;
     763}
     764
    678765MediaSource QuickTimeVideoPlayer::mediaSource() const
    679766{
     
    719806        PhononAutoReleasePool pool;
    720807    return [[m_QTMovie attributeForKey:@"QTMovieTimeScaleAttribute"] longValue];
     808}
     809
     810float QuickTimeVideoPlayer::staticFps()
     811{
     812    return m_staticFps;
     813}
     814
     815void QuickTimeVideoPlayer::calculateStaticFps()
     816{
     817    if (!m_hasVideo){
     818        m_staticFps = 0;
     819        return;
     820    }
     821
     822#ifdef QT_ALLOW_QUICKTIME
     823    Boolean isMpeg = false;
     824    Track videoTrack = GetMovieIndTrackType([m_QTMovie quickTimeMovie], 1,
     825            FOUR_CHAR_CODE('vfrr'), // 'vfrr' means: has frame rate
     826            movieTrackCharacteristic | movieTrackEnabledOnly);
     827    Media media = GetTrackMedia(videoTrack);
     828    MediaHandler mediaH = GetMediaHandler(media);
     829    MediaHasCharacteristic(mediaH, FOUR_CHAR_CODE('mpeg'), &isMpeg);
     830
     831    if (isMpeg){
     832        MHInfoEncodedFrameRateRecord frameRate;
     833        Size frameRateSize = sizeof(frameRate);
     834        MediaGetPublicInfo(mediaH, kMHInfoEncodedFrameRate, &frameRate, &frameRateSize);
     835        m_staticFps = float(Fix2X(frameRate.encodedFrameRate));
     836    } else {
     837        Media media = GetTrackMedia(videoTrack);
     838        long sampleCount = GetMediaSampleCount(media);
     839        TimeValue64 duration = GetMediaDisplayDuration(media);
     840        TimeValue64 timeScale = GetMediaTimeScale(media);
     841        m_staticFps = float((double)sampleCount * (double)timeScale / (double)duration);
     842    }
     843#else
     844    m_staticFps = 30.0f;
     845#endif
    721846}
    722847
     
    9511076}
    9521077
     1078QMultiMap<QString, QString> QuickTimeVideoPlayer::metaData()
     1079{
     1080    return m_metaData->metaData();
     1081}
     1082
     1083int QuickTimeVideoPlayer::trackCount() const
     1084{
     1085    if (!m_folderTracks)
     1086        return 0;
     1087    return [m_folderTracks count];
     1088}
     1089
     1090int QuickTimeVideoPlayer::currentTrack() const
     1091{
     1092    return m_currentTrack;
     1093}
     1094
     1095QString QuickTimeVideoPlayer::currentTrackPath() const
     1096{
     1097    if (!m_folderTracks)
     1098        return QString();
     1099
     1100    PhononAutoReleasePool pool;
     1101    NSString *trackPath = [m_folderTracks objectAtIndex:m_currentTrack];
     1102    return PhononCFString::toQString(reinterpret_cast<CFStringRef>(trackPath));
     1103}
     1104
     1105NSString* QuickTimeVideoPlayer::pathToCompactDisc()
     1106{
     1107    PhononAutoReleasePool pool;
     1108    NSArray *devices = [[NSWorkspace sharedWorkspace] mountedRemovableMedia];
     1109    for (unsigned int i=0; i<[devices count]; ++i) {
     1110        NSString *dev = [devices objectAtIndex:i];
     1111        if (isCompactDisc(dev))
     1112            return [dev retain];
     1113    }
     1114    return 0;
     1115}
     1116
     1117bool QuickTimeVideoPlayer::isCompactDisc(NSString *path)
     1118{
     1119    PhononAutoReleasePool pool;
     1120    NSString *type = [NSString string];
     1121    [[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:path
     1122        isRemovable:0
     1123        isWritable:0
     1124        isUnmountable:0
     1125        description:0
     1126        type:&type];
     1127    return [type hasPrefix:@"cdd"];
     1128}
     1129
     1130NSArray* QuickTimeVideoPlayer::scanFolder(NSString *path)
     1131{
     1132    NSMutableArray *tracks = [NSMutableArray arrayWithCapacity:20];
     1133    if (!path)
     1134        return tracks;
     1135
     1136    NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtPath:path];
     1137    while (NSString *track = [enumerator nextObject]) {
     1138        if (![track hasPrefix:@"."])
     1139            [tracks addObject:[path stringByAppendingPathComponent:track]];
     1140    }
     1141    return tracks;
     1142}
     1143
     1144void QuickTimeVideoPlayer::setCurrentTrack(int track)
     1145{
     1146    PhononAutoReleasePool pool;
     1147    [m_QTMovie release];
     1148        m_QTMovie = 0;
     1149    m_currentTime = 0;
     1150    m_currentTrack = track;
     1151
     1152    if (!m_folderTracks)
     1153        return;
     1154    if (track < 0 || track >= (int)[m_folderTracks count])
     1155        return;
     1156
     1157    NSString *trackPath = [m_folderTracks objectAtIndex:track];
     1158    QTDataReference *dataRef = [QTDataReference dataReferenceWithReferenceToFile:trackPath];
     1159    State currentState = m_state;
     1160    openMovieFromDataRef(dataRef);
     1161    prepareCurrentMovieForPlayback();
     1162    if (currentState == Playing)
     1163        play();
     1164}
     1165
    9531166}}
    9541167
  • trunk/src/3rdparty/phonon/qt7/videoframe.mm

    r2 r561  
    2020#import <QuartzCore/CIFilter.h>
    2121#import <QuartzCore/CIContext.h>
     22
     23//#define CACHE_CV_TEXTURE
    2224
    2325QT_BEGIN_NAMESPACE
     
    7173    void VideoFrame::copyMembers(const VideoFrame& frame)
    7274    {
     75#ifdef CACHE_CV_TEXTURE
    7376        m_cachedCVTextureRef = frame.m_cachedCVTextureRef;
     77#endif
    7478                m_cachedCIImage = frame.m_cachedCIImage;
    7579                m_cachedQImage = frame.m_cachedQImage;
     
    106110    CVOpenGLTextureRef VideoFrame::cachedCVTexture() const
    107111    {
     112#ifdef CACHE_CV_TEXTURE
    108113        if (!m_cachedCVTextureRef && m_videoPlayer){
    109114            m_videoPlayer->setColors(m_brightness, m_contrast, m_hue, m_saturation);
    110115            (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = m_videoPlayer->currentFrameAsCVTexture();
     116            CVOpenGLTextureRetain((const_cast<VideoFrame *>(this))->m_cachedCVTextureRef);
    111117        }
    112118        return m_cachedCVTextureRef;
     119#else
     120        if (m_videoPlayer){
     121            m_videoPlayer->setColors(m_brightness, m_contrast, m_hue, m_saturation);
     122            return m_videoPlayer->currentFrameAsCVTexture();
     123        }
     124        return 0;
     125#endif
    113126    }
    114127
     
    330343    void VideoFrame::invalidateImage() const
    331344    {
     345#ifdef CACHE_CV_TEXTURE
    332346        if (m_cachedCVTextureRef){
    333347            CVOpenGLTextureRelease(m_cachedCVTextureRef);
    334348            (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0;
    335349        }
     350#endif
    336351        if (m_cachedCIImage){
    337352                        [(CIImage *) m_cachedCIImage release];
     
    347362    void VideoFrame::retain() const
    348363    {
     364#ifdef CACHE_CV_TEXTURE
    349365        if (m_cachedCVTextureRef)
    350366            CVOpenGLTextureRetain(m_cachedCVTextureRef);
     367#endif
    351368                if (m_cachedCIImage)
    352369                        [(CIImage *) m_cachedCIImage retain];
     
    359376    void VideoFrame::release() const
    360377    {
    361         if (m_cachedCVTextureRef)
     378#ifdef CACHE_CV_TEXTURE
     379        if (m_cachedCVTextureRef){
    362380            CVOpenGLTextureRelease(m_cachedCVTextureRef);
     381            (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0;
     382        }
     383#endif
    363384                if (m_cachedCIImage)
    364385                        [(CIImage *) m_cachedCIImage release];
     
    369390
    370391        (const_cast<VideoFrame *>(this))->m_backgroundFrame = 0;
    371         (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0;
    372392        (const_cast<VideoFrame *>(this))->m_cachedCIImage = 0;
    373393        (const_cast<VideoFrame *>(this))->m_cachedNSBitmap = 0;
  • trunk/src/3rdparty/phonon/waveout/mediaobject.cpp

    r2 r561  
    248248        {
    249249            m_thread = new WorkerThread();
    250             connect(this, SIGNAL(outOfData(QIODevice*, QByteArray*, bool*)), m_thread, SLOT(stream(QIODevice*, QByteArray*, bool*)));
     250            connect(this, SIGNAL(outOfData(QIODevice*,QByteArray*,bool*)), m_thread, SLOT(stream(QIODevice*,QByteArray*,bool*)));
    251251            m_thread->start();
    252252            m_soundBuffer1.waveHeader = new WAVEHDR;
     
    259259        {
    260260            stop();
    261             disconnect(this, SIGNAL(outOfData(QIODevice*, QByteArray*, bool*)), m_thread, SLOT(stream(QIODevice*, QByteArray*, bool*)));
     261            disconnect(this, SIGNAL(outOfData(QIODevice*,QByteArray*,bool*)), m_thread, SLOT(stream(QIODevice*,QByteArray*,bool*)));
    262262            do { //The event loop of m_thread might not be started, yet
    263263                m_thread->quit(); //If the event loop is not started yet quit() does nothing
Note: See TracChangeset for help on using the changeset viewer.