From 95e9155b7f290d438dfd986fca7f9a26698cf691 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 26 Feb 2015 16:16:49 +0100 Subject: Android: fix some MediaPlayer signals not being emitted on first load. When loading the first media while the video output was not yet ready, mediaChanged() and mediaStatusChanged() signals were not emitted. That's because in that particular situation, the backend believed the delayed loading was a reload of the same media. Change-Id: If5dfbf383ea2dac065fc26b70640ebfb2c52862d Reviewed-by: Christian Stromme --- src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp index a8f427f81..3128a89e6 100644 --- a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp +++ b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp @@ -307,7 +307,7 @@ void QAndroidMediaPlayerControl::setMedia(const QMediaContent &mediaContent, { StateChangeNotifier notifier(this); - mReloadingMedia = (mMediaContent == mediaContent); + mReloadingMedia = (mMediaContent == mediaContent) && !mPendingSetMedia; if (!mReloadingMedia) { mMediaContent = mediaContent; @@ -712,8 +712,8 @@ void QAndroidMediaPlayerControl::resetBufferingProgress() void QAndroidMediaPlayerControl::flushPendingStates() { if (mPendingSetMedia) { - mPendingSetMedia = false; setMedia(mMediaContent, 0); + mPendingSetMedia = false; return; } -- cgit v1.2.3 From e1d76e2df53b766f418e15282a2b908e91108b66 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 11 Mar 2015 14:32:17 +0100 Subject: Revert "Alsa: fix crash when detecting devices." This reverts commit 0ab81ef59f35d103ec8174834c4fc2a4dcced453. The workaround causes software devices not to appear in the list of available devices. Besides, since the crash is caused by a bug in older versions of Alsa, the workaround was probably a bad idea in the first place. People should update Alsa instead. Task-number: QTBUG-42326 Change-Id: I37923a87180d1c5abc18d52d84f633e14ba46860 Reviewed-by: Christian Stromme --- src/gsttools/qgstreameraudioinputselector.cpp | 49 ++++++------ src/plugins/alsa/qalsaaudiodeviceinfo.cpp | 109 ++++++++++++-------------- 2 files changed, 75 insertions(+), 83 deletions(-) diff --git a/src/gsttools/qgstreameraudioinputselector.cpp b/src/gsttools/qgstreameraudioinputselector.cpp index 31634f024..a0ced3367 100644 --- a/src/gsttools/qgstreameraudioinputselector.cpp +++ b/src/gsttools/qgstreameraudioinputselector.cpp @@ -111,36 +111,33 @@ void QGstreamerAudioInputSelector::updateAlsaDevices() { #ifdef HAVE_ALSA void **hints, **n; - int card = -1; - - while (snd_card_next(&card) == 0 && card >= 0) { - if (snd_device_name_hint(card, "pcm", &hints) < 0) - continue; - - n = hints; - while (*n != NULL) { - char *name = snd_device_name_get_hint(*n, "NAME"); - char *descr = snd_device_name_get_hint(*n, "DESC"); - char *io = snd_device_name_get_hint(*n, "IOID"); - - if ((name != NULL) && (descr != NULL)) { - if ( io == NULL || qstrcmp(io,"Input") == 0 ) { - m_names.append(QLatin1String("alsa:")+QString::fromUtf8(name)); - m_descriptions.append(QString::fromUtf8(descr)); - } - } + if (snd_device_name_hint(-1, "pcm", &hints) < 0) { + qWarning()<<"no alsa devices available"; + return; + } + n = hints; - if (name != NULL) - free(name); - if (descr != NULL) - free(descr); - if (io != NULL) - free(io); - ++n; + while (*n != NULL) { + char *name = snd_device_name_get_hint(*n, "NAME"); + char *descr = snd_device_name_get_hint(*n, "DESC"); + char *io = snd_device_name_get_hint(*n, "IOID"); + + if ((name != NULL) && (descr != NULL)) { + if ( io == NULL || qstrcmp(io,"Input") == 0 ) { + m_names.append(QLatin1String("alsa:")+QString::fromUtf8(name)); + m_descriptions.append(QString::fromUtf8(descr)); + } } - snd_device_name_free_hint(hints); + if (name != NULL) + free(name); + if (descr != NULL) + free(descr); + if (io != NULL) + free(io); + n++; } + snd_device_name_free_hint(hints); #endif } diff --git a/src/plugins/alsa/qalsaaudiodeviceinfo.cpp b/src/plugins/alsa/qalsaaudiodeviceinfo.cpp index 349999c66..ce7fb701d 100644 --- a/src/plugins/alsa/qalsaaudiodeviceinfo.cpp +++ b/src/plugins/alsa/qalsaaudiodeviceinfo.cpp @@ -337,9 +337,14 @@ QList QAlsaAudioDeviceInfo::availableDevices(QAudio::Mode mode) #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) // Create a list of all current audio devices that support mode - void **hints; + void **hints, **n; char *name, *descr, *io; - int card = -1; + + if(snd_device_name_hint(-1, "pcm", &hints) < 0) { + qWarning() << "no alsa devices available"; + return devices; + } + n = hints; if(mode == QAudio::AudioInput) { filter = "Input"; @@ -347,35 +352,28 @@ QList QAlsaAudioDeviceInfo::availableDevices(QAudio::Mode mode) filter = "Output"; } - while (snd_card_next(&card) == 0 && card >= 0) { - if (snd_device_name_hint(card, "pcm", &hints) < 0) - continue; - - void **n = hints; - while (*n != NULL) { - name = snd_device_name_get_hint(*n, "NAME"); - if (name != 0 && qstrcmp(name, "null") != 0) { - descr = snd_device_name_get_hint(*n, "DESC"); - io = snd_device_name_get_hint(*n, "IOID"); - - if ((descr != NULL) && ((io == NULL) || (io == filter))) { - QString deviceName = QLatin1String(name); - QString deviceDescription = QLatin1String(descr); - if (deviceDescription.contains(QLatin1String("Default Audio Device"))) - devices.prepend(deviceName.toLocal8Bit().constData()); - else - devices.append(deviceName.toLocal8Bit().constData()); - } - - free(descr); - free(io); + while (*n != NULL) { + name = snd_device_name_get_hint(*n, "NAME"); + if (name != 0 && qstrcmp(name, "null") != 0) { + descr = snd_device_name_get_hint(*n, "DESC"); + io = snd_device_name_get_hint(*n, "IOID"); + + if ((descr != NULL) && ((io == NULL) || (io == filter))) { + QString deviceName = QLatin1String(name); + QString deviceDescription = QLatin1String(descr); + if (deviceDescription.contains(QLatin1String("Default Audio Device"))) + devices.prepend(deviceName.toLocal8Bit().constData()); + else + devices.append(deviceName.toLocal8Bit().constData()); } - free(name); - ++n; - } - snd_device_name_free_hint(hints); + free(descr); + free(io); + } + free(name); + ++n; } + snd_device_name_free_hint(hints); #else int idx = 0; char* name; @@ -416,41 +414,38 @@ void QAlsaAudioDeviceInfo::checkSurround() surround51 = false; surround71 = false; - void **hints; + void **hints, **n; char *name, *descr, *io; - int card = -1; - while (snd_card_next(&card) == 0 && card >= 0) { - if (snd_device_name_hint(card, "pcm", &hints) < 0) - continue; + if(snd_device_name_hint(-1, "pcm", &hints) < 0) + return; - void **n = hints; - while (*n != NULL) { - name = snd_device_name_get_hint(*n, "NAME"); - descr = snd_device_name_get_hint(*n, "DESC"); - io = snd_device_name_get_hint(*n, "IOID"); - if((name != NULL) && (descr != NULL)) { - QString deviceName = QLatin1String(name); - if (mode == QAudio::AudioOutput) { - if(deviceName.contains(QLatin1String("surround40"))) - surround40 = true; - if(deviceName.contains(QLatin1String("surround51"))) - surround51 = true; - if(deviceName.contains(QLatin1String("surround71"))) - surround71 = true; - } + n = hints; + + while (*n != NULL) { + name = snd_device_name_get_hint(*n, "NAME"); + descr = snd_device_name_get_hint(*n, "DESC"); + io = snd_device_name_get_hint(*n, "IOID"); + if((name != NULL) && (descr != NULL)) { + QString deviceName = QLatin1String(name); + if (mode == QAudio::AudioOutput) { + if(deviceName.contains(QLatin1String("surround40"))) + surround40 = true; + if(deviceName.contains(QLatin1String("surround51"))) + surround51 = true; + if(deviceName.contains(QLatin1String("surround71"))) + surround71 = true; } - if(name != NULL) - free(name); - if(descr != NULL) - free(descr); - if(io != NULL) - free(io); - ++n; } - - snd_device_name_free_hint(hints); + if(name != NULL) + free(name); + if(descr != NULL) + free(descr); + if(io != NULL) + free(io); + ++n; } + snd_device_name_free_hint(hints); } QT_END_NAMESPACE -- cgit v1.2.3 From d4208cc5a1c6d6bf114653b39b8880fe4c00c1f3 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 12 Mar 2015 16:06:26 +0100 Subject: QPainterVideoSurface: restore original order for the supported formats. The formats returned by supportedPixelFormats() are supposed to be in descending order of preference. Some formats were changed positions in commit 66ba2197. Change-Id: Ib52e93ba3554d80fa388a01f0b47fa049ac046ec Reviewed-by: Laszlo Agocs --- src/multimediawidgets/qpaintervideosurface.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/multimediawidgets/qpaintervideosurface.cpp b/src/multimediawidgets/qpaintervideosurface.cpp index 13306fd87..3529ab7d6 100644 --- a/src/multimediawidgets/qpaintervideosurface.cpp +++ b/src/multimediawidgets/qpaintervideosurface.cpp @@ -91,15 +91,16 @@ QVideoSurfaceGenericPainter::QVideoSurfaceGenericPainter() : m_imageFormat(QImage::Format_Invalid) , m_scanLineDirection(QVideoSurfaceFormat::TopToBottom) { - m_imagePixelFormats - << QVideoFrame::Format_RGB32 - << QVideoFrame::Format_ARGB32 - << QVideoFrame::Format_RGB565; + m_imagePixelFormats << QVideoFrame::Format_RGB32; + // The raster formats should be a subset of the GL formats. #ifndef QT_NO_OPENGL if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGLES) #endif m_imagePixelFormats << QVideoFrame::Format_RGB24; + + m_imagePixelFormats << QVideoFrame::Format_ARGB32 + << QVideoFrame::Format_RGB565; } QList QVideoSurfaceGenericPainter::supportedPixelFormats( @@ -1055,7 +1056,13 @@ QVideoSurfaceGlslPainter::QVideoSurfaceGlslPainter(QGLContext *context) m_imagePixelFormats << QVideoFrame::Format_RGB32 << QVideoFrame::Format_BGR32 - << QVideoFrame::Format_ARGB32 + << QVideoFrame::Format_ARGB32; + if (!context->contextHandle()->isOpenGLES()) { + m_imagePixelFormats + << QVideoFrame::Format_RGB24 + << QVideoFrame::Format_BGR24; + } + m_imagePixelFormats << QVideoFrame::Format_RGB565 << QVideoFrame::Format_YUV444 << QVideoFrame::Format_AYUV444 @@ -1064,11 +1071,6 @@ QVideoSurfaceGlslPainter::QVideoSurfaceGlslPainter(QGLContext *context) m_glPixelFormats << QVideoFrame::Format_RGB32 << QVideoFrame::Format_ARGB32; - if (!context->contextHandle()->isOpenGLES()) { - m_imagePixelFormats - << QVideoFrame::Format_RGB24 - << QVideoFrame::Format_BGR24; - } } QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurfaceFormat &format) -- cgit v1.2.3