GStreamer: added convenience function in QGstUtils.
-> qt_gst_element_get_factory_name(GstElement *elem) Change-Id: Icf806488b49fbcdecdd605b6316bd1ef8796a883 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
This commit is contained in:
@@ -1453,6 +1453,17 @@ GstCaps *qt_gst_caps_normalize(GstCaps *caps)
|
||||
#endif
|
||||
}
|
||||
|
||||
const gchar *qt_gst_element_get_factory_name(GstElement *element)
|
||||
{
|
||||
const gchar *name = 0;
|
||||
const GstElementFactory *factory = 0;
|
||||
|
||||
if (element && (factory = gst_element_get_factory(element)))
|
||||
name = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(factory));
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
QDebug operator <<(QDebug debug, GstCaps *caps)
|
||||
{
|
||||
if (caps) {
|
||||
|
||||
@@ -147,6 +147,7 @@ GstStructure *qt_gst_structure_new_empty(const char *name);
|
||||
gboolean qt_gst_element_query_position(GstElement *element, GstFormat format, gint64 *cur);
|
||||
gboolean qt_gst_element_query_duration(GstElement *element, GstFormat format, gint64 *cur);
|
||||
GstCaps *qt_gst_caps_normalize(GstCaps *caps);
|
||||
const gchar *qt_gst_element_get_factory_name(GstElement *element);
|
||||
|
||||
QDebug operator <<(QDebug debug, GstCaps *caps);
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "camerabinaudioencoder.h"
|
||||
#include "camerabincontainer.h"
|
||||
#include <private/qgstcodecsinfo_p.h>
|
||||
#include <private/qgstutils_p.h>
|
||||
|
||||
#include <QtCore/qdebug.h>
|
||||
|
||||
@@ -120,8 +121,7 @@ GstEncodingProfile *CameraBinAudioEncoder::createProfile()
|
||||
void CameraBinAudioEncoder::applySettings(GstElement *encoder)
|
||||
{
|
||||
GObjectClass * const objectClass = G_OBJECT_GET_CLASS(encoder);
|
||||
const char * const name = gst_plugin_feature_get_name(
|
||||
GST_PLUGIN_FEATURE(gst_element_get_factory(encoder)));
|
||||
const char * const name = qt_gst_element_get_factory_name(encoder);
|
||||
|
||||
const bool isVorbis = qstrcmp(name, "vorbisenc") == 0;
|
||||
|
||||
|
||||
@@ -388,7 +388,7 @@ void CameraBinSession::setupCaptureResolution()
|
||||
gst_caps_unref(caps);
|
||||
|
||||
// Special case when using mfw_v4lsrc
|
||||
if (m_videoSrc && qstrcmp(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(gst_element_get_factory(m_videoSrc))), "mfw_v4lsrc") == 0) {
|
||||
if (m_videoSrc && qstrcmp(qt_gst_element_get_factory_name(m_videoSrc), "mfw_v4lsrc") == 0) {
|
||||
int capMode = 0;
|
||||
if (viewfinderResolution == QSize(320, 240))
|
||||
capMode = 1;
|
||||
@@ -472,9 +472,7 @@ GstElement *CameraBinSession::buildCameraSource()
|
||||
#if CAMERABIN_DEBUG
|
||||
qDebug() << "set camera device" << m_inputDevice;
|
||||
#endif
|
||||
const char *const cameraSrcName = gst_plugin_feature_get_name(
|
||||
GST_PLUGIN_FEATURE(gst_element_get_factory(m_cameraSrc)));
|
||||
m_usingWrapperCameraBinSrc = qstrcmp(cameraSrcName, "wrappercamerabinsrc") == 0;
|
||||
m_usingWrapperCameraBinSrc = qstrcmp(qt_gst_element_get_factory_name(m_cameraSrc), "wrappercamerabinsrc") == 0;
|
||||
|
||||
if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_cameraSrc), "video-source")) {
|
||||
if (!m_videoSrc) {
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "camerabinvideoencoder.h"
|
||||
#include "camerabinsession.h"
|
||||
#include "camerabincontainer.h"
|
||||
#include <private/qgstutils_p.h>
|
||||
|
||||
#include <QtCore/qdebug.h>
|
||||
|
||||
@@ -178,8 +179,7 @@ GstEncodingProfile *CameraBinVideoEncoder::createProfile()
|
||||
void CameraBinVideoEncoder::applySettings(GstElement *encoder)
|
||||
{
|
||||
GObjectClass * const objectClass = G_OBJECT_GET_CLASS(encoder);
|
||||
const char * const name = gst_plugin_feature_get_name(
|
||||
GST_PLUGIN_FEATURE(gst_element_get_factory(encoder)));
|
||||
const char * const name = qt_gst_element_get_factory_name(encoder);
|
||||
|
||||
const int bitRate = m_actualVideoSettings.bitRate();
|
||||
if (bitRate == -1) {
|
||||
|
||||
Reference in New Issue
Block a user