Changeset 561 for trunk/src/3rdparty/phonon
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 151 edited
- 42 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/3rdparty/phonon/CMakeLists.txt
r2 r561 56 56 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") 57 57 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) 59 59 endif (CMAKE_SYSTEM_NAME MATCHES Linux) 60 60 … … 116 116 endif (GCC_IS_NEWER_THAN_4_1) 117 117 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) 119 119 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") 120 120 set (KDE4_C_FLAGS "-fvisibility=hidden") … … 138 138 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden") 139 139 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) 141 141 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) 143 143 144 144 endif (CMAKE_COMPILER_IS_GNUCXX) … … 150 150 set(PHONON_LIB_MAJOR_VERSION "4") 151 151 set(PHONON_LIB_MINOR_VERSION "3") 152 set(PHONON_LIB_PATCH_VERSION " 1")153 set(PHONON_LIB_VERSION "${PHONON_LIB_MAJOR_VERSION}. 3.1")152 set(PHONON_LIB_PATCH_VERSION "50") 153 set(PHONON_LIB_VERSION "${PHONON_LIB_MAJOR_VERSION}.4.0") 154 154 set(PHONON_LIB_SOVERSION ${PHONON_LIB_MAJOR_VERSION}) 155 155 … … 178 178 set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) 179 179 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/") 180 if (WIN32) 181 _set_fancy(EXEC_INSTALL_PREFIX "." "Base directory for executables and libraries") 182 else(WIN32) 183 _set_fancy(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries") 184 endif(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") 182 187 _set_fancy(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)") 183 188 _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")185 189 _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)") 186 190 _set_fancy(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)") … … 197 201 set(INSTALL_TARGETS_DEFAULT_ARGS ${INSTALL_TARGETS_DEFAULT_ARGS} 198 202 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") 199 205 endif(APPLE) 200 206 … … 250 256 251 257 252 add_subdirectory(cmake)253 258 add_subdirectory(phonon) 254 259 add_subdirectory(includes) -
trunk/src/3rdparty/phonon/ds9/CMakeLists.txt
r2 r561 41 41 42 42 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}) 44 44 set_target_properties(phonon_ds9 PROPERTIES PREFIX "") 45 45 target_link_libraries(phonon_ds9 46 46 ${PHONON_LIBS} ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY} 47 47 dxguid strmiids dmoguids msdmo ole32 oleaut32 uuid gdi32) 48 # 'MODULE' is treated as a LIBRARY 48 49 install(TARGETS phonon_ds9 49 50 RUNTIME DESTINATION ${BIN_INSTALL_DIR}/phonon_backend 50 LIBRARY DESTINATION ${ LIB_INSTALL_DIR}51 LIBRARY DESTINATION ${BIN_INSTALL_DIR}/phonon_backend 51 52 ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) 52 53 install(FILES ds9.desktop DESTINATION ${SERVICES_INSTALL_DIR}/phononbackends) -
trunk/src/3rdparty/phonon/ds9/abstractvideorenderer.cpp
r2 r561 100 100 101 101 if (ratio > 0) { 102 if ( realWidth / realHeight > ratio && scaleMode == Phonon::VideoWidget::FitInView103 || realWidth / realHeight < ratio && scaleMode == Phonon::VideoWidget::ScaleAndCrop) {102 if ((realWidth / realHeight > ratio && scaleMode == Phonon::VideoWidget::FitInView) 103 || (realWidth / realHeight < ratio && scaleMode == Phonon::VideoWidget::ScaleAndCrop)) { 104 104 //the height is correct, let's change the width 105 105 m_dstWidth = qRound(realHeight * ratio); -
trunk/src/3rdparty/phonon/ds9/backend.cpp
r2 r561 42 42 namespace DS9 43 43 { 44 QMutex *Backend::directShowMutex = 0; 45 44 46 bool Backend::AudioMoniker::operator==(const AudioMoniker &other) 45 47 { … … 51 53 : QObject(parent) 52 54 { 53 ::CoInitialize(0); 55 directShowMutex = &m_directShowMutex; 56 57 ::CoInitialize(0); 54 58 55 59 //registering meta types … … 62 66 m_audioOutputs.clear(); 63 67 m_audioEffects.clear(); 64 ::CoUninitialize(); 68 ::CoUninitialize(); 69 70 directShowMutex = 0; 65 71 } 66 72 … … 132 138 QList<int> Backend::objectDescriptionIndexes(Phonon::ObjectDescriptionType type) const 133 139 { 140 QMutexLocker locker(&m_directShowMutex); 134 141 QList<int> ret; 135 142 … … 158 165 LPOLESTR str = 0; 159 166 mon->GetDisplayName(0,0,&str); 160 const QString name = QString::from Utf16((unsigned short*)str);167 const QString name = QString::fromWCharArray(str); 161 168 ComPointer<IMalloc> alloc; 162 169 ::CoGetMalloc(1, alloc.pparam()); … … 205 212 QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(Phonon::ObjectDescriptionType type, int index) const 206 213 { 214 QMutexLocker locker(&m_directShowMutex); 207 215 QHash<QByteArray, QVariant> ret; 208 216 switch (type) … … 217 225 HRESULT hr = mon->GetDisplayName(0,0, &str); 218 226 if (SUCCEEDED(hr)) { 219 QString name = QString::from Utf16((unsigned short*)str);227 QString name = QString::fromWCharArray(str); 220 228 ComPointer<IMalloc> alloc; 221 229 ::CoGetMalloc(1, alloc.pparam()); … … 232 240 HRESULT hr = ::DMOGetName(m_audioEffects[index], name); 233 241 if (SUCCEEDED(hr)) { 234 ret["name"] = QString::from Utf16((unsigned short*)name);242 ret["name"] = QString::fromWCharArray(name); 235 243 } 236 244 } -
trunk/src/3rdparty/phonon/ds9/backend.h
r2 r561 24 24 25 25 #include <QtCore/QList> 26 #include <QtCore/QMutex> 26 27 27 28 #include "compointer.h" … … 64 65 Filter getAudioOutputFilter(int index) const; 65 66 67 static QMutex *directShowMutex; 68 66 69 Q_SIGNALS: 67 70 void objectDescriptionChanged(ObjectDescriptionType); … … 75 78 mutable QVector<AudioMoniker> m_audioOutputs; 76 79 mutable QVector<CLSID> m_audioEffects; 80 mutable QMutex m_directShowMutex; 77 81 }; 78 82 } -
trunk/src/3rdparty/phonon/ds9/backendnode.cpp
r2 r561 58 58 BackendNode::~BackendNode() 59 59 { 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 } 60 79 } 61 80 -
trunk/src/3rdparty/phonon/ds9/ds9.desktop
r2 r561 6 6 X-KDE-PhononBackendInfo-InterfaceVersion=1 7 7 X-KDE-PhononBackendInfo-Version=0.1 8 X-KDE-PhononBackendInfo-Website=http:// www.trolltech.com/8 X-KDE-PhononBackendInfo-Website=http://qt.nokia.com/ 9 9 InitialPreference=15 10 10 11 11 Name=DirectShow9 12 Name[bg]=DirectShow9 13 Name[ca]=DirectShow9 14 Name[cs]=DirectShow9 15 Name[da]=DirectShow9 16 Name[de]=DirectShow9 17 Name[el]=DirectShow9 18 Name[en_GB]=DirectShow9 19 Name[es]=DirectShow9 20 Name[et]=DirectShow9 21 Name[eu]=DirectShow9 22 Name[fr]=DirectShow9 23 Name[ga]=DirectShow9 24 Name[gl]=DirectShow9 25 Name[hsb]=DirectShow9 26 Name[hu]=DirectShow9 27 Name[is]=DirectShow9 28 Name[it]=DirectShow9 29 Name[ja]=DirectShow9 30 Name[ko]=DirectShow9 31 Name[ku]=DirectShow9 32 Name[lt]=DirectShow9 33 Name[lv]=DirectShow9 34 Name[nds]=DirectShow9 35 Name[nl]=DirectShow9 36 Name[nn]=DirectShow9 12 37 Name[pa]=àš¡àšŸàšàš°à©àšàšžàšŒà©9 38 Name[pl]=DirectShow9 39 Name[pt]=DirectShow9 40 Name[pt_BR]=DirectShow9 41 Name[se]=DirectShow9 13 42 Name[sk]=DirectShow 9 14 43 Name[sl]=DirectShow 9 … … 16 45 Name[sr@latin]=DirectShowâ9 17 46 Name[sv]=Directshow 9 47 Name[tr]=DirectShow9 48 Name[uk]=DirectShow9 18 49 Name[x-test]=xxDirectShow9xx 50 Name[zh_CN]=DirectShow9 51 Name[zh_TW]=DirectShow9 19 52 20 53 Comment=Phonon DirectShow9 backend 21 54 Comment[bg]=Phonon DirectShow9 22 55 Comment[ca]=Dorsal DirectShow9 del Phonon 56 Comment[cs]=Phonon DirectShow9 backend 23 57 Comment[da]=DirectShow9-backend til Phonon 24 58 Comment[de]=Phonon-Treiber fÃŒr DirectShow9 … … 26 60 ÏοÏÏήÏÎ¹ÎŸÎ·Ï DirectShow9 ÏÎ¿Ï 27 61 Phonon 62 Comment[en_GB]=Phonon DirectShow9 backend 28 63 Comment[es]=Motor DirectShow9 para Phonon 29 64 Comment[et]=Phononi DirectShow9 taustaprogramm 65 Comment[eu]=Phonon DirectShow9 backend 30 66 Comment[fr]=SystÚme de gestion DirectShow9 pour Phonon 31 67 Comment[ga]=Inneall DirectShow9 le haghaidh Phonon 32 68 Comment[gl]=Infraestrutura de DirectShow9 para Phonon 69 Comment[hsb]=Phonon DirectShow9 backend 70 Comment[hu]=Phonon DirectShow9 modul 71 Comment[is]=Phonon DirectShow9 bakendi 33 72 Comment[it]=Motore DirectShow9 di Phonon 34 73 Comment[ja]=Phonon DirectShow9 ããã¯ãšã³ã 35 74 Comment[ko]=Phonon DirectShow9 ë°±ìë 75 Comment[ku]=Binesaza Phonon DirectShow9 76 Comment[lt]=Phonon DirectShow9 galinÄ sÄ 77 saja 36 78 Comment[lv]=Phonon DirectShow9 aizmugure 37 79 Comment[nds]=Phonon-HÃŒlpprogrmm DirectShow9 … … 42 84 Comment[pt]=Infra-estrutura do DirectShow9 para o Phonon 43 85 Comment[pt_BR]=Infraestrutura Phonon DirectShow9 86 Comment[se]=Phonon DirectShow9 duogášmohtor 44 87 Comment[sk]=Phonon DirectShow 9 podsystém 45 88 Comment[sl]=Phononova Hrbtenica DirectShow 9 -
trunk/src/3rdparty/phonon/ds9/effect.cpp
r2 r561 83 83 current += wcslen(current) + 1; //skip the unit 84 84 for(; *current; current += wcslen(current) + 1) { 85 values.append( QString::from Utf16((unsigned short*)current) );85 values.append( QString::fromWCharArray(current) ); 86 86 } 87 87 } … … 108 108 Phonon::EffectParameter::LogarithmicHint : Phonon::EffectParameter::Hints(0); 109 109 110 const QString n = QString::from Utf16((unsigned short*)name);110 const QString n = QString::fromWCharArray(name); 111 111 ret.append(Phonon::EffectParameter(i, n, hint, def, min, max, values)); 112 112 ::CoTaskMemFree(name); //let's free the memory … … 139 139 Q_ASSERT(params); 140 140 141 MP_DATA data = float(v.toDouble()); 142 params->SetParam(p.id(), data); 141 params->SetParam(p.id(), v.toFloat()); 143 142 } 144 143 } -
trunk/src/3rdparty/phonon/ds9/fakesource.cpp
r2 r561 30 30 { 31 31 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)}; 34 36 35 37 class FakePin : public QPin … … 129 131 void FakeSource::createFakeAudioPin() 130 132 { 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); 143 134 } 144 135 145 136 void FakeSource::createFakeVideoPin() 146 137 { 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); 161 139 } 162 140 -
trunk/src/3rdparty/phonon/ds9/iodevicereader.cpp
r2 r561 37 37 static QVector<AM_MEDIA_TYPE> getMediaTypes() 38 38 { 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}; 48 43 49 44 QVector<AM_MEDIA_TYPE> ret; 50 //normal auto-detect stream51 mt.subtype = MEDIASUBTYPE_NULL;52 ret << mt;53 45 //AVI stream 54 mt.subtype = MEDIASUBTYPE_Avi;55 46 ret << mt; 56 47 //WAVE stream 57 48 mt.subtype = MEDIASUBTYPE_WAVE; 49 ret << mt; 50 //normal auto-detect stream (must be at the end!) 51 mt.subtype = MEDIASUBTYPE_NULL; 58 52 ret << mt; 59 53 return ret; … … 73 67 void writeData(const QByteArray &data) 74 68 { 75 QWriteLocker locker(&m_lock);76 69 m_pos += data.size(); 77 70 m_buffer += data; … … 84 77 void setStreamSize(qint64 newSize) 85 78 { 86 Q WriteLocker locker(&m_lock);79 QMutexLocker locker(&m_mutex); 87 80 m_size = newSize; 88 }89 90 qint64 streamSize() const91 {92 QReadLocker locker(&m_lock);93 return m_size;94 81 } 95 82 96 83 void setStreamSeekable(bool s) 97 84 { 98 Q WriteLocker locker(&m_lock);85 QMutexLocker locker(&m_mutex); 99 86 m_seekable = s; 100 }101 102 bool streamSeekable() const103 {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() const117 {118 QReadLocker locker(&m_lock);119 return m_pos;120 }121 122 int currentBufferSize() const123 {124 QReadLocker locker(&m_lock);125 return m_buffer.size();126 87 } 127 88 … … 131 92 STDMETHODIMP Length(LONGLONG *total, LONGLONG *available) 132 93 { 133 Q ReadLocker locker(&m_lock);94 QMutexLocker locker(&m_mutex); 134 95 if (total) { 135 96 *total = m_size; … … 146 107 HRESULT read(LONGLONG pos, LONG length, BYTE *buffer, LONG *actual) 147 108 { 148 QMutexLocker locker(&m_mutexRead); 149 109 Q_ASSERT(!m_mutex.tryLock()); 150 110 if (m_mediaGraph->isStopping()) { 151 111 return VFW_E_WRONG_STATE; 152 112 } 153 113 154 if( streamSize() != 1 && pos + length > streamSize()) {114 if(m_size != 1 && pos + length > m_size) { 155 115 //it tries to read outside of the boundaries 156 116 return E_FAIL; 157 117 } 158 118 159 if ( currentPos() - currentBufferSize() != pos) {160 if (! streamSeekable()) {119 if (m_pos - m_buffer.size() != pos) { 120 if (!m_seekable) { 161 121 return S_FALSE; 162 122 } 163 setCurrentPos(pos); 123 m_pos = pos; 124 seekStream(pos); 125 m_buffer.clear(); 164 126 } 165 127 166 int oldSize = currentBufferSize();167 while ( currentBufferSize() < int(length)) {128 int oldSize = m_buffer.size(); 129 while (m_buffer.size() < int(length)) { 168 130 needData(); 169 131 if (m_mediaGraph->isStopping()) { … … 171 133 } 172 134 173 if (oldSize == currentBufferSize()) {135 if (oldSize == m_buffer.size()) { 174 136 break; //we didn't get any data 175 137 } 176 oldSize = currentBufferSize();138 oldSize = m_buffer.size(); 177 139 } 178 140 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); 186 145 187 146 if (actual) { … … 199 158 qint64 m_size; 200 159 201 QMutex m_mutexRead;202 160 const MediaGraph *m_mediaGraph; 203 161 }; … … 213 171 { 214 172 } 215 216 STDMETHODIMP IODeviceReader::Stop()217 {218 HRESULT hr = QBaseFilter::Stop();219 m_streamReader->enoughData(); //this asks to cancel any blocked call to needData220 return hr;221 }222 223 173 } 224 174 } -
trunk/src/3rdparty/phonon/ds9/iodevicereader.h
r2 r561 42 42 IODeviceReader(const MediaSource &source, const MediaGraph *); 43 43 ~IODeviceReader(); 44 STDMETHODIMP Stop();45 44 46 45 private: -
trunk/src/3rdparty/phonon/ds9/mediagraph.cpp
r2 r561 69 69 } 70 70 71 72 /* 71 73 static HRESULT saveToFile(Graph graph, const QString &filepath) 72 74 { … … 104 106 return hr; 105 107 } 106 108 */ 107 109 108 110 MediaGraph::MediaGraph(MediaObject *mo, short index) : … … 382 384 if (info.pGraph) { 383 385 info.pGraph->Release(); 384 return m_graph->RemoveFilter(filter); 386 if (info.pGraph == m_graph) 387 return m_graph->RemoveFilter(filter); 385 388 } 386 389 … … 538 541 for(int i = 0; i < outputs.count(); ++i) { 539 542 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())) { 541 544 return SUCCEEDED(pin->Connect(newIn, 0)); 542 545 } … … 680 683 } else if (source.discType() == Phonon::Cd) { 681 684 m_realSource = Filter(new QAudioCDPlayer); 682 m_result = m_graph->AddFilter(m_realSource, 0);683 685 684 686 #endif //QT_NO_PHONON_MEDIACONTROLLER … … 810 812 const OutputPin &out = outputs.at(i); 811 813 InputPin pin; 812 if (out->ConnectedTo(pin.pparam()) == VFW_E_NOT_CONNECTED) {814 if (out->ConnectedTo(pin.pparam()) == HRESULT(VFW_E_NOT_CONNECTED)) { 813 815 m_decoderPins += out; //unconnected outputs can be decoded outputs 814 816 } … … 1007 1009 HRESULT hr = mediaContent->get_AuthorName(&str); 1008 1010 if (SUCCEEDED(hr)) { 1009 ret.insert(QLatin1String("ARTIST"), QString::from Utf16((const unsigned short*)str));1011 ret.insert(QLatin1String("ARTIST"), QString::fromWCharArray(str)); 1010 1012 SysFreeString(str); 1011 1013 } 1012 1014 hr = mediaContent->get_Title(&str); 1013 1015 if (SUCCEEDED(hr)) { 1014 ret.insert(QLatin1String("TITLE"), QString::from Utf16((const unsigned short*)str));1016 ret.insert(QLatin1String("TITLE"), QString::fromWCharArray(str)); 1015 1017 SysFreeString(str); 1016 1018 } 1017 1019 hr = mediaContent->get_Description(&str); 1018 1020 if (SUCCEEDED(hr)) { 1019 ret.insert(QLatin1String("DESCRIPTION"), QString::from Utf16((const unsigned short*)str));1021 ret.insert(QLatin1String("DESCRIPTION"), QString::fromWCharArray(str)); 1020 1022 SysFreeString(str); 1021 1023 } 1022 1024 hr = mediaContent->get_Copyright(&str); 1023 1025 if (SUCCEEDED(hr)) { 1024 ret.insert(QLatin1String("COPYRIGHT"), QString::from Utf16((const unsigned short*)str));1026 ret.insert(QLatin1String("COPYRIGHT"), QString::fromWCharArray(str)); 1025 1027 SysFreeString(str); 1026 1028 } 1027 1029 hr = mediaContent->get_MoreInfoText(&str); 1028 1030 if (SUCCEEDED(hr)) { 1029 ret.insert(QLatin1String("MOREINFO"), QString::from Utf16((const unsigned short*)str));1031 ret.insert(QLatin1String("MOREINFO"), QString::fromWCharArray(str)); 1030 1032 SysFreeString(str); 1031 1033 } -
trunk/src/3rdparty/phonon/ds9/mediaobject.cpp
r2 r561 24 24 #ifndef Q_CC_MSVC 25 25 #include <dshow.h> 26 #endif //Q_CC_MSVC26 #endif 27 27 #include <objbase.h> 28 28 #include <initguid.h> … … 37 37 #include <QtCore/QDebug> 38 38 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) 40 40 #define PRELOAD_TIME 2000 // 2 seconds to load a source 41 41 … … 50 50 //first the definition of the WorkerThread class 51 51 WorkerThread::WorkerThread() 52 : QThread(), m_ currentRenderId(0), m_finished(false), m_currentWorkId(1)52 : QThread(), m_finished(false), m_currentWorkId(1) 53 53 { 54 54 } … … 56 56 WorkerThread::~WorkerThread() 57 57 { 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 state69 if (m_queue.isEmpty()) {70 m_waitCondition.reset();71 } else {72 m_waitCondition.set();73 }74 75 return ret;76 58 } 77 59 … … 89 71 DWORD result = ::WaitForMultipleObjects(count, handles, FALSE, INFINITE); 90 72 if (result == WAIT_OBJECT_0) { 91 if (m_finished) {92 //that's the end if the thread execution93 return;94 }95 96 73 handleTask(); 97 74 } else { … … 181 158 w.graph = Graph(CLSID_FilterGraph, IID_IGraphBuilder); 182 159 w.filter = filter; 160 w.graph->AddFilter(filter, 0); 183 161 w.id = m_currentWorkId++; 184 162 m_queue.enqueue(w); … … 200 178 void WorkerThread::handleTask() 201 179 { 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 } 206 195 } 207 196 208 197 HRESULT hr = S_OK; 209 198 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) { 216 200 int index = -1; 217 201 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) { 219 203 m_graphHandle[i].graph = Graph(); 220 204 index = i; … … 229 213 230 214 //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) 232 217 ->GetEventHandle(reinterpret_cast<OAEVENT*>(&h)))) { 233 m_graphHandle[index].graph = w.graph;218 m_graphHandle[index].graph = m_currentWork.graph; 234 219 m_graphHandle[index].handle = h; 235 220 } 236 } else if ( w.task == Render) {237 if ( w.filter) {221 } else if (m_currentWork.task == Render) { 222 if (m_currentWork.filter) { 238 223 //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()) { 249 229 //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); 251 231 } 252 232 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) { 256 236 //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; 259 239 hr = mediaSeeking->SetPositions(&newtime, AM_SEEKING_AbsolutePositioning, 260 240 0, AM_SEEKING_NoPositioning); 261 qint64 currentTime = -1; 262 if (SUCCEEDED(hr)) { 263 hr = mediaSeeking->GetCurrentPosition(¤tTime); 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) { 271 244 272 245 //remove useless decoders 273 246 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); 276 249 bool used = false; 277 250 const QList<OutputPin> pins = BackendNode::pins(filter, PINDIR_OUTPUT); … … 290 263 for (int i = 0; i < unused.count(); ++i) { 291 264 //we should remove this filter from the graph 292 w.graph->RemoveFilter(unused.at(i));265 m_currentWork.graph->RemoveFilter(unused.at(i)); 293 266 } 294 267 295 268 296 269 //we can get the state 297 ComPointer<IMediaControl> mc( w.graph, IID_IMediaControl);270 ComPointer<IMediaControl> mc(m_currentWork.graph, IID_IMediaControl); 298 271 299 272 //we change the state here 300 switch( w.state)273 switch(m_currentWork.state) 301 274 { 302 275 case State_Stopped: … … 316 289 if (SUCCEEDED(hr)) { 317 290 if (s == State_Stopped) { 318 emit stateReady( w.graph, Phonon::StoppedState);291 emit stateReady(m_currentWork.graph, Phonon::StoppedState); 319 292 } else if (s == State_Paused) { 320 emit stateReady( w.graph, Phonon::PausedState);293 emit stateReady(m_currentWork.graph, Phonon::PausedState); 321 294 } 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 { 334 308 QMutexLocker locker(&m_mutex); 309 if (m_currentWork.id == renderId) { 310 m_currentWork.graph->Abort(); 311 } 335 312 bool found = false; 336 //we try to see if there is already an attempt to seek and we remove it337 313 for(int i = 0; !found && i < m_queue.size(); ++i) { 338 314 const Work &w = m_queue.at(i); … … 340 316 found = true; 341 317 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 } 349 324 350 325 //tells the thread to stop processing … … 353 328 QMutexLocker locker(&m_mutex); 354 329 m_queue.clear(); 355 if (m_current Render) {330 if (m_currentWork.graph) { 356 331 //in case we're currently rendering something 357 m_current Render->Abort();332 m_currentWork.graph->Abort(); 358 333 359 334 } … … 384 359 385 360 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, 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, 399 SLOT(finishSeeking(quint16, 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))); 400 375 //really special case 401 376 m_mediaObject = this; … … 485 460 486 461 if (!m_aboutToFinishSent && remaining < PRELOAD_TIME - m_transitionTime + TIMER_INTERVAL/2) { 487 //let's take a 2 seconds time t ime to actually load the next file462 //let's take a 2 seconds time to actually load the next file 488 463 #ifdef GRAPH_DEBUG 489 464 qDebug() << "DS9: emit aboutToFinish" << remaining << QTime::currentTime().toString(); … … 520 495 qSwap(m_graphs[0], m_graphs[1]); //swap the graphs 521 496 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 522 509 //we tell the video widgets to switch now to the new source 523 510 #ifndef QT_NO_PHONON_VIDEO … … 528 515 529 516 emit currentSourceChanged(currentGraph()->mediaSource()); 530 531 if (currentGraph()->isLoading()) {532 //will simply tell that when loading is finished533 //it should start the playback534 play();535 }536 537 538 539 517 emit metaDataChanged(currentGraph()->metadata()); 540 518 … … 549 527 setTitles(currentGraph()->titles()); 550 528 #endif //QT_NO_PHONON_MEDIACONTROLLER 551 552 //this manages only gapless transitions553 if (currentGraph()->mediaSource().type() != Phonon::MediaSource::Invalid) {554 if (catchComError(currentGraph()->renderResult())) {555 setState(Phonon::ErrorState);556 } else {557 play();558 }559 }560 529 } 561 530 … … 583 552 #ifndef QT_NO_PHONON_MEDIACONTROLLER 584 553 //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) ? 586 555 titleAbsolutePosition(m_currentTitle+1) : currentGraph()->absoluteTotalTime(); 587 556 … … 596 565 { 597 566 //this handles inaccuracy when stopping on a title 598 return currentGraph()->absoluteCurrentTime() 567 return currentGraph()->absoluteCurrentTime() 599 568 #ifndef QT_NO_PHONON_MEDIACONTROLLER 600 569 - titleAbsolutePosition(m_currentTitle) … … 746 715 setState(Phonon::LoadingState); 747 716 //After loading we go into stopped state 748 m_nextState = Phonon::StoppedState; 717 m_nextState = Phonon::StoppedState; 749 718 catchComError(currentGraph()->loadSource(source)); 750 719 emit currentSourceChanged(source); … … 760 729 void MediaObject::loadingFinished(MediaGraph *mg) 761 730 { 762 if (mg == currentGraph()) { 731 if (mg == currentGraph()) { 763 732 #ifndef QT_NO_PHONON_MEDIACONTROLLER 764 733 //Title interface … … 791 760 case Phonon::PausedState: 792 761 pause(); 793 break;794 case Phonon::StoppedState:795 stop();796 762 break; 797 763 case Phonon::PlayingState: … … 801 767 setState(Phonon::ErrorState); 802 768 break; 769 case Phonon::StoppedState: 770 default: 771 stop(); 772 break; 803 773 } 804 774 } … … 817 787 void MediaObject::seekingFinished(MediaGraph *mg) 818 788 { 819 if (mg == currentGraph()) { 789 if (mg == currentGraph()) { 820 790 821 791 updateTargetTick(); … … 848 818 LPAMGETERRORTEXT getErrorText = (LPAMGETERRORTEXT)QLibrary::resolve(QLatin1String("quartz"), "AMGetErrorTextW"); 849 819 850 ushortbuffer[MAX_ERROR_TEXT_LEN];851 if (getErrorText && getErrorText(hr, (WCHAR*)buffer, MAX_ERROR_TEXT_LEN)) {852 m_errorString = QString::from Utf16(buffer);820 WCHAR buffer[MAX_ERROR_TEXT_LEN]; 821 if (getErrorText && getErrorText(hr, buffer, MAX_ERROR_TEXT_LEN)) { 822 m_errorString = QString::fromWCharArray(buffer); 853 823 } else { 854 824 m_errorString = QString::fromLatin1("Unknown error"); … … 892 862 if (VideoWidget *video = qobject_cast<VideoWidget*>(sink)) { 893 863 m_videoWidgets += video; 894 } else 864 } else 895 865 #endif //QT_NO_PHONON_VIDEO 896 866 if (AudioOutput *audio = qobject_cast<AudioOutput*>(sink)) { … … 911 881 if (VideoWidget *video = qobject_cast<VideoWidget*>(sink)) { 912 882 m_videoWidgets.removeOne(video); 913 } else 883 } else 914 884 #endif //QT_NO_PHONON_VIDEO 915 885 if (AudioOutput *audio = qobject_cast<AudioOutput*>(sink)) { … … 993 963 } 994 964 break; 995 case EC_LENGTH_CHANGED: 965 case EC_LENGTH_CHANGED: 996 966 if (graph == currentGraph()->graph()) { 997 967 emit totalTimeChanged( totalTime() ); -
trunk/src/3rdparty/phonon/ds9/mediaobject.h
r2 r561 115 115 enum Task 116 116 { 117 None, 117 118 Render, 118 119 Seek, … … 123 124 struct Work 124 125 { 126 Work() : task(None), id(0), time(0) { } 125 127 Task task; 126 128 quint16 id; … … 136 138 QList<Filter> decoders; //for the state change requests 137 139 }; 138 Work dequeueWork();139 140 void handleTask(); 140 141 141 Graph m_currentRender; 142 qint16 m_currentRenderId; 142 Work m_currentWork; 143 143 QQueue<Work> m_queue; 144 144 bool m_finished; 145 145 quint16 m_currentWorkId; 146 146 QWinWaitCondition m_waitCondition; 147 QMutex m_mutex; 147 QMutex m_mutex; // mutex for the m_queue, m_finished and m_currentWorkId 148 148 149 149 //this is for WaitForMultipleObjects -
trunk/src/3rdparty/phonon/ds9/qasyncreader.cpp
r2 r561 15 15 along with this library. If not, see <http://www.gnu.org/licenses/>. 16 16 */ 17 18 #include <QtCore/QFile>19 17 20 18 #include "qasyncreader.h" … … 81 79 STDMETHODIMP QAsyncReader::Request(IMediaSample *sample,DWORD_PTR user) 82 80 { 83 QMutexLocker mutexLocker(&m_mutexWait); 84 QWriteLocker locker(&m_lock); 81 QMutexLocker locker(&m_mutex); 85 82 if (m_flushing) { 86 83 return VFW_E_WRONG_STATE; … … 94 91 STDMETHODIMP QAsyncReader::WaitForNext(DWORD timeout, IMediaSample **sample, DWORD_PTR *user) 95 92 { 96 QMutexLocker locker(&m_mutex Wait);93 QMutexLocker locker(&m_mutex); 97 94 if (!sample ||!user) { 98 95 return E_POINTER; 99 96 } 100 97 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 101 101 *sample = 0; 102 102 *user = 0; 103 103 104 AsyncRequest r = getNextRequest();105 106 if (r.sample == 0) {107 //there is no request in the queue108 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()) { 109 109 return VFW_E_WRONG_STATE; 110 } else {111 //First we need to lock the mutex112 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();120 110 } 121 111 } 112 113 AsyncRequest r = m_requestQueue.dequeue(); 122 114 123 115 //at this point we're sure to have a request to proceed … … 128 120 *sample = r.sample; 129 121 *user = r.user; 130 131 return SyncReadAligned(r.sample); 122 return syncReadAlignedUnlocked(r.sample); 132 123 } 133 124 134 125 STDMETHODIMP QAsyncReader::BeginFlush() 135 126 { 136 QMutexLocker mutexLocker(&m_mutexWait); 137 QWriteLocker locker(&m_lock); 127 QMutexLocker locker(&m_mutex); 138 128 m_flushing = true; 139 129 m_requestWait.wakeOne(); … … 143 133 STDMETHODIMP QAsyncReader::EndFlush() 144 134 { 145 Q WriteLocker locker(&m_lock);135 QMutexLocker locker(&m_mutex); 146 136 m_flushing = false; 147 137 return S_OK; … … 150 140 STDMETHODIMP QAsyncReader::SyncReadAligned(IMediaSample *sample) 151 141 { 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 152 157 if (!sample) { 153 158 return E_POINTER; … … 176 181 } 177 182 178 STDMETHODIMP QAsyncReader::SyncRead(LONGLONG pos, LONG length, BYTE *buffer)179 {180 return read(pos, length, buffer, 0);181 }182 183 184 //addition185 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 }195 183 } 196 184 } -
trunk/src/3rdparty/phonon/ds9/qasyncreader.h
r2 r561 49 49 STDMETHODIMP SyncReadAligned(IMediaSample *); 50 50 STDMETHODIMP SyncRead(LONGLONG,LONG,BYTE *); 51 virtualSTDMETHODIMP Length(LONGLONG *,LONGLONG *) = 0;51 STDMETHODIMP Length(LONGLONG *,LONGLONG *) = 0; 52 52 STDMETHODIMP BeginFlush(); 53 53 STDMETHODIMP EndFlush(); 54 54 55 55 protected: 56 STDMETHODIMP syncReadAlignedUnlocked(IMediaSample *); 56 57 virtual HRESULT read(LONGLONG pos, LONG length, BYTE *buffer, LONG *actual) = 0; 57 58 … … 63 64 DWORD_PTR user; 64 65 }; 65 AsyncRequest getNextRequest();66 67 QMutex m_mutexWait;68 66 69 67 QQueue<AsyncRequest> m_requestQueue; -
trunk/src/3rdparty/phonon/ds9/qaudiocdreader.cpp
r2 r561 104 104 private: 105 105 HANDLE m_cddrive; 106 CDROM_TOC *m_toc;107 WaveStructure *m_waveHeader;106 CDROM_TOC m_toc; 107 WaveStructure m_waveHeader; 108 108 qint64 m_trackAddress; 109 109 }; … … 113 113 #define NB_SECTORS_READ 20 114 114 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 128 117 int addressToSectors(UCHAR address[4]) 129 118 { … … 142 131 143 132 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 { 149 135 //now open the cd-drive 150 136 QString path; … … 155 141 } 156 142 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)); 163 146 //read the TOC 164 147 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); 166 149 167 150 if (!tocRead) { … … 170 153 } 171 154 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) 174 157 - m_trackAddress); 175 158 const qint32 dataLength = nbSectorsToRead * SECTOR_SIZE; 176 159 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; 179 162 } 180 163 … … 182 165 { 183 166 ::CloseHandle(m_cddrive); 184 delete m_toc;185 delete m_waveHeader;186 187 167 } 188 168 … … 200 180 STDMETHODIMP QAudioCDReader::Length(LONGLONG *total,LONGLONG *available) 201 181 { 202 const LONGLONG length = sizeof(WaveStructure) + m_waveHeader ->dataLength;182 const LONGLONG length = sizeof(WaveStructure) + m_waveHeader.dataLength; 203 183 if (total) { 204 184 *total = length; … … 239 219 //we first copy the content of the structure 240 220 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); 242 222 } 243 223 244 224 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)); 246 226 247 227 if (bytesLeft > 0) { … … 298 278 QList<qint64> ret; 299 279 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; 302 282 ret << ((address[0] * 60 + address[1]) * 60 + address[2]) * 1000 + address[3]*1000/75 - 2000; 303 283 -
trunk/src/3rdparty/phonon/ds9/qbasefilter.cpp
r2 r561 93 93 } 94 94 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()) { 97 97 IPin *current = m_pins[m_index]; 98 98 current->AddRef(); … … 167 167 const QList<QPin *> QBaseFilter::pins() const 168 168 { 169 Q ReadLocker locker(&m_lock);169 QMutexLocker locker(&m_mutex); 170 170 return m_pins; 171 171 } … … 173 173 void QBaseFilter::addPin(QPin *pin) 174 174 { 175 Q WriteLocker locker(&m_lock);175 QMutexLocker locker(&m_mutex); 176 176 m_pins.append(pin); 177 177 } … … 179 179 void QBaseFilter::removePin(QPin *pin) 180 180 { 181 Q WriteLocker locker(&m_lock);181 QMutexLocker locker(&m_mutex); 182 182 m_pins.removeAll(pin); 183 183 } … … 212 212 else if (iid == IID_IMediaPosition || iid == IID_IMediaSeeking) { 213 213 if (inputPins().isEmpty()) { 214 if (*out = getUpStreamInterface(iid)) { 214 *out = getUpStreamInterface(iid); 215 if (*out) { 215 216 return S_OK; //we return here to avoid adding a reference 216 217 } else { … … 251 252 STDMETHODIMP QBaseFilter::GetClassID(CLSID *clsid) 252 253 { 253 Q ReadLocker locker(&m_lock);254 QMutexLocker locker(&m_mutex); 254 255 *clsid = m_clsid; 255 256 return S_OK; … … 258 259 STDMETHODIMP QBaseFilter::Stop() 259 260 { 260 Q WriteLocker locker(&m_lock);261 QMutexLocker locker(&m_mutex); 261 262 m_state = State_Stopped; 262 263 return S_OK; … … 265 266 STDMETHODIMP QBaseFilter::Pause() 266 267 { 267 Q WriteLocker locker(&m_lock);268 QMutexLocker locker(&m_mutex); 268 269 m_state = State_Paused; 269 270 return S_OK; … … 272 273 STDMETHODIMP QBaseFilter::Run(REFERENCE_TIME) 273 274 { 274 Q WriteLocker locker(&m_lock);275 QMutexLocker locker(&m_mutex); 275 276 m_state = State_Running; 276 277 return S_OK; … … 279 280 STDMETHODIMP QBaseFilter::GetState(DWORD, FILTER_STATE *state) 280 281 { 281 Q ReadLocker locker(&m_lock);282 QMutexLocker locker(&m_mutex); 282 283 if (!state) { 283 284 return E_POINTER; … … 290 291 STDMETHODIMP QBaseFilter::SetSyncSource(IReferenceClock *clock) 291 292 { 292 Q WriteLocker locker(&m_lock);293 QMutexLocker locker(&m_mutex); 293 294 if (clock) { 294 295 clock->AddRef(); … … 303 304 STDMETHODIMP QBaseFilter::GetSyncSource(IReferenceClock **clock) 304 305 { 305 Q ReadLocker locker(&m_lock);306 QMutexLocker locker(&m_mutex); 306 307 if (!clock) { 307 308 return E_POINTER; … … 342 343 STDMETHODIMP QBaseFilter::QueryFilterInfo(FILTER_INFO *info ) 343 344 { 344 Q ReadLocker locker(&m_lock);345 QMutexLocker locker(&m_mutex); 345 346 if (!info) { 346 347 return E_POINTER; … … 356 357 STDMETHODIMP QBaseFilter::JoinFilterGraph(IFilterGraph *graph, LPCWSTR name) 357 358 { 358 Q WriteLocker locker(&m_lock);359 QMutexLocker locker(&m_mutex); 359 360 m_graph = graph; 360 m_name = QString::from Utf16((const unsigned short*)name);361 m_name = QString::fromWCharArray(name); 361 362 return S_OK; 362 363 } -
trunk/src/3rdparty/phonon/ds9/qbasefilter.h
r2 r561 23 23 #include <QtCore/QString> 24 24 #include <QtCore/QList> 25 #include <QtCore/Q ReadWriteLock>25 #include <QtCore/QMutex> 26 26 27 27 #include <dshow.h> … … 128 128 FILTER_STATE m_state; 129 129 QList<QPin *> m_pins; 130 mutable Q ReadWriteLock m_lock;130 mutable QMutex m_mutex; 131 131 }; 132 132 } -
trunk/src/3rdparty/phonon/ds9/qmeminputpin.cpp
r2 r561 29 29 { 30 30 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) 33 33 { 34 34 } … … 67 67 //this allows to serialize with Receive calls 68 68 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(); 74 72 } 75 73 return S_OK; … … 79 77 { 80 78 //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); 88 84 m_flushing = true; 89 85 return S_OK; … … 93 89 { 94 90 //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); 102 96 m_flushing = false; 103 97 return S_OK; … … 106 100 STDMETHODIMP QMemInputPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate) 107 101 { 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); 111 104 return S_OK; 112 105 } … … 120 113 mt->majortype != MEDIATYPE_NULL && 121 114 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()); 130 118 } 131 119 return hr; … … 138 126 } 139 127 140 if (*alloc = memoryAllocator(true)) { 128 *alloc = memoryAllocator(true); 129 if (*alloc) { 141 130 return S_OK; 142 131 } … … 152 141 153 142 { 154 Q WriteLocker locker(&m_lock);143 QMutexLocker locker(&m_mutex); 155 144 m_shouldDuplicateSamples = m_transform && readonly; 156 145 } … … 158 147 setMemoryAllocator(alloc); 159 148 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); 166 152 } 167 153 … … 202 188 } 203 189 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()) 208 193 : sample; 209 194 … … 212 197 } 213 198 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); 220 202 } 221 203 … … 248 230 STDMETHODIMP QMemInputPin::ReceiveCanBlock() 249 231 { 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; 258 237 } 259 238 } … … 261 240 } 262 241 263 //addition264 //this should be used by the filter to tell it's input pins to which output they should route the samples265 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() const279 {280 QReadLocker locker(&m_lock);281 return m_outputs;282 }283 242 284 243 ALLOCATOR_PROPERTIES QMemInputPin::getDefaultAllocatorProperties() const … … 295 254 296 255 HRESULT hr = alloc->Commit(); 297 if (hr == VFW_E_SIZENOTSET) {256 if (hr == HRESULT(VFW_E_SIZENOTSET)) { 298 257 ALLOCATOR_PROPERTIES prop = getDefaultAllocatorProperties(); 299 258 prop.cbBuffer = qMax(prop.cbBuffer, length); … … 325 284 LONGLONG start, end; 326 285 hr = sample->GetMediaTime(&start, &end); 327 if (hr != VFW_E_MEDIA_TIME_NOT_SET) {286 if (hr != HRESULT(VFW_E_MEDIA_TIME_NOT_SET)) { 328 287 hr = out->SetMediaTime(&start, &end); 329 288 Q_ASSERT(SUCCEEDED(hr)); -
trunk/src/3rdparty/phonon/ds9/qmeminputpin.h
r2 r561 38 38 { 39 39 public: 40 QMemInputPin(QBaseFilter *, const QVector<AM_MEDIA_TYPE> &, bool transform );40 QMemInputPin(QBaseFilter *, const QVector<AM_MEDIA_TYPE> &, bool transform, QPin *output); 41 41 ~QMemInputPin(); 42 42 … … 61 61 STDMETHODIMP ReceiveCanBlock(); 62 62 63 //addition64 void addOutput(QPin *output);65 void removeOutput(QPin *output);66 QList<QPin*> outputs() const;67 68 63 private: 69 64 IMediaSample *duplicateSampleForOutput(IMediaSample *, IMemAllocator *); … … 72 67 bool m_shouldDuplicateSamples; 73 68 const bool m_transform; //defines if the pin is transforming the samples 74 Q List<QPin*> m_outputs;69 QPin* const m_output; 75 70 QMutex m_mutexReceive; 76 71 }; -
trunk/src/3rdparty/phonon/ds9/qpin.cpp
r2 r561 29 29 { 30 30 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}; 45 32 46 33 class QEnumMediaTypes : public IEnumMediaTypes … … 105 92 } 106 93 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()) { 109 96 //the caller will deallocate the memory 110 97 *out = static_cast<AM_MEDIA_TYPE *>(::CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))); … … 159 146 160 147 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) 164 151 { 165 152 Q_ASSERT(m_parent); … … 274 261 if (FAILED(hr)) { 275 262 setConnected(0); 276 setConnectedType(defaultMediaType ());263 setConnectedType(defaultMediaType); 277 264 } else { 278 265 ComPointer<IMemInputPin> input(pin, IID_IMemInputPin); … … 316 303 317 304 setConnected(0); 318 setConnectedType(defaultMediaType()); 319 if (m_direction == PINDIR_INPUT) { 320 setMemoryAllocator(0); 321 } 305 setConnectedType(defaultMediaType); 306 setMemoryAllocator(0); 322 307 return S_OK; 323 308 } … … 339 324 STDMETHODIMP QPin::ConnectionMediaType(AM_MEDIA_TYPE *type) 340 325 { 341 Q ReadLocker locker(&m_lock);326 QMutexLocker locker(&m_mutex); 342 327 if (!type) { 343 328 return E_POINTER; … … 354 339 STDMETHODIMP QPin::QueryPinInfo(PIN_INFO *info) 355 340 { 356 QReadLocker locker(&m_lock);357 341 if (!info) { 358 342 return E_POINTER; … … 362 346 info->pFilter = m_parent; 363 347 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; 366 349 return S_OK; 367 350 } … … 369 352 STDMETHODIMP QPin::QueryDirection(PIN_DIRECTION *dir) 370 353 { 371 QReadLocker locker(&m_lock);372 354 if (!dir) { 373 355 return E_POINTER; … … 380 362 STDMETHODIMP QPin::QueryId(LPWSTR *id) 381 363 { 382 QReadLocker locker(&m_lock);383 364 if (!id) { 384 365 return E_POINTER; 385 366 } 386 367 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; 390 370 return S_OK; 391 371 } … … 393 373 STDMETHODIMP QPin::QueryAccept(const AM_MEDIA_TYPE *type) 394 374 { 395 Q ReadLocker locker(&m_lock);375 QMutexLocker locker(&m_mutex); 396 376 if (!type) { 397 377 return E_POINTER; … … 440 420 STDMETHODIMP QPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate) 441 421 { 442 Q ReadLocker locker(&m_lock);422 QMutexLocker locker(&m_mutex); 443 423 if (m_direction == PINDIR_OUTPUT && m_connected) { 444 424 //we deliver this downstream … … 457 437 HRESULT QPin::checkOutputMediaTypesConnection(IPin *pin) 458 438 { 459 IEnumMediaTypes *emt = 0;460 HRESULT hr = pin->EnumMediaTypes( &emt);439 ComPointer<IEnumMediaTypes> emt; 440 HRESULT hr = pin->EnumMediaTypes(emt.pparam()); 461 441 if (hr != S_OK) { 462 442 return hr; … … 471 451 return S_OK; 472 452 } else { 473 setConnectedType(defaultMediaType ());453 setConnectedType(defaultMediaType); 474 454 freeMediaType(type); 475 455 } … … 521 501 void QPin::setConnectedType(const AM_MEDIA_TYPE &type) 522 502 { 523 Q WriteLocker locker(&m_lock);503 QMutexLocker locker(&m_mutex); 524 504 525 505 //1st we free memory … … 531 511 const AM_MEDIA_TYPE &QPin::connectedType() const 532 512 { 533 Q ReadLocker locker(&m_lock);513 QMutexLocker locker(&m_mutex); 534 514 return m_connectedType; 535 515 } … … 537 517 void QPin::setConnected(IPin *pin) 538 518 { 539 Q WriteLocker locker(&m_lock);519 QMutexLocker locker(&m_mutex); 540 520 if (pin) { 541 521 pin->AddRef(); … … 549 529 IPin *QPin::connected(bool addref) const 550 530 { 551 Q ReadLocker locker(&m_lock);531 QMutexLocker locker(&m_mutex); 552 532 if (addref && m_connected) { 553 533 m_connected->AddRef(); … … 558 538 bool QPin::isFlushing() const 559 539 { 560 Q ReadLocker locker(&m_lock);540 QMutexLocker locker(&m_mutex); 561 541 return m_flushing; 562 542 } … … 564 544 FILTER_STATE QPin::filterState() const 565 545 { 566 QReadLocker locker(&m_lock);567 546 FILTER_STATE fstate = State_Stopped; 568 547 m_parent->GetState(0, &fstate); … … 572 551 QVector<AM_MEDIA_TYPE> QPin::mediaTypes() const 573 552 { 574 Q ReadLocker locker(&m_lock);553 QMutexLocker locker(&m_mutex); 575 554 return m_mediaTypes; 576 555 } … … 608 587 void QPin::setMemoryAllocator(IMemAllocator *alloc) 609 588 { 610 Q WriteLocker locker(&m_lock);589 QMutexLocker locker(&m_mutex); 611 590 if (alloc) { 612 591 alloc->AddRef(); … … 620 599 IMemAllocator *QPin::memoryAllocator(bool addref) const 621 600 { 622 Q ReadLocker locker(&m_lock);601 QMutexLocker locker(&m_mutex); 623 602 if (addref && m_memAlloc) { 624 603 m_memAlloc->AddRef(); -
trunk/src/3rdparty/phonon/ds9/qpin.h
r2 r561 23 23 #include <QtCore/QString> 24 24 #include <QtCore/QVector> 25 #include <QtCore/Q ReadWriteLock>25 #include <QtCore/QMutex> 26 26 27 27 #include <dshow.h> … … 86 86 protected: 87 87 //this can be used by sub-classes 88 mutable Q ReadWriteLock m_lock;89 QBaseFilter * m_parent;88 mutable QMutex m_mutex; 89 QBaseFilter * const m_parent; 90 90 bool m_flushing; 91 91 … … 99 99 QVector<AM_MEDIA_TYPE> m_mediaTypes; //accepted media types 100 100 AM_MEDIA_TYPE m_connectedType; 101 QString m_name;102 101 IMemAllocator *m_memAlloc; 103 102 }; -
trunk/src/3rdparty/phonon/ds9/videorenderer_soft.cpp
r2 r561 64 64 "!!ARBfp1.0" 65 65 "PARAM c[5] = { program.local[0..1]," 66 " 67 " 68 " 66 "{ 1.164, 0, 1.596, 0.5 }," 67 "{ 0.0625, 1.164, -0.391, -0.81300002 }," 68 "{ 1.164, 2.0179999, 0 } };" 69 69 "TEMP R0;" 70 70 "TEX R0.x, fragment.texcoord[0], texture[1], 2D;" … … 90 90 91 91 static const char yuy2ToRgb[] = 92 92 "!!ARBfp1.0" 93 93 "PARAM c[5] = { program.local[0..1]," 94 " 95 " 96 " 94 "{ 0.5, 2, 1, 0.0625 }," 95 "{ 1.164, 0, 1.596, 2.0179999 }," 96 "{ 1.164, -0.391, -0.81300002 } };" 97 97 "TEMP R0;" 98 98 "TEMP R1;" … … 150 150 static const QVector<AM_MEDIA_TYPE> videoMediaTypes() 151 151 { 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 }; 160 153 161 154 QVector<AM_MEDIA_TYPE> ret; 162 155 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 166 158 mt.subtype = MEDIASUBTYPE_YUY2; 167 ret << mt; 159 ret << mt; //YUY2 168 160 mt.subtype = MEDIASUBTYPE_RGB32; 169 ret << mt; 161 ret << mt; //RGB32 170 162 171 163 return ret; … … 203 195 #ifndef QT_NO_OPENGL 204 196 freeGLResources(); 197 m_textureUploaded = false; 205 198 #endif // QT_NO_OPENGL 206 m_textureUploaded = false;207 199 } 208 200 … … 323 315 HANDLE m_renderEvent, m_receiveCanWait; // Signals sample to render 324 316 QSize m_size; 325 bool m_textureUploaded;326 317 327 318 //mixer settings … … 365 356 bool m_checkedPrograms; 366 357 bool m_usingOpenGL; 358 bool m_textureUploaded; 367 359 GLuint m_program[2]; 368 360 GLuint m_texture[3]; … … 374 366 public: 375 367 VideoRendererSoftPin(VideoRendererSoftFilter *parent) : 376 QMemInputPin(parent, videoMediaTypes(), false /*no transformation of the samples*/ ),368 QMemInputPin(parent, videoMediaTypes(), false /*no transformation of the samples*/, 0), 377 369 m_renderer(parent) 378 370 { … … 445 437 m_renderer(renderer), m_start(0) 446 438 #ifndef QT_NO_OPENGL 447 , m_usingOpenGL(false), m_checkedPrograms(false), m_textureUploaded(false)439 , m_checkedPrograms(false), m_usingOpenGL(false), m_textureUploaded(false) 448 440 #endif 449 441 { … … 670 662 671 663 #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 673 668 //for now we only support YUV (both YV12 and YUY2) 674 669 updateTexture(); … … 682 677 683 678 //let's draw the texture 679 painter.beginNativePainting(); 684 680 685 681 //Let's pass the other arguments … … 731 727 732 728 glDisable(GL_FRAGMENT_PROGRAM_ARB); 729 painter.endNativePainting(); 733 730 return; 734 731 } else -
trunk/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp
r2 r561 170 170 ComPointer<IVMRWindowlessControl9> windowlessControl(m_filter, IID_IVMRWindowlessControl9); 171 171 windowlessControl->SetVideoClippingWindow(reinterpret_cast<HWND>(target->winId())); 172 windowlessControl->SetAspectRatioMode(VMR9ARMode_None); //we're in control of the size 172 173 } 173 174 -
trunk/src/3rdparty/phonon/ds9/videowidget.cpp
r2 r561 85 85 { 86 86 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); 88 100 } 89 101 … … 107 119 void paintEvent(QPaintEvent *e) 108 120 { 121 if (!updatesEnabled()) 122 return; //this avoids repaint from native events 109 123 checkCurrentRenderingMode(); 110 124 m_currentRenderer->repaintCurrentFrame(this, e->rect()); … … 154 168 } else if (!isEmbedded()) { 155 169 m_currentRenderer = m_node->switchRendering(m_currentRenderer); 156 setAttribute(Qt::WA_PaintOnScreen, true);170 setAttribute(Qt::WA_PaintOnScreen, false); 157 171 } 158 172 } … … 161 175 AbstractVideoRenderer *m_currentRenderer; 162 176 QVariant m_restoreScreenSaverActive; 177 QBasicTimer m_flickerFreeTimer; 163 178 }; 164 179 … … 262 277 m_aspectRatio = aspectRatio; 263 278 updateVideoSize(); 279 m_widget->update(); 264 280 } 265 281 … … 280 296 m_scaleMode = scaleMode; 281 297 updateVideoSize(); 298 m_widget->update(); 282 299 } 283 300 -
trunk/src/3rdparty/phonon/ds9/volumeeffect.cpp
r2 r561 69 69 { 70 70 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}; 82 72 ret << mt; 83 73 return ret; … … 87 77 { 88 78 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) 90 80 { 91 81 } … … 150 140 //then creating the input 151 141 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); 154 143 } 155 144 -
trunk/src/3rdparty/phonon/gstreamer/CMakeLists.txt
r2 r561 18 18 19 19 if (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 ) 22 34 23 35 set(phonon_gstreamer_SRCS … … 46 58 47 59 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) 49 62 add_definitions(-DUSE_ALSASINK2) 50 63 include_directories(${ALSA_INCLUDES}) … … 53 66 alsasink2.c 54 67 ) 55 endif(ALSA_FOUND )68 endif(ALSA_FOUND AND NOT GSTREAMER_HAS_NONBLOCKING_ALSASINK) 56 69 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}) 59 71 set_target_properties(phonon_gstreamer PROPERTIES PREFIX "") 60 72 target_link_libraries(phonon_gstreamer -
trunk/src/3rdparty/phonon/gstreamer/abstractrenderer.cpp
r2 r561 18 18 #include "abstractrenderer.h" 19 19 20 #ifndef QT_NO_PHONON_VIDEO 20 21 QT_BEGIN_NAMESPACE 21 22 … … 53 54 54 55 QT_END_NAMESPACE 56 #endif //QT_NO_PHONON_VIDEO 55 57 56 -
trunk/src/3rdparty/phonon/gstreamer/abstractrenderer.h
r2 r561 24 24 #include <phonon/videowidget.h> 25 25 26 #ifndef QT_NO_PHONON_VIDEO 26 27 QT_BEGIN_NAMESPACE 27 28 … … 59 60 60 61 QT_END_NAMESPACE 61 62 #endif //QT_NO_PHONON_VIDEO 62 63 #endif // Phonon_GSTREAMER_ABSTRACTRENDERER_H -
trunk/src/3rdparty/phonon/gstreamer/artssink.cpp
r2 r561 234 234 GST_DEBUG_OBJECT (src, "initializing artssink"); 235 235 src->stream = 0; 236 236 #ifndef QT_NO_LIBRARY 237 237 p_arts_init = (Ptr_arts_init)QLibrary::resolve(QLatin1String("artsc"), 0, "arts_init"); 238 238 p_arts_play_stream = (Ptr_arts_play_stream)QLibrary::resolve(QLatin1String("artsc"), 0, "arts_play_stream"); … … 251 251 } 252 252 sinkCount ++; 253 #endif //QT_NO_LIBRARY 253 254 } 254 255 -
trunk/src/3rdparty/phonon/gstreamer/audioeffect.cpp
r2 r561 24 24 25 25 #include <gst/gst.h> 26 26 #ifndef QT_NO_PHONON_EFFECT 27 27 QT_BEGIN_NAMESPACE 28 28 … … 76 76 77 77 QT_END_NAMESPACE 78 #endif //QT_NO_PHONON_EFFECT 78 79 #include "moc_audioeffect.cpp" -
trunk/src/3rdparty/phonon/gstreamer/audioeffect.h
r2 r561 30 30 #include <gst/gst.h> 31 31 32 #ifndef QT_NO_PHONON_EFFECT 32 33 QT_BEGIN_NAMESPACE 33 34 34 namespace Phonon 35 35 { … … 50 50 }; 51 51 }} //namespace Phonon::Gstreamer 52 53 52 QT_END_NAMESPACE 53 #endif //QT_NO_PHONON_EFFECT 54 54 55 55 #endif // Phonon_GSTREAMER_AUDIOEFFECT_H -
trunk/src/3rdparty/phonon/gstreamer/audiooutput.cpp
r2 r561 43 43 m_name = "AudioOutput" + QString::number(count++); 44 44 if (m_backend->isValid()) { 45 g_set_application_name(qApp->applicationName().toUtf8());46 45 m_audioBin = gst_bin_new (NULL); 47 46 gst_object_ref (GST_OBJECT (m_audioBin)); … … 138 137 bool success = false; 139 138 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) { 141 148 // Save previous state 142 149 GstState oldState = GST_STATE(m_audioSink); 143 150 const QByteArray oldDeviceValue = GstHelper::property(m_audioSink, "device"); 144 const QByteArray deviceId = deviceList.at( newDevice).gstId;151 const QByteArray deviceId = deviceList.at(deviceIdx).gstId; 145 152 m_device = newDevice; 146 153 -
trunk/src/3rdparty/phonon/gstreamer/backend.cpp
r2 r561 50 50 , m_isValid(false) 51 51 { 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 52 59 GError *err = 0; 53 60 bool wasInit = gst_init_check(0, 0, &err); //init gstreamer: must be called before any gst-related functions … … 56 63 57 64 qRegisterMetaType<Message>("Message"); 58 65 #ifndef QT_NO_PROPERTIES 59 66 setProperty("identifier", QLatin1String("phonon_gstreamer")); 60 67 setProperty("backendName", QLatin1String("Gstreamer")); 61 68 setProperty("backendComment", QLatin1String("Gstreamer plugin for Phonon")); 62 69 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 64 72 65 73 //check if we should enable debug output … … 85 93 Backend::~Backend() 86 94 { 87 gst_deinit();88 95 } 89 96 … … 118 125 return ao; 119 126 } 127 #ifndef QT_NO_PHONON_EFFECT 120 128 case EffectClass: 121 129 return new AudioEffect(this, args[0].toInt(), parent); 122 130 #endif //QT_NO_PHONON_EFFECT 123 131 case AudioDataOutputClass: 124 132 logMessage("createObject() : AudioDataOutput not implemented"); 125 133 break; 126 134 135 #ifndef QT_NO_PHONON_VIDEO 127 136 case VideoDataOutputClass: 128 137 logMessage("createObject() : VideoDataOutput not implemented"); … … 133 142 return new VideoWidget(this, widget); 134 143 } 135 144 #endif //QT_NO_PHONON_VIDEO 145 #ifndef QT_NO_PHONON_VOLUMEFADEREFFECT 136 146 case VolumeFaderEffectClass: 137 147 return new VolumeFaderEffect(this, parent); 148 #endif //QT_NO_PHONON_VOLUMEFADEREFFECT 138 149 139 150 case VisualizationClass: //Fall through … … 204 215 QString klass = gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature)); 205 216 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")) { 208 226 209 227 const GList *static_templates; … … 277 295 case Phonon::AudioOutputDeviceType: { 278 296 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 } 283 304 } 284 305 } -
trunk/src/3rdparty/phonon/gstreamer/devicemanager.cpp
r2 r561 73 73 , m_backend(backend) 74 74 { 75 m_audioSink = qgetenv("PHONON_GST_AUDIOSINK"); 76 m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE"); 77 78 #ifndef QT_NO_SETTINGS 75 79 QSettings settings(QLatin1String("Trolltech")); 76 80 settings.beginGroup(QLatin1String("Qt")); 77 81 78 m_audioSink = qgetenv("PHONON_GST_AUDIOSINK");79 82 if (m_audioSink.isEmpty()) { 80 83 m_audioSink = settings.value(QLatin1String("audiosink"), "Auto").toByteArray().toLower(); 81 84 } 82 85 83 m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE");84 86 if (m_videoSinkWidget.isEmpty()) { 85 87 m_videoSinkWidget = settings.value(QLatin1String("videomode"), "Auto").toByteArray().toLower(); 86 88 } 89 #endif //QT_NO_SETTINGS 87 90 88 91 if (m_backend->isValid()) … … 244 247 } 245 248 249 #ifndef QT_NO_PHONON_VIDEO 246 250 AbstractRenderer *DeviceManager::createVideoRenderer(VideoWidget *parent) 247 251 { … … 266 270 return new WidgetRenderer(parent); 267 271 } 272 #endif //QT_NO_PHONON_VIDEO 268 273 269 274 /* -
trunk/src/3rdparty/phonon/gstreamer/effect.cpp
r2 r561 26 26 #include <gst/gst.h> 27 27 28 #ifndef QT_NO_PHONON_EFFECT 28 29 QT_BEGIN_NAMESPACE 29 30 30 namespace Phonon 31 31 { … … 242 242 } 243 243 } //namespace Phonon::Gstreamer 244 245 244 QT_END_NAMESPACE 245 #endif //QT_NO_PHONON_EFFECT 246 246 #include "moc_effect.cpp" -
trunk/src/3rdparty/phonon/gstreamer/effect.h
r2 r561 29 29 #include <gst/gst.h> 30 30 31 #ifndef QT_NO_PHONON_EFFECT 31 32 QT_BEGIN_NAMESPACE 32 33 33 namespace Phonon 34 34 { … … 59 59 }; 60 60 }} //namespace Phonon::Gstreamer 61 62 61 QT_END_NAMESPACE 62 #endif //QT_NO_PHONON_EFFECT 63 63 64 64 #endif // Phonon_GSTREAMER_EFFECT_H -
trunk/src/3rdparty/phonon/gstreamer/mediaobject.cpp
r2 r561 88 88 89 89 if (!m_backend->isValid()) { 90 setError(tr("Cannot start playback. \n\nCheck your G streamer installation and make sure you "90 setError(tr("Cannot start playback. \n\nCheck your GStreamer installation and make sure you " 91 91 "\nhave libgstreamer-plugins-base installed."), Phonon::FatalError); 92 92 } else { … … 96 96 connect(m_tickTimer, SIGNAL(timeout()), SLOT(emitTick())); 97 97 } 98 connect(this, SIGNAL(stateChanged(Phonon::State, 99 this, SLOT(notifyStateChange(Phonon::State, 98 connect(this, SIGNAL(stateChanged(Phonon::State,Phonon::State)), 99 this, SLOT(notifyStateChange(Phonon::State,Phonon::State))); 100 100 101 101 } … … 227 227 228 228 // These functions require GStreamer > 0.10.12 229 #ifndef QT_NO_LIBRARY 229 230 static Ptr_gst_pb_utils_init p_gst_pb_utils_init = 0; 230 231 static Ptr_gst_pb_utils_get_codec_description p_gst_pb_utils_get_codec_description = 0; … … 240 241 value = QString::fromUtf8(codecName); 241 242 g_free (codecName); 242 } else { 243 } else 244 #endif //QT_NO_LIBRARY 245 { 243 246 // For GStreamer versions < 0.10.12 244 247 GstStructure *str = gst_caps_get_structure (caps, 0); 245 248 value = QString::fromUtf8(gst_structure_get_name (str)); 249 246 250 } 247 251 media->addMissingCodecName(value); … … 341 345 GstPad *decodepad = static_cast<GstPad*>(data); 342 346 gst_pad_link (pad, decodepad); 343 gst_object_unref (decodepad);347 //gst_object_unref (decodepad); 344 348 } 345 349 … … 369 373 if (!m_datasource) 370 374 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 } 371 392 372 393 // Link data source into pipeline … … 388 409 bool MediaObject::createPipefromStream(const MediaSource &source) 389 410 { 411 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 390 412 // Remove any existing data source 391 413 if (m_datasource) { … … 409 431 } 410 432 return true; 433 #else //QT_NO_PHONON_ABSTRACTMEDIASTREAM 434 Q_UNUSED(source); 435 return false; 436 #endif 411 437 } 412 438 … … 903 929 break; 904 930 905 case MediaSource::Disc: // CD tracks can be specified by setting the url in the following way uri=cdda:4931 case MediaSource::Disc: 906 932 { 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))) 909 952 m_loading = true; 910 953 else … … 966 1009 GstFormat format = gst_format_get_by_nick("track"); 967 1010 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 } 973 1020 } 974 1021 } -
trunk/src/3rdparty/phonon/gstreamer/phononsrc.cpp
r2 r561 110 110 { 111 111 Q_UNUSED(g_class); 112 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 112 113 src->device = 0; 114 #else 115 Q_UNUSED(src); 116 #endif 113 117 } 114 118 115 119 static void phonon_src_finalize (GObject * object) 116 120 { 121 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 117 122 PhononSrc *src; 118 123 src = GST_PHONON_SRC (object); 119 124 delete src->device; 120 125 src->device = 0; 126 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM 121 127 G_OBJECT_CLASS (parent_class)->finalize (object); 122 128 } 123 129 130 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 124 131 static gboolean phonon_src_set_device(PhononSrc * src, StreamReader* device) 125 132 { … … 146 153 } 147 154 } 155 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM 148 156 149 157 static void phonon_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) … … 154 162 155 163 switch (prop_id) { 164 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 156 165 case ARG_PHONONSRC: 157 166 { … … 161 170 break; 162 171 } 172 #else 173 Q_UNUSED(value); 174 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM 163 175 default: 164 176 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); … … 175 187 176 188 switch (prop_id) { 189 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 177 190 case ARG_PHONONSRC: 178 191 g_value_set_pointer(value, src->device); 179 192 break; 193 #else //QT_NO_PHONON_ABSTRACTMEDIASTREAM 194 Q_UNUSED(value); 195 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM 180 196 default: 181 197 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); … … 186 202 static GstFlowReturn phonon_src_create_read (PhononSrc * src, guint64 offset, guint length, GstBuffer ** buffer) 187 203 { 204 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 188 205 Q_ASSERT(src->device); 189 206 if (!src->device) … … 205 222 gst_mini_object_unref(GST_MINI_OBJECT(buf)); 206 223 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 207 231 } 208 232 … … 219 243 { 220 244 PhononSrc *src = GST_PHONON_SRC (basesrc); 245 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 221 246 if (src->device) 222 247 return src->device->streamSeekable(); 248 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM 223 249 return false; 224 250 } … … 226 252 static gboolean phonon_src_get_size (GstBaseSrc * basesrc, guint64 * size) 227 253 { 254 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 228 255 PhononSrc *src; 229 256 src = GST_PHONON_SRC (basesrc); … … 232 259 return TRUE; 233 260 } 261 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM 234 262 *size = 0; 235 263 return FALSE; -
trunk/src/3rdparty/phonon/gstreamer/phononsrc.h
r2 r561 50 50 struct _PhononSrc { 51 51 GstBaseSrc element; 52 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 52 53 StreamReader *device; 54 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM 53 55 }; 54 56 -
trunk/src/3rdparty/phonon/gstreamer/streamreader.cpp
r2 r561 21 21 22 22 QT_BEGIN_NAMESPACE 23 23 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 24 24 namespace Phonon 25 25 { … … 50 50 } 51 51 } 52 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM 52 53 53 54 QT_END_NAMESPACE -
trunk/src/3rdparty/phonon/gstreamer/streamreader.h
r2 r561 23 23 24 24 QT_BEGIN_NAMESPACE 25 26 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 25 27 26 28 namespace Phonon … … 92 94 } 93 95 96 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM 97 94 98 QT_END_NAMESPACE 95 99 -
trunk/src/3rdparty/phonon/gstreamer/videowidget.cpp
r2 r561 34 34 #include "x11renderer.h" 35 35 36 #ifndef QT_NO_PHONON_VIDEO 36 37 QT_BEGIN_NAMESPACE 37 38 … … 384 385 385 386 QT_END_NAMESPACE 387 #endif //QT_NO_PHONON_VIDEO 386 388 387 389 #include "moc_videowidget.cpp" -
trunk/src/3rdparty/phonon/gstreamer/videowidget.h
r2 r561 29 29 #include <gst/gst.h> 30 30 31 #ifndef QT_NO_PHONON_VIDEO 31 32 QT_BEGIN_NAMESPACE 32 33 … … 103 104 104 105 QT_END_NAMESPACE 105 106 #endif //QT_NO_PHONON_VIDEO 106 107 #endif // Phonon_GSTREAMER_VIDEOWIDGET_H -
trunk/src/3rdparty/phonon/gstreamer/volumefadereffect.cpp
r2 r561 22 22 QT_BEGIN_NAMESPACE 23 23 24 #ifndef QT_NO_PHONON_VOLUMEFADEREFFECT 24 25 namespace Phonon 25 26 { 26 27 namespace Gstreamer 27 28 { 28 29 29 VolumeFaderEffect::VolumeFaderEffect(Backend *backend, QObject *parent) 30 30 : Effect(backend, parent, AudioSource | AudioSink) … … 157 157 158 158 }} //namespace Phonon::Gstreamer 159 159 #endif //QT_NO_PHONON_VOLUMEFADEREFFECT 160 160 QT_END_NAMESPACE 161 161 -
trunk/src/3rdparty/phonon/gstreamer/volumefadereffect.h
r2 r561 31 31 32 32 QT_BEGIN_NAMESPACE 33 33 #ifndef QT_NO_PHONON_VOLUMEFADEREFFECT 34 34 namespace Phonon 35 35 { … … 65 65 }; 66 66 }} //namespace Phonon::Gstreamer 67 67 #endif //QT_NO_PHONON_VOLUMEFADEREFFECT 68 68 QT_END_NAMESPACE 69 69 -
trunk/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp
r2 r561 33 33 #endif 34 34 35 #ifndef QT_NO_PHONON_VIDEO 35 36 QT_BEGIN_NAMESPACE 36 37 … … 149 150 150 151 QT_END_NAMESPACE 152 #endif //QT_NO_PHONON_VIDEO -
trunk/src/3rdparty/phonon/gstreamer/widgetrenderer.h
r2 r561 27 27 #endif 28 28 29 #ifndef QT_NO_PHONON_VIDEO 29 30 QT_BEGIN_NAMESPACE 30 31 … … 60 61 61 62 QT_END_NAMESPACE 62 63 #endif //QT_NO_PHONON_VIDEO 63 64 #endif // Phonon_GSTREAMER_WIDGETRENDERER_H -
trunk/src/3rdparty/phonon/includes/CMakeLists.txt
r2 r561 36 36 Phonon/VolumeFaderInterface 37 37 Phonon/VolumeSlider 38 DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Phonon )38 DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Phonon COMPONENT Devel) 39 39 40 40 install(FILES … … 47 47 Phonon/Experimental/VideoFrame2 48 48 Phonon/Experimental/Visualization 49 DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Phonon/Experimental )49 DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Phonon/Experimental COMPONENT Devel) -
trunk/src/3rdparty/phonon/phonon/abstractaudiooutput.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/abstractaudiooutput.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/abstractaudiooutput_p.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/abstractaudiooutput_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/abstractmediastream.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 50 50 AbstractMediaStream::~AbstractMediaStream() 51 51 { 52 delete d_ptr;53 52 } 54 53 -
trunk/src/3rdparty/phonon/phonon/abstractmediastream.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 215 215 216 216 AbstractMediaStream(AbstractMediaStreamPrivate &dd, QObject *parent); 217 AbstractMediaStreamPrivate *d_ptr;217 QScopedPointer<AbstractMediaStreamPrivate> d_ptr; 218 218 }; 219 219 -
trunk/src/3rdparty/phonon/phonon/abstractmediastream_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 46 46 void setStreamInterface(StreamInterface *); 47 47 void setMediaObjectPrivate(MediaObjectPrivate *); 48 ~AbstractMediaStreamPrivate(); 48 49 49 50 protected: … … 57 58 { 58 59 } 59 ~AbstractMediaStreamPrivate();60 60 61 61 virtual void setStreamSize(qint64 newSize); -
trunk/src/3rdparty/phonon/phonon/abstractvideooutput.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/abstractvideooutput.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/abstractvideooutput_p.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/abstractvideooutput_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/addoninterface.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/audiooutput.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 30 30 #include "platform_p.h" 31 31 32 #include < qmath.h>32 #include <QtCore/qmath.h> 33 33 34 34 #define PHONON_CLASSNAME AudioOutput … … 127 127 setVolume(Platform::loadVolume(newName)); 128 128 #ifndef QT_NO_DBUS 129 emit d->adaptor->nameChanged(newName); 129 if (d->adaptor) { 130 emit d->adaptor->nameChanged(newName); 131 } 130 132 #endif 131 133 } … … 258 260 pINTERFACE_CALL(setVolume(pow(volume, VOLTAGE_TO_LOUDNESS_EXPONENT))); 259 261 262 #ifndef QT_NO_PHONON_SETTINGSGROUP 260 263 // if the output device is not available and the device was not explicitly set 261 264 if (!callSetOutputDevice(this, device) && !outputDeviceOverridden) { … … 265 268 return; 266 269 } 267 for each (int devIndex, deviceList) {268 const AudioOutputDevice &dev = AudioOutputDevice::fromIndex(dev Index);270 for (int i = 0; i < deviceList.count(); ++i) { 271 const AudioOutputDevice &dev = AudioOutputDevice::fromIndex(deviceList.at(i)); 269 272 if (callSetOutputDevice(this, dev)) { 270 273 handleAutomaticDeviceChange(dev, AudioOutputPrivate::FallbackChange); … … 277 280 handleAutomaticDeviceChange(none, FallbackChange); 278 281 } 282 #endif //QT_NO_PHONON_SETTINGSGROUP 279 283 } 280 284 … … 306 310 // outputDeviceIndex identifies a failing device 307 311 // 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); 310 316 // if it's the same device as the one that failed, ignore it 311 317 if (device.index() != devIndex) { … … 317 323 } 318 324 } 325 #endif //QT_NO_PHONON_SETTINGSGROUP 319 326 // if we get here there is no working output device. Tell the backend. 320 327 const AudioOutputDevice none; … … 326 333 { 327 334 pDebug() << Q_FUNC_INFO; 335 #ifndef QT_NO_PHONON_SETTINGSGROUP 328 336 // 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); 330 338 DeviceChangeType changeType = HigherPreferenceChange; 331 foreach (int devIndex, deviceList) { 339 for (int i = 0; i < deviceList.count(); ++i) { 340 const int devIndex = deviceList.at(i); 332 341 const AudioOutputDevice &info = AudioOutputDevice::fromIndex(devIndex); 333 342 if (!info.property("available").toBool()) { … … 350 359 } 351 360 } 361 #endif //QT_NO_PHONON_SETTINGSGROUP 352 362 } 353 363 … … 402 412 { 403 413 #ifndef QT_NO_DBUS 404 emit adaptor->outputDestroyed(); 414 if (adaptor) { 415 emit adaptor->outputDestroyed(); 416 } 405 417 #endif 406 418 } -
trunk/src/3rdparty/phonon/phonon/audiooutput.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/audiooutput_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/audiooutputinterface.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/audiooutputinterface.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/backendcapabilities.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 76 76 { 77 77 QList<AudioOutputDevice> ret; 78 #ifndef QT_NO_PHONON_SETTINGSGROUP 78 79 const QList<int> deviceIndexes = GlobalConfig().audioOutputDeviceListFor(Phonon::NoCategory); 79 for each (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))); 81 82 } 83 #endif //QT_NO_PHONON_SETTINGSGROUP 82 84 return ret; 83 85 } … … 89 91 QList<AudioCaptureDevice> ret; 90 92 const QList<int> deviceIndexes = GlobalConfig().audioCaptureDeviceListFor(Phonon::NoCategory); 91 for each (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))); 93 95 } 94 96 return ret; … … 102 104 QList<EffectDescription> ret; 103 105 if (backendIface) { 104 QList<int> deviceIndexes = backendIface->objectDescriptionIndexes(Phonon::EffectType);105 for each (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))); 107 109 } 108 110 } -
trunk/src/3rdparty/phonon/phonon/backendcapabilities.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 16 16 Lesser General Public License for more details. 17 17 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 19 19 License along with this library. If not, see <http://www.gnu.org/licenses/>. 20 20 … … 89 89 90 90 /** 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. 92 92 * 93 93 * \return a pointer to a QObject. 94 94 * 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: 99 96 * \code 100 97 * QObject::connect(BackendCapabilities::notifier(), SIGNAL(capabilitiesChanged()), ... … … 102 99 * 103 100 * \see Notifier::capabilitiesChanged() 101 * \see Notifier::availableAudioOutputDevicesChanged() 102 * \see Notifier::availableAudioCaptureDevicesChanged() 104 103 */ 105 104 PHONON_EXPORT Notifier *notifier(); -
trunk/src/3rdparty/phonon/phonon/backendcapabilities_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/backendinterface.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/effect.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 108 108 if (m_backendObject) { 109 109 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); 111 112 parameterValues[p] = pINTERFACE_CALL(parameterValue(p)); 112 113 } … … 121 122 // set up attributes 122 123 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); 124 126 pINTERFACE_CALL(setParameterValue(p, parameterValues[p])); 125 127 } -
trunk/src/3rdparty/phonon/phonon/effect.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/effect_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/effectinterface.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/effectparameter.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/effectparameter.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/effectparameter_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/effectwidget.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 98 98 QVBoxLayout *mainLayout = new QVBoxLayout(q); 99 99 mainLayout->setMargin(0); 100 foreach (const EffectParameter ¶, effect->parameters()) { 100 const QList<Phonon::EffectParameter> parameters = effect->parameters(); 101 for (int i = 0; i < parameters.count(); ++i) { 102 const EffectParameter ¶ = parameters.at(i); 101 103 QVariant value = effect->parameterValue(para); 102 104 QHBoxLayout *pLayout = new QHBoxLayout; … … 118 120 if (value.type() == QVariant::Int) { 119 121 //value just defines the item index 120 for each (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()); 122 124 } 123 125 cb->setCurrentIndex(value.toInt()); 124 126 QObject::connect(cb, SIGNAL(currentIndexChanged(int)), q, SLOT(_k_setIntParameter(int))); 125 127 } 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); 127 130 cb->addItem(item.toString()); 128 131 if (item == value) { … … 156 159 } 157 160 break; 161 case QMetaType::Float: 158 162 case QVariant::Double: 159 163 { 160 const double minValue = (para.minimumValue().type() == QVariant::Double?161 para.minimumValue().to Double() : DEFAULT_MIN);162 const double maxValue = (para.maximumValue().type() == QVariant::Double?163 para.maximumValue().to Double() : 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; 164 168 165 169 if (minValue == -1. && maxValue == 1.) { 166 170 //Special case values between -1 and 1.0 to use a slider for improved usability 167 171 QSlider *slider = new QSlider(Qt::Horizontal, q); 172 control = slider; 168 173 slider->setRange(-SLIDER_RANGE, +SLIDER_RANGE); 169 slider->setValue(int(SLIDER_RANGE * value.to Double()));174 slider->setValue(int(SLIDER_RANGE * value.toReal())); 170 175 slider->setTickPosition(QSlider::TicksBelow); 171 176 slider->setTickInterval(TICKINTERVAL); … … 189 194 } 190 195 196 if (control) { 191 197 #ifndef QT_NO_TOOLTIP 192 198 control->setToolTip(para.description()); 193 199 #endif 194 if (control) {195 200 #ifndef QT_NO_SHORTCUT 196 201 label->setBuddy(control); -
trunk/src/3rdparty/phonon/phonon/effectwidget.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 40 40 41 41 /** \class EffectWidget effectwidget.h Phonon/EffectWidget 42 * \brief Widget to control the parameters of an \refEffect.42 * \brief Widget to control the parameters of an Effect. 43 43 * 44 44 * \ingroup PhononWidgets -
trunk/src/3rdparty/phonon/phonon/effectwidget_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/factory.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 112 112 bool FactoryPrivate::createBackend() 113 113 { 114 #ifndef QT_NO_LIBRARY 114 115 Q_ASSERT(m_backendObject == 0); 115 116 #ifndef QT_NO_PHONON_PLATFORMPLUGIN … … 125 126 // (finding the first loadable backend). 126 127 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; 129 131 const QDir dir(libPath); 130 132 if (!dir.exists()) { … … 132 134 continue; 133 135 } 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)); 136 161 if (!pluginLoader.load()) { 137 162 pDebug() << Q_FUNC_INFO << " load failed:" … … 163 188 164 189 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 165 195 } 166 196 167 197 FactoryPrivate::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), 171 202 #endif //QT_NO_PHONON_PLATFORMPLUGIN 172 ,m_backendObject(0)203 m_backendObject(0) 173 204 { 174 205 // Add the post routine to make sure that all other global statics (especially the ones from Qt) … … 184 215 FactoryPrivate::~FactoryPrivate() 185 216 { 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(); 194 219 } 195 220 if (objects.size() > 0) { … … 259 284 { 260 285 if (m_backendObject) { 261 for each (MediaNodePrivate *bp, mediaNodePrivateList) {262 bp->deleteBackendObject();286 for (int i = 0; i < mediaNodePrivateList.count(); ++i) { 287 mediaNodePrivateList.at(i)->deleteBackendObject(); 263 288 } 264 289 if (objects.size() > 0) { … … 269 294 // in case there were objects deleted give 'em a chance to recreate 270 295 // them now 271 for each (MediaNodePrivate *bp, mediaNodePrivateList) {272 bp->createBackendObject();296 for (int i = 0; i < mediaNodePrivateList.count(); ++i) { 297 mediaNodePrivateList.at(i)->createBackendObject(); 273 298 } 274 299 return; … … 278 303 } 279 304 createBackend(); 280 for each (MediaNodePrivate *bp, mediaNodePrivateList) {281 bp->createBackendObject();305 for (int i = 0; i < mediaNodePrivateList.count(); ++i) { 306 mediaNodePrivateList.at(i)->createBackendObject(); 282 307 } 283 308 emit backendChanged(); … … 363 388 ); 364 389 dir.setFilter(QDir::Files); 390 const QStringList libPaths = QCoreApplication::libraryPaths(); 365 391 forever { 366 for each (QString libPath, QCoreApplication::libraryPaths()) {367 libPath +=suffix;392 for (int i = 0; i < libPaths.count(); ++i) { 393 const QString libPath = libPaths.at(i) + suffix; 368 394 dir.setPath(libPath); 369 395 if (!dir.exists()) { 370 396 continue; 371 397 } 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)); 374 401 if (!pluginLoader.load()) { 375 402 pDebug() << Q_FUNC_INFO << " platform plugin load failed:" … … 423 450 } 424 451 452 #ifndef QT_NO_PROPERTIES 425 453 #define GET_STRING_PROPERTY(name) \ 426 454 QString Factory::name() \ … … 438 466 GET_STRING_PROPERTY(backendIcon) 439 467 GET_STRING_PROPERTY(backendWebsite) 440 468 #endif //QT_NO_PROPERTIES 441 469 QObject *Factory::registerQObject(QObject *o) 442 470 { 443 471 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); 445 473 globalFactory->objects.append(o); 446 474 } -
trunk/src/3rdparty/phonon/phonon/factory_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/frontendinterface_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/globalconfig.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 39 39 { 40 40 41 GlobalConfig::GlobalConfig() : m_config(QLatin1String("kde.org"), QLatin1String("libphonon")) 41 GlobalConfig::GlobalConfig() 42 #ifndef QT_NO_SETTINGS 43 : m_config(QLatin1String("kde.org"), QLatin1String("libphonon")) 44 #endif //QT_NO_SETTINGS 42 45 { 43 46 } … … 83 86 } 84 87 88 #ifndef QT_NO_PHONON_SETTINGSGROUP 85 89 static QList<int> listSortedByConfig(const QSettingsGroup &backendConfig, Phonon::Category category, QList<int> &defaultList) 86 90 { … … 127 131 return deviceList; 128 132 } 129 133 #endif //QT_NO_PHONON_SETTINGSGROUP 134 135 #ifndef QT_NO_PHONON_SETTINGSGROUP 130 136 QList<int> GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, int override) const 131 137 { … … 173 179 return listSortedByConfig(backendConfig, category, defaultList); 174 180 } 175 181 #endif //QT_NO_PHONON_SETTINGSGROUP 176 182 int GlobalConfig::audioOutputDeviceFor(Phonon::Category category, int override) const 177 183 { 184 #ifndef QT_NO_PHONON_SETTINGSGROUP 178 185 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; 182 190 } 183 191 … … 185 193 QList<int> GlobalConfig::audioCaptureDeviceListFor(Phonon::Category category, int override) const 186 194 { 195 #ifndef QT_NO_PHONON_SETTINGSGROUP 187 196 //The devices need to be stored independently for every backend 188 197 const QSettingsGroup backendConfig(&m_config, QLatin1String("AudioCaptureDevice")); // + Factory::identifier()); … … 227 236 228 237 return listSortedByConfig(backendConfig, category, defaultList); 238 #else //QT_NO_SETTINGSGROUP 239 return QList<int>(); 240 #endif //QT_NO_SETTINGSGROUP 229 241 } 230 242 -
trunk/src/3rdparty/phonon/phonon/globalconfig_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 47 47 HideUnavailableDevices = 4 48 48 }; 49 #ifndef QT_NO_PHONON_SETTINGSGROUP 49 50 QList<int> audioOutputDeviceListFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const; 51 #endif //QT_NO_PHONON_SETTINGSGROUP 50 52 int audioOutputDeviceFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const; 51 53 … … 56 58 57 59 protected: 60 #ifndef QT_NO_SETTINGS 58 61 QSettings m_config; 62 #endif //QT_NO_SETTINGS 59 63 }; 60 64 } // namespace Phonon -
trunk/src/3rdparty/phonon/phonon/globalstatic_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/iodevicestream.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/iodevicestream_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/mediacontroller.cpp
r2 r561 8 8 version 2.1 of the License, or (at your option) version 3, or any 9 9 later version accepted by the membership of KDE e.V. (or its 10 successor approved by the membership of KDE e.V.), Trolltech ASA10 successor approved by the membership of KDE e.V.), Nokia Corporation 11 11 (or its successors, if any) and the KDE Free Qt Foundation, which shall 12 12 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/mediacontroller.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/medianode.cpp
r2 r561 8 8 version 2.1 of the License, or (at your option) version 3, or any 9 9 later version accepted by the membership of KDE e.V. (or its 10 successor approved by the membership of KDE e.V.), Trolltech ASA10 successor approved by the membership of KDE e.V.), Nokia Corporation 11 11 (or its successors, if any) and the KDE Free Qt Foundation, which shall 12 12 act as a proxy defined in Section 6 of version 3 of the license. … … 68 68 MediaNodePrivate::~MediaNodePrivate() 69 69 { 70 for each (MediaNodeDestructionHandler *handler, handlers) {71 handler ->phononObjectDestroyed(this);70 for (int i = 0 ; i < handlers.count(); ++i) { 71 handlers.at(i)->phononObjectDestroyed(this); 72 72 } 73 73 Factory::deregisterFrontendObject(this); -
trunk/src/3rdparty/phonon/phonon/medianode.h
r2 r561 8 8 version 2.1 of the License, or (at your option) version 3, or any 9 9 later version accepted by the membership of KDE e.V. (or its 10 successor approved by the membership of KDE e.V.), Trolltech ASA10 successor approved by the membership of KDE e.V.), Nokia Corporation 11 11 (or its successors, if any) and the KDE Free Qt Foundation, which shall 12 12 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/medianode_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/medianodedestructionhandler_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/mediaobject.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 301 301 void MediaObject::enqueue(const QList<MediaSource> &sources) 302 302 { 303 for each (const MediaSource &m, sources) {304 enqueue( m);303 for (int i = 0; i < sources.count(); ++i) { 304 enqueue(sources.at(i)); 305 305 } 306 306 } … … 308 308 void MediaObject::enqueue(const QList<QUrl> &urls) 309 309 { 310 for each (const QUrl &url, urls) {311 enqueue(url );310 for (int i = 0; i < urls.count(); ++i) { 311 enqueue(urls.at(i)); 312 312 } 313 313 } … … 454 454 455 455 #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))); 457 457 #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))); 459 459 #endif // QT_NO_PHONON_ABSTRACTMEDIASTREAM 460 460 QObject::connect(m_backendObject, SIGNAL(tick(qint64)), q, SIGNAL(tick(qint64))); … … 468 468 QObject::connect(m_backendObject, SIGNAL(prefinishMarkReached(qint32)), q, SIGNAL(prefinishMarkReached(qint32))); 469 469 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))); 474 474 475 475 // set up attributes … … 503 503 504 504 #ifndef QT_NO_PHONON_MEDIACONTROLLER 505 for each (FrontendInterfacePrivate *f, interfaceList) {506 f->_backendObjectChanged();505 for (int i = 0 ; i < interfaceList.count(); ++i) { 506 interfaceList.at(i)->_backendObjectChanged(); 507 507 } 508 508 #endif //QT_NO_PHONON_MEDIACONTROLLER -
trunk/src/3rdparty/phonon/phonon/mediaobject.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 16 16 Lesser General Public License for more details. 17 17 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 19 19 License along with this library. If not, see <http://www.gnu.org/licenses/>. 20 20 … … 59 59 * \endcode 60 60 * 61 * If you want to play more tha tone media file (one after another) you can61 * If you want to play more than one media file (one after another) you can 62 62 * either tell MediaObject about all those files 63 63 * \code … … 199 199 * 200 200 * \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. 202 202 * 203 203 * \code 204 * connect(media, SIGNAL( hasVideoChanged(bool)), hasVideoChanged(bool));204 * connect(media, SIGNAL(seekableChanged(bool)), seekableChanged(bool)); 205 205 * media->setCurrentSource("somevideo.avi"); 206 * media-> hasVideo(); // returns false;206 * media->isSeekable(); // returns false; 207 207 * } 208 208 * 209 * void hasVideoChanged(bool b)209 * void seekableChanged(bool b) 210 210 * { 211 211 * // b == true 212 * media-> hasVideo(); // returns true;212 * media->isSeekable(); // returns true; 213 213 * } 214 214 * \endcode … … 302 302 303 303 /** 304 * Returns the queued media sources. This doeslist does not include304 * Returns the queued media sources. This list does not include 305 305 * the current source (returned by currentSource). 306 306 */ … … 457 457 /** 458 458 * Emitted when the state of the MediaObject has changed. 459 * In case you're not interested in the old state you can also460 * connect to a slot that only has one State argument.461 459 * 462 460 * @param newstate The state the Player is in now. … … 588 586 * This signal is emitted as soon as the total time of the media file is 589 587 * 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 timethe588 * time of the media can only be known after some time. Initially the 591 589 * totalTime function can not return useful information. You have 592 590 * to wait for this signal to know the real total time. -
trunk/src/3rdparty/phonon/phonon/mediaobject_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/mediaobjectinterface.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/mediasource.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 141 141 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 142 142 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(); 145 149 } 146 150 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM -
trunk/src/3rdparty/phonon/phonon/mediasource.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/mediasource_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/objectdescription.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/objectdescription.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/objectdescription_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 322 322 } 323 323 d->model->beginInsertRows(QModelIndex(), row, row + toInsert.size() - 1); 324 for each (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)); 326 326 } 327 327 d->model->endInsertRows(); -
trunk/src/3rdparty/phonon/phonon/objectdescriptionmodel.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 139 139 ObjectDescriptionModelDataPrivate *const d; 140 140 }; 141 142 /* Required to ensure template class vtables are exported on both symbian 143 and 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 141 156 142 157 /** \class ObjectDescriptionModel objectdescriptionmodel.h Phonon/ObjectDescriptionModel … … 176 191 */ 177 192 template<ObjectDescriptionType type> 178 class ObjectDescriptionModel : public QAbstractListModel193 class PHONON_TEMPLATE_CLASS_EXPORT ObjectDescriptionModel : public QAbstractListModel 179 194 { 180 195 public: … … 189 204 #if !defined(Q_CC_MINGW) || __MINGW32_MAJOR_VERSION >= 4 190 205 /** \internal */ 191 static PHONON_ EXPORT const QMetaObject staticMetaObject;206 static PHONON_TEMPLATE_CLASS_MEMBER_EXPORT const QMetaObject staticMetaObject; 192 207 /** \internal */ 193 PHONON_ EXPORT const QMetaObject *metaObject() const;208 PHONON_TEMPLATE_CLASS_MEMBER_EXPORT const QMetaObject *metaObject() const; 194 209 /** \internal */ 195 PHONON_ EXPORT void *qt_metacast(const char *_clname);210 PHONON_TEMPLATE_CLASS_MEMBER_EXPORT void *qt_metacast(const char *_clname); 196 211 //int qt_metacall(QMetaObject::Call _c, int _id, void **_a); 197 212 #endif … … 293 308 inline void setModelData(const QList<ObjectDescription<type> > &data) { //krazy:exclude=inline 294 309 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; 297 312 } 298 313 d->setModelData(list); … … 308 323 QList<ObjectDescription<type> > ret; 309 324 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)); 312 327 } 313 328 return ret; -
trunk/src/3rdparty/phonon/phonon/objectdescriptionmodel_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/path.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 59 59 { 60 60 #ifndef QT_NO_PHONON_EFFECT 61 for each (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); 63 63 } 64 64 delete effectsParent; … … 234 234 list << d->sourceNode->k_ptr->backendObject(); 235 235 #ifndef QT_NO_PHONON_EFFECT 236 for each(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(); 238 238 } 239 239 #endif … … 245 245 QList<QObjectPair> disco; 246 246 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) { 249 249 disco << QObjectPair(*it, *(it+1)); 250 250 } … … 261 261 262 262 #ifndef QT_NO_PHONON_EFFECT 263 for each(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()); 265 265 } 266 266 d->effects.clear(); … … 293 293 { 294 294 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); 296 297 nodesForTransaction << pair.first; 297 298 nodesForTransaction << pair.second; 298 299 } 299 foreach(const QObjectPair &pair, connections) { 300 for (int i = 0; i < connections.count(); ++i) { 301 const QObjectPair &pair = connections.at(i); 300 302 nodesForTransaction << pair.first; 301 303 nodesForTransaction << pair.second; … … 309 311 return false; 310 312 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) { 313 315 const QObjectPair &pair = *it; 314 316 if (!backend->disconnectNodes(pair.first, pair.second)) { … … 326 328 } 327 329 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; 330 332 if (!backend->connectNodes(pair.first, pair.second)) { 331 333 //Error: a connection failed … … 339 341 340 342 //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); 342 345 bool success = backend->connectNodes(pair.first, pair.second); 343 346 Q_ASSERT(success); //a failure here means it is impossible to reestablish the connection … … 418 421 } else { 419 422 #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); 421 425 if (e->k_ptr == mediaNodePrivate) { 422 426 removeEffect(e); -
trunk/src/3rdparty/phonon/phonon/path.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/path_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/phonon_export.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 33 33 # endif 34 34 # 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 36 40 # endif 37 41 #endif -
trunk/src/3rdparty/phonon/phonon/phonondefs.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/phonondefs_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/phononnamespace.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/phononnamespace.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 25 25 26 26 #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 27 32 28 33 /** -
trunk/src/3rdparty/phonon/phonon/phononnamespace.h.in
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 91 91 92 92 /** 93 * Provided as keys for \refMediaObject::metaData for convenience, in addition to the strings defined in93 * Provided as keys for MediaObject::metaData for convenience, in addition to the strings defined in 94 94 * the Ogg Vorbis specification. 95 95 */ -
trunk/src/3rdparty/phonon/phonon/phononnamespace_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/platform.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/platform_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/platformplugin.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/qsettingsgroup_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 27 27 #include <QtCore/QString> 28 28 #include <QtCore/QVariant> 29 30 #ifndef QT_NO_PHONON_SETTINGSGROUP 29 31 30 32 QT_BEGIN_HEADER … … 88 90 QT_END_NAMESPACE 89 91 QT_END_HEADER 92 #endif //QT_NO_PHONON_SETTINGSGROUP 90 93 91 94 #endif // PHONON_QSETTINGSGROUP_P_H -
trunk/src/3rdparty/phonon/phonon/seekslider.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 73 73 74 74 if (media) { 75 connect(media, SIGNAL(stateChanged(Phonon::State, 75 connect(media, SIGNAL(stateChanged(Phonon::State,Phonon::State)), 76 76 SLOT(_k_stateChanged(Phonon::State))); 77 77 connect(media, SIGNAL(totalTimeChanged(qint64)), SLOT(_k_length(qint64))); 78 78 connect(media, SIGNAL(tick(qint64)), SLOT(_k_tick(qint64))); 79 79 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())); 81 81 d->_k_stateChanged(media->state()); 82 82 d->_k_seekableChanged(media->isSeekable()); -
trunk/src/3rdparty/phonon/phonon/seekslider.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/seekslider_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/streaminterface.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/streaminterface.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/streaminterface_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/videoplayer.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/videoplayer.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/videowidget.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/videowidget.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/videowidget_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/videowidgetinterface.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/volumefadereffect.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/volumefadereffect.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/volumefadereffect_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/volumefaderinterface.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/volumeslider.cpp
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. … … 86 86 bool VolumeSlider::isMuteVisible() const 87 87 { 88 return k_ptr->muteButton.isVisible();88 return !k_ptr->muteButton.isHidden(); 89 89 } 90 90 -
trunk/src/3rdparty/phonon/phonon/volumeslider.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/phonon/volumeslider_p.h
r2 r561 7 7 version 2.1 of the License, or (at your option) version 3, or any 8 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), Trolltech ASA9 successor approved by the membership of KDE e.V.), Nokia Corporation 10 10 (or its successors, if any) and the KDE Free Qt Foundation, which shall 11 11 act as a proxy defined in Section 6 of version 3 of the license. -
trunk/src/3rdparty/phonon/qt7/backend.mm
r2 r561 60 60 setProperty("backendVersion", QLatin1String("0.1")); 61 61 setProperty("backendIcon", QLatin1String("")); 62 setProperty("backendWebsite", QLatin1String("http://qt software.com/"));62 setProperty("backendWebsite", QLatin1String("http://qt.nokia.com/")); 63 63 } 64 64 -
trunk/src/3rdparty/phonon/qt7/mediaobject.h
r2 r561 25 25 26 26 #include "medianode.h" 27 28 #if QT_ALLOW_QUICKTIME 29 #include <QuickTime/QuickTime.h> 30 #endif 27 31 28 32 QT_BEGIN_NAMESPACE … … 39 43 40 44 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 42 49 { 43 50 Q_OBJECT … … 92 99 93 100 int videoOutputCount(); 101 102 #if QT_ALLOW_QUICKTIME 103 void displayLinkEvent(); 104 #endif 94 105 95 106 signals: … … 106 117 void currentSourceChanged(const MediaSource &newSource); 107 118 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 108 129 protected: 109 130 void mediaNodeEvent(const MediaNodeEvent *event); … … 119 140 QuickTimeAudioPlayer *m_nextAudioPlayer; 120 141 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 122 150 123 151 qint32 m_tickInterval; … … 128 156 129 157 int m_tickTimer; 130 int m_bufferTimer; 158 int m_videoTimer; 159 int m_audioTimer; 131 160 int m_rapidTimer; 132 161 … … 134 163 int m_swapTimeLeft; 135 164 QTime m_swapTime; 165 bool m_autoplayTitles; 136 166 137 167 void synchAudioVideo(); … … 142 172 void play_internal(); 143 173 void setupAudioSystem(); 144 void updateTimer(int &timer, int interval); 145 void bufferAudioVideo(); 174 void restartAudioVideoTimers(); 146 175 void updateRapidly(); 147 176 void updateCrossFade(); … … 155 184 void inspectGraph(); 156 185 bool isCrossFading(); 186 void setCurrentTrack(int track); 157 187 158 188 QString m_errorString; -
trunk/src/3rdparty/phonon/qt7/mediaobject.mm
r2 r561 47 47 setAudioNode(m_mediaObjectAudioNode); 48 48 49 m_metaData = new QuickTimeMetaData();50 49 m_audioGraph = new AudioGraph(this); 51 50 … … 56 55 m_percentageLoaded = 0; 57 56 m_waitNextSwap = false; 57 m_autoplayTitles = true; 58 58 m_audioEffectCount = 0; 59 59 m_audioOutputCount = 0; … … 64 64 65 65 m_tickTimer = 0; 66 m_bufferTimer = 0; 66 m_videoTimer = 0; 67 m_audioTimer = 0; 67 68 m_rapidTimer = 0; 68 69 70 #if QT_ALLOW_QUICKTIME 71 m_displayLink = 0; 72 m_pendingDisplayLinkEvent = false; 73 #endif 74 69 75 checkForError(); 70 76 } 71 77 72 78 MediaObject::~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 75 84 m_audioPlayer->unsetVideoPlayer(); 76 85 m_nextAudioPlayer->unsetVideoPlayer(); 77 86 delete m_videoPlayer; 78 87 delete m_nextVideoPlayer; 79 delete m_metaData;80 88 checkForError(); 81 89 } … … 89 97 if (m_state != state){ 90 98 // End-application did something 91 // upon receiving the signal. 99 // upon receiving the signal. 92 100 return false; 93 101 } … … 123 131 // effects or outputs connected. This will have 124 132 // influence on the audio system and video system that ends up beeing used: 125 int prevVideoOutputCount = m_videoOutputCount; 133 int prevVideoOutputCount = m_videoOutputCount; 126 134 m_audioEffectCount = 0; 127 135 m_audioOutputCount = 0; … … 135 143 MediaNodeEvent e1(MediaNodeEvent::VideoOutputCountChanged, &m_videoOutputCount); 136 144 notify(&e1); 137 } 145 } 138 146 } 139 147 … … 168 176 if (newAudioSystem == m_audioSystem) 169 177 return; 170 178 171 179 // Enable selected audio system: 172 m_audioSystem = newAudioSystem; 180 m_audioSystem = newAudioSystem; 173 181 switch (newAudioSystem){ 174 182 case AS_Silent: 175 183 m_audioGraph->stop(); 176 184 m_videoPlayer->enableAudio(false); 177 m_nextVideoPlayer->enableAudio(false); 185 m_nextVideoPlayer->enableAudio(false); 178 186 m_audioPlayer->enableAudio(false); 179 187 m_nextAudioPlayer->enableAudio(false); … … 215 223 PhononAutoReleasePool pool; 216 224 setState(Phonon::LoadingState); 217 225 218 226 // Save current state for event/signal handling below: 219 227 bool prevHasVideo = m_videoPlayer->hasVideo(); 220 228 qint64 prevTotalTime = totalTime(); 229 int prevTrackCount = m_videoPlayer->trackCount(); 221 230 m_waitNextSwap = false; 222 231 223 232 // Cancel cross-fade if any: 224 233 m_nextVideoPlayer->pause(); 225 234 m_nextAudioPlayer->pause(); 226 235 m_mediaObjectAudioNode->cancelCrossFade(); 227 236 228 237 // Set new source: 229 238 m_audioPlayer->unsetVideoPlayer(); 230 239 m_videoPlayer->setMediaSource(source); 231 240 m_audioPlayer->setVideoPlayer(m_videoPlayer); 232 m_metaData->setVideo(m_videoPlayer); 233 234 m_audioGraph->updateStreamSpecifications(); 241 242 m_audioGraph->updateStreamSpecifications(); 235 243 m_nextAudioPlayer->unsetVideoPlayer(); 236 m_nextVideoPlayer->unset Video();244 m_nextVideoPlayer->unsetCurrentMediaSource(); 237 245 m_currentTime = 0; 238 246 239 247 // Emit/notify information about the new source: 240 248 QRect videoRect = m_videoPlayer->videoRect(); … … 247 255 248 256 emit currentSourceChanged(source); 249 emit metaDataChanged(m_ metaData->metaData());257 emit metaDataChanged(m_videoPlayer->metaData()); 250 258 251 259 if (prevHasVideo != m_videoPlayer->hasVideo()) 252 emit hasVideoChanged(m_videoPlayer->hasVideo()); 260 emit hasVideoChanged(m_videoPlayer->hasVideo()); 253 261 if (prevTotalTime != totalTime()) 254 emit totalTimeChanged(totalTime()); 262 emit totalTimeChanged(totalTime()); 263 if (prevTrackCount != m_videoPlayer->trackCount()) 264 emit availableTitlesChanged(m_videoPlayer->trackCount()); 255 265 if (checkForError()) 256 266 return; … … 261 271 if (!m_videoPlayer->canPlayMedia()) 262 272 SET_ERROR("Cannot play media.", FATAL_ERROR) 263 273 264 274 // The state might have changed from LoadingState 265 275 // as a response to an error state change. So we … … 288 298 bool prevHasVideo = m_videoPlayer->hasVideo(); 289 299 qint64 prevTotalTime = totalTime(); 300 int prevTrackCount = m_videoPlayer->trackCount(); 290 301 291 302 qSwap(m_audioPlayer, m_nextAudioPlayer); … … 293 304 m_mediaObjectAudioNode->startCrossFade(transitionTime); 294 305 m_audioGraph->updateStreamSpecifications(); 295 m_metaData->setVideo(m_videoPlayer);296 306 297 307 m_waitNextSwap = false; 298 308 m_currentTime = 0; 299 309 300 310 // Emit/notify information about the new source: 301 311 QRect videoRect = m_videoPlayer->videoRect(); … … 304 314 305 315 emit currentSourceChanged(m_videoPlayer->mediaSource()); 306 emit metaDataChanged(m_ metaData->metaData());316 emit metaDataChanged(m_videoPlayer->metaData()); 307 317 308 318 if (prevHasVideo != m_videoPlayer->hasVideo()) 309 emit hasVideoChanged(m_videoPlayer->hasVideo()); 319 emit hasVideoChanged(m_videoPlayer->hasVideo()); 310 320 if (prevTotalTime != totalTime()) 311 321 emit totalTimeChanged(totalTime()); 322 if (prevTrackCount != m_videoPlayer->trackCount()) 323 emit availableTitlesChanged(m_videoPlayer->trackCount()); 312 324 if (checkForError()) 313 325 return; … … 328 340 } 329 341 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 343 static 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 355 void 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 370 void 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; 387 fail: 388 stopDisplayLink(); 389 } 390 391 void 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 401 void 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(); 337 427 } 338 428 … … 341 431 // Play main audio/video: 342 432 m_videoPlayer->play(); 343 m_audioPlayer->play(); 433 m_audioPlayer->play(); 344 434 updateLipSynch(0); 345 435 // Play old audio/video to finish cross-fade: … … 348 438 m_nextAudioPlayer->play(); 349 439 } 350 bufferAudioVideo(); 351 updateTimer(m_rapidTimer, 100); 440 restartAudioVideoTimers(); 441 if (!m_rapidTimer) 442 m_rapidTimer = startTimer(100); 352 443 } 353 444 … … 359 450 m_videoPlayer->pause(); 360 451 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 364 461 if (m_waitNextSwap) 365 462 m_swapTimeLeft = m_swapTime.msecsTo(QTime::currentTime()); … … 383 480 return; 384 481 if (!setState(Phonon::PlayingState)) 385 return; 482 return; 386 483 if (m_audioSystem == AS_Graph){ 387 484 m_audioGraph->start(); … … 424 521 return; 425 522 m_waitNextSwap = false; 426 m_nextVideoPlayer->unset Video();523 m_nextVideoPlayer->unsetCurrentMediaSource(); 427 524 m_nextAudioPlayer->unsetVideoPlayer(); 428 525 pause_internal(); … … 436 533 if (m_state == Phonon::ErrorState) 437 534 return; 438 535 439 536 // Stop cross-fade if any: 440 m_nextVideoPlayer->unset Video();537 m_nextVideoPlayer->unsetCurrentMediaSource(); 441 538 m_nextAudioPlayer->unsetVideoPlayer(); 442 539 m_mediaObjectAudioNode->cancelCrossFade(); … … 447 544 m_audioPlayer->seek(m_videoPlayer->currentTime()); 448 545 m_mediaObjectAudioNode->setMute(false); 449 546 450 547 // Update time and cancel pending swap: 451 548 if (m_currentTime < m_videoPlayer->duration()) … … 558 655 { 559 656 IMPLEMENTED_SILENT; 560 const_cast<MediaObject *>(this)->updateCurrentTime(); 657 const_cast<MediaObject *>(this)->updateCurrentTime(); 561 658 return m_currentTime; 562 659 } … … 568 665 quint64 total = m_videoPlayer->duration(); 569 666 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 583 685 if (lastUpdateTime < m_currentTime && m_currentTime == total){ 584 686 emit finished(); … … 590 692 // We have a next source. 591 693 // 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); 593 695 if (m_waitNextSwap && m_state == Phonon::PlayingState && 594 696 m_transitionTime < m_swapTime.msecsTo(QTime::currentTime())){ … … 693 795 void MediaObject::updateCrossFade() 694 796 { 695 m_mediaObjectAudioNode->updateCrossFade(m_currentTime); 797 m_mediaObjectAudioNode->updateCrossFade(m_currentTime); 696 798 // Clean-up previous movie if done fading: 697 799 if (m_mediaObjectAudioNode->m_fadeDuration == 0){ 698 800 if (m_nextVideoPlayer->isPlaying() || m_nextAudioPlayer->isPlaying()){ 699 m_nextVideoPlayer->unset Video();801 m_nextVideoPlayer->unsetCurrentMediaSource(); 700 802 m_nextAudioPlayer->unsetVideoPlayer(); 701 803 } 702 } 804 } 703 805 } 704 806 … … 729 831 if (m_videoPlayer->videoFrameChanged()){ 730 832 updateLipSynch(50); 731 VideoFrame frame(m_videoPlayer); 833 VideoFrame frame(m_videoPlayer); 732 834 if (m_nextVideoPlayer->isPlaying() 733 835 && m_nextVideoPlayer->hasVideo() … … 737 839 frame.setBaseOpacity(m_mediaObjectAudioNode->m_volume1); 738 840 } 739 841 740 842 // Send the frame through the graph: 741 updateVideo(frame); 843 updateVideo(frame); 742 844 checkForError(); 743 845 } … … 750 852 if (m_videoSinkList.isEmpty() || m_audioSinkList.isEmpty()) 751 853 return; 752 854 753 855 if (m_videoPlayer->hasVideo()){ 754 856 qint64 diff = m_audioPlayer->currentTime() - m_videoPlayer->currentTime(); … … 762 864 m_nextAudioPlayer->seek(m_nextVideoPlayer->currentTime()); 763 865 } 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));774 866 } 775 867 … … 798 890 checkForError(); 799 891 m_mediaObjectAudioNode->setMute(false); 800 801 bufferAudioVideo();892 if (m_state == Phonon::PlayingState) 893 restartAudioVideoTimers(); 802 894 break; 803 895 case MediaNodeEvent::AudioGraphCannotPlay: … … 810 902 m_mediaObjectAudioNode->setMute(false); 811 903 } 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 }830 904 break; 831 905 default: 832 906 break; 833 907 } 908 } 909 910 bool 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 } 834 935 return QObject::event(event); 835 936 } 836 937 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 { 938 void 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 948 bool MediaObject::hasInterface(Interface iface) const 949 { 950 return iface == AddonInterface::TitleInterface; 951 } 952 953 QVariant MediaObject::interfaceCall(Interface iface, int command, const QList<QVariant> ¶ms) 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 } 844 974 return QVariant(); 845 975 } -
trunk/src/3rdparty/phonon/qt7/quicktimemetadata.h
r2 r561 39 39 { 40 40 public: 41 QuickTimeMetaData(); 42 virtual ~QuickTimeMetaData(); 43 44 void setVideo(QuickTimeVideoPlayer *videoPlayer); 41 QuickTimeMetaData(QuickTimeVideoPlayer *videoPlayer); 42 void update(); 45 43 QMultiMap<QString, QString> metaData(); 46 44 … … 50 48 QuickTimeVideoPlayer *m_videoPlayer; 51 49 void readMetaData(); 50 void guessMetaDataForCD(); 51 void readMetaDataFromMovie(); 52 52 53 53 #ifdef QUICKTIME_C_API_AVAILABLE -
trunk/src/3rdparty/phonon/qt7/quicktimemetadata.mm
r2 r561 16 16 */ 17 17 18 #include <QtCore/QFileInfo> 18 19 #include "quicktimemetadata.h" 19 20 #include "quicktimevideoplayer.h" … … 26 27 { 27 28 28 QuickTimeMetaData::QuickTimeMetaData( )29 { 30 m_videoPlayer = 0;29 QuickTimeMetaData::QuickTimeMetaData(QuickTimeVideoPlayer *videoPlayer) 30 { 31 m_videoPlayer = videoPlayer; 31 32 m_movieChanged = false; 32 33 } 33 34 34 QuickTimeMetaData::~QuickTimeMetaData() 35 { 36 } 37 38 void QuickTimeMetaData::setVideo(QuickTimeVideoPlayer *videoPlayer) 39 { 40 m_videoPlayer = videoPlayer; 35 void QuickTimeMetaData::update() 36 { 41 37 m_movieChanged = true; 42 38 m_metaData.clear(); … … 146 142 #endif // QUICKTIME_C_API_AVAILABLE 147 143 148 void QuickTimeMetaData::readMetaData() 149 { 150 if (!m_videoPlayer) 151 return; 144 void 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 154 void QuickTimeMetaData::readMetaDataFromMovie() 155 { 152 156 QMultiMap<QString, QString> metaMap; 153 157 154 158 #ifdef QUICKTIME_C_API_AVAILABLE 155 QTMetaDataRef metaDataRef; 159 QTMetaDataRef metaDataRef; 156 160 OSStatus err = QTCopyMovieMetaData([m_videoPlayer->qtMovie() quickTimeMovie], &metaDataRef); 157 161 BACKEND_ASSERT2(err == noErr, "Could not read QuickTime meta data", NORMAL_ERROR) … … 174 178 } 175 179 180 void 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 176 191 QMultiMap<QString, QString> QuickTimeMetaData::metaData() 177 192 { -
trunk/src/3rdparty/phonon/qt7/quicktimevideoplayer.h
r2 r561 40 40 { 41 41 class QuickTimeStreamReader; 42 class QuickTimeMetaData; 42 43 class VideoRenderWidgetQTMovieView; 43 44 … … 57 58 void setMediaSource(const MediaSource &source); 58 59 MediaSource mediaSource() const; 59 void unset Video();60 void unsetCurrentMediaSource(); 60 61 61 62 void play(); … … 68 69 void *currentFrameAsCIImage(); 69 70 QImage currentFrameAsQImage(); 71 void releaseImageCache(); 70 72 QRect videoRect() const; 71 73 … … 73 75 quint64 currentTime() const; 74 76 long timeScale() const; 77 float staticFps(); 75 78 QString currentTimeString(); 76 79 … … 85 88 void setPlaybackRate(float rate); 86 89 QTMovie *qtMovie() const; 90 QMultiMap<QString, QString> metaData(); 87 91 88 92 float playbackRate() const; … … 104 108 quint64 timeLoaded(); 105 109 110 int trackCount() const; 111 int currentTrack() const; 112 void setCurrentTrack(int track); 113 QString movieCompactDiscPath() const; 114 QString currentTrackPath() const; 115 106 116 static QString timeToString(quint64 ms); 107 117 … … 117 127 State m_state; 118 128 QGLPixelBuffer *m_QImagePixelBuffer; 129 QuickTimeMetaData *m_metaData; 130 131 CVOpenGLTextureRef m_cachedCVTextureRef; 132 QImage m_cachedQImage; 119 133 120 134 bool m_playbackRateSat; … … 127 141 float m_relativeVolume; 128 142 float m_playbackRate; 143 float m_staticFps; 129 144 quint64 m_currentTime; 130 145 MediaSource m_mediaSource; 146 131 147 void *m_primaryRenderingCIImage; 132 148 qreal m_brightness; … … 134 150 qreal m_hue; 135 151 qreal m_saturation; 152 NSArray *m_folderTracks; 153 int m_currentTrack; 154 QString m_movieCompactDiscPath; 136 155 137 156 #ifdef QUICKTIME_C_API_AVAILABLE … … 141 160 QuickTimeStreamReader *m_streamReader; 142 161 162 void prepareCurrentMovieForPlayback(); 143 163 void createVisualContext(); 144 164 void openMovieFromCurrentMediaSource(); … … 147 167 void openMovieFromUrl(); 148 168 void openMovieFromStream(); 169 void openMovieFromCompactDisc(); 149 170 void openMovieFromData(QByteArray *data, char *fileType); 150 171 void openMovieFromDataGuessType(QByteArray *data); 151 172 QString mediaSourcePath(); 152 173 bool codecExistsAccordingToSuffix(const QString &fileName); 174 NSString* pathToCompactDisc(); 175 bool isCompactDisc(NSString *path); 176 NSArray* scanFolder(NSString *path); 153 177 154 178 void setError(NSError *error); 155 179 bool errorOccured(); 156 180 void readProtection(); 181 void calculateStaticFps(); 157 182 void checkIfVideoAwailable(); 158 183 bool movieNotLoaded(); -
trunk/src/3rdparty/phonon/qt7/quicktimevideoplayer.mm
r2 r561 21 21 #include "audiodevice.h" 22 22 #include "quicktimestreamreader.h" 23 #include "quicktimemetadata.h" 23 24 24 25 #include <QtCore/QCoreApplication> … … 53 54 m_state = NoMedia; 54 55 m_mediaSource = MediaSource(); 56 m_metaData = new QuickTimeMetaData(this); 55 57 m_QTMovie = 0; 56 58 m_streamReader = 0; … … 62 64 m_audioEnabled = false; 63 65 m_hasVideo = false; 66 m_staticFps = 0; 64 67 m_playbackRateSat = false; 65 68 m_isDrmProtected = false; … … 68 71 m_primaryRenderingCIImage = 0; 69 72 m_QImagePixelBuffer = 0; 73 m_cachedCVTextureRef = 0; 74 m_folderTracks = 0; 75 m_currentTrack = 0; 70 76 71 77 #ifdef QUICKTIME_C_API_AVAILABLE … … 78 84 QuickTimeVideoPlayer::~QuickTimeVideoPlayer() 79 85 { 80 unsetVideo(); 86 PhononAutoReleasePool pool; 87 unsetCurrentMediaSource(); 88 delete m_metaData; 81 89 [(NSObject*)m_primaryRenderingTarget release]; 82 90 m_primaryRenderingTarget = 0; … … 85 93 CFRelease(m_visualContext); 86 94 #endif 95 } 96 97 void QuickTimeVideoPlayer::releaseImageCache() 98 { 99 if (m_cachedCVTextureRef){ 100 CVOpenGLTextureRelease(m_cachedCVTextureRef); 101 m_cachedCVTextureRef = 0; 102 } 103 m_cachedQImage = QImage(); 87 104 } 88 105 … … 126 143 127 144 QTVisualContextTask(m_visualContext); 128 return QTVisualContextIsNewImageAvailable(m_visualContext, 0); 145 bool changed = QTVisualContextIsNewImageAvailable(m_visualContext, 0); 146 if (changed) 147 releaseImageCache(); 148 return changed; 129 149 130 150 #elif defined(QT_MAC_USE_COCOA) … … 141 161 if (!m_visualContext) 142 162 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; 147 168 148 169 #else … … 153 174 QImage QuickTimeVideoPlayer::currentFrameAsQImage() 154 175 { 176 if (!m_cachedQImage.isNull()) 177 return m_cachedQImage; 178 155 179 #ifdef QUICKTIME_C_API_AVAILABLE 156 180 QGLContext *prevContext = const_cast<QGLContext *>(QGLContext::currentContext()); … … 182 206 glEnd(); 183 207 184 QImage image = m_QImagePixelBuffer->toImage(); 185 CVOpenGLTextureRelease(texture); 208 m_cachedQImage = m_QImagePixelBuffer->toImage(); 186 209 // Because of QuickTime, m_QImagePixelBuffer->doneCurrent() will fail. 187 210 // So we store, and restore, the context our selves: 188 211 prevContext->makeCurrent(); 189 return image;212 return m_cachedQImage; 190 213 #else 191 214 CIImage *img = (CIImage *)currentFrameAsCIImage(); … … 196 219 CGRect bounds = [img extent]; 197 220 QImage qImg([bitmap bitmapData], bounds.size.width, bounds.size.height, QImage::Format_ARGB32); 198 QImage swapped= qImg.rgbSwapped();221 m_cachedQImage = qImg.rgbSwapped(); 199 222 [bitmap release]; 200 223 [img release]; 201 return swapped;224 return m_cachedQImage; 202 225 #endif 203 226 } … … 251 274 CVOpenGLTextureRef cvImg = currentFrameAsCVTexture(); 252 275 CIImage *img = [[CIImage alloc] initWithCVImageBuffer:cvImg]; 253 CVOpenGLTextureRelease(cvImg); 254 return img; 276 return img; 255 277 #else 256 278 return 0; … … 274 296 int samplesPerPixel = [bitmap samplesPerPixel]; 275 297 if (![bitmap isPlanar] && (samplesPerPixel == 3 || samplesPerPixel == 4)){ 276 glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 298 glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 277 299 samplesPerPixel == 4 ? GL_RGBA8 : GL_RGB8, 278 300 [bitmap pixelsWide], [bitmap pixelsHigh], … … 303 325 m_relativeVolume = relativeVolume; 304 326 if (!m_QTMovie || !m_audioEnabled || m_mute) 305 return; 327 return; 306 328 [m_QTMovie setVolume:(m_masterVolume * m_relativeVolume)]; 307 329 } … … 314 336 315 337 // 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 317 339 // through graph. Then audio is delayed. 318 340 [m_QTMovie setMuted:mute]; … … 327 349 328 350 // 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 330 352 // through graph. Then audio is delayed. 331 353 [m_QTMovie setMuted:(!enable || m_mute)]; … … 346 368 // The following code will not work for some media codecs that 347 369 // typically mingle audio/video frames (e.g mpeg). 348 CFStringRef idString = PhononCFString::toCFStringRef(AudioDevice::deviceUID(id)); 370 CFStringRef idString = PhononCFString::toCFStringRef(AudioDevice::deviceUID(id)); 349 371 QTAudioContextRef context; 350 372 QTAudioContextCreateForAudioDevice(kCFAllocatorDefault, idString, 0, &context); … … 370 392 saturation += 1; 371 393 394 if (m_brightness == brightness 395 && m_contrast == contrast 396 && m_hue == hue 397 && m_saturation == saturation) 398 return; 399 372 400 m_brightness = brightness; 373 401 m_contrast = contrast; 374 402 m_hue = hue; 375 403 m_saturation = saturation; 376 377 404 #ifdef QUICKTIME_C_API_AVAILABLE 378 405 Float32 value; … … 386 413 SetMovieVisualSaturation([m_QTMovie quickTimeMovie], value, 0); 387 414 #endif 415 releaseImageCache(); 388 416 } 389 417 … … 398 426 } 399 427 400 void QuickTimeVideoPlayer::unset Video()428 void QuickTimeVideoPlayer::unsetCurrentMediaSource() 401 429 { 402 430 if (!m_QTMovie) … … 411 439 m_isDrmProtected = false; 412 440 m_isDrmAuthorized = true; 441 m_hasVideo = false; 442 m_staticFps = 0; 413 443 m_mediaSource = MediaSource(); 444 m_movieCompactDiscPath.clear(); 414 445 [(CIImage *)m_primaryRenderingCIImage release]; 415 446 m_primaryRenderingCIImage = 0; 416 447 delete m_QImagePixelBuffer; 417 448 m_QImagePixelBuffer = 0; 449 releaseImageCache(); 450 [m_folderTracks release]; 451 m_folderTracks = 0; 418 452 } 419 453 … … 525 559 { 526 560 PhononAutoReleasePool pool; 527 unsetVideo(); 561 unsetCurrentMediaSource(); 562 528 563 m_mediaSource = mediaSource; 529 564 if (mediaSource.type() == MediaSource::Empty || mediaSource.type() == MediaSource::Invalid){ … … 531 566 return; 532 567 } 568 533 569 openMovieFromCurrentMediaSource(); 534 570 if (errorOccured()){ 535 unsetVideo(); 536 return; 537 } 538 571 unsetCurrentMediaSource(); 572 return; 573 } 574 575 prepareCurrentMovieForPlayback(); 576 } 577 578 void QuickTimeVideoPlayer::prepareCurrentMovieForPlayback() 579 { 539 580 #ifdef QUICKTIME_C_API_AVAILABLE 540 581 if (m_visualContext) … … 544 585 waitStatePlayable(); 545 586 if (errorOccured()){ 546 unset Video();587 unsetCurrentMediaSource(); 547 588 return; 548 589 } … … 551 592 preRollMovie(); 552 593 if (errorOccured()){ 553 unset Video();594 unsetCurrentMediaSource(); 554 595 return; 555 596 } … … 558 599 m_playbackRate = prefferedPlaybackRate(); 559 600 checkIfVideoAwailable(); 601 calculateStaticFps(); 560 602 enableAudio(m_audioEnabled); 561 603 setMute(m_mute); 562 604 setVolume(m_masterVolume, m_relativeVolume); 605 m_metaData->update(); 563 606 pause(); 564 607 } … … 574 617 break; 575 618 case MediaSource::Disc: 576 CASE_UNSUPPORTED("Could not open media source.", FATAL_ERROR)619 openMovieFromCompactDisc(); 577 620 break; 578 621 case MediaSource::Stream: … … 636 679 // codecs *think* they can decode the stream, and crash... 637 680 #define TryOpenMovieWithCodec(type) gClearError(); \ 638 openMovieFromData(data, "."type); \681 openMovieFromData(data, (char *)"."type); \ 639 682 if (m_QTMovie) return; 640 683 … … 676 719 } 677 720 721 typedef void (*qt_sighandler_t)(int); 722 static void sigtest(int) { 723 qApp->exit(0); 724 } 725 726 void 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 760 QString QuickTimeVideoPlayer::movieCompactDiscPath() const 761 { 762 return m_movieCompactDiscPath; 763 } 764 678 765 MediaSource QuickTimeVideoPlayer::mediaSource() const 679 766 { … … 719 806 PhononAutoReleasePool pool; 720 807 return [[m_QTMovie attributeForKey:@"QTMovieTimeScaleAttribute"] longValue]; 808 } 809 810 float QuickTimeVideoPlayer::staticFps() 811 { 812 return m_staticFps; 813 } 814 815 void 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 721 846 } 722 847 … … 951 1076 } 952 1077 1078 QMultiMap<QString, QString> QuickTimeVideoPlayer::metaData() 1079 { 1080 return m_metaData->metaData(); 1081 } 1082 1083 int QuickTimeVideoPlayer::trackCount() const 1084 { 1085 if (!m_folderTracks) 1086 return 0; 1087 return [m_folderTracks count]; 1088 } 1089 1090 int QuickTimeVideoPlayer::currentTrack() const 1091 { 1092 return m_currentTrack; 1093 } 1094 1095 QString 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 1105 NSString* 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 1117 bool 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 1130 NSArray* 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 1144 void 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 953 1166 }} 954 1167 -
trunk/src/3rdparty/phonon/qt7/videoframe.mm
r2 r561 20 20 #import <QuartzCore/CIFilter.h> 21 21 #import <QuartzCore/CIContext.h> 22 23 //#define CACHE_CV_TEXTURE 22 24 23 25 QT_BEGIN_NAMESPACE … … 71 73 void VideoFrame::copyMembers(const VideoFrame& frame) 72 74 { 75 #ifdef CACHE_CV_TEXTURE 73 76 m_cachedCVTextureRef = frame.m_cachedCVTextureRef; 77 #endif 74 78 m_cachedCIImage = frame.m_cachedCIImage; 75 79 m_cachedQImage = frame.m_cachedQImage; … … 106 110 CVOpenGLTextureRef VideoFrame::cachedCVTexture() const 107 111 { 112 #ifdef CACHE_CV_TEXTURE 108 113 if (!m_cachedCVTextureRef && m_videoPlayer){ 109 114 m_videoPlayer->setColors(m_brightness, m_contrast, m_hue, m_saturation); 110 115 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = m_videoPlayer->currentFrameAsCVTexture(); 116 CVOpenGLTextureRetain((const_cast<VideoFrame *>(this))->m_cachedCVTextureRef); 111 117 } 112 118 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 113 126 } 114 127 … … 330 343 void VideoFrame::invalidateImage() const 331 344 { 345 #ifdef CACHE_CV_TEXTURE 332 346 if (m_cachedCVTextureRef){ 333 347 CVOpenGLTextureRelease(m_cachedCVTextureRef); 334 348 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0; 335 349 } 350 #endif 336 351 if (m_cachedCIImage){ 337 352 [(CIImage *) m_cachedCIImage release]; … … 347 362 void VideoFrame::retain() const 348 363 { 364 #ifdef CACHE_CV_TEXTURE 349 365 if (m_cachedCVTextureRef) 350 366 CVOpenGLTextureRetain(m_cachedCVTextureRef); 367 #endif 351 368 if (m_cachedCIImage) 352 369 [(CIImage *) m_cachedCIImage retain]; … … 359 376 void VideoFrame::release() const 360 377 { 361 if (m_cachedCVTextureRef) 378 #ifdef CACHE_CV_TEXTURE 379 if (m_cachedCVTextureRef){ 362 380 CVOpenGLTextureRelease(m_cachedCVTextureRef); 381 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0; 382 } 383 #endif 363 384 if (m_cachedCIImage) 364 385 [(CIImage *) m_cachedCIImage release]; … … 369 390 370 391 (const_cast<VideoFrame *>(this))->m_backgroundFrame = 0; 371 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0;372 392 (const_cast<VideoFrame *>(this))->m_cachedCIImage = 0; 373 393 (const_cast<VideoFrame *>(this))->m_cachedNSBitmap = 0; -
trunk/src/3rdparty/phonon/waveout/mediaobject.cpp
r2 r561 248 248 { 249 249 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*))); 251 251 m_thread->start(); 252 252 m_soundBuffer1.waveHeader = new WAVEHDR; … … 259 259 { 260 260 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*))); 262 262 do { //The event loop of m_thread might not be started, yet 263 263 m_thread->quit(); //If the event loop is not started yet quit() does nothing
Note:
See TracChangeset
for help on using the changeset viewer.