Changeset 846 for trunk/src/3rdparty/phonon
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 89 edited
- 18 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/3rdparty/phonon/CMakeLists.txt
r561 r846 71 71 endif (MINGW) 72 72 73 if (QT_USE_FRAMEWORKS) 74 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -F${QT_LIBRARY_DIR}") 75 endif (QT_USE_FRAMEWORKS) 76 73 77 check_cxx_compiler_flag(-fPIE HAVE_FPIE_SUPPORT) 74 78 if(KDE4_ENABLE_FPIE) … … 91 95 92 96 # get the gcc version 93 exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info)97 exec_program(${CMAKE_C_COMPILER} ARGS ${CMAKE_C_COMPILER_ARG1} --version OUTPUT_VARIABLE _gcc_version_info) 94 98 95 99 string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}") … … 149 153 150 154 set(PHONON_LIB_MAJOR_VERSION "4") 151 set(PHONON_LIB_MINOR_VERSION " 3")152 set(PHONON_LIB_PATCH_VERSION " 50")155 set(PHONON_LIB_MINOR_VERSION "4") 156 set(PHONON_LIB_PATCH_VERSION "0") 153 157 set(PHONON_LIB_VERSION "${PHONON_LIB_MAJOR_VERSION}.4.0") 154 158 set(PHONON_LIB_SOVERSION ${PHONON_LIB_MAJOR_VERSION}) -
trunk/src/3rdparty/phonon/ds9/backendnode.cpp
r561 r846 68 68 HRESULT hr = info.pGraph->RemoveFilter(filter); 69 69 70 if ( hr == VFW_E_NOT_STOPPED&& m_mediaObject) {70 if (FAILED(hr) && m_mediaObject) { 71 71 m_mediaObject->ensureStopped(); 72 72 -
trunk/src/3rdparty/phonon/ds9/iodevicereader.cpp
r561 r846 129 129 while (m_buffer.size() < int(length)) { 130 130 needData(); 131 if (m_mediaGraph->isStopping()) {132 return VFW_E_WRONG_STATE;133 }134 131 135 132 if (oldSize == m_buffer.size()) { -
trunk/src/3rdparty/phonon/ds9/mediagraph.cpp
r561 r846 380 380 filter->QueryFilterInfo(&info); 381 381 #ifdef GRAPH_DEBUG 382 qDebug() << "removeFilter" << QString ::fromUtf16(info.achName);382 qDebug() << "removeFilter" << QString((const QChar *)info.achName); 383 383 #endif 384 384 if (info.pGraph) { … … 876 876 FILTER_INFO info; 877 877 filter->QueryFilterInfo(&info); 878 qDebug() << Q_FUNC_INFO << QString ::fromUtf16(info.achName);878 qDebug() << Q_FUNC_INFO << QString((const QChar *)info.achName); 879 879 if (info.pGraph) { 880 880 info.pGraph->Release(); … … 922 922 FILTER_INFO info; 923 923 filter->QueryFilterInfo(&info); 924 qDebug() << "found a decoder filter" << QString ::fromUtf16(info.achName);924 qDebug() << "found a decoder filter" << QString((const QChar *)info.achName); 925 925 if (info.pGraph) { 926 926 info.pGraph->Release(); … … 938 938 FILTER_INFO info; 939 939 filter->QueryFilterInfo(&info); 940 qDebug() << Q_FUNC_INFO << QString ::fromUtf16(info.achName);940 qDebug() << Q_FUNC_INFO << QString((const QChar *)info.achName); 941 941 if (info.pGraph) { 942 942 info.pGraph->Release(); … … 957 957 FILTER_INFO info; 958 958 filter->QueryFilterInfo(&info); 959 qDebug() << Q_FUNC_INFO << QString ::fromUtf16(info.achName);959 qDebug() << Q_FUNC_INFO << QString((const QChar *)info.achName); 960 960 if (info.pGraph) { 961 961 info.pGraph->Release(); … … 991 991 FILTER_INFO info; 992 992 filter->QueryFilterInfo(&info); 993 qDebug() << "found a demuxer filter" << QString ::fromUtf16(info.achName);993 qDebug() << "found a demuxer filter" << QString((const QChar *)info.achName); 994 994 if (info.pGraph) { 995 995 info.pGraph->Release(); -
trunk/src/3rdparty/phonon/ds9/mediaobject.cpp
r561 r846 28 28 #include <initguid.h> 29 29 #include <qnetwork.h> 30 #ifdef Q_CC_MSVC 31 # include <comdef.h> 32 #endif 30 33 #include <evcode.h> 31 34 -
trunk/src/3rdparty/phonon/ds9/videorenderer_soft.cpp
r561 r846 46 46 47 47 #ifndef QT_NO_OPENGL 48 #include < gl/gl.h>48 #include <GL/gl.h> 49 49 #ifndef GL_FRAGMENT_PROGRAM_ARB 50 50 #define GL_FRAGMENT_PROGRAM_ARB 0x8804 -
trunk/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp
r561 r846 23 23 #include <QtGui/QWidget> 24 24 #include <QtGui/QPainter> 25 #include <QtCore/QTimerEvent> 26 27 #ifndef Q_OS_WINCE 25 28 26 #include <d3d9.h> 29 27 #include <vmr9.h> 30 #else31 #include <uuids.h>32 #endif33 28 34 29 QT_BEGIN_NAMESPACE … … 49 44 50 45 51 #ifdef Q_OS_WINCE52 VideoRendererVMR9::VideoRendererVMR9(QWidget *target) : m_target(target)53 {54 m_target->setAttribute(Qt::WA_PaintOnScreen, true);55 m_filter = Filter(CLSID_VideoRenderer, IID_IBaseFilter);56 }57 58 QSize VideoRendererVMR9::videoSize() const59 {60 LONG w = 0,61 h = 0;62 ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo);63 if (basic) {64 basic->GetVideoSize( &w, &h);65 }66 return QSize(w, h);67 }68 69 void VideoRendererVMR9::repaintCurrentFrame(QWidget * /*target*/, const QRect & /*rect*/)70 {71 //nothing to do here: the renderer paints everything72 }73 74 void VideoRendererVMR9::notifyResize(const QSize &size, Phonon::VideoWidget::AspectRatio aspectRatio,75 Phonon::VideoWidget::ScaleMode scaleMode)76 {77 if (!isActive()) {78 ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo);79 if (basic) {80 basic->SetDestinationPosition(0, 0, 0, 0);81 }82 return;83 }84 85 ComPointer<IVideoWindow> video(m_filter, IID_IVideoWindow);86 87 OAHWND owner;88 HRESULT hr = video->get_Owner(&owner);89 if (FAILED(hr)) {90 return;91 }92 93 const OAHWND newOwner = reinterpret_cast<OAHWND>(m_target->winId());94 if (owner != newOwner) {95 video->put_Owner(newOwner);96 video->put_MessageDrain(newOwner);97 video->put_WindowStyle(WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);98 }99 100 //make sure the widget takes the whole size of the parent101 video->SetWindowPosition(0, 0, size.width(), size.height());102 103 const QSize vsize = videoSize();104 internalNotifyResize(size, vsize, aspectRatio, scaleMode);105 106 ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo);107 if (basic) {108 basic->SetDestinationPosition(m_dstX, m_dstY, m_dstWidth, m_dstHeight);109 }110 }111 112 void VideoRendererVMR9::applyMixerSettings(qreal /*brightness*/, qreal /*contrast*/, qreal /*m_hue*/, qreal /*saturation*/)113 {114 //this can't be supported for WinCE115 }116 117 QImage VideoRendererVMR9::snapshot() const118 {119 ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo);120 if (basic) {121 LONG bufferSize = 0;122 //1st we get the buffer size123 basic->GetCurrentImage(&bufferSize, 0);124 125 QByteArray buffer;126 buffer.resize(bufferSize);127 HRESULT hr = basic->GetCurrentImage(&bufferSize, reinterpret_cast<long*>(buffer.data()));128 129 if (SUCCEEDED(hr)) {130 131 const BITMAPINFOHEADER *bmi = reinterpret_cast<const BITMAPINFOHEADER*>(buffer.constData());132 133 const int w = qAbs(bmi->biWidth),134 h = qAbs(bmi->biHeight);135 136 // Create image and copy data into image.137 QImage ret(w, h, QImage::Format_RGB32);138 139 if (!ret.isNull()) {140 const char *data = buffer.constData() + bmi->biSize;141 const int bytes_per_line = w * sizeof(QRgb);142 for (int y = h - 1; y >= 0; --y) {143 qMemCopy(ret.scanLine(y), //destination144 data, //source145 bytes_per_line);146 data += bytes_per_line;147 }148 }149 return ret;150 }151 }152 return QImage();153 }154 155 #else156 46 VideoRendererVMR9::VideoRendererVMR9(QWidget *target) : m_target(target) 157 47 { 158 48 m_filter = Filter(CLSID_VideoMixingRenderer9, IID_IBaseFilter); 159 49 if (!m_filter) { 160 qWarning("the video widget could not be initialized correctly");161 50 return; 162 51 } … … 326 215 mixer->SetProcAmpControl(0, &ctrl); 327 216 } 328 #endif329 217 } 330 218 } -
trunk/src/3rdparty/phonon/ds9/videorenderer_vmr9.h
r2 r846 20 20 21 21 #include "abstractvideorenderer.h" 22 #include "compointer.h"23 22 24 23 QT_BEGIN_NAMESPACE -
trunk/src/3rdparty/phonon/ds9/videowidget.cpp
r769 r846 25 25 #include "mediaobject.h" 26 26 27 #ifndef Q_OS_WINCE 28 #include "videorenderer_evr.h" 27 29 #include "videorenderer_vmr9.h" 30 #else 31 #include "videorenderer_default.h" 32 #endif 28 33 #include "videorenderer_soft.h" 29 34 … … 353 358 if (m_renderers[index] == 0 && autoCreate) { 354 359 AbstractVideoRenderer *renderer = 0; 355 if (type == Native) { 356 renderer = new VideoRendererVMR9(m_widget); 360 if (type == Native) { 361 #ifndef Q_OS_WINCE 362 renderer = new VideoRendererEVR(m_widget); 357 363 if (renderer->getFilter() == 0) { 358 //instanciating the renderer might fail with error VFW_E_DDRAW_CAPS_NOT_SUITABLE (0x80040273) 364 delete renderer; 365 //EVR not present, let's try VMR 366 renderer = new VideoRendererVMR9(m_widget); 367 if (renderer->getFilter() == 0) { 368 //instanciating the renderer might fail 369 m_noNativeRendererSupported = true; 370 delete renderer; 371 renderer = 0; 372 } 373 } 374 #else 375 renderer = new VideoRendererDefault(m_widget); 376 if (renderer->getFilter() == 0) { 377 //instanciating the renderer might fail 359 378 m_noNativeRendererSupported = true; 360 379 delete renderer; 361 380 renderer = 0; 362 381 } 382 #endif 363 383 } 364 384 -
trunk/src/3rdparty/phonon/gstreamer/CMakeLists.txt
r561 r846 20 20 include_directories( 21 21 ${CMAKE_CURRENT_BINARY_DIR} 22 ${GSTREAMER_INCLUDE_DIR} 22 ${GSTREAMER_INCLUDE_DIR} 23 23 ${GLIB2_INCLUDE_DIR} 24 24 ${LIBXML2_INCLUDE_DIR} … … 35 35 set(phonon_gstreamer_SRCS 36 36 audiooutput.cpp 37 artssink.cpp38 37 backend.cpp 39 38 devicemanager.cpp … … 51 50 audioeffect.cpp 52 51 abstractrenderer.cpp 53 x11renderer.cpp54 52 widgetrenderer.cpp 55 53 glrenderer.cpp 56 54 volumefadereffect.cpp 55 audiodataoutput.cpp 57 56 ) 58 57 59 find_package(Alsa) 60 macro_ensure_version("0.10.22" ${GSTREAMER_VERSION} GSTREAMER_HAS_NONBLOCKING_ALSASINK) 58 if(NOT WIN32) 59 set(phonon_gstreamer_SRCS 60 ${phonon_gstreamer_SRCS} 61 artssink.cpp 62 x11renderer.cpp) 63 macro_optional_find_package(Alsa) 64 macro_ensure_version("0.10.22" ${GSTREAMER_VERSION} GSTREAMER_HAS_NONBLOCKING_ALSASINK) 65 endif(NOT WIN32) 61 66 if(ALSA_FOUND AND NOT GSTREAMER_HAS_NONBLOCKING_ALSASINK) 62 67 add_definitions(-DUSE_ALSASINK2) … … 79 84 target_link_libraries(phonon_gstreamer ${ASOUND_LIBRARY}) 80 85 endif(ALSA_FOUND) 86 if(USE_INSTALL_PLUGIN) 87 target_link_libraries(phonon_gstreamer ${GSTREAMER_PLUGIN_PBUTILS_LIBRARIES}) 88 endif(USE_INSTALL_PLUGIN) 81 89 82 90 install(TARGETS phonon_gstreamer DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/phonon_backend) -
trunk/src/3rdparty/phonon/gstreamer/ConfigureChecks.cmake
r2 r846 18 18 macro_optional_find_package(GStreamerPlugins) 19 19 macro_log_feature(GSTREAMER_PLUGIN_VIDEO_LIBRARIES "GStreamer video plugin" "The gstreamer video plugin (part of gstreamer-plugins-base 0.10) is required for the multimedia gstreamer backend" "http://gstreamer.freedesktop.org/modules/" FALSE "0.10") 20 macro_log_feature(GSTREAMER_PLUGIN_AUDIO_LIBRARIES "GStreamer audio plugin" "The gstreamer audio plugin (part of gstreamer-plugins-base 0.10) is required for the multimedia gstreamer backend" "http://gstreamer.freedesktop.org/modules/" FALSE "0.10") 20 21 21 22 macro_optional_find_package(GLIB2) … … 31 32 macro_log_feature(OPENGL_FOUND "OpenGL" "OpenGL support is required to compile the gstreamer backend for Phonon" "" FALSE) 32 33 33 if (GSTREAMER_FOUND AND GSTREAMER_PLUGIN_VIDEO_LIBRARIES AND G LIB2_FOUND AND GOBJECT_FOUND AND LIBXML2_FOUND AND OPENGL_FOUND)34 if (GSTREAMER_FOUND AND GSTREAMER_PLUGIN_VIDEO_LIBRARIES AND GSTREAMER_PLUGIN_AUDIO_LIBRARIES AND GLIB2_FOUND AND GOBJECT_FOUND AND LIBXML2_FOUND AND OPENGL_FOUND) 34 35 set(BUILD_PHONON_GSTREAMER TRUE) 35 else (GSTREAMER_FOUND AND GSTREAMER_PLUGIN_VIDEO_LIBRARIES AND G LIB2_FOUND AND GOBJECT_FOUND AND LIBXML2_FOUND AND OPENGL_FOUND)36 else (GSTREAMER_FOUND AND GSTREAMER_PLUGIN_VIDEO_LIBRARIES AND GSTREAMER_PLUGIN_AUDIO_LIBRARIES AND GLIB2_FOUND AND GOBJECT_FOUND AND LIBXML2_FOUND AND OPENGL_FOUND) 36 37 set(BUILD_PHONON_GSTREAMER FALSE) 37 endif (GSTREAMER_FOUND AND GSTREAMER_PLUGIN_VIDEO_LIBRARIES AND G LIB2_FOUND AND GOBJECT_FOUND AND LIBXML2_FOUND AND OPENGL_FOUND)38 endif (GSTREAMER_FOUND AND GSTREAMER_PLUGIN_VIDEO_LIBRARIES AND GSTREAMER_PLUGIN_AUDIO_LIBRARIES AND GLIB2_FOUND AND GOBJECT_FOUND AND LIBXML2_FOUND AND OPENGL_FOUND) -
trunk/src/3rdparty/phonon/gstreamer/audiooutput.cpp
r561 r846 126 126 { 127 127 m_backend->logMessage(Q_FUNC_INFO + QString::number(newDevice), Backend::Info, this); 128 128 129 if (newDevice == m_device) 129 130 return true; … … 136 137 137 138 bool success = false; 138 const QList<AudioDevice> deviceList = m_backend->deviceManager()->audioOutputDevices(); 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) { 139 if (m_audioSink && newDevice >= 0) { 148 140 // Save previous state 149 141 GstState oldState = GST_STATE(m_audioSink); 150 142 const QByteArray oldDeviceValue = GstHelper::property(m_audioSink, "device"); 151 const QByteArray deviceId = deviceList.at(deviceIdx).gstId;143 const QByteArray deviceId = m_backend->deviceManager()->gstId(newDevice); 152 144 m_device = newDevice; 153 145 … … 171 163 } 172 164 173 // Note the stopped state should not really be nec cessary, but seems to be required to165 // Note the stopped state should not really be necessary, but seems to be required to 174 166 // properly reset after changing the audio state 175 167 if (root()) { -
trunk/src/3rdparty/phonon/gstreamer/backend.cpp
r561 r846 19 19 #include "backend.h" 20 20 #include "audiooutput.h" 21 #include "audiodataoutput.h" 21 22 #include "audioeffect.h" 22 23 #include "mediaobject.h" … … 27 28 #include "volumefadereffect.h" 28 29 #include <gst/interfaces/propertyprobe.h> 30 #include <phonon/pulsesupport.h> 29 31 30 32 #include <QtCore/QSet> … … 50 52 , m_isValid(false) 51 53 { 54 // Initialise PulseAudio support 55 PulseSupport *pulse = PulseSupport::getInstance(); 56 pulse->enable(); 57 connect(pulse, SIGNAL(objectDescriptionChanged(ObjectDescriptionType)), SIGNAL(objectDescriptionChanged(ObjectDescriptionType))); 58 52 59 // In order to support reloading, we only set the app name once... 53 60 static bool first = true; … … 56 63 g_set_application_name(qApp->applicationName().toUtf8()); 57 64 } 58 59 65 GError *err = 0; 60 66 bool wasInit = gst_init_check(0, 0, &err); //init gstreamer: must be called before any gst-related functions … … 93 99 Backend::~Backend() 94 100 { 101 delete m_effectManager; 102 delete m_deviceManager; 103 PulseSupport::shutdown(); 95 104 } 96 105 … … 120 129 return new MediaObject(this, parent); 121 130 122 case AudioOutputClass: { 123 AudioOutput *ao = new AudioOutput(this, parent); 124 m_audioOutputs.append(ao); 125 return ao; 126 } 131 case AudioOutputClass: 132 return new AudioOutput(this, parent); 133 127 134 #ifndef QT_NO_PHONON_EFFECT 128 135 case EffectClass: … … 130 137 #endif //QT_NO_PHONON_EFFECT 131 138 case AudioDataOutputClass: 132 logMessage("createObject() : AudioDataOutput not implemented"); 133 break; 139 return new AudioDataOutput(this, parent); 134 140 135 141 #ifndef QT_NO_PHONON_VIDEO … … 215 221 QString klass = gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature)); 216 222 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") || 223 if (klass == QLatin1String("Codec/Decoder") || 224 klass == QLatin1String("Codec/Decoder/Audio") || 225 klass == QLatin1String("Codec/Decoder/Video") || 226 klass == QLatin1String("Codec/Demuxer") || 227 klass == QLatin1String("Codec/Demuxer/Audio") || 228 klass == QLatin1String("Codec/Demuxer/Video") || 229 klass == QLatin1String("Codec/Parser") || 230 klass == QLatin1String("Codec/Parser/Audio") || 225 231 klass == QLatin1String("Codec/Parser/Video")) { 226 232 … … 235 241 236 242 if (caps) { 237 const GstStructure* capsStruct = gst_caps_get_structure (caps, 0); 238 QString mime = QString::fromUtf8(gst_structure_get_name (capsStruct)); 239 if (!availableMimeTypes.contains(mime)) 240 availableMimeTypes.append(mime); 243 for (unsigned int struct_idx = 0; struct_idx < gst_caps_get_size (caps); struct_idx++) { 244 245 const GstStructure* capsStruct = gst_caps_get_structure (caps, struct_idx); 246 QString mime = QString::fromUtf8(gst_structure_get_name (capsStruct)); 247 if (!availableMimeTypes.contains(mime)) 248 availableMimeTypes.append(mime); 249 } 241 250 } 242 251 } … … 245 254 } 246 255 g_list_free(factoryList); 256 if (availableMimeTypes.contains("audio/x-vorbis") 257 && availableMimeTypes.contains("application/x-ogm-audio")) { 258 if (!availableMimeTypes.contains("audio/x-vorbis+ogg")) 259 availableMimeTypes.append("audio/x-vorbis+ogg"); 260 if (!availableMimeTypes.contains("application/ogg")) /* *.ogg */ 261 availableMimeTypes.append("application/ogg"); 262 if (!availableMimeTypes.contains("audio/ogg")) /* *.oga */ 263 availableMimeTypes.append("audio/ogg"); 264 } 247 265 availableMimeTypes.sort(); 248 266 return availableMimeTypes; … … 294 312 switch (type) { 295 313 case Phonon::AudioOutputDeviceType: { 296 QList<AudioDevice> audioDevices = deviceManager()->audioOutputDevices(); 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 } 314 AudioDevice* ad; 315 if ((ad = deviceManager()->audioDevice(index))) { 316 ret.insert("name", ad->gstId); 317 ret.insert("description", ad->description); 318 ret.insert("icon", ad->icon); 304 319 } 305 320 } … … 430 445 /** 431 446 * Returns a debuglevel that is determined by the 432 * PHONON_GST REAMER_DEBUG environment variable.447 * PHONON_GST_DEBUG environment variable. 433 448 * 434 449 * Warning - important warnings -
trunk/src/3rdparty/phonon/gstreamer/backend.h
r2 r846 87 87 private: 88 88 static gboolean busCall(GstBus *bus, GstMessage *msg, gpointer data); 89 QList<QPointer<AudioOutput> > m_audioOutputs;90 89 91 90 DeviceManager *m_deviceManager; -
trunk/src/3rdparty/phonon/gstreamer/devicemanager.cpp
r561 r846 25 25 #include "x11renderer.h" 26 26 #include "artssink.h" 27 #include "pulsesupport.h" 27 28 28 29 #ifdef USE_ALSASINK2 … … 45 46 : gstId(gstId) 46 47 { 47 //get an id 48 static int counter = 0; 49 id = counter++; 48 // This should never be called when PulseAudio is active. 49 Q_ASSERT(!PulseSupport::getInstance()->isActive()); 50 51 id = manager->allocateDeviceId(); 52 icon = "audio-card"; 53 50 54 //get name from device 51 55 if (gstId == "default") { … … 72 76 : QObject(backend) 73 77 , m_backend(backend) 74 { 75 m_audioSink = qgetenv("PHONON_GST_AUDIOSINK"); 76 m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE"); 77 78 #ifndef QT_NO_SETTINGS 78 , m_audioDeviceCounter(0) 79 { 79 80 QSettings settings(QLatin1String("Trolltech")); 80 81 settings.beginGroup(QLatin1String("Qt")); 81 82 83 PulseSupport *pulse = PulseSupport::getInstance(); 84 m_audioSink = qgetenv("PHONON_GST_AUDIOSINK"); 82 85 if (m_audioSink.isEmpty()) { 83 86 m_audioSink = settings.value(QLatin1String("audiosink"), "Auto").toByteArray().toLower(); 84 } 85 87 if (m_audioSink == "auto" && pulse->isActive()) 88 m_audioSink = "pulsesink"; 89 } 90 if ("pulsesink" != m_audioSink) 91 pulse->enable(false); 92 93 m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE"); 86 94 if (m_videoSinkWidget.isEmpty()) { 87 95 m_videoSinkWidget = settings.value(QLatin1String("videomode"), "Auto").toByteArray().toLower(); 88 96 } 89 #endif //QT_NO_SETTINGS90 97 91 98 if (m_backend->isValid()) … … 272 279 #endif //QT_NO_PHONON_VIDEO 273 280 274 /* 275 * Returns a positive device id or -1 if device 276 * does not exist 281 /** 282 * Allocate a device id for a new audio device 283 */ 284 int DeviceManager::allocateDeviceId() 285 { 286 return m_audioDeviceCounter++; 287 } 288 289 290 /** 291 * Returns a positive device id or -1 if device does not exist 277 292 * 278 293 * The gstId is typically in the format hw:1,0 … … 289 304 290 305 /** 291 * Get a human-readable description from a device id 292 */ 293 QByteArray DeviceManager::deviceDescription(int id) const 306 * Returns a gstId or "default" if device does not exist 307 * 308 * The gstId is typically in the format hw:1,0 309 */ 310 const QByteArray DeviceManager::gstId(int deviceId) 311 { 312 if (!PulseSupport::getInstance()->isActive()) { 313 AudioDevice *ad = audioDevice(deviceId); 314 if (ad) 315 return QByteArray(ad->gstId); 316 } 317 return QByteArray("default"); 318 } 319 320 /** 321 * Get the AudioDevice for a given device id 322 */ 323 AudioDevice* DeviceManager::audioDevice(int id) 294 324 { 295 325 for (int i = 0 ; i < m_audioDeviceList.size() ; ++i) { 296 if (m_audioDeviceList[i].id == id) { 297 return m_audioDeviceList[i].description; 298 } 299 } 300 return QByteArray(); 326 if (m_audioDeviceList[i].id == id) 327 return &m_audioDeviceList[i]; 328 } 329 return NULL; 301 330 } 302 331 … … 312 341 313 342 if (audioSink) { 314 list = GstHelper::extractProperties(audioSink, "device"); 315 list.prepend("default"); 343 if (!PulseSupport::getInstance()->isActive()) { 344 // If we're using pulse, the PulseSupport class takes care of things for us. 345 list = GstHelper::extractProperties(audioSink, "device"); 346 list.prepend("default"); 347 } 316 348 317 349 for (int i = 0 ; i < list.size() ; ++i) { -
trunk/src/3rdparty/phonon/gstreamer/devicemanager.h
r2 r846 43 43 QByteArray gstId; 44 44 QByteArray description; 45 QString icon; 45 46 }; 46 47 … … 52 53 const QList<AudioDevice> audioOutputDevices() const; 53 54 GstPad *requestPad(int device) const; 55 int allocateDeviceId(); 54 56 int deviceId(const QByteArray &gstId) const; 55 QByteArray deviceDescription(int id) const; 57 const QByteArray gstId(int id); 58 AudioDevice* audioDevice(int id); 56 59 GstElement *createGNOMEAudioSink(Category category); 57 60 GstElement *createAudioSink(Category category = NoCategory); … … 69 72 Backend *m_backend; 70 73 QList <AudioDevice> m_audioDeviceList; 74 int m_audioDeviceCounter; 71 75 QTimer m_devicePollTimer; 72 76 QByteArray m_audioSink; -
trunk/src/3rdparty/phonon/gstreamer/effectmanager.cpp
r2 r846 55 55 // "equalizer-nbands" not really useful at the moment 56 56 57 // These plugins simply don t work or have major stability issues:57 // These plugins simply don't work or have major stability issues: 58 58 // "iir" Does not seem to do much at the moment 59 59 // "audioinvert" Only works for some streams, should be invesigated -
trunk/src/3rdparty/phonon/gstreamer/glrenderer.cpp
r2 r846 267 267 setPalette(palette); 268 268 setAutoFillBackground(true); 269 // Videowidget al lways have this property to allow hiding the mouse cursor269 // Videowidget always have this property to allow hiding the mouse cursor 270 270 setMouseTracking(true); 271 271 } … … 305 305 const QRectF r = drawFrameRect(); 306 306 307 const float v_array[] = { r.left(), r.top(), r.right(), r.top(), r.right(), r.bottom(), r.left(), r.bottom() };307 const float v_array[] = { float(r.left()), float(r.top()), float(r.right()), float(r.top()), float(r.right()), float(r.bottom()), float(r.left()), float(r.bottom()) }; 308 308 309 309 glActiveTexture(GL_TEXTURE0); -
trunk/src/3rdparty/phonon/gstreamer/gsthelper.cpp
r2 r846 122 122 GstElement *playbin = 0; 123 123 //init playbin and add to our pipeline 124 playbin = gst_element_factory_make("playbin ", NULL);124 playbin = gst_element_factory_make("playbin2", NULL); 125 125 126 126 //Create an identity element to redirect sound -
trunk/src/3rdparty/phonon/gstreamer/gstreamer.desktop
r2 r846 11 11 12 12 Name=GStreamer 13 Name[bg]=GStreamer 14 Name[ca]=GStreamer 15 Name[ca@valencia]=GStreamer 16 Name[cs]=GStreamer 17 Name[da]=GStreamer 18 Name[de]=GStreamer 19 Name[el]=GStreamer 20 Name[en_GB]=GStreamer 21 Name[es]=GStreamer 22 Name[et]=GStreamer 23 Name[eu]=GStreamer 24 Name[fi]=GStreamer 25 Name[fr]=GStreamer 26 Name[ga]=GStreamer 27 Name[gl]=GStreamer 28 Name[hsb]=GStreamer 29 Name[hu]=GStreamer 30 Name[id]=GStreamer 31 Name[is]=GStreamer 32 Name[it]=GStreamer 33 Name[ja]=GStreamer 34 Name[ko]=GStreamer 35 Name[ku]=GStreamer 36 Name[lt]=GStreamer 37 Name[lv]=GStreamer 38 Name[nb]=GStreamer 39 Name[nds]=GStreamer 40 Name[nl]=GStreamer 41 Name[nn]=GStreamer 13 42 Name[pa]=àšà©àšžàšà©àš°àš®àš° 43 Name[pl]=GStreamer 44 Name[pt]=GStreamer 45 Name[pt_BR]=GStreamer 46 Name[ru]=GStreamer 47 Name[se]=GStreamer 48 Name[sk]=GStreamer 49 Name[sl]=GStreamer 14 50 Name[sr]=ÐÑÑÑÐžÐŒÐµÑ 51 Name[sr@ijekavian]=ÐÑÑÑÐžÐŒÐµÑ 52 Name[sr@ijekavianlatin]=GStreamer 53 Name[sr@latin]=GStreamer 15 54 Name[sv]=Gstreamer 55 Name[tr]=GStreamer 56 Name[uk]=GStreamer 16 57 Name[x-test]=xxGStreamerxx 58 Name[zh_CN]=GStreamer 59 Name[zh_TW]=GStreamer 17 60 18 61 Comment=Phonon GStreamer backend 19 62 Comment[bg]=Phonon GStreamer 20 63 Comment[ca]=Dorsal GStreamer del Phonon 64 Comment[ca@valencia]=Dorsal GStreamer del Phonon 65 Comment[cs]=Phonon GStreamer backend 21 66 Comment[da]=GStreamer-backend til Phonon 22 67 Comment[de]=Phonon-Treiber fÃŒr GStreamer … … 24 69 ÏοÏÏήÏÎ¹ÎŸÎ·Ï GStreamer ÏÎ¿Ï 25 70 Phonon 71 Comment[en_GB]=Phonon GStreamer backend 26 72 Comment[es]=Motor GStreamer para Phonon 27 73 Comment[et]=Phononi GStreameri taustaprogramm 74 Comment[eu]=Phonon GStreamer backend 75 Comment[fi]=Phonon GStreamer-taustaohjelma 28 76 Comment[fr]=SystÚme de gestion GStreamer pour Phonon 29 77 Comment[ga]=Inneall GStreamer le haghaidh Phonon 30 78 Comment[gl]=Infraestrutura de GStreamer para Phonon 79 Comment[hsb]=Phonon GStreamer backend 80 Comment[hu]=Phonon GStreamer modul 81 Comment[id]=Phonon GStreamer backend 31 82 Comment[is]=Phonon GStreamer bakendi 32 83 Comment[it]=Motore Gstreamer di Phonon … … 34 85 Comment[ko]=Phonon GStreamer ë°±ìë 35 86 Comment[ku]=Binesaza Phonon GStreamer 87 Comment[lt]=Phonon GStreamer galinÄ sÄ 88 saja 36 89 Comment[lv]=Phonon GStreamer aizmugure 90 Comment[nb]=Phonon-motor for GStreamer 37 91 Comment[nds]=Phonon-HÃŒlpprogramm GStreamer 38 92 Comment[nl]=GStreamer-backend (Phonon) … … 42 96 Comment[pt]=Infra-estrutura do GStreamer para o Phonon 43 97 Comment[pt_BR]=Infraestrutura Phonon GStreamer 98 Comment[ru]=ÐÐµÑ 99 аМОзЌ GStreamer ÐŽÐ»Ñ Phonon 100 Comment[se]=Phonon GStreamer duogášmohtor 44 101 Comment[sk]=GStreamer podsystém 45 102 Comment[sl]=Phononova hrbtenica GStreamer 46 103 Comment[sr]=ÐÑÑÑÐžÐŒÐµÑ ÐºÐ°ÐŸ пПзаЎОМа ЀПМПМа 104 Comment[sr@ijekavian]=ÐÑÑÑÐžÐŒÐµÑ ÐºÐ°ÐŸ пПзаЎОМа ЀПМПМа 105 Comment[sr@ijekavianlatin]=GStreamer kao pozadina Phonona 47 106 Comment[sr@latin]=GStreamer kao pozadina Phonona 48 107 Comment[sv]=Phonon Gstreamer-grÀnssnitt -
trunk/src/3rdparty/phonon/gstreamer/medianode.cpp
r2 r846 199 199 // potential deadlock. Hence we force the pipeline into ready state 200 200 // before any nodes are disconnected. 201 gst_element_set_state(root()->pipeline(), GST_STATE_READY); 202 203 Q_ASSERT(sink->root()); //sink has to have a root since it is onnected201 gst_element_set_state(root()->pipeline(), GST_STATE_READY); 202 203 Q_ASSERT(sink->root()); //sink has to have a root since it is connected 204 204 205 205 if (sink->description() & (AudioSink)) { -
trunk/src/3rdparty/phonon/gstreamer/mediaobject.cpp
r561 r846 17 17 #include <cmath> 18 18 #include <gst/interfaces/propertyprobe.h> 19 #include <gst/pbutils/install-plugins.h> 19 20 #include "common.h" 20 21 #include "mediaobject.h" … … 54 55 , m_prefinishMark(0) 55 56 , m_transitionTime(0) 57 , m_isStream(false) 56 58 , m_posAtSeek(-1) 57 59 , m_prefinishMarkReachedNotEmitted(true) … … 80 82 , m_availableTitles(0) 81 83 , m_currentTitle(1) 84 , m_pendingTitle(1) 82 85 { 83 86 qRegisterMetaType<GstCaps*>("GstCaps*"); … … 96 99 connect(m_tickTimer, SIGNAL(timeout()), SLOT(emitTick())); 97 100 } 98 connect(this, SIGNAL(stateChanged(Phonon::State, Phonon::State)),99 this, SLOT(notifyStateChange(Phonon::State, Phonon::State)));101 connect(this, SIGNAL(stateChanged(Phonon::State, Phonon::State)), 102 this, SLOT(notifyStateChange(Phonon::State, Phonon::State))); 100 103 101 104 } … … 137 140 } 138 141 142 void 143 pluginInstallationDone( GstInstallPluginsReturn res, gpointer userData ) 144 { 145 // Nothing inside yet 146 Q_UNUSED(res); 147 Q_UNUSED(userData); 148 } 149 139 150 void MediaObject::saveState() 140 151 { … … 196 207 bool canPlay = (m_hasAudio || m_videoStreamFound); 197 208 Phonon::ErrorType error = canPlay ? Phonon::NormalError : Phonon::FatalError; 209 #ifdef PLUGIN_INSTALL_API 210 GstInstallPluginsContext *ctx = gst_install_plugins_context_new (); 211 gchar *details[2]; 212 details[0] = m_missingCodecs[0].toLocal8Bit().data(); 213 details[1] = NULL; 214 GstInstallPluginsReturn status; 215 216 status = gst_install_plugins_async( details, ctx, pluginInstallationDone, NULL ); 217 gst_install_plugins_context_free ( ctx ); 218 219 if ( status != GST_INSTALL_PLUGINS_STARTED_OK ) 220 { 221 if( status == GST_INSTALL_PLUGINS_HELPER_MISSING ) 222 setError(tr("Missing codec helper script assistant."), Phonon::FatalError ); 223 else 224 setError(tr("Plugin codec installation failed for codec: %0") 225 .arg(m_missingCodecs[0].split("|")[3]), error); 226 } 227 m_missingCodecs.clear(); 228 #else 229 QString codecs = m_missingCodecs.join(", "); 230 198 231 if (error == Phonon::NormalError && m_hasVideo && !m_videoStreamFound) { 199 232 m_hasVideo = false; 200 233 emit hasVideoChanged(false); 201 234 } 202 QString codecs = m_missingCodecs.join(", "); 203 setError(QString(tr("A required codec is missing. You need to install the following codec(s) to play this content: %0")).arg(codecs), error); 235 setError(tr("A required codec is missing. You need to install the following codec(s) to play this content: %0").arg(codecs), error); 204 236 m_missingCodecs.clear(); 237 #endif 205 238 } 206 239 } … … 249 282 250 283 } 251 media->addMissingCodecName(value); 284 285 #ifdef PLUGIN_INSTALL_API 286 QString plugins = QString("gstreamer|0.10|%0|%1|decoder-%2") 287 .arg( qApp->applicationName() ) 288 .arg( value ) 289 .arg( QString::fromUtf8(gst_caps_to_string (caps) ) ); 290 media->addMissingCodecName( plugins ); 291 #else 292 media->addMissingCodecName( value ); 293 #endif 252 294 } 253 295 … … 310 352 // Note that the notify::caps _must_ be installed after linking to work with Dapper 311 353 m_capsHandler = g_signal_connect(pad, "notify::caps", G_CALLBACK(notifyVideoCaps), this); 312 354 313 355 if (!m_loading && !m_hasVideo) { 314 356 m_hasVideo = m_videoStreamFound; … … 369 411 370 412 // Create a new datasource based on the input URL 371 QByteArray encoded_cstr_url = url.toEncoded(); 413 // add the 'file' scheme if it's missing; the double '/' is needed! 414 QByteArray encoded_cstr_url = (url.scheme() == QLatin1String("") ? 415 "file://" + url.toEncoded() : 416 url.toEncoded()); 372 417 m_datasource = gst_element_make_from_uri(GST_URI_SRC, encoded_cstr_url.constData(), (const char*)NULL); 373 418 if (!m_datasource) … … 389 434 m_backend->logMessage(QString("new device speed : 2X"), Backend::Info, this); 390 435 } 436 } 437 438 /* make HTTP sources send extra headers so we get icecast 439 * metadata in case the stream is an icecast stream */ 440 if (encoded_cstr_url.startsWith("http://") 441 && g_object_class_find_property (G_OBJECT_GET_CLASS (m_datasource), "iradio-mode")) { 442 g_object_set (m_datasource, "iradio-mode", TRUE, NULL); 443 m_isStream = true; 391 444 } 392 445 … … 443 496 gst_object_sink (GST_OBJECT (m_pipeline)); 444 497 445 m_decodebin = gst_element_factory_make ("decodebin ", NULL);498 m_decodebin = gst_element_factory_make ("decodebin2", NULL); 446 499 g_signal_connect (m_decodebin, "new-decoded-pad", G_CALLBACK (&cb_newpad), this); 447 500 g_signal_connect (m_decodebin, "unknown-type", G_CALLBACK (&cb_unknown_type), this); … … 647 700 } else if (currentState == GST_STATE_PLAYING) { 648 701 changeState(Phonon::PlayingState); 649 } else if ( !m_atEndOfStream &&gst_element_set_state(m_pipeline, GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE) {702 } else if (gst_element_set_state(m_pipeline, GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE) { 650 703 m_pendingState = Phonon::PlayingState; 651 704 } else { … … 677 730 678 731 Phonon::State oldState = m_state; 679 m_state = newstate; // m_state must be set before emitting, since 732 m_state = newstate; // m_state must be set before emitting, since 680 733 // Error state requires that state() will return the new value 681 734 m_pendingState = newstate; … … 697 750 case Phonon::StoppedState: 698 751 m_backend->logMessage("phonon state changed: Stopped", Backend::Info, this); 752 // We must reset the pipeline when playing again 753 m_resetNeeded = true; 699 754 m_tickTimer->stop(); 700 755 break; … … 862 917 GstState state; 863 918 gst_element_set_state(m_pipeline, GST_STATE_NULL); 864 gst_element_get_state 919 gst_element_get_state(m_pipeline, &state, NULL, 2000); 865 920 866 921 m_source = source; … … 872 927 changeState(Phonon::LoadingState); 873 928 m_loading = true; 874 m_resetNeeded = false; 929 // IMPORTANT: Honor the m_resetNeeded flag as it currently stands. 930 // See https://qa.mandriva.com/show_bug.cgi?id=56807 931 //m_resetNeeded = false; 875 932 m_resumeState = false; 876 933 m_pendingState = Phonon::StoppedState; … … 885 942 m_aboutToFinishEmitted = false; 886 943 m_error = NoError; 887 m_errorString = QString();888 944 m_errorString.clear(); 945 889 946 m_bufferPercent = 0; 890 947 m_prefinishMarkReachedNotEmitted = true; … … 895 952 m_atEndOfStream = false; 896 953 897 // Clear exising meta tags 954 m_availableTitles = 0; 955 m_pendingTitle = 1; 956 m_currentTitle = 1; 957 958 // Clear existing meta tags 898 959 m_metaData.clear(); 960 m_isStream = false; 899 961 900 962 switch (source.type()) { 901 case MediaSource::Url: { 902 if (createPipefromURL(source.url())) 903 m_loading = true; 904 else 963 case MediaSource::Url: { 964 if (!createPipefromURL(source.url())) 905 965 setError(tr("Could not open media source.")); 906 966 } … … 908 968 909 969 case MediaSource::LocalFile: { 910 if (createPipefromURL(QUrl::fromLocalFile(source.fileName()))) 911 m_loading = true; 912 else 970 if (!createPipefromURL(QUrl::fromLocalFile(source.fileName()))) 913 971 setError(tr("Could not open media source.")); 914 972 } … … 923 981 924 982 case MediaSource::Stream: 925 if (createPipefromStream(source)) 926 m_loading = true; 927 else 983 if (!createPipefromStream(source)) 928 984 setError(tr("Could not open media source.")); 929 985 break; … … 931 987 case MediaSource::Disc: 932 988 { 933 934 935 989 QString mediaUrl; 990 switch (source.discType()) { 991 case Phonon::NoDisc: 936 992 qWarning() << "I should never get to see a MediaSource that is a disc but doesn't specify which one"; 937 993 return; … … 949 1005 return; 950 1006 } 951 if (!mediaUrl.isEmpty() && createPipefromURL(QUrl(mediaUrl))) 952 m_loading = true; 953 else 1007 if (mediaUrl.isEmpty() || !createPipefromURL(QUrl(mediaUrl))) 954 1008 setError(tr("Could not open media source.")); 955 1009 } … … 967 1021 // We need to link this node to ensure that fake sinks are connected 968 1022 // before loading, otherwise the stream will be blocked 969 if (m_loading) 970 link(); 1023 link(); 971 1024 beginLoad(); 972 1025 } … … 1005 1058 } 1006 1059 1007 m_availableTitles = 1;1008 gint64 titleCount;1009 GstFormat format = gst_format_get_by_nick("track");1010 if (gst_element_query_duration (m_pipeline, &format, &titleCount)) {1060 if (m_source.discType() == Phonon::Cd) { 1061 gint64 titleCount; 1062 GstFormat format = gst_format_get_by_nick("track"); 1063 if (gst_element_query_duration (m_pipeline, &format, &titleCount)) { 1011 1064 //check if returned format is still "track", 1012 1065 //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); 1066 if (qstrcmp(gst_format_get_name(format), "track") == 0) { 1067 int oldAvailableTitles = m_availableTitles; 1068 m_availableTitles = (int)titleCount; 1069 if (m_availableTitles != oldAvailableTitles) { 1070 emit availableTitlesChanged(m_availableTitles); 1071 m_backend->logMessage(QString("Available titles changed: %0").arg(m_availableTitles), Backend::Info, this); 1072 } 1019 1073 } 1020 1074 } 1021 1075 } 1022 1023 1076 } 1024 1077 … … 1078 1131 1079 1132 quint64 current = currentTime(); 1080 quint64 total = totalTime(); 1133 quint64 total = totalTime(); 1081 1134 1082 1135 if (current < total - m_prefinishMark) … … 1099 1152 if (m_tickInterval > 0 && currentTime != m_previousTickTime) { 1100 1153 emit tick(currentTime); 1101 m_previousTickTime = currentTime; 1154 m_previousTickTime = currentTime; 1102 1155 } 1103 1156 if (m_state == Phonon::PlayingState) { … … 1110 1163 // Prepare load of next source 1111 1164 if (currentTime >= totalTime - ABOUT_TO_FINNISH_TIME) { 1112 if (!m_aboutToFinishEmitted) { 1165 if (m_source.type() == MediaSource::Disc && 1166 m_autoplayTitles && 1167 m_availableTitles > 1 && 1168 m_currentTitle < m_availableTitles) { 1169 m_aboutToFinishEmitted = false; 1170 } else if (!m_aboutToFinishEmitted) { 1113 1171 m_aboutToFinishEmitted = true; // track is about to finish 1114 1172 emit aboutToFinish(); … … 1214 1272 switch (GST_MESSAGE_TYPE (gstMessage)) { 1215 1273 1216 case GST_MESSAGE_EOS: 1217 m_backend->logMessage("EOS rec ieved", Backend::Info, this);1274 case GST_MESSAGE_EOS: 1275 m_backend->logMessage("EOS received", Backend::Info, this); 1218 1276 handleEndOfStream(); 1219 1277 break; … … 1223 1281 gst_message_parse_tag(gstMessage, &tag_list); 1224 1282 if (tag_list) { 1283 TagMap newTags; 1284 gst_tag_list_foreach (tag_list, &foreach_tag_function, &newTags); 1285 gst_tag_list_free(tag_list); 1286 1287 // Determine if we should no fake the album/artist tags. 1288 // This is a little confusing as we want to fake it on initial 1289 // connection where title, album and artist are all missing. 1290 // There are however times when we get just other information, 1291 // e.g. codec, and so we want to only do clever stuff if we 1292 // have a commonly available tag (ORGANIZATION) or we have a 1293 // change in title 1294 bool fake_it = 1295 (m_isStream 1296 && ((!newTags.contains("TITLE") 1297 && newTags.contains("ORGANIZATION")) 1298 || (newTags.contains("TITLE") 1299 && m_metaData.value("TITLE") != newTags.value("TITLE"))) 1300 && !newTags.contains("ALBUM") 1301 && !newTags.contains("ARTIST")); 1302 1225 1303 TagMap oldMap = m_metaData; // Keep a copy of the old one for reference 1226 // Append any new meta tags to the existing tag list 1227 gst_tag_list_foreach (tag_list, &foreach_tag_function, &m_metaData); 1304 1305 // Now we've checked the new data, append any new meta tags to the existing tag list 1306 // We cannot use TagMap::iterator as this is a multimap and when streaming data 1307 // could in theory be lost. 1308 QList<QString> keys = newTags.keys(); 1309 for (QList<QString>::iterator i = keys.begin(); i != keys.end(); ++i) { 1310 QString key = *i; 1311 if (m_isStream) { 1312 // If we're streaming, we need to remove data in m_metaData 1313 // in order to stop it filling up indefinitely (as it's a multimap) 1314 m_metaData.remove(key); 1315 } 1316 QList<QString> values = newTags.values(key); 1317 for (QList<QString>::iterator j = values.begin(); j != values.end(); ++j) { 1318 QString value = *j; 1319 QString currVal = m_metaData.value(key); 1320 if (!m_metaData.contains(key) || currVal != value) { 1321 m_metaData.insert(key, value); 1322 } 1323 } 1324 } 1325 1228 1326 m_backend->logMessage("Meta tags found", Backend::Info, this); 1229 if (oldMap != m_metaData && !m_loading) 1230 emit metaDataChanged(m_metaData); 1231 gst_tag_list_free(tag_list); 1232 } 1327 if (oldMap != m_metaData) { 1328 // This is a bit of a hack to ensure that stream metadata is 1329 // returned. We get as much as we can from the Shoutcast server's 1330 // StreamTitle= header. If further info is decoded from the stream 1331 // itself later, then it will overwrite this info. 1332 if (m_isStream && fake_it) { 1333 m_metaData.remove("ALBUM"); 1334 m_metaData.remove("ARTIST"); 1335 1336 // Detect whether we want to "fill in the blanks" 1337 QString str; 1338 if (m_metaData.contains("TITLE")) 1339 { 1340 str = m_metaData.value("TITLE"); 1341 int splitpoint; 1342 // Check to see if our title matches "%s - %s" 1343 // Where neither %s are empty... 1344 if ((splitpoint = str.indexOf(" - ")) > 0 1345 && str.size() > (splitpoint+3)) { 1346 m_metaData.insert("ARTIST", str.left(splitpoint)); 1347 m_metaData.replace("TITLE", str.mid(splitpoint+3)); 1348 } 1349 } else { 1350 str = m_metaData.value("GENRE"); 1351 if (!str.isEmpty()) 1352 m_metaData.insert("TITLE", str); 1353 else 1354 m_metaData.insert("TITLE", "Streaming Data"); 1355 } 1356 if (!m_metaData.contains("ARTIST")) { 1357 str = m_metaData.value("LOCATION"); 1358 if (!str.isEmpty()) 1359 m_metaData.insert("ARTIST", str); 1360 else 1361 m_metaData.insert("ARTIST", "Streaming Data"); 1362 } 1363 str = m_metaData.value("ORGANIZATION"); 1364 if (!str.isEmpty()) 1365 m_metaData.insert("ALBUM", str); 1366 else 1367 m_metaData.insert("ALBUM", "Streaming Data"); 1368 } 1369 // As we manipulate the title, we need to recompare 1370 // oldMap and m_metaData here... 1371 if (oldMap != m_metaData && !m_loading) 1372 emit metaDataChanged(m_metaData); 1373 } 1374 } 1233 1375 } 1234 1376 break; … … 1256 1398 m_tickTimer->start(); 1257 1399 changeState(Phonon::PlayingState); 1400 if ((m_source.type() == MediaSource::Disc) && (m_currentTitle != m_pendingTitle)) { 1401 setTrack(m_pendingTitle); 1402 } 1258 1403 if (m_resumeState && m_oldState == Phonon::PlayingState) { 1259 1404 seek(m_oldPos); … … 1291 1436 m_backend->logMessage("gstreamer: pipeline state set to ready", Backend::Debug, this); 1292 1437 m_tickTimer->stop(); 1438 if ((m_source.type() == MediaSource::Disc) && (m_currentTitle != m_pendingTitle)) { 1439 setTrack(m_pendingTitle); 1440 } 1293 1441 break; 1294 1442 … … 1329 1477 gst_caps_unref (caps); 1330 1478 gst_object_unref (sinkPad); 1331 } 1479 } 1332 1480 } else { 1333 1481 setError(QString(err->message), Phonon::FatalError); … … 1401 1549 //case GST_MESSAGE_LATENCY: only from 0.10.12 1402 1550 //case GST_MESSAGE_ASYNC_DONE: only from 0.10.13 1403 default: 1404 break; 1551 default: 1552 break; 1405 1553 } 1406 1554 } … … 1418 1566 m_atEndOfStream = true; 1419 1567 1420 if (m_autoplayTitles && 1568 if (m_source.type() == MediaSource::Disc && 1569 m_autoplayTitles && 1421 1570 m_availableTitles > 1 && 1422 1571 m_currentTitle < m_availableTitles) { … … 1442 1591 setState(m_pendingState); 1443 1592 } 1593 } 1594 } 1595 1596 void MediaObject::invalidateGraph() 1597 { 1598 m_resetNeeded = true; 1599 if (m_state == Phonon::PlayingState || m_state == Phonon::PausedState) { 1600 changeState(Phonon::StoppedState); 1444 1601 } 1445 1602 } … … 1503 1660 void MediaObject::_iface_setCurrentTitle(int title) 1504 1661 { 1662 m_backend->logMessage(QString("setCurrentTitle %0").arg(title), Backend::Info, this); 1663 if ((title == m_currentTitle) || (title == m_pendingTitle)) 1664 return; 1665 1666 m_pendingTitle = title; 1667 1668 if (m_state == Phonon::PlayingState || m_state == Phonon::StoppedState) { 1669 setTrack(m_pendingTitle); 1670 } else { 1671 setState(Phonon::StoppedState); 1672 } 1673 } 1674 1675 void MediaObject::setTrack(int title) 1676 { 1677 if (((m_state != Phonon::PlayingState) && (m_state != Phonon::StoppedState)) || (title < 1) || (title > m_availableTitles)) 1678 return; 1679 1680 1681 //let's seek to the beginning of the song 1505 1682 GstFormat trackFormat = gst_format_get_by_nick("track"); 1506 m_backend->logMessage(QString("setCurrentTitle %0").arg(title), Backend::Info, this); 1507 if ((title == m_currentTitle) || (title < 1) || (title > m_availableTitles)) 1508 return; 1509 1510 m_currentTitle = title; 1511 1512 //let's seek to the beginning of the song 1513 if (gst_element_seek_simple(m_pipeline, trackFormat, GST_SEEK_FLAG_FLUSH, m_currentTitle - 1)) { 1683 m_backend->logMessage(QString("setTrack %0").arg(title), Backend::Info, this); 1684 if (gst_element_seek_simple(m_pipeline, trackFormat, GST_SEEK_FLAG_FLUSH, title - 1)) { 1685 m_currentTitle = title; 1514 1686 updateTotalTime(); 1515 1687 m_atEndOfStream = false; -
trunk/src/3rdparty/phonon/gstreamer/mediaobject.h
r2 r846 56 56 { 57 57 friend class Stream; 58 friend class AudioDataOutput; 58 59 Q_OBJECT 59 60 Q_INTERFACES(Phonon::MediaObjectInterface … … 145 146 void handleEndOfStream(); 146 147 void addMissingCodecName(const QString &codec) { m_missingCodecs.append(codec); } 147 void invalidateGraph() { 148 m_resetNeeded = true; 149 if (m_state == Phonon::PlayingState || m_state == Phonon::PausedState) { 150 changeState(Phonon::StoppedState); 151 } 152 } 148 void invalidateGraph(); 149 153 150 static void cb_newpad (GstElement *decodebin, GstPad *pad, gboolean last, gpointer data); 154 151 static void cb_pad_added (GstElement *decodebin, GstPad *pad, gpointer data); … … 237 234 int _iface_currentTitle() const; 238 235 void _iface_setCurrentTitle(int title); 236 void setTrack(int title); 239 237 240 238 bool m_resumeState; … … 251 249 qint32 m_prefinishMark; 252 250 qint32 m_transitionTime; 251 bool m_isStream; 253 252 254 253 qint64 m_posAtSeek; … … 286 285 int m_availableTitles; 287 286 int m_currentTitle; 287 int m_pendingTitle; 288 288 }; 289 289 } -
trunk/src/3rdparty/phonon/gstreamer/qwidgetvideosink.h
r2 r846 20 20 21 21 #include "common.h" 22 #include "qwidgetvideosink.h" 22 23 23 24 #include <QtCore/QByteArray> -
trunk/src/3rdparty/phonon/gstreamer/videowidget.h
r561 r846 26 26 #include "medianode.h" 27 27 #include "abstractrenderer.h" 28 #include "videowidget.h" 28 29 29 30 #include <gst/gst.h> -
trunk/src/3rdparty/phonon/gstreamer/x11renderer.cpp
r2 r846 91 91 videoSink = 0; 92 92 } else { 93 // Note that this should not really be nec cessary as these are93 // Note that this should not really be necessary as these are 94 94 // default values, though under certain conditions values are retained 95 95 // even between application instances. (reproducible on 0.10.16/Gutsy) … … 139 139 { 140 140 Q_UNUSED(movieSize); 141 141 142 if (m_renderWidget) { 142 143 m_renderWidget->setGeometry(m_videoWidget->calculateDrawFrameRect()); -
trunk/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp
r769 r846 185 185 { 186 186 // Default implementation 187 Q_UNUSED(param) 188 Q_UNUSED(value) 187 189 Q_ASSERT_X(false, Q_FUNC_INFO, "Effect has no parameters"); 188 190 return 0; -
trunk/src/3rdparty/phonon/mmf/abstractaudioeffect.h
r769 r846 119 119 // in the implementations of the backend effect nodes. 120 120 121 #ifdef Q_CC_NOKIAX86 122 # pragma warn_illtokenpasting off 123 #endif 124 121 125 #define PHONON_MMF_DEFINE_EFFECT_FUNCTIONS(Effect) \ 122 126 \ -
trunk/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
r769 r846 17 17 */ 18 18 19 #include <QResource> 19 20 #include <QUrl> 20 21 … … 23 24 #include "mediaobject.h" 24 25 #include "utils.h" 26 #include <cdbcols.h> 27 #include <cdblen.h> 28 #include <commdb.h> 25 29 26 30 QT_BEGIN_NAMESPACE … … 51 55 , m_pending(NothingPending) 52 56 , m_positionTimer(new QTimer(this)) 57 , m_position(0) 53 58 , m_bufferStatusTimer(new QTimer(this)) 54 59 , m_mmfMaxVolume(NullMaxVolume) 55 60 , m_prefinishMarkSent(false) 56 61 , m_aboutToFinishSent(false) 62 #ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD 63 , m_download(0) 64 , m_downloadStalled(false) 65 #endif 57 66 { 58 67 connect(m_positionTimer.data(), SIGNAL(timeout()), this, SLOT(positionTick())); … … 183 192 184 193 doSeek(ms); 194 m_position = ms; 185 195 resetMarksIfRewound(); 186 196 … … 207 217 } 208 218 219 qint64 MMF::AbstractMediaPlayer::currentTime() const 220 { 221 return m_position; 222 } 223 209 224 void MMF::AbstractMediaPlayer::doSetTickInterval(qint32 interval) 210 225 { … … 217 232 } 218 233 219 void MMF::AbstractMediaPlayer::open(const MediaSource &source, RFile& file) 220 { 221 TRACE_CONTEXT(AbstractMediaPlayer::setFileSource, EAudioApi); 234 void MMF::AbstractMediaPlayer::open() 235 { 236 TRACE_CONTEXT(AbstractMediaPlayer::open, EAudioApi); 237 const MediaSource source = m_parent->source(); 222 238 TRACE_ENTRY("state %d source.type %d", privateState(), source.type()); 223 239 … … 230 246 switch (source.type()) { 231 247 case MediaSource::LocalFile: { 232 symbianErr = openFile(file); 248 RFile *const file = m_parent->file(); 249 Q_ASSERT(file); 250 symbianErr = openFile(*file); 233 251 if (KErrNone != symbianErr) 234 252 errorMessage = tr("Error opening file"); … … 238 256 case MediaSource::Url: { 239 257 const QUrl url(source.url()); 240 241 258 if (url.scheme() == QLatin1String("file")) { 242 symbianErr = openFile(file); 259 RFile *const file = m_parent->file(); 260 Q_ASSERT(file); 261 symbianErr = openFile(*file); 243 262 if (KErrNone != symbianErr) 244 263 errorMessage = tr("Error opening file"); 245 } else { 246 symbianErr = openUrl(url.toString()); 264 } 265 #ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD 266 else if (url.scheme() == QLatin1String("http")) { 267 Q_ASSERT(!m_download); 268 m_download = new Download(url, this); 269 connect(m_download, SIGNAL(lengthChanged(qint64)), 270 this, SLOT(downloadLengthChanged(qint64))); 271 connect(m_download, SIGNAL(stateChanged(Download::State)), 272 this, SLOT(downloadStateChanged(Download::State))); 273 int iap = m_parent->currentIAP(); 274 TRACE("HTTP Url: Using IAP %d", iap); 275 m_download->start(iap); 276 } 277 #endif 278 else { 279 int iap = m_parent->currentIAP(); 280 TRACE("Using IAP %d", iap); 281 symbianErr = openUrl(url.toString(), iap); 247 282 if (KErrNone != symbianErr) 248 283 errorMessage = tr("Error opening URL"); 249 284 } 250 285 286 break; 287 } 288 289 case MediaSource::Stream: { 290 QResource *const resource = m_parent->resource(); 291 if (resource) { 292 m_buffer.Set(resource->data(), resource->size()); 293 symbianErr = openDescriptor(m_buffer); 294 if (KErrNone != symbianErr) 295 errorMessage = tr("Error opening resource"); 296 } else { 297 errorMessage = tr("Error opening source: resource not opened"); 298 } 251 299 break; 252 300 } … … 271 319 } 272 320 321 void MMF::AbstractMediaPlayer::close() 322 { 323 doClose(); 324 #ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD 325 delete m_download; 326 m_download = 0; 327 #endif 328 m_position = 0; 329 } 330 273 331 void MMF::AbstractMediaPlayer::volumeChanged(qreal volume) 274 332 { … … 357 415 stopBufferStatusTimer(); 358 416 emit MMF::AbstractPlayer::bufferStatus(100); 359 changeState(m_stateBeforeBuffering); 417 if (!progressiveDownloadStalled()) 418 changeState(m_stateBeforeBuffering); 360 419 } 361 420 … … 368 427 void MMF::AbstractMediaPlayer::loadingComplete(int error) 369 428 { 370 Q_ASSERT(Phonon::LoadingState == state()); 371 372 if (KErrNone == error) { 373 updateMetaData(); 374 changeState(StoppedState); 429 TRACE_CONTEXT(AbstractMediaPlayer::loadingComplete, EAudioApi); 430 TRACE_ENTRY("state %d error %d", state(), error); 431 if (progressiveDownloadStalled()) { 432 Q_ASSERT(Phonon::BufferingState == state()); 433 if (KErrNone == error) { 434 bufferingComplete(); 435 doSeek(m_position); 436 startPlayback(); 437 #ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD 438 m_downloadStalled = false; 439 #endif 440 } 375 441 } else { 376 setError(tr("Loading clip failed"), error); 442 Q_ASSERT(Phonon::LoadingState == state()); 443 if (KErrNone == error) { 444 updateMetaData(); 445 changeState(StoppedState); 446 } else { 447 if (isProgressiveDownload() && KErrCorrupt == error) { 448 setProgressiveDownloadStalled(); 449 } else { 450 setError(tr("Loading clip failed"), error); 451 } 452 } 377 453 } 378 454 } … … 398 474 } 399 475 else { 400 setError(tr("Playback complete"), error); 401 emit finished(); 476 if (isProgressiveDownload() && KErrCorrupt == error) { 477 setProgressiveDownloadStalled(); 478 } else { 479 setError(tr("Playback complete"), error); 480 emit finished(); 481 } 402 482 } 403 483 } … … 408 488 } 409 489 490 bool MMF::AbstractMediaPlayer::isProgressiveDownload() const 491 { 492 #ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD 493 return (0 != m_download); 494 #else 495 return false; 496 #endif 497 } 498 499 bool MMF::AbstractMediaPlayer::progressiveDownloadStalled() const 500 { 501 #ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD 502 return m_downloadStalled; 503 #else 504 return false; 505 #endif 506 } 507 410 508 //----------------------------------------------------------------------------- 411 509 // Slots … … 414 512 void MMF::AbstractMediaPlayer::positionTick() 415 513 { 416 const qint64 current = currentTime(); 417 emitMarksIfReached(current); 418 emit MMF::AbstractPlayer::tick(current); 514 const qint64 pos = getCurrentTime(); 515 if (pos > m_position) { 516 m_position = pos; 517 emitMarksIfReached(m_position); 518 emit MMF::AbstractPlayer::tick(m_position); 519 } 419 520 } 420 521 … … 441 542 void MMF::AbstractMediaPlayer::resetMarksIfRewound() 442 543 { 443 const qint64 current = currentTime();544 const qint64 current = getCurrentTime(); 444 545 const qint64 total = totalTime(); 445 546 const qint64 remaining = total - current; … … 470 571 } 471 572 573 void MMF::AbstractMediaPlayer::setProgressiveDownloadStalled() 574 { 575 #ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD 576 TRACE_CONTEXT(AbstractMediaPlayer::setProgressiveDownloadStalled, EAudioApi); 577 TRACE_ENTRY("state %d", state()); 578 Q_ASSERT(isProgressiveDownload()); 579 m_downloadStalled = true; 580 doClose(); 581 bufferingStarted(); 582 // Video player loses window handle when closed - need to reapply it here 583 videoOutputChanged(); 584 m_download->resume(); 585 #endif 586 } 587 472 588 void MMF::AbstractMediaPlayer::bufferStatusTick() 473 589 { 474 emit MMF::AbstractPlayer::bufferStatus(bufferStatus()); 475 } 590 // During progressive download, there is no way to detect the buffering status. 591 // Phonon does not support a "buffering; amount unknown" signal, therefore we 592 // return a buffering status of zero. 593 const int status = progressiveDownloadStalled() ? 0 : bufferStatus(); 594 emit MMF::AbstractPlayer::bufferStatus(status); 595 } 596 597 #ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD 598 void MMF::AbstractMediaPlayer::downloadLengthChanged(qint64 length) 599 { 600 TRACE_CONTEXT(AbstractMediaPlayer::downloadLengthChanged, EAudioApi); 601 TRACE_ENTRY("length %Ld", length); 602 Q_UNUSED(length) 603 if (m_downloadStalled) { 604 bufferingComplete(); 605 int err = m_parent->openFileHandle(m_download->targetFileName()); 606 if (KErrNone == err) 607 err = openFile(*m_parent->file()); 608 if (KErrNone != err) 609 setError(tr("Error opening file")); 610 } 611 } 612 613 void MMF::AbstractMediaPlayer::downloadStateChanged(Download::State state) 614 { 615 TRACE_CONTEXT(AbstractMediaPlayer::downloadStateChanged, EAudioApi); 616 TRACE_ENTRY("state %d", state); 617 switch (state) { 618 case Download::Idle: 619 case Download::Initializing: 620 break; 621 case Download::Downloading: 622 { 623 int err = m_parent->openFileHandle(m_download->targetFileName()); 624 if (KErrNone == err) 625 err = openFile(*m_parent->file()); 626 else if (KErrCorrupt == err) 627 // Insufficient data downloaded - enter Buffering state 628 setProgressiveDownloadStalled(); 629 if (KErrNone != err) 630 setError(tr("Error opening file")); 631 } 632 break; 633 case Download::Complete: 634 break; 635 case Download::Error: 636 setError(tr("Download error")); 637 break; 638 } 639 } 640 #endif // PHONON_MMF_PROGRESSIVE_DOWNLOAD 476 641 477 642 Phonon::State MMF::AbstractMediaPlayer::phononState(PrivateState state) const -
trunk/src/3rdparty/phonon/mmf/abstractmediaplayer.h
r769 r846 24 24 #include <e32std.h> 25 25 #include "abstractplayer.h" 26 #ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD 27 # include "download.h" 28 #endif 26 29 27 30 class RFile; … … 48 51 49 52 public: 50 virtual void open(const Phonon::MediaSource&, RFile&); 53 virtual void open(); 54 virtual void close(); 51 55 52 56 // MediaObjectInterface … … 56 60 virtual void seek(qint64 milliseconds); 57 61 virtual bool isSeekable() const; 62 virtual qint64 currentTime() const; 58 63 virtual void volumeChanged(qreal volume); 59 64 … … 69 74 virtual void doSeek(qint64 pos) = 0; 70 75 virtual int setDeviceVolume(int mmfVolume) = 0; 76 virtual int openFile(const QString &fileName) = 0; 71 77 virtual int openFile(RFile& file) = 0; 72 virtual int openUrl(const QString& url) = 0; 78 virtual int openUrl(const QString& url, int iap) = 0; 79 virtual int openDescriptor(const TDesC8 &des) = 0; 73 80 virtual int bufferStatus() const = 0; 74 virtual void close() = 0;81 virtual void doClose() = 0; 75 82 76 83 void updateMetaData(); 84 virtual qint64 getCurrentTime() const = 0; 77 85 virtual int numberOfMetaDataEntries() const = 0; 78 86 virtual QPair<QString, QString> metaDataEntry(int index) const = 0; … … 87 95 static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &); 88 96 97 bool isProgressiveDownload() const; 98 bool progressiveDownloadStalled() const; 99 89 100 private: 90 101 void startPositionTimer(); … … 97 108 void resetMarksIfRewound(); 98 109 void startPlayback(); 110 void setProgressiveDownloadStalled(); 99 111 100 112 enum Pending { … … 109 121 void positionTick(); 110 122 void bufferStatusTick(); 123 #ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD 124 void downloadLengthChanged(qint64); 125 void downloadStateChanged(Download::State); 126 #endif 111 127 112 128 private: … … 116 132 117 133 QScopedPointer<QTimer> m_positionTimer; 134 qint64 m_position; 118 135 119 136 QScopedPointer<QTimer> m_bufferStatusTimer; … … 124 141 bool m_prefinishMarkSent; 125 142 bool m_aboutToFinishSent; 143 144 // Used for playback of resource files 145 TPtrC8 m_buffer; 146 147 #ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD 148 Download *m_download; 149 bool m_downloadStalled; 150 #endif 126 151 127 152 QMultiMap<QString, QString> m_metaData; -
trunk/src/3rdparty/phonon/mmf/abstractplayer.h
r769 r846 27 27 #include "abstractvideooutput.h" 28 28 29 class RFile;30 31 29 QT_BEGIN_NAMESPACE 32 30 … … 55 53 AbstractPlayer(const AbstractPlayer *player); 56 54 57 virtual void open(const Phonon::MediaSource&, RFile&) = 0; 55 virtual void open() = 0; 56 virtual void close() = 0; 58 57 59 58 // MediaObjectInterface (implemented) -
trunk/src/3rdparty/phonon/mmf/abstractvideooutput.cpp
r769 r846 61 61 , m_scaleMode(DefaultScaleMode) 62 62 { 63 63 // Ensure that this widget has a native window handle 64 winId(); 64 65 } 65 66 … … 161 162 #ifndef QT_NO_DEBUG 162 163 TRACE_CONTEXT(AbstractVideoOutput::dump, EVideoInternal); 163 164 164 QScopedPointer<ObjectDump::QVisitor> visitor(new ObjectDump::QVisitor); 165 165 visitor->setPrefix("Phonon::MMF"); // to aid searchability of logs 166 166 ObjectDump::addDefaultAnnotators(*visitor); 167 168 if (QWidget *window = QApplication::activeWindow()) {169 TRACE("Dumping from root window 0x%08x:", window);170 ObjectDump::dumpTreeFromLeaf(*window, *visitor);171 }172 173 TRACE("Dumping tree from leaf 0x%08x:", this);174 167 ObjectDump::dumpTreeFromLeaf(*this, *visitor); 175 176 QScopedPointer<ObjectDump::QDumper> dumper(new ObjectDump::QDumper);177 dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs178 ObjectDump::addDefaultAnnotators(*dumper);179 TRACE_0("Dumping AbstractVideoOutput:");180 dumper->dumpObject(*this);181 168 #endif 182 169 } -
trunk/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp
r769 r846 17 17 */ 18 18 19 #include <QDir> 19 20 #include <QUrl> 20 21 #include <QTimer> … … 67 68 createPlayer(); 68 69 70 m_player->RegisterForVideoLoadingNotification(*this); 71 69 72 TRACE_EXIT_0(); 70 73 } … … 131 134 } 132 135 136 int MMF::AbstractVideoPlayer::openFile(const QString &fileName) 137 { 138 const QHBufC nativeFileName(QDir::toNativeSeparators(fileName)); 139 TRAPD(err, m_player->OpenFileL(*nativeFileName)); 140 return err; 141 } 142 133 143 int MMF::AbstractVideoPlayer::openFile(RFile &file) 134 144 { … … 137 147 } 138 148 139 int MMF::AbstractVideoPlayer::openUrl(const QString &url) 140 { 141 TRAPD(err, m_player->OpenUrlL(qt_QString2TPtrC(url))); 149 int MMF::AbstractVideoPlayer::openUrl(const QString &url, int iap) 150 { 151 TRAPD(err, m_player->OpenUrlL(qt_QString2TPtrC(url), iap)); 152 return err; 153 } 154 155 int MMF::AbstractVideoPlayer::openDescriptor(const TDesC8 &des) 156 { 157 TRAPD(err, m_player->OpenDesL(des)); 142 158 return err; 143 159 } … … 150 166 } 151 167 152 void MMF::AbstractVideoPlayer:: close()168 void MMF::AbstractVideoPlayer::doClose() 153 169 { 154 170 m_player->Close(); … … 160 176 } 161 177 162 qint64 MMF::AbstractVideoPlayer:: currentTime() const163 { 164 TRACE_CONTEXT(AbstractVideoPlayer:: currentTime, EVideoApi);178 qint64 MMF::AbstractVideoPlayer::getCurrentTime() const 179 { 180 TRACE_CONTEXT(AbstractVideoPlayer::getCurrentTime, EVideoApi); 165 181 166 182 TTimeIntervalMicroSeconds us; … … 212 228 TRACE_ENTRY("state %d aspectRatio %d", state()); 213 229 214 updateScaleFactors(m_videoOutput->videoWindowSize()); 230 if (m_videoOutput) 231 updateScaleFactors(m_videoOutput->videoWindowSize()); 215 232 216 233 TRACE_EXIT_0(); … … 222 239 TRACE_ENTRY("state %d", state()); 223 240 224 updateScaleFactors(m_videoOutput->videoWindowSize()); 241 if (m_videoOutput) 242 updateScaleFactors(m_videoOutput->videoWindowSize()); 225 243 226 244 TRACE_EXIT_0(); … … 237 255 TRACE_ENTRY("state %d error %d", state(), aError); 238 256 239 __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic)); 257 __ASSERT_ALWAYS(LoadingState == state() || 258 progressiveDownloadStalled() && BufferingState == state(), 259 Utils::panic(InvalidStatePanic)); 240 260 241 261 if (KErrNone == aError) … … 252 272 TRACE_ENTRY("state %d error %d", state(), aError); 253 273 254 __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic)); 274 __ASSERT_ALWAYS(LoadingState == state() || 275 progressiveDownloadStalled() && BufferingState == state(), 276 Utils::panic(InvalidStatePanic)); 255 277 256 278 TRAPD(err, getVideoClipParametersL(aError)); … … 358 380 void MMF::AbstractVideoPlayer::initVideoOutput() 359 381 { 382 Q_ASSERT(m_videoOutput); 383 360 384 bool connected = connect( 361 385 m_videoOutput, SIGNAL(videoWindowChanged()), … … 379 403 Q_UNUSED(connected); 380 404 381 // Do these after all connections are complete, to ensure382 // that any signals generated get to their destinations.383 m_videoOutput->winId();384 405 m_videoOutput->setVideoSize(m_videoFrameSize); 385 406 } … … 401 422 void MMF::AbstractVideoPlayer::updateScaleFactors(const QSize &windowSize, bool apply) 402 423 { 424 Q_ASSERT(m_videoOutput); 425 403 426 if (m_videoFrameSize.isValid()) { 404 427 QRect videoRect; … … 460 483 void MMF::AbstractVideoPlayer::parametersChanged(VideoParameters parameters) 461 484 { 462 if (state() == LoadingState )485 if (state() == LoadingState || progressiveDownloadStalled() && BufferingState == state()) 463 486 m_pendingChanges |= parameters; 464 487 else -
trunk/src/3rdparty/phonon/mmf/abstractvideoplayer.h
r769 r846 65 65 virtual void doSeek(qint64 milliseconds); 66 66 virtual int setDeviceVolume(int mmfVolume); 67 virtual int openFile(const QString &fileName); 67 68 virtual int openFile(RFile &file); 68 virtual int openUrl(const QString &url); 69 virtual int openUrl(const QString &url, int iap); 70 virtual int openDescriptor(const TDesC8 &des); 69 71 virtual int bufferStatus() const; 70 virtual void close();72 virtual void doClose(); 71 73 72 74 // MediaObjectInterface 73 75 virtual bool hasVideo() const; 74 virtual qint64 currentTime() const;75 76 virtual qint64 totalTime() const; 76 77 … … 79 80 80 81 // AbstractMediaPlayer 82 virtual qint64 getCurrentTime() const; 81 83 virtual int numberOfMetaDataEntries() const; 82 84 virtual QPair<QString, QString> metaDataEntry(int index) const; -
trunk/src/3rdparty/phonon/mmf/audiooutput.cpp
r561 r846 79 79 Q_ASSERT_X(index == AudioOutputDeviceID, Q_FUNC_INFO, 80 80 "We only support one output device, with id 0"); 81 #ifdef QT_NO_DEBUG 82 Q_UNUSED(index) 83 #endif 81 84 return true; 82 85 } -
trunk/src/3rdparty/phonon/mmf/audioplayer.cpp
r769 r846 17 17 */ 18 18 19 #include <QDir> 19 20 #include <QUrl> 20 21 … … 110 111 } 111 112 113 int MMF::AudioPlayer::openFile(const QString &fileName) 114 { 115 const QHBufC nativeFileName(QDir::toNativeSeparators(fileName)); 116 TRAPD(err, m_player->OpenFileL(*nativeFileName)); 117 return err; 118 } 119 112 120 int MMF::AudioPlayer::openFile(RFile& file) 113 121 { … … 127 135 } 128 136 129 int MMF::AudioPlayer::openUrl(const QString& /*url*/ )137 int MMF::AudioPlayer::openUrl(const QString& /*url*/, int /*iap*/) 130 138 { 131 139 // Streaming playback is generally not supported by the implementation … … 138 146 } 139 147 148 int MMF::AudioPlayer::openDescriptor(const TDesC8 &des) 149 { 150 TRAPD(err, m_player->OpenDesL(des)); 151 return err; 152 } 153 140 154 int MMF::AudioPlayer::bufferStatus() const 141 155 { … … 145 159 } 146 160 147 void MMF::AudioPlayer:: close()161 void MMF::AudioPlayer::doClose() 148 162 { 149 163 m_player->Close(); … … 155 169 } 156 170 157 qint64 MMF::AudioPlayer:: currentTime() const158 { 159 TRACE_CONTEXT(AudioPlayer:: currentTime, EAudioApi);171 qint64 MMF::AudioPlayer::getCurrentTime() const 172 { 173 TRACE_CONTEXT(AudioPlayer::getCurrentTime, EAudioApi); 160 174 161 175 TTimeIntervalMicroSeconds us; … … 198 212 TRACE_ENTRY("state %d error %d", state(), aError); 199 213 200 __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic)); 214 __ASSERT_ALWAYS(LoadingState == state() || 215 progressiveDownloadStalled() && BufferingState == state(), 216 Utils::panic(InvalidStatePanic)); 201 217 202 218 if (KErrNone == aError) { -
trunk/src/3rdparty/phonon/mmf/audioplayer.h
r561 r846 66 66 virtual void doSeek(qint64 milliseconds); 67 67 virtual int setDeviceVolume(int mmfVolume); 68 virtual int openFile(const QString &fileName); 68 69 virtual int openFile(RFile& file); 69 virtual int openUrl(const QString& url); 70 virtual int openUrl(const QString& url, int iap); 71 virtual int openDescriptor(const TDesC8 &des); 70 72 virtual int bufferStatus() const; 71 virtual void close();73 virtual void doClose(); 72 74 73 75 // MediaObjectInterface 74 76 virtual bool hasVideo() const; 75 virtual qint64 currentTime() const;76 77 virtual qint64 totalTime() const; 77 78 78 79 // AbstractMediaPlayer 80 virtual qint64 getCurrentTime() const; 79 81 virtual int numberOfMetaDataEntries() const; 80 82 virtual QPair<QString, QString> metaDataEntry(int index) const; -
trunk/src/3rdparty/phonon/mmf/bassboost.cpp
r651 r846 50 50 QList<EffectParameter> ¶meters) 51 51 { 52 Q_UNUSED(parameters) 52 53 QScopedPointer<CBassBoost> effect; 53 54 TRAPD(err, effect.reset(CBassBoost::NewL(*stream))); -
trunk/src/3rdparty/phonon/mmf/dummyplayer.cpp
r561 r846 93 93 } 94 94 95 void MMF::DummyPlayer::open( const Phonon::MediaSource &, RFile &)95 void MMF::DummyPlayer::open() 96 96 { 97 97 98 98 } 99 99 100 void MMF::DummyPlayer::close() 101 { 102 103 } 100 104 101 105 //----------------------------------------------------------------------------- -
trunk/src/3rdparty/phonon/mmf/dummyplayer.h
r561 r846 58 58 59 59 // AbstractPlayer 60 virtual void open(const Phonon::MediaSource&, RFile&); 60 virtual void open(); 61 virtual void close(); 61 62 virtual void doSetTickInterval(qint32 interval); 62 63 }; -
trunk/src/3rdparty/phonon/mmf/effectfactory.cpp
r651 r846 184 184 data.m_parameters.append(param); 185 185 186 if (data.m_supported = BackendNode::getParameters 187 (stream.data(), data.m_parameters)) { 186 data.m_supported = BackendNode::getParameters(stream.data(), 187 data.m_parameters); 188 if (data.m_supported) { 188 189 const QString description = QCoreApplication::translate 189 190 ("Phonon::MMF::EffectFactory", BackendNode::description()); -
trunk/src/3rdparty/phonon/mmf/loudness.cpp
r651 r846 50 50 QList<EffectParameter> ¶meters) 51 51 { 52 Q_UNUSED(parameters) 52 53 QScopedPointer<CLoudness> effect; 53 54 TRAPD(err, effect.reset(CLoudness::NewL(*stream))); -
trunk/src/3rdparty/phonon/mmf/mediaobject.cpp
r769 r846 35 35 36 36 #include <QDir> 37 #include <QResource> 37 38 #include <QUrl> 39 #include <cdbcols.h> 40 #include <cdblen.h> 41 #include <commdb.h> 42 #include <mmf/common/mmfcontrollerframeworkbase.h> 38 43 39 44 QT_BEGIN_NAMESPACE … … 53 58 , m_recognizerOpened(false) 54 59 , m_nextSourceSet(false) 60 , m_file(0) 61 , m_resource(0) 55 62 { 56 63 m_player.reset(new DummyPlayer()); … … 59 66 TRACE_ENTRY_0(); 60 67 61 Q_UNUSED(parent); 68 const int err = m_fileServer.Connect(); 69 QT_TRAP_THROWING(User::LeaveIfError(err)); 70 71 parent->installEventFilter(this); 72 m_iap = KUseDefaultIap; 62 73 63 74 TRACE_EXIT_0(); … … 69 80 TRACE_ENTRY_0(); 70 81 71 m_file.Close(); 82 parent()->removeEventFilter(this); 83 delete m_resource; 84 85 if (m_file) 86 m_file->Close(); 87 delete m_file; 88 72 89 m_fileServer.Close(); 73 90 m_recognizer.Close(); … … 89 106 if (KErrNone != err) { 90 107 TRACE("RApaLsSession::Connect error %d", err); 91 return false;92 }93 94 err = m_fileServer.Connect();95 if (KErrNone != err) {96 TRACE("RFs::Connect error %d", err);97 108 return false; 98 109 } … … 120 131 121 132 if (openRecognizer()) { 122 123 const QHBufC fileNameSymbian(QDir::toNativeSeparators(fileName)); 124 125 m_file.Close(); 126 TInt err = m_file.Open(m_fileServer, *fileNameSymbian, EFileRead | EFileShareReadersOnly); 127 133 TInt err = openFileHandle(fileName); 134 const QHBufC nativeFileName(QDir::toNativeSeparators(fileName)); 128 135 if (KErrNone == err) { 129 136 TDataRecognitionResult recognizerResult; 130 err = m_recognizer.RecognizeData( m_file, recognizerResult);137 err = m_recognizer.RecognizeData(*m_file, recognizerResult); 131 138 if (KErrNone == err) { 132 139 const TPtrC mimeType = recognizerResult.iDataType.Des(); 133 140 result = Utils::mimeTypeToMediaType(mimeType); 134 141 } else { 135 TRACE("RApaLsSession::RecognizeData filename %S error %d", fileNameSymbian.data(), err);142 TRACE("RApaLsSession::RecognizeData filename %S error %d", nativeFileName.data(), err); 136 143 } 137 144 } else { 138 TRACE("RFile::Open filename %S error %d", fileNameSymbian.data(), err);145 TRACE("RFile::Open filename %S error %d", nativeFileName.data(), err); 139 146 } 140 147 } … … 143 150 } 144 151 152 int MMF::MediaObject::openFileHandle(const QString &fileName) 153 { 154 TRACE_CONTEXT(MediaObject::openFileHandle, EAudioInternal); 155 const QHBufC nativeFileName(QDir::toNativeSeparators(fileName)); 156 TRACE_ENTRY("filename %S", nativeFileName.data()); 157 if (m_file) 158 m_file->Close(); 159 delete m_file; 160 m_file = 0; 161 m_file = new RFile; 162 TInt err = m_file->Open(m_fileServer, *nativeFileName, EFileRead | EFileShareReadersOrWriters); 163 return err; 164 } 165 166 MMF::MediaType MMF::MediaObject::bufferMediaType(const uchar *data, qint64 size) 167 { 168 TRACE_CONTEXT(MediaObject::bufferMediaType, EAudioInternal); 169 MediaType result = MediaTypeUnknown; 170 if (openRecognizer()) { 171 TDataRecognitionResult recognizerResult; 172 const TPtrC8 des(data, size); 173 const TInt err = m_recognizer.RecognizeData(KNullDesC, des, recognizerResult); 174 if (KErrNone == err) { 175 const TPtrC mimeType = recognizerResult.iDataType.Des(); 176 result = Utils::mimeTypeToMediaType(mimeType); 177 } else { 178 TRACE("RApaLsSession::RecognizeData error %d", err); 179 } 180 } 181 return result; 182 } 145 183 146 184 //----------------------------------------------------------------------------- … … 229 267 void MMF::MediaObject::switchToSource(const MediaSource &source) 230 268 { 269 if (m_file) 270 m_file->Close(); 271 delete m_file; 272 m_file = 0; 273 274 delete m_resource; 275 m_resource = 0; 276 231 277 createPlayer(source); 232 278 m_source = source; 233 m_player->open( m_source, m_file);279 m_player->open(); 234 280 emit currentSourceChanged(m_source); 235 281 } … … 273 319 case MediaSource::Invalid: 274 320 case MediaSource::Disc: 321 errorMessage = tr("Error opening source: type not supported"); 322 break; 323 275 324 case MediaSource::Stream: 276 errorMessage = tr("Error opening source: type not supported"); 325 { 326 const QString fileName = source.url().toLocalFile(); 327 if (fileName.startsWith(QLatin1String(":/")) || fileName.startsWith(QLatin1String("qrc://"))) { 328 Q_ASSERT(!m_resource); 329 m_resource = new QResource(fileName); 330 if (m_resource->isValid()) { 331 if (m_resource->isCompressed()) 332 errorMessage = tr("Error opening source: resource is compressed"); 333 else 334 mediaType = bufferMediaType(m_resource->data(), m_resource->size()); 335 } else { 336 errorMessage = tr("Error opening source: resource not valid"); 337 } 338 } else { 339 errorMessage = tr("Error opening source: type not supported"); 340 } 341 } 277 342 break; 278 343 … … 281 346 break; 282 347 } 348 349 if (oldPlayer) 350 oldPlayer->close(); 283 351 284 352 AbstractPlayer* newPlayer = 0; … … 372 440 } 373 441 442 RFile* MMF::MediaObject::file() const 443 { 444 return m_file; 445 } 446 447 QResource* MMF::MediaObject::resource() const 448 { 449 return m_resource; 450 } 451 374 452 //----------------------------------------------------------------------------- 375 453 // MediaNode … … 422 500 423 501 //----------------------------------------------------------------------------- 502 // IAP support 503 //----------------------------------------------------------------------------- 504 505 int MMF::MediaObject::currentIAP() const 506 { 507 return m_iap; 508 } 509 510 bool MMF::MediaObject::eventFilter(QObject *watched, QEvent *event) 511 { 512 if (event->type() == QEvent::DynamicPropertyChange ) { 513 QDynamicPropertyChangeEvent* dynamicEvent = static_cast<QDynamicPropertyChangeEvent*>(event); 514 if (dynamicEvent->propertyName() == "InternetAccessPointName") { 515 QVariant value = watched->property("InternetAccessPointName"); 516 if (value.isValid()) { 517 QString iapName = value.toString(); 518 TRAPD(err, setIAPIdFromNameL(iapName)); 519 if (err) 520 m_player->setError(tr("Failed to set requested IAP"), err); 521 } 522 } 523 } 524 return false; 525 } 526 527 void MMF::MediaObject::setIAPIdFromNameL(const QString& iapString) 528 { 529 TRACE_CONTEXT(MediaObject::getIapIdFromName, EVideoInternal); 530 TBuf<KCommsDbSvrMaxColumnNameLength> iapDes = qt_QString2TPtrC(iapString); 531 CCommsDatabase *commsDb = CCommsDatabase::NewL(EDatabaseTypeIAP); 532 CleanupStack::PushL(commsDb); 533 commsDb->ShowHiddenRecords(); 534 CCommsDbTableView *view = commsDb->OpenTableLC(TPtrC(IAP)); 535 for (TInt l = view->GotoFirstRecord(); l != KErrNotFound; l = view->GotoNextRecord()) { 536 TBuf<KCommsDbSvrMaxColumnNameLength> iapName; 537 view->ReadTextL(TPtrC(COMMDB_NAME), iapName); 538 TRACE("found IAP %S", &iapName); 539 if (iapName.CompareF(iapDes) == 0) { 540 TUint32 uiap; 541 view->ReadUintL(TPtrC(COMMDB_ID), uiap); 542 TRACE("matched IAP %S, setting m_iap %d", &iapName, uiap); 543 m_iap = uiap; 544 break; 545 } 546 } 547 CleanupStack::PopAndDestroy(2); // commsDb, view 548 } 549 550 //----------------------------------------------------------------------------- 424 551 // Other private functions 425 552 //----------------------------------------------------------------------------- -
trunk/src/3rdparty/phonon/mmf/mediaobject.h
r769 r846 24 24 #include <QScopedPointer> 25 25 #include <QTimer> 26 #include <QString> 26 27 27 28 // For recognizer … … 33 34 34 35 QT_BEGIN_NAMESPACE 36 37 class QResource; 35 38 36 39 namespace Phonon … … 88 91 void setVideoOutput(AbstractVideoOutput* videoOutput); 89 92 93 int openFileHandle(const QString &fileName); 94 RFile* file() const; 95 QResource* resource() const; 96 int currentIAP() const; 97 90 98 public Q_SLOTS: 91 99 void volumeChanged(qreal volume); … … 108 116 void tick(qint64 time); 109 117 118 protected: 119 bool eventFilter(QObject *watched, QEvent *event); 120 110 121 private Q_SLOTS: 111 122 void handlePrefinishMarkReached(qint32); … … 115 126 void createPlayer(const MediaSource &source); 116 127 bool openRecognizer(); 128 void setIAPIdFromNameL(const QString& iapString); 117 129 118 130 // Audio / video media type recognition 119 131 MediaType fileMediaType(const QString& fileName); 132 MediaType bufferMediaType(const uchar *data, qint64 size); 120 133 // TODO: urlMediaType function 121 134 … … 133 146 bool m_nextSourceSet; 134 147 135 // Storing the file handle here to work around KErrInUse error 136 // from MMF player utility OpenFileL functions 137 RFile m_file; 148 RFile* m_file; 149 QResource* m_resource; 138 150 139 151 QScopedPointer<AbstractPlayer> m_player; 152 int m_iap; 140 153 141 154 }; -
trunk/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp
r769 r846 62 62 void MMF::DsaVideoPlayer::videoWindowScreenRectChanged() 63 63 { 64 Q_ASSERT(m_videoOutput); 65 64 66 QRect windowRect = static_cast<DsaVideoOutput *>(m_videoOutput)->videoWindowScreenRect(); 65 67 … … 125 127 // CVideoPlayerUtility::NewL starts DSA 126 128 m_dsaActive = true; 127 128 m_player->RegisterForVideoLoadingNotification(*this);129 129 } 130 130 131 131 void MMF::DsaVideoPlayer::initVideoOutput() 132 132 { 133 Q_ASSERT(m_videoOutput); 134 133 135 bool connected = connect( 134 136 m_videoOutput, SIGNAL(videoWindowScreenRectChanged()), … … 157 159 void MMF::DsaVideoPlayer::prepareCompleted() 158 160 { 159 videoWindowScreenRectChanged(); 161 if (m_videoOutput) 162 videoWindowScreenRectChanged(); 160 163 } 161 164 -
trunk/src/3rdparty/phonon/mmf/videoplayer_surface.cpp
r769 r846 60 60 void MMF::SurfaceVideoPlayer::videoWindowSizeChanged() 61 61 { 62 updateScaleFactors(m_videoOutput->videoWindowSize()); 62 if (m_videoOutput) 63 updateScaleFactors(m_videoOutput->videoWindowSize()); 63 64 } 64 65 … … 81 82 void MMF::SurfaceVideoPlayer::initVideoOutput() 82 83 { 84 Q_ASSERT(m_videoOutput); 85 83 86 bool connected = connect( 84 87 m_videoOutput, SIGNAL(videoWindowSizeChanged()), … … 105 108 void MMF::SurfaceVideoPlayer::handleParametersChanged(VideoParameters parameters) 106 109 { 110 TRACE_CONTEXT(SurfaceVideoPlayer::handleParametersChanged, EVideoApi); 111 TRACE_ENTRY("parameters 0x%x", parameters.operator int()); 112 107 113 TRect rect; 108 114 if (m_videoOutput) { … … 116 122 int err = KErrNone; 117 123 if (parameters & WindowHandle) { 118 if (m_displayWindow) 119 player->RemoveDisplayWindow(*m_displayWindow); 120 121 RWindow *window = static_cast<RWindow *>(m_window); 122 if (window) { 123 window->SetBackgroundColor(TRgb(0, 0, 0, 255)); 124 TRAP(err, player->AddDisplayWindowL(m_wsSession, m_screenDevice, *window, rect, rect)); 125 if (KErrNone != err) { 126 setError(tr("Video display error"), err); 127 window = 0; 128 } 129 } 130 m_displayWindow = window; 124 removeDisplayWindow(); 125 addDisplayWindow(rect); 131 126 } 132 127 133 128 if (KErrNone == err) { 134 129 if (parameters & ScaleFactors) { 130 if (!m_displayWindow) 131 addDisplayWindow(rect); 135 132 Q_ASSERT(m_displayWindow); 136 133 TRAP(err, player->SetVideoExtentL(*m_displayWindow, rect)); … … 144 141 } 145 142 } 143 144 TRACE_EXIT_0(); 145 } 146 147 void MMF::SurfaceVideoPlayer::addDisplayWindow(const TRect &rect) 148 { 149 TRACE_CONTEXT(SurfaceVideoPlayer::addDisplayWindow, EVideoApi); 150 TRACE_ENTRY("rect %d %d - %d %d", rect.iTl.iX, rect.iTl.iY, rect.iBr.iX, rect.iBr.iY); 151 152 Q_ASSERT(!m_displayWindow); 153 RWindow *window = static_cast<RWindow *>(m_window); 154 155 TRACE("window 0x%08x", window); 156 157 if (window) { 158 window->SetBackgroundColor(TRgb(0, 0, 0, 255)); 159 CVideoPlayerUtility2 *player = static_cast<CVideoPlayerUtility2 *>(m_player.data()); 160 Q_ASSERT(player); 161 TRAPD(err, player->AddDisplayWindowL(m_wsSession, m_screenDevice, *window, rect, rect)); 162 if (KErrNone == err) 163 m_displayWindow = window; 164 else 165 setError(tr("Video display error"), err); 166 TRACE("err %d", err); 167 } 168 169 TRACE_EXIT_0(); 170 } 171 172 void MMF::SurfaceVideoPlayer::removeDisplayWindow() 173 { 174 TRACE_CONTEXT(SurfaceVideoPlayer::removeDisplayWindow, EVideoApi); 175 TRACE("player 0x%08x window 0x%08x", m_player.data(), m_displayWindow); 176 177 CVideoPlayerUtility2 *player = static_cast<CVideoPlayerUtility2 *>(m_player.data()); 178 if (player && m_displayWindow) { 179 player->RemoveDisplayWindow(*m_displayWindow); 180 m_displayWindow = 0; 181 } 146 182 } 147 183 -
trunk/src/3rdparty/phonon/mmf/videoplayer_surface.h
r769 r846 63 63 void handleParametersChanged(VideoParameters parameters); 64 64 65 void addDisplayWindow(const TRect &rect); 66 void removeDisplayWindow(); 67 65 68 private: 66 69 // Window handle which has been passed to the MMF via -
trunk/src/3rdparty/phonon/mmf/videowidget.cpp
r769 r846 65 65 TRACE_CONTEXT(VideoWidget::VideoWidget, EVideoApi); 66 66 TRACE_ENTRY_0(); 67 68 parent->setProperty("_q_DummyWindowSurface", true); 67 69 68 70 TRACE_EXIT_0(); -
trunk/src/3rdparty/phonon/phonon/CMakeLists.txt
r2 r846 8 8 9 9 add_subdirectory(experimental) 10 11 set(PULSEAUDIO_MINIMUM_VERSION "0.9.15") 12 macro_optional_find_package(PulseAudio) 13 if (PULSEAUDIO_FOUND) 14 # PULSEAUDIO_DEVICE_MANAGER feature check could be moved to FindPulseAudio.cmake, hint hint. -- Rex 15 macro_ensure_version("0.9.21" "${PULSEAUDIO_VERSION}" PULSEAUDIO_DEVICE_MANAGER) 16 endif (PULSEAUDIO_FOUND) 17 macro_log_feature(PULSEAUDIO_FOUND "PulseAudio" "A cross-platform, networked sound server." "http://www.pulseaudio.org" FALSE "" "Allows audio playback via the PulseAudio soundserver when it is running") 18 macro_optional_find_package(GLIB2) 19 macro_log_feature(GLIB2_FOUND "GLib2" "GLib 2 is required to compile the pulseaudio for Phonon" "http://www.gtk.org/download/" FALSE) 20 21 22 if (GLIB2_FOUND AND PULSEAUDIO_FOUND) 23 add_definitions(-DHAVE_PULSEAUDIO) 24 include_directories(${GLIB2_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIR}) 25 if (PULSEAUDIO_DEVICE_MANAGER) 26 add_definitions(-DHAVE_PULSEAUDIO_DEVICE_MANAGER) 27 endif(PULSEAUDIO_DEVICE_MANAGER) 28 else(GLIB2_FOUND AND PULSEAUDIO_FOUND) 29 set(PULSEAUDIO_INCLUDE_DIR "") 30 set(PULSEAUDIO_LIBRARY "") 31 set(PULSEAUDIO_MAINLOOP_LIBRARY "") 32 endif(GLIB2_FOUND AND PULSEAUDIO_FOUND) 33 10 34 11 35 set(phonon_LIB_SRCS … … 36 60 videoplayer.cpp 37 61 seekslider.cpp 62 swiftslider.cpp 38 63 volumeslider.cpp 39 64 effectwidget.cpp 40 65 iodevicestream.cpp 66 audiodataoutput.cpp 67 pulsesupport.cpp 41 68 ) 42 69 … … 51 78 automoc4_add_library(phonon SHARED ${phonon_LIB_SRCS}) 52 79 target_link_libraries(phonon ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) 80 if (GLIB2_FOUND AND PULSEAUDIO_FOUND) 81 target_link_libraries(phonon ${GLIB2_LIBRARIES} ${GOBJECT_LIBRARIES} ${PULSEAUDIO_LIBRARY} ${PULSEAUDIO_MAINLOOP_LIBRARY}) 82 endif (GLIB2_FOUND AND PULSEAUDIO_FOUND) 83 53 84 if (QT_QTDBUS_FOUND) 54 85 target_link_libraries(phonon ${QT_QTDBUS_LIBRARY}) … … 100 131 effectwidget.h 101 132 platformplugin.h 133 audiodataoutput.h 134 audiodataoutputinterface.h 135 globalconfig.h 136 pulsesupport.h 102 137 DESTINATION ${INCLUDE_INSTALL_DIR}/phonon COMPONENT Devel) 103 138 -
trunk/src/3rdparty/phonon/phonon/audiooutput.cpp
r561 r846 25 25 #include "objectdescription.h" 26 26 #include "audiooutputadaptor_p.h" 27 #include "globalconfig _p.h"27 #include "globalconfig.h" 28 28 #include "audiooutputinterface.h" 29 29 #include "phononnamespace_p.h" 30 30 #include "platform_p.h" 31 #include "pulsesupport.h" 31 32 32 33 #include <QtCore/qmath.h> 34 #include <QtCore/quuid.h> 33 35 34 36 #define PHONON_CLASSNAME AudioOutput … … 43 45 { 44 46 45 static inline bool callSetOutputDevice(MediaNodePrivate *const d, int index) 46 { 47 static inline bool callSetOutputDevice(AudioOutputPrivate *const d, int index) 48 { 49 PulseSupport *pulse = PulseSupport::getInstance(); 50 if (pulse->isActive()) 51 return pulse->setOutputDevice(d->getStreamUuid(), index); 52 47 53 Iface<IFACES2> iface(d); 48 54 if (iface) { … … 52 58 } 53 59 54 static inline bool callSetOutputDevice(MediaNodePrivate *const d, const AudioOutputDevice &dev) 55 { 60 static inline bool callSetOutputDevice(AudioOutputPrivate *const d, const AudioOutputDevice &dev) 61 { 62 PulseSupport *pulse = PulseSupport::getInstance(); 63 if (pulse->isActive()) 64 return pulse->setOutputDevice(d->getStreamUuid(), dev.index()); 65 56 66 Iface<IFACES2> iface(d); 57 67 if (iface) { … … 90 100 91 101 category = c; 92 93 // select hardware device according to the category 94 device = AudioOutputDevice::fromIndex(GlobalConfig().audioOutputDeviceFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices)); 102 streamUuid = QUuid::createUuid().toString(); 103 PulseSupport *pulse = PulseSupport::getInstance(); 104 pulse->setStreamPropList(category, streamUuid); 105 q->connect(pulse, SIGNAL(usingDevice(QString,int)), SLOT(_k_deviceChanged(QString,int))); 95 106 96 107 createBackendObject(); … … 99 110 } 100 111 101 112 QString AudioOutputPrivate::getStreamUuid() 113 { 114 return streamUuid; 115 } 102 116 103 117 void AudioOutputPrivate::createBackendObject() … … 107 121 Q_Q(AudioOutput); 108 122 m_backendObject = Factory::createAudioOutput(q); 123 device = AudioOutputDevice::fromIndex(GlobalConfig().audioOutputDeviceFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices)); 109 124 if (m_backendObject) { 110 125 setupBackendObject(); … … 221 236 K_D(AudioOutput); 222 237 if (!newAudioOutputDevice.isValid()) { 223 d->outputDeviceOverridden = false;238 d->outputDeviceOverridden = d->forceMove = false; 224 239 const int newIndex = GlobalConfig().audioOutputDeviceFor(d->category); 225 240 if (newIndex == d->device.index()) { … … 228 243 d->device = AudioOutputDevice::fromIndex(newIndex); 229 244 } else { 230 d->outputDeviceOverridden = true;245 d->outputDeviceOverridden = d->forceMove = true; 231 246 if (d->device == newAudioOutputDevice) { 232 247 return true; … … 235 250 } 236 251 if (k_ptr->backendObject()) { 237 return callSetOutputDevice( k_ptr, d->device.index());252 return callSetOutputDevice(d, d->device.index()); 238 253 } 239 254 return true; … … 262 277 #ifndef QT_NO_PHONON_SETTINGSGROUP 263 278 // if the output device is not available and the device was not explicitly set 264 if (!callSetOutputDevice(this, device) && !outputDeviceOverridden) { 279 // There is no need to set the output device initially if PA is used as 280 // we know it will not work (stream doesn't exist yet) and that this will be 281 // handled by _k_deviceChanged() 282 if (!PulseSupport::getInstance()->isActive() && !callSetOutputDevice(this, device) && !outputDeviceOverridden) { 265 283 // fall back in the preference list of output devices 266 284 QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices); … … 307 325 void AudioOutputPrivate::_k_audioDeviceFailed() 308 326 { 327 if (PulseSupport::getInstance()->isActive()) 328 return; 329 330 #ifndef QT_NO_PHONON_SETTINGSGROUP 331 309 332 pDebug() << Q_FUNC_INFO; 310 333 // outputDeviceIndex identifies a failing device 311 334 // fall back in the preference list of output devices 312 #ifndef QT_NO_PHONON_SETTINGSGROUP313 335 const QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices); 314 336 for (int i = 0; i < deviceList.count(); ++i) { … … 332 354 void AudioOutputPrivate::_k_deviceListChanged() 333 355 { 356 if (PulseSupport::getInstance()->isActive()) 357 return; 358 359 #ifndef QT_NO_PHONON_SETTINGSGROUP 334 360 pDebug() << Q_FUNC_INFO; 335 #ifndef QT_NO_PHONON_SETTINGSGROUP 361 // Check to see if we have an override and do not change to a higher priority device if the overridden device is still present. 362 if (outputDeviceOverridden && device.property("available").toBool()) { 363 return; 364 } 336 365 // let's see if there's a usable device higher in the preference list 337 366 const QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings); … … 360 389 } 361 390 #endif //QT_NO_PHONON_SETTINGSGROUP 391 } 392 393 void AudioOutputPrivate::_k_deviceChanged(QString inStreamUuid, int deviceIndex) 394 { 395 // Note that this method is only used by PulseAudio at present. 396 if (inStreamUuid == streamUuid) { 397 // 1. Check to see if we are overridden. If we are, and devices do not match, 398 // then try and apply our own device as the output device. 399 // We only do this the first time 400 if (outputDeviceOverridden && forceMove) { 401 forceMove = false; 402 const AudioOutputDevice ¤tDevice = AudioOutputDevice::fromIndex(deviceIndex); 403 if (currentDevice != device) { 404 if (!callSetOutputDevice(this, device)) { 405 // What to do if we are overridden and cannot change to our preferred device? 406 } 407 } 408 } 409 // 2. If we are not overridden, then we need to update our perception of what 410 // device we are using. If the devices do not match, something lower in the 411 // stack is overriding our preferences (e.g. a per-application stream preference, 412 // specific application move, priority list changed etc. etc.) 413 else if (!outputDeviceOverridden) { 414 const AudioOutputDevice ¤tDevice = AudioOutputDevice::fromIndex(deviceIndex); 415 if (currentDevice != device) { 416 // The device is not what we think it is, so lets say what is happening. 417 handleAutomaticDeviceChange(currentDevice, SoundSystemChange); 418 } 419 } 420 } 362 421 } 363 422 … … 406 465 } 407 466 break; 467 case SoundSystemChange: 468 { 469 #ifndef QT_NO_PHONON_PLATFORMPLUGIN 470 if (device1.property("available").toBool()) { 471 const QString text = AudioOutput::tr("<html>Switching to the audio playback device <b>%1</b><br/>" 472 "which has higher preference or is specifically configured for this stream.</html>").arg(device2.name()); 473 Platform::notification("AudioDeviceFallback", text, 474 QStringList(AudioOutput::tr("Revert back to device '%1'").arg(device1.name())), 475 q, SLOT(_k_revertFallback())); 476 } else { 477 const QString &text = 478 AudioOutput::tr("<html>The audio playback device <b>%1</b> does not work.<br/>" 479 "Falling back to <b>%2</b>.</html>").arg(device1.name()).arg(device2.name()); 480 Platform::notification("AudioDeviceFallback", text); 481 } 482 #endif //QT_NO_PHONON_PLATFORMPLUGIN 483 //outputDeviceOverridden = true; 484 g_lastFallback.first = 0; 485 g_lastFallback.second = 0; 486 } 487 break; 408 488 } 409 489 } … … 411 491 AudioOutputPrivate::~AudioOutputPrivate() 412 492 { 493 PulseSupport::getInstance()->clearStreamCache(streamUuid); 413 494 #ifndef QT_NO_DBUS 414 495 if (adaptor) { -
trunk/src/3rdparty/phonon/phonon/audiooutput.h
r561 r846 170 170 Q_PRIVATE_SLOT(k_func(), void _k_audioDeviceFailed()) 171 171 Q_PRIVATE_SLOT(k_func(), void _k_deviceListChanged()) 172 Q_PRIVATE_SLOT(k_func(), void _k_deviceChanged(QString streamUuid, int device)) 172 173 }; 173 174 } //namespace Phonon -
trunk/src/3rdparty/phonon/phonon/audiooutput_p.h
r561 r846 47 47 } 48 48 void init(Phonon::Category c); 49 QString getStreamUuid(); 49 50 50 51 … … 59 60 deviceBeforeFallback(-1), 60 61 outputDeviceOverridden(false), 62 forceMove(false), 61 63 muted(false) 62 64 { … … 67 69 enum DeviceChangeType { 68 70 FallbackChange, 69 HigherPreferenceChange 71 HigherPreferenceChange, 72 SoundSystemChange 70 73 }; 71 74 void handleAutomaticDeviceChange(const AudioOutputDevice &newDev, DeviceChangeType type); … … 75 78 void _k_audioDeviceFailed(); 76 79 void _k_deviceListChanged(); 80 void _k_deviceChanged(QString streamUuid, int deviceIndex); 77 81 78 82 private: … … 80 84 Phonon::AudioOutputDevice device; 81 85 qreal volume; 86 QString streamUuid; 82 87 #ifndef QT_NO_DBUS 83 88 Phonon::AudioOutputAdaptor *adaptor; … … 86 91 int deviceBeforeFallback; 87 92 bool outputDeviceOverridden; 93 bool forceMove; 88 94 bool muted; 89 95 }; -
trunk/src/3rdparty/phonon/phonon/audiooutputinterface.h
r561 r846 65 65 * samples are multiplied by 2). 66 66 * 67 * Every time the volume in the backend changes it should emit volumeChanged(qreal), also67 * Every time the volume in the backend changes it should emit volumeChanged(qreal), also 68 68 * inside this function. 69 69 */ -
trunk/src/3rdparty/phonon/phonon/backendcapabilities.cpp
r561 r846 27 27 #include "backendinterface.h" 28 28 #include "factory_p.h" 29 #include "globalconfig _p.h"29 #include "globalconfig.h" 30 30 #include "globalstatic_p.h" 31 31 #include "objectdescription.h" -
trunk/src/3rdparty/phonon/phonon/effectwidget.cpp
r651 r846 113 113 114 114 QWidget *control = 0; 115 switch ( para.type()) {115 switch (int(para.type())) { 116 116 case QVariant::String: 117 117 { -
trunk/src/3rdparty/phonon/phonon/factory.cpp
r561 r846 135 135 } 136 136 137 137 QStringList plugins(dir.entryList(QDir::Files)); 138 138 139 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 } 140 static const QString preferredPluginName = QLatin1String("phonon_mmf"); 141 const int preferredPluginIndex = plugins.indexOf(preferredPluginName + ".qtplugin"); 142 if (preferredPluginIndex != -1) 143 plugins.move(preferredPluginIndex, 0); 157 144 #endif 158 145 146 const QStringList files = dir.entryList(QDir::Files); 159 147 for (int i = 0; i < plugins.count(); ++i) { 160 148 QPluginLoader pluginLoader(libPath + plugins.at(i)); … … 351 339 FACTORY_IMPL(VideoWidget) 352 340 #endif //QT_NO_PHONON_VIDEO 341 FACTORY_IMPL(AudioDataOutput) 353 342 354 343 #undef FACTORY_IMPL … … 470 459 { 471 460 if (o) { 472 QObject::connect(o, SIGNAL(destroyed(QObject *)), globalFactory, SLOT(objectDestroyed(QObject*)), Qt::DirectConnection);461 QObject::connect(o, SIGNAL(destroyed(QObject *)), globalFactory, SLOT(objectDestroyed(QObject *)), Qt::DirectConnection); 473 462 globalFactory->objects.append(o); 474 463 } -
trunk/src/3rdparty/phonon/phonon/factory_p.h
r561 r846 123 123 124 124 /** 125 * Create a new backend object for a AudioDataOutput. 126 * 127 * \return a pointer to the AudioDataOutput the backend provides. 128 */ 129 PHONON_EXPORT QObject *createAudioDataOutput(QObject *parent = 0); 130 131 /** 125 132 * \return a pointer to the backend interface. 126 133 */ -
trunk/src/3rdparty/phonon/phonon/globalconfig.cpp
r561 r846 21 21 */ 22 22 23 #include "globalconfig.h" 23 24 #include "globalconfig_p.h" 24 25 … … 30 31 #include "qsettingsgroup_p.h" 31 32 #include "phononnamespace_p.h" 33 #include "pulsesupport.h" 32 34 33 35 #include <QtCore/QList> … … 39 41 { 40 42 43 GlobalConfigPrivate::GlobalConfigPrivate() : config(QLatin1String("kde.org"), QLatin1String("libphonon")) 44 { 45 } 46 41 47 GlobalConfig::GlobalConfig() 42 #ifndef QT_NO_SETTINGS 43 : m_config(QLatin1String("kde.org"), QLatin1String("libphonon")) 44 #endif //QT_NO_SETTINGS 48 : k_ptr(new GlobalConfigPrivate) 45 49 { 46 50 } … … 48 52 GlobalConfig::~GlobalConfig() 49 53 { 54 delete k_ptr; 50 55 } 51 56 … … 60 65 QMutableListIterator<int> it(*list); 61 66 while (it.hasNext()) { 62 const QHash<QByteArray, QVariant> properties = backendIface->objectDescriptionProperties(type, it.next()); 67 QHash<QByteArray, QVariant> properties; 68 if (backendIface) 69 properties = backendIface->objectDescriptionProperties(type, it.next()); 70 else 71 properties = PulseSupport::getInstance()->objectDescriptionProperties(type, it.next()); 63 72 QVariant var; 64 73 if (whatToFilter & FilterAdvancedDevices) { … … 74 83 it.remove(); 75 84 continue; 85 #ifndef QT_NO_PHONON_SETTINGSGROUP 76 86 } 77 87 } … … 86 96 } 87 97 88 #ifndef QT_NO_PHONON_SETTINGSGROUP 89 static QList<int> listSortedByConfig(const QSettingsGroup &backendConfig, Phonon::Category category, QList<int> &defaultList) 90 { 98 static QList<int> sortDevicesByCategoryPriority(const GlobalConfig *config, const QSettingsGroup *backendConfig, ObjectDescriptionType type, Phonon::Category category, QList<int> &defaultList) 99 { 100 Q_ASSERT(config); Q_UNUSED(config); 101 Q_ASSERT(backendConfig); 102 Q_ASSERT(type == AudioOutputDeviceType || type == AudioCaptureDeviceType); 103 91 104 if (defaultList.size() <= 1) { 92 105 // nothing to sort … … 105 118 } 106 119 107 QString categoryKey = QLatin1String("Category_") + QString::number(static_cast<int>(category)); 108 if (!backendConfig.hasKey(categoryKey)) { 109 // no list in config for the given category 110 categoryKey = QLatin1String("Category_") + QString::number(static_cast<int>(Phonon::NoCategory)); 111 if (!backendConfig.hasKey(categoryKey)) { 112 // no list in config for NoCategory 113 return defaultList; 114 } 115 } 116 117 //Now the list from m_config 118 QList<int> deviceList = backendConfig.value(categoryKey, QList<int>()); 119 120 //if there are devices in m_config that the backend doesn't report, remove them from the list 120 QList<int> deviceList; 121 PulseSupport *pulse = PulseSupport::getInstance(); 122 if (pulse->isActive()) { 123 deviceList = pulse->objectIndexesByCategory(type, category); 124 } else { 125 QString categoryKey = QLatin1String("Category_") + QString::number(static_cast<int>(category)); 126 if (!backendConfig->hasKey(categoryKey)) { 127 // no list in config for the given category 128 categoryKey = QLatin1String("Category_") + QString::number(static_cast<int>(Phonon::NoCategory)); 129 if (!backendConfig->hasKey(categoryKey)) { 130 // no list in config for NoCategory 131 return defaultList; 132 } 133 } 134 135 //Now the list from d->config 136 deviceList = backendConfig->value(categoryKey, QList<int>()); 137 } 138 139 //if there are devices in d->config that the backend doesn't report, remove them from the list 121 140 QMutableListIterator<int> i(deviceList); 122 141 while (i.hasNext()) { … … 126 145 } 127 146 128 //if the backend reports more devices that are not in m_config append them to the list147 //if the backend reports more devices that are not in d->config append them to the list 129 148 deviceList += defaultList; 130 149 131 150 return deviceList; 151 } 152 153 bool GlobalConfig::hideAdvancedDevices() const 154 { 155 K_D(const GlobalConfig); 156 //The devices need to be stored independently for every backend 157 const QSettingsGroup generalGroup(&d->config, QLatin1String("General")); 158 return generalGroup.value(QLatin1String("HideAdvancedDevices"), true); 159 } 160 161 void GlobalConfig::setHideAdvancedDevices(bool hide) 162 { 163 K_D(GlobalConfig); 164 QSettingsGroup generalGroup(&d->config, QLatin1String("General")); 165 generalGroup.setValue(QLatin1String("HideAdvancedDevices"), hide); 166 } 167 168 static bool isHiddenAudioOutputDevice(const GlobalConfig *config, int i) 169 { 170 Q_ASSERT(config); 171 172 if (!config->hideAdvancedDevices()) 173 return false; 174 175 AudioOutputDevice ad = AudioOutputDevice::fromIndex(i); 176 const QVariant var = ad.property("isAdvanced"); 177 return (var.isValid() && var.toBool()); 178 } 179 180 #ifndef QT_NO_PHONON_AUDIOCAPTURE 181 static bool isHiddenAudioCaptureDevice(const GlobalConfig *config, int i) 182 { 183 Q_ASSERT(config); 184 185 if (!config->hideAdvancedDevices()) 186 return false; 187 188 AudioCaptureDevice ad = AudioCaptureDevice::fromIndex(i); 189 const QVariant var = ad.property("isAdvanced"); 190 return (var.isValid() && var.toBool()); 191 } 192 #endif 193 194 static QList<int> reindexList(const GlobalConfig *config, Phonon::Category category, QList<int>newOrder, bool output) 195 { 196 Q_ASSERT(config); 197 #ifdef QT_NO_PHONON_AUDIOCAPTURE 198 Q_ASSERT(output); 199 #endif 200 201 /*QString sb; 202 sb = QString("(Size %1)").arg(currentList.size()); 203 foreach (int i, currentList) 204 sb += QString("%1, ").arg(i); 205 fprintf(stderr, "=== Reindex Current: %s\n", sb.toUtf8().constData()); 206 sb = QString("(Size %1)").arg(newOrder.size()); 207 foreach (int i, newOrder) 208 sb += QString("%1, ").arg(i); 209 fprintf(stderr, "=== Reindex Before : %s\n", sb.toUtf8().constData());*/ 210 211 QList<int> currentList; 212 if (output) 213 currentList = config->audioOutputDeviceListFor(category, GlobalConfig::ShowUnavailableDevices|GlobalConfig::ShowAdvancedDevices); 214 #ifndef QT_NO_PHONON_AUDIOCAPTURE 215 else 216 currentList = config->audioCaptureDeviceListFor(category, GlobalConfig::ShowUnavailableDevices|GlobalConfig::ShowAdvancedDevices); 217 #endif 218 219 QList<int> newList; 220 221 foreach (int i, newOrder) { 222 int found = currentList.indexOf(i); 223 if (found < 0) { 224 // It's not in the list, so something is odd (e.g. client error). Ignore it. 225 continue; 226 } 227 228 // Iterate through the list from this point onward. If there are hidden devices 229 // immediately following, take them too. 230 newList.append(currentList.takeAt(found)); 231 while (found < currentList.size()) { 232 bool hidden = true; 233 if (output) 234 hidden = isHiddenAudioOutputDevice(config, currentList.at(found)); 235 #ifndef QT_NO_PHONON_AUDIOCAPTURE 236 else 237 hidden = isHiddenAudioCaptureDevice(config, currentList.at(found)); 238 #endif 239 240 if (!hidden) 241 break; 242 newList.append(currentList.takeAt(found)); 243 } 244 } 245 246 // If there are any devices left in.. just tack them on the end. 247 if (currentList.size() > 0) 248 newList += currentList; 249 250 /*sb = QString("(Size %1)").arg(newList.size()); 251 foreach (int i, newList) 252 sb += QString("%1, ").arg(i); 253 fprintf(stderr, "=== Reindex After : %s\n", sb.toUtf8().constData());*/ 254 return newList; 255 } 256 257 258 void GlobalConfig::setAudioOutputDeviceListFor(Phonon::Category category, QList<int> order) 259 { 260 PulseSupport *pulse = PulseSupport::getInstance(); 261 if (pulse->isActive()) { 262 pulse->setOutputDevicePriorityForCategory(category, order); 263 return; 264 } 265 266 K_D(GlobalConfig); 267 QSettingsGroup backendConfig(&d->config, QLatin1String("AudioOutputDevice")); // + Factory::identifier()); 268 269 order = reindexList(this, category, order, true); 270 271 const QList<int> noCategoryOrder = audioOutputDeviceListFor(Phonon::NoCategory, ShowUnavailableDevices|ShowAdvancedDevices); 272 if (category != Phonon::NoCategory && order == noCategoryOrder) { 273 backendConfig.removeEntry(QLatin1String("Category_") + QString::number(category)); 274 } else { 275 backendConfig.setValue(QLatin1String("Category_") + QString::number(category), order); 276 } 132 277 } 133 278 #endif //QT_NO_PHONON_SETTINGSGROUP … … 136 281 QList<int> GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, int override) const 137 282 { 138 //The devices need to be stored independently for every backend 139 const QSettingsGroup backendConfig(&m_config, QLatin1String("AudioOutputDevice")); // + Factory::identifier()); 140 const QSettingsGroup generalGroup(&m_config, QLatin1String("General")); 141 const bool hideAdvancedDevices = ((override & AdvancedDevicesFromSettings) 142 ? generalGroup.value(QLatin1String("HideAdvancedDevices"), true) 283 K_D(const GlobalConfig); 284 285 const bool hide = ((override & AdvancedDevicesFromSettings) 286 ? hideAdvancedDevices() 143 287 : static_cast<bool>(override & HideAdvancedDevices)); 144 288 145 289 QList<int> defaultList; 146 #ifndef QT_NO_PHONON_PLATFORMPLUGIN 147 if (PlatformPlugin *platformPlugin = Factory::platformPlugin()) { 148 // the platform plugin lists the audio devices for the platform 149 // this list already is in default order (as defined by the platform plugin) 150 defaultList = platformPlugin->objectDescriptionIndexes(Phonon::AudioOutputDeviceType); 151 if (hideAdvancedDevices) { 152 QMutableListIterator<int> it(defaultList); 153 while (it.hasNext()) { 154 AudioOutputDevice objDesc = AudioOutputDevice::fromIndex(it.next()); 155 const QVariant var = objDesc.property("isAdvanced"); 156 if (var.isValid() && var.toBool()) { 157 it.remove(); 158 } 159 } 160 } 161 } 162 #endif //QT_NO_PHONON_PLATFORMPLUGIN 163 164 // lookup the available devices directly from the backend (mostly for virtual devices) 165 if (BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend())) { 166 // this list already is in default order (as defined by the backend) 167 QList<int> list = backendIface->objectDescriptionIndexes(Phonon::AudioOutputDeviceType); 168 if (hideAdvancedDevices || !defaultList.isEmpty() || (override & HideUnavailableDevices)) { 169 filter(AudioOutputDeviceType, backendIface, &list, 170 (hideAdvancedDevices ? FilterAdvancedDevices : 0) 171 // the platform plugin already provided the hardware devices 172 | (defaultList.isEmpty() ? 0 : FilterHardwareDevices) 290 291 PulseSupport *pulse = PulseSupport::getInstance(); 292 if (pulse->isActive()) { 293 defaultList = pulse->objectDescriptionIndexes(Phonon::AudioOutputDeviceType); 294 if (hide || (override & HideUnavailableDevices)) { 295 filter(AudioOutputDeviceType, NULL, &defaultList, 296 (hide ? FilterAdvancedDevices : 0) 173 297 | ((override & HideUnavailableDevices) ? FilterUnavailableDevices : 0) 174 298 ); 175 299 } 176 defaultList += list; 177 } 178 179 return listSortedByConfig(backendConfig, category, defaultList); 300 } else { 301 BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend()); 302 303 #ifndef QT_NO_PHONON_PLATFORMPLUGIN 304 if (PlatformPlugin *platformPlugin = Factory::platformPlugin()) { 305 // the platform plugin lists the audio devices for the platform 306 // this list already is in default order (as defined by the platform plugin) 307 defaultList = platformPlugin->objectDescriptionIndexes(Phonon::AudioOutputDeviceType); 308 if (hide) { 309 QMutableListIterator<int> it(defaultList); 310 while (it.hasNext()) { 311 AudioOutputDevice objDesc = AudioOutputDevice::fromIndex(it.next()); 312 const QVariant var = objDesc.property("isAdvanced"); 313 if (var.isValid() && var.toBool()) { 314 it.remove(); 315 } 316 } 317 } 318 } 319 #endif //QT_NO_PHONON_PLATFORMPLUGIN 320 321 // lookup the available devices directly from the backend 322 if (backendIface) { 323 // this list already is in default order (as defined by the backend) 324 QList<int> list = backendIface->objectDescriptionIndexes(Phonon::AudioOutputDeviceType); 325 if (hide || !defaultList.isEmpty() || (override & HideUnavailableDevices)) { 326 filter(AudioOutputDeviceType, backendIface, &list, 327 (hide ? FilterAdvancedDevices : 0) 328 // the platform plugin maybe already provided the hardware devices? 329 | (defaultList.isEmpty() ? 0 : FilterHardwareDevices) 330 | ((override & HideUnavailableDevices) ? FilterUnavailableDevices : 0) 331 ); 332 } 333 defaultList += list; 334 } 335 } 336 337 const QSettingsGroup backendConfig(&d->config, QLatin1String("AudioOutputDevice")); // + Factory::identifier()); 338 return sortDevicesByCategoryPriority(this, &backendConfig, AudioOutputDeviceType, category, defaultList); 180 339 } 181 340 #endif //QT_NO_PHONON_SETTINGSGROUP … … 191 350 192 351 #ifndef QT_NO_PHONON_AUDIOCAPTURE 352 void GlobalConfig::setAudioCaptureDeviceListFor(Phonon::Category category, QList<int> order) 353 { 354 #ifndef QT_NO_PHONON_SETTINGSGROUP 355 PulseSupport *pulse = PulseSupport::getInstance(); 356 if (pulse->isActive()) { 357 pulse->setCaptureDevicePriorityForCategory(category, order); 358 return; 359 } 360 361 K_D(GlobalConfig); 362 QSettingsGroup backendConfig(&d->config, QLatin1String("AudioCaptureDevice")); // + Factory::identifier()); 363 364 order = reindexList(this, category, order, false); 365 366 const QList<int> noCategoryOrder = audioCaptureDeviceListFor(Phonon::NoCategory, ShowUnavailableDevices|ShowAdvancedDevices); 367 if (category != Phonon::NoCategory && order == noCategoryOrder) { 368 backendConfig.removeEntry(QLatin1String("Category_") + QString::number(category)); 369 } else { 370 backendConfig.setValue(QLatin1String("Category_") + QString::number(category), order); 371 } 372 } 373 193 374 QList<int> GlobalConfig::audioCaptureDeviceListFor(Phonon::Category category, int override) const 194 375 { 195 #ifndef QT_NO_PHONON_SETTINGSGROUP 196 //The devices need to be stored independently for every backend 197 const QSettingsGroup backendConfig(&m_config, QLatin1String("AudioCaptureDevice")); // + Factory::identifier()); 198 const QSettingsGroup generalGroup(&m_config, QLatin1String("General")); 199 const bool hideAdvancedDevices = ((override & AdvancedDevicesFromSettings) 200 ? generalGroup.value(QLatin1String("HideAdvancedDevices"), true) 376 K_D(const GlobalConfig); 377 378 const bool hide = ((override & AdvancedDevicesFromSettings) 379 ? hideAdvancedDevices() 201 380 : static_cast<bool>(override & HideAdvancedDevices)); 202 381 203 382 QList<int> defaultList; 383 384 PulseSupport *pulse = PulseSupport::getInstance(); 385 if (pulse->isActive()) { 386 defaultList = pulse->objectDescriptionIndexes(Phonon::AudioCaptureDeviceType); 387 if (hide || (override & HideUnavailableDevices)) { 388 filter(AudioCaptureDeviceType, NULL, &defaultList, 389 (hide ? FilterAdvancedDevices : 0) 390 | ((override & HideUnavailableDevices) ? FilterUnavailableDevices : 0) 391 ); 392 } 393 } else { 394 BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend()); 395 204 396 #ifndef QT_NO_PHONON_PLATFORMPLUGIN 205 if (PlatformPlugin *platformPlugin = Factory::platformPlugin()) {206 // the platform plugin lists the audio devices for the platform207 // this list already is in default order (as defined by the platform plugin)208 defaultList = platformPlugin->objectDescriptionIndexes(Phonon::AudioCaptureDeviceType);209 if (hideAdvancedDevices) {210 QMutableListIterator<int> it(defaultList);211 while (it.hasNext()) {212 AudioCaptureDevice objDesc = AudioCaptureDevice::fromIndex(it.next());213 const QVariant var = objDesc.property("isAdvanced");214 if (var.isValid() && var.toBool()) {215 it.remove();216 }217 }218 }219 }220 #endif //QT_NO_PHONON_PLATFORMPLUGIN221 222 // lookup the available devices directly from the backend (mostly for virtual devices)223 if (BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend())) {224 // this list already is in default order (as defined by the backend)225 QList<int> list = backendIface->objectDescriptionIndexes(Phonon::AudioCaptureDeviceType);226 if (hideAdvancedDevices || !defaultList.isEmpty() || (override & HideUnavailableDevices)) {227 filter(AudioCaptureDeviceType, backendIface, &list,228 (hideAdvancedDevices ? FilterAdvancedDevices : 0)229 // the platform plugin already provided the hardware devices230 | (defaultList.isEmpty() ? 0 : FilterHardwareDevices)231 | ((override & HideUnavailableDevices) ? FilterUnavailableDevices : 0)232 );233 }234 defaultList += list;235 }236 237 return listSortedByConfig(backendConfig, category, defaultList);238 397 #else //QT_NO_SETTINGSGROUP 239 398 return QList<int>(); 240 399 #endif //QT_NO_SETTINGSGROUP 400 if (PlatformPlugin *platformPlugin = Factory::platformPlugin()) { 401 // the platform plugin lists the audio devices for the platform 402 // this list already is in default order (as defined by the platform plugin) 403 defaultList = platformPlugin->objectDescriptionIndexes(Phonon::AudioCaptureDeviceType); 404 if (hide) { 405 QMutableListIterator<int> it(defaultList); 406 while (it.hasNext()) { 407 AudioCaptureDevice objDesc = AudioCaptureDevice::fromIndex(it.next()); 408 const QVariant var = objDesc.property("isAdvanced"); 409 if (var.isValid() && var.toBool()) { 410 it.remove(); 411 } 412 } 413 } 414 } 415 #endif //QT_NO_PHONON_PLATFORMPLUGIN 416 417 // lookup the available devices directly from the backend 418 if (backendIface) { 419 // this list already is in default order (as defined by the backend) 420 QList<int> list = backendIface->objectDescriptionIndexes(Phonon::AudioCaptureDeviceType); 421 if (hide || !defaultList.isEmpty() || (override & HideUnavailableDevices)) { 422 filter(AudioCaptureDeviceType, backendIface, &list, 423 (hide ? FilterAdvancedDevices : 0) 424 // the platform plugin maybe already provided the hardware devices? 425 | (defaultList.isEmpty() ? 0 : FilterHardwareDevices) 426 | ((override & HideUnavailableDevices) ? FilterUnavailableDevices : 0) 427 ); 428 } 429 defaultList += list; 430 } 431 } 432 433 const QSettingsGroup backendConfig(&d->config, QLatin1String("AudioCaptureDevice")); // + Factory::identifier()); 434 return sortDevicesByCategoryPriority(this, &backendConfig, AudioCaptureDeviceType, category, defaultList); 241 435 } 242 436 -
trunk/src/3rdparty/phonon/phonon/globalconfig_p.h
r561 r846 27 27 28 28 #include "phonon_export.h" 29 #include "phononnamespace.h"30 29 31 30 QT_BEGIN_HEADER … … 34 33 namespace Phonon 35 34 { 36 class PHONON_EXPORT GlobalConfig35 class GlobalConfigPrivate 37 36 { 38 public:39 GlobalConfig();40 virtual ~GlobalConfig();37 public: 38 GlobalConfigPrivate(); 39 virtual ~GlobalConfigPrivate() {} 41 40 42 enum DevicesToHideFlag { 43 ShowUnavailableDevices = 0, 44 ShowAdvancedDevices = 0, 45 HideAdvancedDevices = 1, 46 AdvancedDevicesFromSettings = 2, 47 HideUnavailableDevices = 4 48 }; 49 #ifndef QT_NO_PHONON_SETTINGSGROUP 50 QList<int> audioOutputDeviceListFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const; 51 #endif //QT_NO_PHONON_SETTINGSGROUP 52 int audioOutputDeviceFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const; 53 54 #ifndef QT_NO_PHONON_AUDIOCAPTURE 55 QList<int> audioCaptureDeviceListFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const; 56 int audioCaptureDeviceFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const; 57 #endif //QT_NO_PHONON_AUDIOCAPTURE 58 59 protected: 60 #ifndef QT_NO_SETTINGS 61 QSettings m_config; 62 #endif //QT_NO_SETTINGS 41 QSettings config; 63 42 }; 64 43 } // namespace Phonon -
trunk/src/3rdparty/phonon/phonon/mediacontroller.cpp
r561 r846 77 77 { 78 78 if (!d || !d->media) { 79 return false;80 } 81 IFACE false;79 return Features(); 80 } 81 IFACE Features(); 82 82 Features ret; 83 83 if (iface->hasInterface(AddonInterface::AngleInterface)) { -
trunk/src/3rdparty/phonon/phonon/mediaobject.cpp
r561 r846 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( 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)));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&))); 474 474 475 475 // set up attributes -
trunk/src/3rdparty/phonon/phonon/mediasource.cpp
r561 r846 51 51 if (fileInfo.exists()) { 52 52 bool localFs = QAbstractFileEngine::LocalDiskFlag & QFSFileEngine(filename).fileFlags(QAbstractFileEngine::LocalDiskFlag); 53 if (localFs ) {53 if (localFs && !filename.startsWith(QLatin1String(":/")) && !filename.startsWith(QLatin1String("qrc://"))) { 54 54 d->url = QUrl::fromLocalFile(fileInfo.absoluteFilePath()); 55 55 } else { … … 59 59 d->ioDevice = new QFile(filename); 60 60 d->setStream(new IODeviceStream(d->ioDevice, d->ioDevice)); 61 d->url = QUrl::fromLocalFile(fileInfo.absoluteFilePath()); 61 62 #else 62 63 d->type = Invalid; -
trunk/src/3rdparty/phonon/phonon/objectdescription.cpp
r561 r846 30 30 #include "backendinterface.h" 31 31 #include "platformplugin.h" 32 #include "pulsesupport.h" 32 33 33 34 QT_BEGIN_NAMESPACE … … 109 110 ObjectDescriptionData *ObjectDescriptionData::fromIndex(ObjectDescriptionType type, int index) 110 111 { 111 // prefer to get the ObjectDescriptionData from the platform plugin for audio devices 112 bool is_audio_device = (AudioOutputDeviceType == type || AudioCaptureDeviceType == type); 113 114 PulseSupport *pulse = PulseSupport::getInstance(); 115 if (is_audio_device && pulse->isActive()) { 116 QList<int> indexes = pulse->objectDescriptionIndexes(type); 117 if (indexes.contains(index)) { 118 QHash<QByteArray, QVariant> properties = pulse->objectDescriptionProperties(type, index); 119 return new ObjectDescriptionData(index, properties); 120 } 121 } else { 122 BackendInterface *iface = qobject_cast<BackendInterface *>(Factory::backend()); 123 124 // prefer to get the ObjectDescriptionData from the platform plugin for audio devices 112 125 #ifndef QT_NO_PHONON_PLATFORMPLUGIN 113 if (type == AudioOutputDeviceType || type == AudioCaptureDeviceType) { 114 PlatformPlugin *platformPlugin = Factory::platformPlugin(); 115 if (platformPlugin) { 116 QList<int> indexes = platformPlugin->objectDescriptionIndexes(type); 126 if (is_audio_device) { 127 PlatformPlugin *platformPlugin = Factory::platformPlugin(); 128 if (platformPlugin) { 129 QList<int> indexes = platformPlugin->objectDescriptionIndexes(type); 130 if (indexes.contains(index)) { 131 QHash<QByteArray, QVariant> properties = platformPlugin->objectDescriptionProperties(type, index); 132 return new ObjectDescriptionData(index, properties); 133 } 134 } 135 } 136 #endif //QT_NO_PHONON_PLATFORMPLUGIN 137 138 if (iface) { 139 QList<int> indexes = iface->objectDescriptionIndexes(type); 117 140 if (indexes.contains(index)) { 118 QHash<QByteArray, QVariant> properties = platformPlugin->objectDescriptionProperties(type, index);141 QHash<QByteArray, QVariant> properties = iface->objectDescriptionProperties(type, index); 119 142 return new ObjectDescriptionData(index, properties); 120 143 } 121 }122 }123 #endif //QT_NO_PHONON_PLATFORMPLUGIN124 125 QObject *b = Factory::backend();126 BackendInterface *iface = qobject_cast<BackendInterface *>(b);127 if (iface) {128 QList<int> indexes = iface->objectDescriptionIndexes(type);129 if (indexes.contains(index)) {130 QHash<QByteArray, QVariant> properties = iface->objectDescriptionProperties(type, index);131 return new ObjectDescriptionData(index, properties);132 144 } 133 145 } -
trunk/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp
r561 r846 68 68 { 69 69 70 #if !defined(Q_CC_MINGW) || __MINGW32_MAJOR_VERSION >= 471 72 70 template<> const QMetaObject ObjectDescriptionModel<AudioOutputDeviceType>::staticMetaObject = { 73 71 { &QAbstractListModel::staticMetaObject, qt_meta_stringdata_Phonon__ObjectDescriptionModel_AudioOutputDeviceType, … … 140 138 } 141 139 */ 142 #endif143 140 144 141 int ObjectDescriptionModelData::rowCount(const QModelIndex &parent) const … … 366 363 } 367 364 368 #if !defined(Q_CC_MINGW) || __MINGW32_MAJOR_VERSION >= 4 369 #if !defined(Q_CC_MSVC) || _MSC_VER > 1300 || defined(Q_CC_INTEL) 365 #if !defined(Q_CC_MSVC) || _MSC_VER > 1300 || defined(Q_CC_INTEL) || defined(Q_CC_MINGW) 370 366 #define INSTANTIATE_META_FUNCTIONS(type) \ 371 367 template const QMetaObject *ObjectDescriptionModel<type>::metaObject() const; \ … … 385 381 INSTANTIATE_META_FUNCTIONS(VisualizationType); 386 382 */ 387 #endif //Q_CC_MINGW388 383 } // namespace Phonon 389 384 -
trunk/src/3rdparty/phonon/phonon/objectdescriptionmodel.h
r561 r846 196 196 Q_OBJECT_CHECK 197 197 198 /* MinGW 3.4.x gives an ICE when trying to instantiate one of the199 ObjectDescriptionModel<foo> classes because it can't handle200 half exported classes correct. gcc 4.3.x has a fix for this but201 we currently there's no official gcc 4.3 on windows available.202 Because of this we need this little hack203 */204 #if !defined(Q_CC_MINGW) || __MINGW32_MAJOR_VERSION >= 4205 198 /** \internal */ 206 199 static PHONON_TEMPLATE_CLASS_MEMBER_EXPORT const QMetaObject staticMetaObject; … … 210 203 PHONON_TEMPLATE_CLASS_MEMBER_EXPORT void *qt_metacast(const char *_clname); 211 204 //int qt_metacall(QMetaObject::Call _c, int _id, void **_a); 212 #endif213 205 214 206 /** -
trunk/src/3rdparty/phonon/phonon/path.cpp
r561 r846 311 311 return false; 312 312 313 QList<QObjectPair>::const_iterator it = disconnections. constBegin();314 for(;it != disconnections. constEnd();++it) {313 QList<QObjectPair>::const_iterator it = disconnections.begin(); 314 for(;it != disconnections.end();++it) { 315 315 const QObjectPair &pair = *it; 316 316 if (!backend->disconnectNodes(pair.first, pair.second)) { … … 328 328 } 329 329 330 for(it = connections. constBegin(); it != connections.constEnd();++it) {331 const QObjectPair pair = *it;330 for(it = connections.begin(); it != connections.end();++it) { 331 const QObjectPair &pair = *it; 332 332 if (!backend->connectNodes(pair.first, pair.second)) { 333 333 //Error: a connection failed -
trunk/src/3rdparty/phonon/phonon/phonondefs.h
r561 r846 30 30 QT_BEGIN_NAMESPACE 31 31 32 #ifdef PHONON_BACKEND_VERSION_4_4 33 # ifndef PHONON_BACKEND_VERSION_4_3 34 # define PHONON_BACKEND_VERSION_4_3 35 # endif 36 #endif 32 37 #ifdef PHONON_BACKEND_VERSION_4_3 33 38 # ifndef PHONON_BACKEND_VERSION_4_2 -
trunk/src/3rdparty/phonon/phonon/phononnamespace.h
r561 r846 42 42 * PHONON_VERSION is (major << 16) + (minor << 8) + patch. 43 43 */ 44 #define PHONON_VERSION PHONON_VERSION_CHECK(4, 3, 1)44 #define PHONON_VERSION PHONON_VERSION_CHECK(4, 4, 0) 45 45 46 46 /** 47 47 * PHONON_VERSION_STR is "major.minor.patch". E.g. "4.2.1" 48 48 */ 49 #define PHONON_VERSION_STR "4. 3.1"49 #define PHONON_VERSION_STR "4.4.0" 50 50 51 51 QT_BEGIN_HEADER -
trunk/src/3rdparty/phonon/phonon/seekslider.cpp
r561 r846 73 73 74 74 if (media) { 75 connect(media, SIGNAL(stateChanged(Phonon::State, 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( Phonon::MediaSource)), SLOT(_k_currentSourceChanged()));80 connect(media, SIGNAL(currentSourceChanged(const 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_p.h
r561 r846 25 25 26 26 #include "seekslider.h" 27 #include "swiftslider_p.h" 27 28 #include <QtGui/QBoxLayout> 28 #include <QtGui/QSlider>29 29 #include <QtGui/QLabel> 30 30 #include <QtGui/QPixmap> … … 85 85 86 86 QBoxLayout layout; 87 QSlider slider;87 SwiftSlider slider; 88 88 QLabel iconLabel; 89 89 QPointer<MediaObject> media; -
trunk/src/3rdparty/phonon/phonon/videowidget.cpp
r561 r846 29 29 30 30 #include <QtGui/QAction> 31 32 #define PHONON_INTERFACENAME VideoWidgetInterface 31 #define IFACES4 VideoWidgetInterface44 32 #define IFACES0 VideoWidgetInterface, IFACES4 33 #define PHONON_INTERFACENAME IFACES0 33 34 34 35 QT_BEGIN_NAMESPACE … … 48 49 setMouseTracking(true); 49 50 } 51 52 50 53 51 54 VideoWidget::VideoWidget(VideoWidgetPrivate &dd, QWidget *parent) … … 98 101 PHONON_INTERFACE_GETTER(qreal, saturation, d->saturation) 99 102 PHONON_INTERFACE_SETTER(setSaturation, saturation, qreal) 103 104 105 QImage VideoWidget::snapshot() const { 106 K_D(const VideoWidget); 107 ConstIface<IFACES4> iface(d); 108 if(iface) return iface->snapshot(); 109 return QImage(); // TODO not implemented in VideoInterface 110 } 111 100 112 101 113 void VideoWidget::setFullScreen(bool newFullScreen) -
trunk/src/3rdparty/phonon/phonon/videowidget.h
r561 r846 173 173 qreal hue() const; 174 174 qreal saturation() const; 175 QImage snapshot() const; 175 176 176 177 //TODO: bar colors property -
trunk/src/3rdparty/phonon/phonon/videowidgetinterface.h
r561 r846 54 54 //X virtual bool createOverlay(QWidget *widget, int type) = 0; 55 55 }; 56 57 class VideoWidgetInterface44 : public VideoWidgetInterface 58 { 59 public: 60 virtual QImage snapshot() const = 0; 61 }; 56 62 } 57 63 64 #ifdef PHONON_BACKEND_VERSION_4_4 65 namespace Phonon { typedef VideoWidgetInterface44 VideoWidgetInterfaceLatest; } 66 #else 67 namespace Phonon { typedef VideoWidgetInterface VideoWidgetInterfaceLatest; } 68 #endif 69 70 Q_DECLARE_INTERFACE(Phonon::VideoWidgetInterface44, "VideoWidgetInterface44.phonon.kde.org") 58 71 Q_DECLARE_INTERFACE(Phonon::VideoWidgetInterface, "VideoWidgetInterface3.phonon.kde.org") 59 72 -
trunk/src/3rdparty/phonon/phonon/volumeslider_p.h
r561 r846 25 25 26 26 #include "volumeslider.h" 27 #include "swiftslider_p.h" 27 28 #include <QtGui/QBoxLayout> 28 #include <QtGui/QSlider>29 29 #include <QtGui/QLabel> 30 30 #include <QtGui/QPixmap> … … 84 84 private: 85 85 QBoxLayout layout; 86 QSlider slider;86 SwiftSlider slider; 87 87 QToolButton muteButton; 88 88 QIcon volumeIcon; -
trunk/src/3rdparty/phonon/qt7/audionode.h
r2 r846 73 73 74 74 // Only the following methods needs to 75 // be over idden by only_one-audio-unit nodes:75 // be overridden by only_one-audio-unit nodes: 76 76 virtual ComponentDescription getAudioNodeDescription() const; 77 77 virtual void initializeAudioUnit(); -
trunk/src/3rdparty/phonon/qt7/audionode.mm
r2 r846 78 78 // deal with at the moment, so we'll take the "deprecated" warning instead. 79 79 err = AUGraphNewNode(m_audioGraph->audioGraphRef(), &description, 0, 0, &m_auNode); 80 80 81 BACKEND_ASSERT2(err != kAUGraphErr_OutputNodeErr, "A MediaObject can only be connected to one audio output device.", FATAL_ERROR) 81 82 BACKEND_ASSERT2(err == noErr, "Could not create new AUNode.", FATAL_ERROR) -
trunk/src/3rdparty/phonon/qt7/backendinfo.mm
r2 r846 16 16 */ 17 17 18 #include "backendinfo.h"19 #include "backendheader.h"20 21 #include <AudioToolbox/AudioToolbox.h>22 #include <AudioUnit/AudioUnit.h>23 #include <CoreServices/CoreServices.h>24 25 #include <QtGui/qmacdefines_mac.h>26 18 #import <QTKit/QTMovie.h> 27 28 19 #ifdef QUICKTIME_C_API_AVAILABLE 29 20 #include <QuickTime/QuickTime.h> 30 21 #undef check // avoid name clash; 31 22 #endif 23 24 #include "backendinfo.h" 25 #include "backendheader.h" 26 27 #include <AudioToolbox/AudioToolbox.h> 28 #include <AudioUnit/AudioUnit.h> 29 #include <CoreServices/CoreServices.h> 30 32 31 33 32 QT_BEGIN_NAMESPACE -
trunk/src/3rdparty/phonon/qt7/mediaobject.h
r561 r846 26 26 #include "medianode.h" 27 27 28 #if QT_ALLOW_QUICKTIME29 #include <QuickTime/QuickTime.h>30 #endif31 32 28 QT_BEGIN_NAMESPACE 33 29 … … 43 39 44 40 class MediaObject : public MediaNode, 45 public Phonon::MediaObjectInterface 46 #ifndef QT_NO_PHONON_MEDIACONTROLLER 47 , public Phonon::AddonInterface 48 #endif 41 public Phonon::MediaObjectInterface, public Phonon::AddonInterface 49 42 { 50 43 Q_OBJECT … … 100 93 int videoOutputCount(); 101 94 102 #if QT_ALLOW_QUICKTIME103 void displayLinkEvent();104 #endif105 106 95 signals: 107 96 void stateChanged(Phonon::State,Phonon::State); … … 116 105 void metaDataChanged(QMultiMap<QString,QString>); 117 106 void currentSourceChanged(const MediaSource &newSource); 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 107 129 108 protected: … … 140 119 QuickTimeAudioPlayer *m_nextAudioPlayer; 141 120 MediaObjectAudioNode *m_mediaObjectAudioNode; 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 121 QuickTimeMetaData *m_metaData; 150 122 151 123 qint32 m_tickInterval; … … 156 128 157 129 int m_tickTimer; 158 int m_videoTimer; 159 int m_audioTimer; 130 int m_bufferTimer; 160 131 int m_rapidTimer; 161 132 … … 163 134 int m_swapTimeLeft; 164 135 QTime m_swapTime; 165 bool m_autoplayTitles;166 136 167 137 void synchAudioVideo(); … … 172 142 void play_internal(); 173 143 void setupAudioSystem(); 174 void restartAudioVideoTimers(); 144 void updateTimer(int &timer, int interval); 145 void bufferAudioVideo(); 175 146 void updateRapidly(); 176 147 void updateCrossFade(); … … 184 155 void inspectGraph(); 185 156 bool isCrossFading(); 186 void setCurrentTrack(int track);187 157 188 158 QString m_errorString; -
trunk/src/3rdparty/phonon/qt7/mediaobject.mm
r561 r846 47 47 setAudioNode(m_mediaObjectAudioNode); 48 48 49 m_metaData = new QuickTimeMetaData(); 49 50 m_audioGraph = new AudioGraph(this); 50 51 … … 55 56 m_percentageLoaded = 0; 56 57 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_videoTimer = 0; 67 m_audioTimer = 0; 66 m_bufferTimer = 0; 68 67 m_rapidTimer = 0; 69 68 70 #if QT_ALLOW_QUICKTIME71 m_displayLink = 0;72 m_pendingDisplayLinkEvent = false;73 #endif74 75 69 checkForError(); 76 70 } 77 71 78 72 MediaObject::~MediaObject() 79 { 80 // m_mediaObjectAudioNode is owned by super class. 81 #if QT_ALLOW_QUICKTIME 82 stopDisplayLink(); 83 #endif 73 { 74 // m_mediaObjectAudioNode is owned by super class. 84 75 m_audioPlayer->unsetVideoPlayer(); 85 76 m_nextAudioPlayer->unsetVideoPlayer(); 86 77 delete m_videoPlayer; 87 78 delete m_nextVideoPlayer; 79 delete m_metaData; 88 80 checkForError(); 89 81 } … … 97 89 if (m_state != state){ 98 90 // End-application did something 99 // upon receiving the signal. 91 // upon receiving the signal. 100 92 return false; 101 93 } … … 131 123 // effects or outputs connected. This will have 132 124 // influence on the audio system and video system that ends up beeing used: 133 int prevVideoOutputCount = m_videoOutputCount; 125 int prevVideoOutputCount = m_videoOutputCount; 134 126 m_audioEffectCount = 0; 135 127 m_audioOutputCount = 0; … … 143 135 MediaNodeEvent e1(MediaNodeEvent::VideoOutputCountChanged, &m_videoOutputCount); 144 136 notify(&e1); 145 } 137 } 146 138 } 147 139 … … 176 168 if (newAudioSystem == m_audioSystem) 177 169 return; 178 170 179 171 // Enable selected audio system: 180 m_audioSystem = newAudioSystem; 172 m_audioSystem = newAudioSystem; 181 173 switch (newAudioSystem){ 182 174 case AS_Silent: 183 175 m_audioGraph->stop(); 184 176 m_videoPlayer->enableAudio(false); 185 m_nextVideoPlayer->enableAudio(false); 177 m_nextVideoPlayer->enableAudio(false); 186 178 m_audioPlayer->enableAudio(false); 187 179 m_nextAudioPlayer->enableAudio(false); … … 223 215 PhononAutoReleasePool pool; 224 216 setState(Phonon::LoadingState); 225 217 226 218 // Save current state for event/signal handling below: 227 219 bool prevHasVideo = m_videoPlayer->hasVideo(); 228 220 qint64 prevTotalTime = totalTime(); 229 int prevTrackCount = m_videoPlayer->trackCount();230 221 m_waitNextSwap = false; 231 222 232 223 // Cancel cross-fade if any: 233 224 m_nextVideoPlayer->pause(); 234 225 m_nextAudioPlayer->pause(); 235 226 m_mediaObjectAudioNode->cancelCrossFade(); 236 227 237 228 // Set new source: 238 229 m_audioPlayer->unsetVideoPlayer(); 239 230 m_videoPlayer->setMediaSource(source); 240 231 m_audioPlayer->setVideoPlayer(m_videoPlayer); 241 242 m_audioGraph->updateStreamSpecifications(); 232 m_metaData->setVideo(m_videoPlayer); 233 234 m_audioGraph->updateStreamSpecifications(); 243 235 m_nextAudioPlayer->unsetVideoPlayer(); 244 m_nextVideoPlayer->unset CurrentMediaSource();236 m_nextVideoPlayer->unsetVideo(); 245 237 m_currentTime = 0; 246 238 247 239 // Emit/notify information about the new source: 248 240 QRect videoRect = m_videoPlayer->videoRect(); … … 255 247 256 248 emit currentSourceChanged(source); 257 emit metaDataChanged(m_ videoPlayer->metaData());249 emit metaDataChanged(m_metaData->metaData()); 258 250 259 251 if (prevHasVideo != m_videoPlayer->hasVideo()) 260 emit hasVideoChanged(m_videoPlayer->hasVideo()); 252 emit hasVideoChanged(m_videoPlayer->hasVideo()); 261 253 if (prevTotalTime != totalTime()) 262 emit totalTimeChanged(totalTime()); 263 if (prevTrackCount != m_videoPlayer->trackCount()) 264 emit availableTitlesChanged(m_videoPlayer->trackCount()); 254 emit totalTimeChanged(totalTime()); 265 255 if (checkForError()) 266 256 return; … … 271 261 if (!m_videoPlayer->canPlayMedia()) 272 262 SET_ERROR("Cannot play media.", FATAL_ERROR) 273 263 274 264 // The state might have changed from LoadingState 275 265 // as a response to an error state change. So we … … 298 288 bool prevHasVideo = m_videoPlayer->hasVideo(); 299 289 qint64 prevTotalTime = totalTime(); 300 int prevTrackCount = m_videoPlayer->trackCount();301 290 302 291 qSwap(m_audioPlayer, m_nextAudioPlayer); … … 304 293 m_mediaObjectAudioNode->startCrossFade(transitionTime); 305 294 m_audioGraph->updateStreamSpecifications(); 295 m_metaData->setVideo(m_videoPlayer); 306 296 307 297 m_waitNextSwap = false; 308 298 m_currentTime = 0; 309 299 310 300 // Emit/notify information about the new source: 311 301 QRect videoRect = m_videoPlayer->videoRect(); … … 314 304 315 305 emit currentSourceChanged(m_videoPlayer->mediaSource()); 316 emit metaDataChanged(m_ videoPlayer->metaData());306 emit metaDataChanged(m_metaData->metaData()); 317 307 318 308 if (prevHasVideo != m_videoPlayer->hasVideo()) 319 emit hasVideoChanged(m_videoPlayer->hasVideo()); 309 emit hasVideoChanged(m_videoPlayer->hasVideo()); 320 310 if (prevTotalTime != totalTime()) 321 311 emit totalTimeChanged(totalTime()); 322 if (prevTrackCount != m_videoPlayer->trackCount())323 emit availableTitlesChanged(m_videoPlayer->trackCount());324 312 if (checkForError()) 325 313 return; … … 340 328 } 341 329 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(); 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); 427 337 } 428 338 … … 431 341 // Play main audio/video: 432 342 m_videoPlayer->play(); 433 m_audioPlayer->play(); 343 m_audioPlayer->play(); 434 344 updateLipSynch(0); 435 345 // Play old audio/video to finish cross-fade: … … 438 348 m_nextAudioPlayer->play(); 439 349 } 440 restartAudioVideoTimers(); 441 if (!m_rapidTimer) 442 m_rapidTimer = startTimer(100); 350 bufferAudioVideo(); 351 updateTimer(m_rapidTimer, 100); 443 352 } 444 353 … … 450 359 m_videoPlayer->pause(); 451 360 m_nextVideoPlayer->pause(); 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 361 updateTimer(m_rapidTimer, -1); 362 updateTimer(m_bufferTimer, -1); 363 461 364 if (m_waitNextSwap) 462 365 m_swapTimeLeft = m_swapTime.msecsTo(QTime::currentTime()); … … 480 383 return; 481 384 if (!setState(Phonon::PlayingState)) 482 return; 385 return; 483 386 if (m_audioSystem == AS_Graph){ 484 387 m_audioGraph->start(); … … 521 424 return; 522 425 m_waitNextSwap = false; 523 m_nextVideoPlayer->unset CurrentMediaSource();426 m_nextVideoPlayer->unsetVideo(); 524 427 m_nextAudioPlayer->unsetVideoPlayer(); 525 428 pause_internal(); … … 533 436 if (m_state == Phonon::ErrorState) 534 437 return; 535 438 536 439 // Stop cross-fade if any: 537 m_nextVideoPlayer->unset CurrentMediaSource();440 m_nextVideoPlayer->unsetVideo(); 538 441 m_nextAudioPlayer->unsetVideoPlayer(); 539 442 m_mediaObjectAudioNode->cancelCrossFade(); … … 544 447 m_audioPlayer->seek(m_videoPlayer->currentTime()); 545 448 m_mediaObjectAudioNode->setMute(false); 546 449 547 450 // Update time and cancel pending swap: 548 451 if (m_currentTime < m_videoPlayer->duration()) … … 655 558 { 656 559 IMPLEMENTED_SILENT; 657 const_cast<MediaObject *>(this)->updateCurrentTime(); 560 const_cast<MediaObject *>(this)->updateCurrentTime(); 658 561 return m_currentTime; 659 562 } … … 665 568 quint64 total = m_videoPlayer->duration(); 666 569 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 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: 685 583 if (lastUpdateTime < m_currentTime && m_currentTime == total){ 686 584 emit finished(); … … 692 590 // We have a next source. 693 591 // Check if it's time to swap to next source: 694 quint32mark = qMax(quint64(0), total + m_transitionTime);592 mark = qMax(quint64(0), total + m_transitionTime); 695 593 if (m_waitNextSwap && m_state == Phonon::PlayingState && 696 594 m_transitionTime < m_swapTime.msecsTo(QTime::currentTime())){ … … 795 693 void MediaObject::updateCrossFade() 796 694 { 797 m_mediaObjectAudioNode->updateCrossFade(m_currentTime); 695 m_mediaObjectAudioNode->updateCrossFade(m_currentTime); 798 696 // Clean-up previous movie if done fading: 799 697 if (m_mediaObjectAudioNode->m_fadeDuration == 0){ 800 698 if (m_nextVideoPlayer->isPlaying() || m_nextAudioPlayer->isPlaying()){ 801 m_nextVideoPlayer->unset CurrentMediaSource();699 m_nextVideoPlayer->unsetVideo(); 802 700 m_nextAudioPlayer->unsetVideoPlayer(); 803 701 } 804 } 702 } 805 703 } 806 704 … … 831 729 if (m_videoPlayer->videoFrameChanged()){ 832 730 updateLipSynch(50); 833 VideoFrame frame(m_videoPlayer); 731 VideoFrame frame(m_videoPlayer); 834 732 if (m_nextVideoPlayer->isPlaying() 835 733 && m_nextVideoPlayer->hasVideo() … … 839 737 frame.setBaseOpacity(m_mediaObjectAudioNode->m_volume1); 840 738 } 841 739 842 740 // Send the frame through the graph: 843 updateVideo(frame); 741 updateVideo(frame); 844 742 checkForError(); 845 743 } … … 852 750 if (m_videoSinkList.isEmpty() || m_audioSinkList.isEmpty()) 853 751 return; 854 752 855 753 if (m_videoPlayer->hasVideo()){ 856 754 qint64 diff = m_audioPlayer->currentTime() - m_videoPlayer->currentTime(); … … 864 762 m_nextAudioPlayer->seek(m_nextVideoPlayer->currentTime()); 865 763 } 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)); 866 774 } 867 775 … … 890 798 checkForError(); 891 799 m_mediaObjectAudioNode->setMute(false); 892 if (m_state == Phonon::PlayingState)893 restartAudioVideoTimers();800 if (m_state == Phonon::PlayingState) 801 bufferAudioVideo(); 894 802 break; 895 803 case MediaNodeEvent::AudioGraphCannotPlay: … … 902 810 m_mediaObjectAudioNode->setMute(false); 903 811 } 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 } 904 830 break; 905 831 default: 906 832 break; 907 833 } 908 }909 910 bool MediaObject::event(QEvent *event)911 {912 switch (event->type()){913 #if QT_ALLOW_QUICKTIME914 case QEvent::User:{915 m_displayLinkMutex.lock();916 m_pendingDisplayLinkEvent = false;917 m_displayLinkMutex.unlock();918 updateVideoFrames();919 break; }920 #endif921 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 }935 834 return QObject::event(event); 936 835 } 937 836 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 } 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 { 974 844 return QVariant(); 975 845 } -
trunk/src/3rdparty/phonon/qt7/mediaobjectaudionode.mm
r2 r846 15 15 along with this library. If not, see <http://www.gnu.org/licenses/>. 16 16 */ 17 18 #import <QTKit/QTMovie.h> 17 19 18 20 #include "mediaobjectaudionode.h" -
trunk/src/3rdparty/phonon/qt7/quicktimeaudioplayer.mm
r2 r846 15 15 along with this library. If not, see <http://www.gnu.org/licenses/>. 16 16 */ 17 18 #import <QTKit/QTMovie.h> 17 19 18 20 #include "quicktimeaudioplayer.h" -
trunk/src/3rdparty/phonon/qt7/quicktimemetadata.h
r561 r846 39 39 { 40 40 public: 41 QuickTimeMetaData(QuickTimeVideoPlayer *videoPlayer); 42 void update(); 41 QuickTimeMetaData(); 42 virtual ~QuickTimeMetaData(); 43 44 void setVideo(QuickTimeVideoPlayer *videoPlayer); 43 45 QMultiMap<QString, QString> metaData(); 44 46 … … 48 50 QuickTimeVideoPlayer *m_videoPlayer; 49 51 void readMetaData(); 50 void guessMetaDataForCD();51 void readMetaDataFromMovie();52 52 53 53 #ifdef QUICKTIME_C_API_AVAILABLE -
trunk/src/3rdparty/phonon/qt7/quicktimemetadata.mm
r561 r846 16 16 */ 17 17 18 #include <QtCore/QFileInfo> 18 #import <QTKit/QTMovie.h> 19 19 20 #include "quicktimemetadata.h" 20 21 #include "quicktimevideoplayer.h" … … 27 28 { 28 29 29 QuickTimeMetaData::QuickTimeMetaData( QuickTimeVideoPlayer *videoPlayer)30 QuickTimeMetaData::QuickTimeMetaData() 30 31 { 31 m_videoPlayer = videoPlayer;32 m_videoPlayer = 0; 32 33 m_movieChanged = false; 33 34 } 34 35 35 void QuickTimeMetaData::update()36 QuickTimeMetaData::~QuickTimeMetaData() 36 37 { 38 } 39 40 void QuickTimeMetaData::setVideo(QuickTimeVideoPlayer *videoPlayer) 41 { 42 m_videoPlayer = videoPlayer; 37 43 m_movieChanged = true; 38 44 m_metaData.clear(); … … 142 148 #endif // QUICKTIME_C_API_AVAILABLE 143 149 144 void QuickTimeMetaData:: guessMetaDataForCD()150 void QuickTimeMetaData::readMetaData() 145 151 { 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 if (!m_videoPlayer) 153 return; 156 154 QMultiMap<QString, QString> metaMap; 157 155 158 156 #ifdef QUICKTIME_C_API_AVAILABLE 159 QTMetaDataRef metaDataRef; 157 QTMetaDataRef metaDataRef; 160 158 OSStatus err = QTCopyMovieMetaData([m_videoPlayer->qtMovie() quickTimeMovie], &metaDataRef); 161 159 BACKEND_ASSERT2(err == noErr, "Could not read QuickTime meta data", NORMAL_ERROR) … … 178 176 } 179 177 180 void QuickTimeMetaData::readMetaData()181 {182 if (!m_videoPlayer)183 return;184 185 if (m_videoPlayer->mediaSource().type() == Phonon::MediaSource::Disc)186 guessMetaDataForCD();187 else188 readMetaDataFromMovie();189 }190 191 178 QMultiMap<QString, QString> QuickTimeMetaData::metaData() 192 179 { -
trunk/src/3rdparty/phonon/qt7/quicktimevideoplayer.h
r561 r846 21 21 #include "backendheader.h" 22 22 23 #include <QtGui/qmacdefines_mac.h>24 23 #import <QTKit/QTDataReference.h> 25 24 #import <QTKit/QTMovie.h> … … 40 39 { 41 40 class QuickTimeStreamReader; 42 class QuickTimeMetaData;43 41 class VideoRenderWidgetQTMovieView; 44 42 … … 58 56 void setMediaSource(const MediaSource &source); 59 57 MediaSource mediaSource() const; 60 void unset CurrentMediaSource();58 void unsetVideo(); 61 59 62 60 void play(); … … 69 67 void *currentFrameAsCIImage(); 70 68 QImage currentFrameAsQImage(); 71 void releaseImageCache();72 69 QRect videoRect() const; 73 70 … … 75 72 quint64 currentTime() const; 76 73 long timeScale() const; 77 float staticFps();78 74 QString currentTimeString(); 79 75 … … 88 84 void setPlaybackRate(float rate); 89 85 QTMovie *qtMovie() const; 90 QMultiMap<QString, QString> metaData();91 86 92 87 float playbackRate() const; … … 108 103 quint64 timeLoaded(); 109 104 110 int trackCount() const;111 int currentTrack() const;112 void setCurrentTrack(int track);113 QString movieCompactDiscPath() const;114 QString currentTrackPath() const;115 116 105 static QString timeToString(quint64 ms); 117 106 … … 127 116 State m_state; 128 117 QGLPixelBuffer *m_QImagePixelBuffer; 129 QuickTimeMetaData *m_metaData;130 131 CVOpenGLTextureRef m_cachedCVTextureRef;132 QImage m_cachedQImage;133 118 134 119 bool m_playbackRateSat; … … 141 126 float m_relativeVolume; 142 127 float m_playbackRate; 143 float m_staticFps;144 128 quint64 m_currentTime; 145 129 MediaSource m_mediaSource; 146 147 130 void *m_primaryRenderingCIImage; 148 131 qreal m_brightness; … … 150 133 qreal m_hue; 151 134 qreal m_saturation; 152 NSArray *m_folderTracks;153 int m_currentTrack;154 QString m_movieCompactDiscPath;155 135 156 136 #ifdef QUICKTIME_C_API_AVAILABLE … … 160 140 QuickTimeStreamReader *m_streamReader; 161 141 162 void prepareCurrentMovieForPlayback();163 142 void createVisualContext(); 164 143 void openMovieFromCurrentMediaSource(); … … 167 146 void openMovieFromUrl(); 168 147 void openMovieFromStream(); 169 void openMovieFromCompactDisc();170 148 void openMovieFromData(QByteArray *data, char *fileType); 171 149 void openMovieFromDataGuessType(QByteArray *data); 172 150 QString mediaSourcePath(); 173 151 bool codecExistsAccordingToSuffix(const QString &fileName); 174 NSString* pathToCompactDisc();175 bool isCompactDisc(NSString *path);176 NSArray* scanFolder(NSString *path);177 152 178 153 void setError(NSError *error); 179 154 bool errorOccured(); 180 155 void readProtection(); 181 void calculateStaticFps();182 156 void checkIfVideoAwailable(); 183 157 bool movieNotLoaded(); -
trunk/src/3rdparty/phonon/qt7/quicktimevideoplayer.mm
r561 r846 21 21 #include "audiodevice.h" 22 22 #include "quicktimestreamreader.h" 23 #include "quicktimemetadata.h"24 23 25 24 #include <QtCore/QCoreApplication> … … 54 53 m_state = NoMedia; 55 54 m_mediaSource = MediaSource(); 56 m_metaData = new QuickTimeMetaData(this);57 55 m_QTMovie = 0; 58 56 m_streamReader = 0; … … 64 62 m_audioEnabled = false; 65 63 m_hasVideo = false; 66 m_staticFps = 0;67 64 m_playbackRateSat = false; 68 65 m_isDrmProtected = false; … … 71 68 m_primaryRenderingCIImage = 0; 72 69 m_QImagePixelBuffer = 0; 73 m_cachedCVTextureRef = 0;74 m_folderTracks = 0;75 m_currentTrack = 0;76 70 77 71 #ifdef QUICKTIME_C_API_AVAILABLE … … 84 78 QuickTimeVideoPlayer::~QuickTimeVideoPlayer() 85 79 { 86 PhononAutoReleasePool pool; 87 unsetCurrentMediaSource(); 88 delete m_metaData; 80 unsetVideo(); 89 81 [(NSObject*)m_primaryRenderingTarget release]; 90 82 m_primaryRenderingTarget = 0; … … 93 85 CFRelease(m_visualContext); 94 86 #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();104 87 } 105 88 … … 143 126 144 127 QTVisualContextTask(m_visualContext); 145 bool changed = QTVisualContextIsNewImageAvailable(m_visualContext, 0); 146 if (changed) 147 releaseImageCache(); 148 return changed; 128 return QTVisualContextIsNewImageAvailable(m_visualContext, 0); 149 129 150 130 #elif defined(QT_MAC_USE_COCOA) … … 161 141 if (!m_visualContext) 162 142 return 0; 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; 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; 168 147 169 148 #else … … 174 153 QImage QuickTimeVideoPlayer::currentFrameAsQImage() 175 154 { 176 if (!m_cachedQImage.isNull())177 return m_cachedQImage;178 179 155 #ifdef QUICKTIME_C_API_AVAILABLE 180 156 QGLContext *prevContext = const_cast<QGLContext *>(QGLContext::currentContext()); … … 206 182 glEnd(); 207 183 208 m_cachedQImage = m_QImagePixelBuffer->toImage(); 184 QImage image = m_QImagePixelBuffer->toImage(); 185 CVOpenGLTextureRelease(texture); 209 186 // Because of QuickTime, m_QImagePixelBuffer->doneCurrent() will fail. 210 187 // So we store, and restore, the context our selves: 211 188 prevContext->makeCurrent(); 212 return m_cachedQImage;189 return image; 213 190 #else 214 191 CIImage *img = (CIImage *)currentFrameAsCIImage(); … … 219 196 CGRect bounds = [img extent]; 220 197 QImage qImg([bitmap bitmapData], bounds.size.width, bounds.size.height, QImage::Format_ARGB32); 221 m_cachedQImage= qImg.rgbSwapped();198 QImage swapped = qImg.rgbSwapped(); 222 199 [bitmap release]; 223 200 [img release]; 224 return m_cachedQImage;201 return swapped; 225 202 #endif 226 203 } … … 274 251 CVOpenGLTextureRef cvImg = currentFrameAsCVTexture(); 275 252 CIImage *img = [[CIImage alloc] initWithCVImageBuffer:cvImg]; 276 return img; 253 CVOpenGLTextureRelease(cvImg); 254 return img; 277 255 #else 278 256 return 0; … … 296 274 int samplesPerPixel = [bitmap samplesPerPixel]; 297 275 if (![bitmap isPlanar] && (samplesPerPixel == 3 || samplesPerPixel == 4)){ 298 glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 276 glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 299 277 samplesPerPixel == 4 ? GL_RGBA8 : GL_RGB8, 300 278 [bitmap pixelsWide], [bitmap pixelsHigh], … … 325 303 m_relativeVolume = relativeVolume; 326 304 if (!m_QTMovie || !m_audioEnabled || m_mute) 327 return; 305 return; 328 306 [m_QTMovie setVolume:(m_masterVolume * m_relativeVolume)]; 329 307 } … … 336 314 337 315 // Work-around bug that happends if you set/unset mute 338 // before movie is playing, and audio is not played 316 // before movie is playing, and audio is not played 339 317 // through graph. Then audio is delayed. 340 318 [m_QTMovie setMuted:mute]; … … 349 327 350 328 // Work-around bug that happends if you set/unset mute 351 // before movie is playing, and audio is not played 329 // before movie is playing, and audio is not played 352 330 // through graph. Then audio is delayed. 353 331 [m_QTMovie setMuted:(!enable || m_mute)]; … … 368 346 // The following code will not work for some media codecs that 369 347 // typically mingle audio/video frames (e.g mpeg). 370 CFStringRef idString = PhononCFString::toCFStringRef(AudioDevice::deviceUID(id)); 348 CFStringRef idString = PhononCFString::toCFStringRef(AudioDevice::deviceUID(id)); 371 349 QTAudioContextRef context; 372 350 QTAudioContextCreateForAudioDevice(kCFAllocatorDefault, idString, 0, &context); … … 392 370 saturation += 1; 393 371 394 if (m_brightness == brightness395 && m_contrast == contrast396 && m_hue == hue397 && m_saturation == saturation)398 return;399 400 372 m_brightness = brightness; 401 373 m_contrast = contrast; 402 374 m_hue = hue; 403 375 m_saturation = saturation; 376 404 377 #ifdef QUICKTIME_C_API_AVAILABLE 405 378 Float32 value; … … 413 386 SetMovieVisualSaturation([m_QTMovie quickTimeMovie], value, 0); 414 387 #endif 415 releaseImageCache();416 388 } 417 389 … … 426 398 } 427 399 428 void QuickTimeVideoPlayer::unset CurrentMediaSource()400 void QuickTimeVideoPlayer::unsetVideo() 429 401 { 430 402 if (!m_QTMovie) … … 439 411 m_isDrmProtected = false; 440 412 m_isDrmAuthorized = true; 441 m_hasVideo = false;442 m_staticFps = 0;443 413 m_mediaSource = MediaSource(); 444 m_movieCompactDiscPath.clear();445 414 [(CIImage *)m_primaryRenderingCIImage release]; 446 415 m_primaryRenderingCIImage = 0; 447 416 delete m_QImagePixelBuffer; 448 417 m_QImagePixelBuffer = 0; 449 releaseImageCache();450 [m_folderTracks release];451 m_folderTracks = 0;452 418 } 453 419 … … 559 525 { 560 526 PhononAutoReleasePool pool; 561 unsetCurrentMediaSource(); 562 527 unsetVideo(); 563 528 m_mediaSource = mediaSource; 564 529 if (mediaSource.type() == MediaSource::Empty || mediaSource.type() == MediaSource::Invalid){ … … 566 531 return; 567 532 } 568 569 533 openMovieFromCurrentMediaSource(); 570 534 if (errorOccured()){ 571 unsetCurrentMediaSource(); 572 return; 573 } 574 575 prepareCurrentMovieForPlayback(); 576 } 577 578 void QuickTimeVideoPlayer::prepareCurrentMovieForPlayback() 579 { 535 unsetVideo(); 536 return; 537 } 538 580 539 #ifdef QUICKTIME_C_API_AVAILABLE 581 540 if (m_visualContext) … … 585 544 waitStatePlayable(); 586 545 if (errorOccured()){ 587 unset CurrentMediaSource();546 unsetVideo(); 588 547 return; 589 548 } … … 592 551 preRollMovie(); 593 552 if (errorOccured()){ 594 unset CurrentMediaSource();553 unsetVideo(); 595 554 return; 596 555 } … … 599 558 m_playbackRate = prefferedPlaybackRate(); 600 559 checkIfVideoAwailable(); 601 calculateStaticFps();602 560 enableAudio(m_audioEnabled); 603 561 setMute(m_mute); 604 562 setVolume(m_masterVolume, m_relativeVolume); 605 m_metaData->update();606 563 pause(); 607 564 } … … 617 574 break; 618 575 case MediaSource::Disc: 619 openMovieFromCompactDisc();576 CASE_UNSUPPORTED("Could not open media source.", FATAL_ERROR) 620 577 break; 621 578 case MediaSource::Stream: … … 679 636 // codecs *think* they can decode the stream, and crash... 680 637 #define TryOpenMovieWithCodec(type) gClearError(); \ 681 openMovieFromData(data, (char *)"."type); \638 openMovieFromData(data, "."type); \ 682 639 if (m_QTMovie) return; 683 640 … … 719 676 } 720 677 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 open729 // causes the application to hang. So we need to handle730 // 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() const761 {762 return m_movieCompactDiscPath;763 }764 765 678 MediaSource QuickTimeVideoPlayer::mediaSource() const 766 679 { … … 806 719 PhononAutoReleasePool pool; 807 720 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_QUICKTIME823 Boolean isMpeg = false;824 Track videoTrack = GetMovieIndTrackType([m_QTMovie quickTimeMovie], 1,825 FOUR_CHAR_CODE('vfrr'), // 'vfrr' means: has frame rate826 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 #else844 m_staticFps = 30.0f;845 #endif846 721 } 847 722 … … 1076 951 } 1077 952 1078 QMultiMap<QString, QString> QuickTimeVideoPlayer::metaData()1079 {1080 return m_metaData->metaData();1081 }1082 1083 int QuickTimeVideoPlayer::trackCount() const1084 {1085 if (!m_folderTracks)1086 return 0;1087 return [m_folderTracks count];1088 }1089 1090 int QuickTimeVideoPlayer::currentTrack() const1091 {1092 return m_currentTrack;1093 }1094 1095 QString QuickTimeVideoPlayer::currentTrackPath() const1096 {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:path1122 isRemovable:01123 isWritable:01124 isUnmountable:01125 description:01126 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 1166 953 }} 1167 954 -
trunk/src/3rdparty/phonon/qt7/videoframe.mm
r561 r846 20 20 #import <QuartzCore/CIFilter.h> 21 21 #import <QuartzCore/CIContext.h> 22 23 //#define CACHE_CV_TEXTURE24 22 25 23 QT_BEGIN_NAMESPACE … … 73 71 void VideoFrame::copyMembers(const VideoFrame& frame) 74 72 { 75 #ifdef CACHE_CV_TEXTURE76 73 m_cachedCVTextureRef = frame.m_cachedCVTextureRef; 77 #endif78 74 m_cachedCIImage = frame.m_cachedCIImage; 79 75 m_cachedQImage = frame.m_cachedQImage; … … 110 106 CVOpenGLTextureRef VideoFrame::cachedCVTexture() const 111 107 { 112 #ifdef CACHE_CV_TEXTURE113 108 if (!m_cachedCVTextureRef && m_videoPlayer){ 114 109 m_videoPlayer->setColors(m_brightness, m_contrast, m_hue, m_saturation); 115 110 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = m_videoPlayer->currentFrameAsCVTexture(); 116 CVOpenGLTextureRetain((const_cast<VideoFrame *>(this))->m_cachedCVTextureRef);117 111 } 118 112 return m_cachedCVTextureRef; 119 #else120 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 #endif126 113 } 127 114 … … 343 330 void VideoFrame::invalidateImage() const 344 331 { 345 #ifdef CACHE_CV_TEXTURE346 332 if (m_cachedCVTextureRef){ 347 333 CVOpenGLTextureRelease(m_cachedCVTextureRef); 348 334 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0; 349 335 } 350 #endif351 336 if (m_cachedCIImage){ 352 337 [(CIImage *) m_cachedCIImage release]; … … 362 347 void VideoFrame::retain() const 363 348 { 364 #ifdef CACHE_CV_TEXTURE365 349 if (m_cachedCVTextureRef) 366 350 CVOpenGLTextureRetain(m_cachedCVTextureRef); 367 #endif368 351 if (m_cachedCIImage) 369 352 [(CIImage *) m_cachedCIImage retain]; … … 376 359 void VideoFrame::release() const 377 360 { 378 #ifdef CACHE_CV_TEXTURE 379 if (m_cachedCVTextureRef){ 361 if (m_cachedCVTextureRef) 380 362 CVOpenGLTextureRelease(m_cachedCVTextureRef); 381 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0;382 }383 #endif384 363 if (m_cachedCIImage) 385 364 [(CIImage *) m_cachedCIImage release]; … … 390 369 391 370 (const_cast<VideoFrame *>(this))->m_backgroundFrame = 0; 371 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0; 392 372 (const_cast<VideoFrame *>(this))->m_cachedCIImage = 0; 393 373 (const_cast<VideoFrame *>(this))->m_cachedNSBitmap = 0; -
trunk/src/3rdparty/phonon/waveout/mediaobject.cpp
r561 r846 51 51 ushort b[256]; 52 52 waveOutGetErrorText(error, (LPWSTR)b, 256); 53 return QString ::fromUtf16(b);53 return QString((const QChar *)b); 54 54 } 55 55 … … 71 71 72 72 73 void CALLBACK MediaObject::WaveOutCallBack(HWAVEOUT m_hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)73 void QT_WIN_CALLBACK MediaObject::WaveOutCallBack(HWAVEOUT m_hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2) 74 74 { 75 75 Q_UNUSED(m_hWaveOut); -
trunk/src/3rdparty/phonon/waveout/mediaobject.h
r2 r846 113 113 void playBuffer(WAVEHDR *waveHeader); 114 114 115 static void CALLBACK WaveOutCallBack(HWAVEOUT hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);115 static void QT_WIN_CALLBACK WaveOutCallBack(HWAVEOUT hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2); 116 116 117 117 struct {
Note:
See TracChangeset
for help on using the changeset viewer.