Merge remote-tracking branch 'origin/5.4' into 5.5

Change-Id: Id24f14bef17b86e7027e055473f0357854780979
This commit is contained in:
Frederik Gladhorn
2015-03-17 09:48:51 +01:00
4 changed files with 86 additions and 92 deletions

View File

@@ -111,36 +111,33 @@ void QGstreamerAudioInputSelector::updateAlsaDevices()
{ {
#ifdef HAVE_ALSA #ifdef HAVE_ALSA
void **hints, **n; void **hints, **n;
int card = -1; if (snd_device_name_hint(-1, "pcm", &hints) < 0) {
qWarning()<<"no alsa devices available";
return;
}
n = hints;
while (snd_card_next(&card) == 0 && card >= 0) { while (*n != NULL) {
if (snd_device_name_hint(card, "pcm", &hints) < 0) char *name = snd_device_name_get_hint(*n, "NAME");
continue; char *descr = snd_device_name_get_hint(*n, "DESC");
char *io = snd_device_name_get_hint(*n, "IOID");
n = hints; if ((name != NULL) && (descr != NULL)) {
while (*n != NULL) { if ( io == NULL || qstrcmp(io,"Input") == 0 ) {
char *name = snd_device_name_get_hint(*n, "NAME"); m_names.append(QLatin1String("alsa:")+QString::fromUtf8(name));
char *descr = snd_device_name_get_hint(*n, "DESC"); m_descriptions.append(QString::fromUtf8(descr));
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 (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);
#endif #endif
} }

View File

@@ -91,15 +91,16 @@ QVideoSurfaceGenericPainter::QVideoSurfaceGenericPainter()
: m_imageFormat(QImage::Format_Invalid) : m_imageFormat(QImage::Format_Invalid)
, m_scanLineDirection(QVideoSurfaceFormat::TopToBottom) , m_scanLineDirection(QVideoSurfaceFormat::TopToBottom)
{ {
m_imagePixelFormats m_imagePixelFormats << QVideoFrame::Format_RGB32;
<< QVideoFrame::Format_RGB32
<< QVideoFrame::Format_ARGB32
<< QVideoFrame::Format_RGB565;
// The raster formats should be a subset of the GL formats. // The raster formats should be a subset of the GL formats.
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGLES) if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGLES)
#endif #endif
m_imagePixelFormats << QVideoFrame::Format_RGB24; m_imagePixelFormats << QVideoFrame::Format_RGB24;
m_imagePixelFormats << QVideoFrame::Format_ARGB32
<< QVideoFrame::Format_RGB565;
} }
QList<QVideoFrame::PixelFormat> QVideoSurfaceGenericPainter::supportedPixelFormats( QList<QVideoFrame::PixelFormat> QVideoSurfaceGenericPainter::supportedPixelFormats(
@@ -1055,7 +1056,13 @@ QVideoSurfaceGlslPainter::QVideoSurfaceGlslPainter(QGLContext *context)
m_imagePixelFormats m_imagePixelFormats
<< QVideoFrame::Format_RGB32 << QVideoFrame::Format_RGB32
<< QVideoFrame::Format_BGR32 << 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_RGB565
<< QVideoFrame::Format_YUV444 << QVideoFrame::Format_YUV444
<< QVideoFrame::Format_AYUV444 << QVideoFrame::Format_AYUV444
@@ -1064,11 +1071,6 @@ QVideoSurfaceGlslPainter::QVideoSurfaceGlslPainter(QGLContext *context)
m_glPixelFormats m_glPixelFormats
<< QVideoFrame::Format_RGB32 << QVideoFrame::Format_RGB32
<< QVideoFrame::Format_ARGB32; << QVideoFrame::Format_ARGB32;
if (!context->contextHandle()->isOpenGLES()) {
m_imagePixelFormats
<< QVideoFrame::Format_RGB24
<< QVideoFrame::Format_BGR24;
}
} }
QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurfaceFormat &format) QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurfaceFormat &format)

View File

@@ -337,9 +337,14 @@ QList<QByteArray> QAlsaAudioDeviceInfo::availableDevices(QAudio::Mode mode)
#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
// Create a list of all current audio devices that support mode // Create a list of all current audio devices that support mode
void **hints; void **hints, **n;
char *name, *descr, *io; 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) { if(mode == QAudio::AudioInput) {
filter = "Input"; filter = "Input";
@@ -347,35 +352,28 @@ QList<QByteArray> QAlsaAudioDeviceInfo::availableDevices(QAudio::Mode mode)
filter = "Output"; filter = "Output";
} }
while (snd_card_next(&card) == 0 && card >= 0) { while (*n != NULL) {
if (snd_device_name_hint(card, "pcm", &hints) < 0) name = snd_device_name_get_hint(*n, "NAME");
continue; if (name != 0 && qstrcmp(name, "null") != 0) {
descr = snd_device_name_get_hint(*n, "DESC");
io = snd_device_name_get_hint(*n, "IOID");
void **n = hints; if ((descr != NULL) && ((io == NULL) || (io == filter))) {
while (*n != NULL) { QString deviceName = QLatin1String(name);
name = snd_device_name_get_hint(*n, "NAME"); QString deviceDescription = QLatin1String(descr);
if (name != 0 && qstrcmp(name, "null") != 0) { if (deviceDescription.contains(QLatin1String("Default Audio Device")))
descr = snd_device_name_get_hint(*n, "DESC"); devices.prepend(deviceName.toLocal8Bit().constData());
io = snd_device_name_get_hint(*n, "IOID"); else
devices.append(deviceName.toLocal8Bit().constData());
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);
} }
free(name);
++n;
}
snd_device_name_free_hint(hints); free(descr);
free(io);
}
free(name);
++n;
} }
snd_device_name_free_hint(hints);
#else #else
int idx = 0; int idx = 0;
char* name; char* name;
@@ -416,41 +414,38 @@ void QAlsaAudioDeviceInfo::checkSurround()
surround51 = false; surround51 = false;
surround71 = false; surround71 = false;
void **hints; void **hints, **n;
char *name, *descr, *io; char *name, *descr, *io;
int card = -1;
while (snd_card_next(&card) == 0 && card >= 0) { if(snd_device_name_hint(-1, "pcm", &hints) < 0)
if (snd_device_name_hint(card, "pcm", &hints) < 0) return;
continue;
void **n = hints; n = hints;
while (*n != NULL) {
name = snd_device_name_get_hint(*n, "NAME"); while (*n != NULL) {
descr = snd_device_name_get_hint(*n, "DESC"); name = snd_device_name_get_hint(*n, "NAME");
io = snd_device_name_get_hint(*n, "IOID"); descr = snd_device_name_get_hint(*n, "DESC");
if((name != NULL) && (descr != NULL)) { io = snd_device_name_get_hint(*n, "IOID");
QString deviceName = QLatin1String(name); if((name != NULL) && (descr != NULL)) {
if (mode == QAudio::AudioOutput) { QString deviceName = QLatin1String(name);
if(deviceName.contains(QLatin1String("surround40"))) if (mode == QAudio::AudioOutput) {
surround40 = true; if(deviceName.contains(QLatin1String("surround40")))
if(deviceName.contains(QLatin1String("surround51"))) surround40 = true;
surround51 = true; if(deviceName.contains(QLatin1String("surround51")))
if(deviceName.contains(QLatin1String("surround71"))) surround51 = true;
surround71 = true; if(deviceName.contains(QLatin1String("surround71")))
} surround71 = true;
} }
if(name != NULL)
free(name);
if(descr != NULL)
free(descr);
if(io != NULL)
free(io);
++n;
} }
if(name != NULL)
snd_device_name_free_hint(hints); free(name);
if(descr != NULL)
free(descr);
if(io != NULL)
free(io);
++n;
} }
snd_device_name_free_hint(hints);
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@@ -307,7 +307,7 @@ void QAndroidMediaPlayerControl::setMedia(const QMediaContent &mediaContent,
{ {
StateChangeNotifier notifier(this); StateChangeNotifier notifier(this);
mReloadingMedia = (mMediaContent == mediaContent); mReloadingMedia = (mMediaContent == mediaContent) && !mPendingSetMedia;
if (!mReloadingMedia) { if (!mReloadingMedia) {
mMediaContent = mediaContent; mMediaContent = mediaContent;
@@ -712,8 +712,8 @@ void QAndroidMediaPlayerControl::resetBufferingProgress()
void QAndroidMediaPlayerControl::flushPendingStates() void QAndroidMediaPlayerControl::flushPendingStates()
{ {
if (mPendingSetMedia) { if (mPendingSetMedia) {
mPendingSetMedia = false;
setMedia(mMediaContent, 0); setMedia(mMediaContent, 0);
mPendingSetMedia = false;
return; return;
} }