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

Conflicts:
	.qmake.conf
	src/plugins/gstreamer/camerabin/camerabinsession.cpp

Change-Id: I66a6f3efc5391013934b6b321073c31f25e1de26
This commit is contained in:
Yoann Lopes
2015-01-19 14:35:33 +01:00
16 changed files with 119 additions and 358 deletions

View File

@@ -244,7 +244,7 @@ QIODevice* QAlsaAudioInput::start()
delete audioSource;
pullMode = false;
audioSource = new InputPrivate(this);
audioSource = new AlsaInputPrivate(this);
audioSource->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
deviceState = QAudio::IdleState;
@@ -725,7 +725,7 @@ bool QAlsaAudioInput::deviceReady()
read(0, buffer_size);
} else {
// emits readyRead() so user will call read() on QIODevice to get some audio data
InputPrivate* a = qobject_cast<InputPrivate*>(audioSource);
AlsaInputPrivate* a = qobject_cast<AlsaInputPrivate*>(audioSource);
a->trigger();
}
bytesAvailable = checkBytesReady();
@@ -777,28 +777,28 @@ void QAlsaAudioInput::drain()
snd_pcm_drain(handle);
}
InputPrivate::InputPrivate(QAlsaAudioInput* audio)
AlsaInputPrivate::AlsaInputPrivate(QAlsaAudioInput* audio)
{
audioDevice = qobject_cast<QAlsaAudioInput*>(audio);
}
InputPrivate::~InputPrivate()
AlsaInputPrivate::~AlsaInputPrivate()
{
}
qint64 InputPrivate::readData( char* data, qint64 len)
qint64 AlsaInputPrivate::readData( char* data, qint64 len)
{
return audioDevice->read(data,len);
}
qint64 InputPrivate::writeData(const char* data, qint64 len)
qint64 AlsaInputPrivate::writeData(const char* data, qint64 len)
{
Q_UNUSED(data)
Q_UNUSED(len)
return 0;
}
void InputPrivate::trigger()
void AlsaInputPrivate::trigger()
{
emit readyRead();
}

View File

@@ -63,7 +63,7 @@
QT_BEGIN_NAMESPACE
class InputPrivate;
class AlsaInputPrivate;
class RingBuffer
{
@@ -158,12 +158,12 @@ private:
qreal m_volume;
};
class InputPrivate : public QIODevice
class AlsaInputPrivate : public QIODevice
{
Q_OBJECT
public:
InputPrivate(QAlsaAudioInput* audio);
~InputPrivate();
AlsaInputPrivate(QAlsaAudioInput* audio);
~AlsaInputPrivate();
qint64 readData( char* data, qint64 len);
qint64 writeData(const char* data, qint64 len);

View File

@@ -247,7 +247,7 @@ QIODevice* QAlsaAudioOutput::start()
close();
audioSource = new OutputPrivate(this);
audioSource = new AlsaOutputPrivate(this);
audioSource->open(QIODevice::WriteOnly|QIODevice::Unbuffered);
pullMode = false;
@@ -785,14 +785,14 @@ void QAlsaAudioOutput::reset()
stop();
}
OutputPrivate::OutputPrivate(QAlsaAudioOutput* audio)
AlsaOutputPrivate::AlsaOutputPrivate(QAlsaAudioOutput* audio)
{
audioDevice = qobject_cast<QAlsaAudioOutput*>(audio);
}
OutputPrivate::~OutputPrivate() {}
AlsaOutputPrivate::~AlsaOutputPrivate() {}
qint64 OutputPrivate::readData( char* data, qint64 len)
qint64 AlsaOutputPrivate::readData( char* data, qint64 len)
{
Q_UNUSED(data)
Q_UNUSED(len)
@@ -800,7 +800,7 @@ qint64 OutputPrivate::readData( char* data, qint64 len)
return 0;
}
qint64 OutputPrivate::writeData(const char* data, qint64 len)
qint64 AlsaOutputPrivate::writeData(const char* data, qint64 len)
{
int retry = 0;
qint64 written = 0;

View File

@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
class QAlsaAudioOutput : public QAbstractAudioOutput
{
friend class OutputPrivate;
friend class AlsaOutputPrivate;
Q_OBJECT
public:
QAlsaAudioOutput(const QByteArray &device);
@@ -137,13 +137,13 @@ private:
qreal m_volume;
};
class OutputPrivate : public QIODevice
class AlsaOutputPrivate : public QIODevice
{
friend class QAlsaAudioOutput;
Q_OBJECT
public:
OutputPrivate(QAlsaAudioOutput* audio);
~OutputPrivate();
AlsaOutputPrivate(QAlsaAudioOutput* audio);
~AlsaOutputPrivate();
qint64 readData( char* data, qint64 len);
qint64 writeData(const char* data, qint64 len);

View File

@@ -315,6 +315,7 @@ void CameraBinSession::setupCaptureResolution()
if (!viewfinderResolution.isEmpty())
resolution = viewfinderResolution;
{
GstCaps *caps = resolutionToCaps(resolution);
#if CAMERABIN_DEBUG
@@ -323,6 +324,40 @@ void CameraBinSession::setupCaptureResolution()
g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, caps, NULL);
if (caps)
gst_caps_unref(caps);
GstElement *mfw_v4lsrc = 0;
if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSrc), "video-source")) {
GstElement *videoSrc = 0;
g_object_get(G_OBJECT(m_videoSrc), "video-source", &videoSrc, NULL);
if (videoSrc) {
const char *name = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(gst_element_get_factory(videoSrc)));
if (!qstrcmp(name, "mfw_v4lsrc"))
mfw_v4lsrc = videoSrc;
}
}
if (mfw_v4lsrc) {
int capMode = 0;
if (resolution == QSize(320, 240))
capMode = 1;
else if (resolution == QSize(720, 480))
capMode = 2;
else if (resolution == QSize(720, 576))
capMode = 3;
else if (resolution == QSize(1280, 720))
capMode = 4;
else if (resolution == QSize(1920, 1080))
capMode = 5;
g_object_set(G_OBJECT(mfw_v4lsrc), "capture-mode", capMode, NULL);
const qreal maxFps = m_viewfinderSettingsControl->maximumFrameRate();
if (!qFuzzyIsNull(maxFps)) {
int n, d;
gst_util_double_to_fraction(maxFps, &n, &d);
g_object_set(G_OBJECT(mfw_v4lsrc), "fps-n", n, NULL);
g_object_set(G_OBJECT(mfw_v4lsrc), "fps-d", d, NULL);
}
}
}
if (m_videoEncoder)

View File

@@ -38,7 +38,9 @@
QT_BEGIN_NAMESPACE
CameraBinViewfinderSettings::CameraBinViewfinderSettings(QObject *parent)
: QCameraViewfinderSettingsControl(parent)
: QCameraViewfinderSettingsControl(parent),
m_minimumFrameRate(0),
m_maximumFrameRate(0)
{
}
@@ -50,10 +52,10 @@ bool CameraBinViewfinderSettings::isViewfinderParameterSupported(ViewfinderParam
{
switch (parameter) {
case Resolution:
return true;
case PixelAspectRatio:
case MinimumFrameRate:
case MaximumFrameRate:
return true;
case PixelAspectRatio:
case PixelFormat:
case UserParameter:
return false;
@@ -66,9 +68,11 @@ QVariant CameraBinViewfinderSettings::viewfinderParameter(ViewfinderParameter pa
switch (parameter) {
case Resolution:
return m_resolution;
case PixelAspectRatio:
case MinimumFrameRate:
return m_minimumFrameRate;
case MaximumFrameRate:
return m_maximumFrameRate;
case PixelAspectRatio:
case PixelFormat:
case UserParameter:
return QVariant();
@@ -82,9 +86,13 @@ void CameraBinViewfinderSettings::setViewfinderParameter(ViewfinderParameter par
case Resolution:
m_resolution = value.toSize();
break;
case PixelAspectRatio:
case MinimumFrameRate:
m_minimumFrameRate = value.toFloat();
break;
case MaximumFrameRate:
m_maximumFrameRate = value.toFloat();
break;
case PixelAspectRatio:
case PixelFormat:
case UserParameter:
break;
@@ -96,4 +104,14 @@ QSize CameraBinViewfinderSettings::resolution() const
return m_resolution;
}
qreal CameraBinViewfinderSettings::minimumFrameRate() const
{
return m_minimumFrameRate;
}
qreal CameraBinViewfinderSettings::maximumFrameRate() const
{
return m_maximumFrameRate;
}
QT_END_NAMESPACE

View File

@@ -52,9 +52,13 @@ public:
void setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value);
QSize resolution() const;
qreal minimumFrameRate() const;
qreal maximumFrameRate() const;
private:
QSize m_resolution;
qreal m_minimumFrameRate;
qreal m_maximumFrameRate;
};
QT_END_NAMESPACE

View File

@@ -248,7 +248,7 @@ QIODevice *QPulseAudioInput::start()
return Q_NULLPTR;
m_pullMode = false;
m_audioSource = new InputPrivate(this);
m_audioSource = new PulseInputPrivate(this);
m_audioSource->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
setState(QAudio::IdleState);
@@ -661,7 +661,7 @@ bool QPulseAudioInput::deviceReady()
} else {
// emits readyRead() so user will call read() on QIODevice to get some audio data
if (m_audioSource != 0) {
InputPrivate *a = qobject_cast<InputPrivate*>(m_audioSource);
PulseInputPrivate *a = qobject_cast<PulseInputPrivate*>(m_audioSource);
a->trigger();
}
}
@@ -701,24 +701,24 @@ void QPulseAudioInput::onPulseContextFailed()
setState(QAudio::StoppedState);
}
InputPrivate::InputPrivate(QPulseAudioInput *audio)
PulseInputPrivate::PulseInputPrivate(QPulseAudioInput *audio)
{
m_audioDevice = qobject_cast<QPulseAudioInput*>(audio);
}
qint64 InputPrivate::readData(char *data, qint64 len)
qint64 PulseInputPrivate::readData(char *data, qint64 len)
{
return m_audioDevice->read(data, len);
}
qint64 InputPrivate::writeData(const char *data, qint64 len)
qint64 PulseInputPrivate::writeData(const char *data, qint64 len)
{
Q_UNUSED(data)
Q_UNUSED(len)
return 0;
}
void InputPrivate::trigger()
void PulseInputPrivate::trigger()
{
emit readyRead();
}

View File

@@ -60,7 +60,7 @@
QT_BEGIN_NAMESPACE
class InputPrivate;
class PulseInputPrivate;
class QPulseAudioInput : public QAbstractAudioInput
{
@@ -139,12 +139,12 @@ private:
pa_sample_spec m_spec;
};
class InputPrivate : public QIODevice
class PulseInputPrivate : public QIODevice
{
Q_OBJECT
public:
InputPrivate(QPulseAudioInput *audio);
~InputPrivate() {};
PulseInputPrivate(QPulseAudioInput *audio);
~PulseInputPrivate() {};
qint64 readData(char *data, qint64 len);
qint64 writeData(const char *data, qint64 len);

View File

@@ -237,7 +237,7 @@ QIODevice *QPulseAudioOutput::start()
if (!open())
return Q_NULLPTR;
m_audioSource = new OutputPrivate(this);
m_audioSource = new PulseOutputPrivate(this);
m_audioSource->open(QIODevice::WriteOnly|QIODevice::Unbuffered);
m_pullMode = false;
@@ -604,12 +604,12 @@ void QPulseAudioOutput::reset()
stop();
}
OutputPrivate::OutputPrivate(QPulseAudioOutput *audio)
PulseOutputPrivate::PulseOutputPrivate(QPulseAudioOutput *audio)
{
m_audioDevice = qobject_cast<QPulseAudioOutput*>(audio);
}
qint64 OutputPrivate::readData(char *data, qint64 len)
qint64 PulseOutputPrivate::readData(char *data, qint64 len)
{
Q_UNUSED(data)
Q_UNUSED(len)
@@ -617,7 +617,7 @@ qint64 OutputPrivate::readData(char *data, qint64 len)
return 0;
}
qint64 OutputPrivate::writeData(const char *data, qint64 len)
qint64 PulseOutputPrivate::writeData(const char *data, qint64 len)
{
int retry = 0;
qint64 written = 0;

View File

@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
class QPulseAudioOutput : public QAbstractAudioOutput
{
friend class OutputPrivate;
friend class PulseOutputPrivate;
Q_OBJECT
public:
@@ -140,14 +140,14 @@ private:
pa_sample_spec m_spec;
};
class OutputPrivate : public QIODevice
class PulseOutputPrivate : public QIODevice
{
friend class QPulseAudioOutput;
Q_OBJECT
public:
OutputPrivate(QPulseAudioOutput *audio);
virtual ~OutputPrivate() {}
PulseOutputPrivate(QPulseAudioOutput *audio);
virtual ~PulseOutputPrivate() {}
protected:
qint64 readData(char *data, qint64 len);

View File

@@ -61,6 +61,7 @@ void QSGVivanteVideoNode::setCurrentFrame(const QVideoFrame &frame)
const QMap<QVideoFrame::PixelFormat, GLenum>& QSGVivanteVideoNode::getVideoFormat2GLFormatMap()
{
if (static_VideoFormat2GLFormatMap.isEmpty()) {
static_VideoFormat2GLFormatMap.insert(QVideoFrame::Format_YUV420P, GL_VIV_I420);
static_VideoFormat2GLFormatMap.insert(QVideoFrame::Format_YV12, GL_VIV_YV12);
static_VideoFormat2GLFormatMap.insert(QVideoFrame::Format_NV12, GL_VIV_NV12);
static_VideoFormat2GLFormatMap.insert(QVideoFrame::Format_NV21, GL_VIV_NV21);