mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2025-06-06 15:39:00 +00:00
Code cleanup
Use GNU formatter from Eclipse.
This commit is contained in:
parent
606b1bb3eb
commit
2d75a32dd0
21 changed files with 2718 additions and 2812 deletions
|
@ -1,13 +1,15 @@
|
||||||
#include "CustomMenuAction.h"
|
#include "CustomMenuAction.h"
|
||||||
|
|
||||||
CustomMenuAction::CustomMenuAction(const QString& displayName, QObject * parent)
|
CustomMenuAction::CustomMenuAction (const QString& displayName,
|
||||||
:QAction(displayName, parent)
|
QObject * parent)
|
||||||
, m_name(displayName)
|
: QAction (displayName, parent),
|
||||||
|
m_name (displayName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomMenuAction::CustomMenuAction(const QString& displayName, const QString& name, QObject * parent)
|
CustomMenuAction::CustomMenuAction (const QString& displayName,
|
||||||
:QAction(displayName, parent)
|
const QString& name, QObject * parent)
|
||||||
, m_name(name)
|
: QAction (displayName, parent),
|
||||||
|
m_name (name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,18 @@
|
||||||
#ifndef CUSTOM_MENU_ACTION_H_
|
#ifndef CUSTOM_MENU_ACTION_H_
|
||||||
#define CUSTOM_MENU_ACTION_H_
|
#define CUSTOM_MENU_ACTION_H_
|
||||||
|
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
class CustomMenuAction: public QAction
|
class CustomMenuAction: public QAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CustomMenuAction(const QString& displayName, QObject * parent);
|
CustomMenuAction(const QString& displayName, QObject * parent);
|
||||||
|
|
||||||
CustomMenuAction(const QString& displayName, const QString& name, QObject * parent);
|
CustomMenuAction(const QString& displayName, const QString& name, QObject * parent);
|
||||||
|
|
||||||
QString getName() { return m_name;}
|
QString getName() {return m_name;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_name;
|
QString m_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif //CUSTOM_MENU_ACTION_H_
|
#endif //CUSTOM_MENU_ACTION_H_
|
||||||
|
|
|
@ -5,34 +5,35 @@
|
||||||
#define COMPANY_NAME "virinext"
|
#define COMPANY_NAME "virinext"
|
||||||
#define APPLICATION_NAME "pipeviz"
|
#define APPLICATION_NAME "pipeviz"
|
||||||
|
|
||||||
void CustomSettings::saveLastIODirectory(const QString &name)
|
void
|
||||||
|
CustomSettings::saveLastIODirectory (const QString &name)
|
||||||
{
|
{
|
||||||
QSettings settings(COMPANY_NAME, APPLICATION_NAME);
|
QSettings settings (COMPANY_NAME, APPLICATION_NAME);
|
||||||
settings.setValue("last_directory", name);
|
settings.setValue ("last_directory", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
QString CustomSettings::lastIODirectory()
|
CustomSettings::lastIODirectory ()
|
||||||
{
|
{
|
||||||
QSettings settings(COMPANY_NAME, APPLICATION_NAME);
|
QSettings settings (COMPANY_NAME, APPLICATION_NAME);
|
||||||
QString res = settings.value("last_directory").toString();
|
QString res = settings.value ("last_directory").toString ();
|
||||||
|
|
||||||
if(res.isEmpty())
|
if (res.isEmpty ())
|
||||||
res = "./";
|
res = "./";
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void CustomSettings::saveMainWindowGeometry(const QByteArray &geometry)
|
CustomSettings::saveMainWindowGeometry (const QByteArray &geometry)
|
||||||
{
|
{
|
||||||
QSettings settings(COMPANY_NAME, APPLICATION_NAME);
|
QSettings settings (COMPANY_NAME, APPLICATION_NAME);
|
||||||
settings.setValue("geometry", geometry);
|
settings.setValue ("geometry", geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray
|
||||||
QByteArray CustomSettings::mainWindowGeometry()
|
CustomSettings::mainWindowGeometry ()
|
||||||
{
|
{
|
||||||
QSettings settings(COMPANY_NAME, APPLICATION_NAME);
|
QSettings settings (COMPANY_NAME, APPLICATION_NAME);
|
||||||
return settings.value("geometry").toByteArray();
|
return settings.value ("geometry").toByteArray ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
|
||||||
|
|
||||||
namespace CustomSettings
|
namespace CustomSettings
|
||||||
{
|
{
|
||||||
void saveLastIODirectory(const QString &name);
|
void saveLastIODirectory(const QString &name);
|
||||||
|
@ -14,6 +13,4 @@ namespace CustomSettings
|
||||||
QByteArray mainWindowGeometry();
|
QByteArray mainWindowGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,231 +11,208 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
ElementProperties::ElementProperties(QSharedPointer<GraphManager> pGraph, const char *name,
|
ElementProperties::ElementProperties (QSharedPointer<GraphManager> pGraph,
|
||||||
QWidget *parent, Qt::WindowFlags flags):
|
const char *name, QWidget *parent,
|
||||||
QWidget(parent, flags),
|
Qt::WindowFlags flags)
|
||||||
m_pGraphManager(pGraph),
|
: QWidget (parent, flags),
|
||||||
m_name(name)
|
m_pGraphManager (pGraph),
|
||||||
|
m_name (name)
|
||||||
{
|
{
|
||||||
setWindowTitle(QString(name) + " properties");
|
setWindowTitle (QString (name) + " properties");
|
||||||
|
|
||||||
create();
|
create ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void ElementProperties::addParamEnum(GParamSpec *param, GstElement *element, QGridLayout *play)
|
ElementProperties::addParamEnum (GParamSpec *param, GstElement *element,
|
||||||
|
QGridLayout *play)
|
||||||
{
|
{
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
|
|
||||||
g_value_init (&value, param -> value_type);
|
g_value_init (&value, param->value_type);
|
||||||
if(param -> flags & G_PARAM_READABLE)
|
if (param->flags & G_PARAM_READABLE)
|
||||||
g_object_get_property (G_OBJECT(element), param -> name, &value);
|
g_object_get_property (G_OBJECT (element), param->name, &value);
|
||||||
else
|
else {
|
||||||
{
|
const GValue *valueDef = g_param_spec_get_default_value (param);
|
||||||
const GValue *valueDef = g_param_spec_get_default_value(param);
|
g_value_copy (valueDef, &value);
|
||||||
g_value_copy(valueDef, &value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString propertyName = g_param_spec_get_name (param);
|
QString propertyName = g_param_spec_get_name (param);
|
||||||
int propertyValue;
|
int propertyValue;
|
||||||
|
|
||||||
propertyValue = g_value_get_enum(&value);
|
propertyValue = g_value_get_enum (&value);
|
||||||
|
|
||||||
GParamSpecEnum *penumSpec = G_PARAM_SPEC_ENUM(param);
|
GParamSpecEnum *penumSpec = G_PARAM_SPEC_ENUM (param);
|
||||||
|
|
||||||
if(!penumSpec)
|
if (!penumSpec)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QComboBox *pcomBox = new QComboBox;
|
QComboBox *pcomBox = new QComboBox;
|
||||||
|
|
||||||
for(std::size_t i=0; i<penumSpec -> enum_class -> n_values; i++)
|
for (std::size_t i = 0; i < penumSpec->enum_class->n_values; i++) {
|
||||||
{
|
QVariant var (penumSpec->enum_class->values[i].value);
|
||||||
QVariant var(penumSpec -> enum_class -> values[i].value);
|
QString valueName = penumSpec->enum_class->values[i].value_name;
|
||||||
QString valueName = penumSpec -> enum_class -> values[i].value_name;
|
|
||||||
|
|
||||||
pcomBox -> addItem(valueName, var);
|
pcomBox->addItem (valueName, var);
|
||||||
|
|
||||||
if(penumSpec -> enum_class -> values[i].value == propertyValue)
|
if (penumSpec->enum_class->values[i].value == propertyValue)
|
||||||
pcomBox -> setCurrentIndex(i);
|
pcomBox->setCurrentIndex (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int row = play->rowCount ();
|
||||||
int row = play -> rowCount();
|
play->addWidget (new QLabel (propertyName), row, 0);
|
||||||
|
play->addWidget (pcomBox, row, 1);
|
||||||
play -> addWidget(new QLabel(propertyName), row, 0);
|
m_values.insert (propertyName, pcomBox);
|
||||||
|
|
||||||
play -> addWidget(pcomBox, row, 1);
|
|
||||||
|
|
||||||
m_values.insert(propertyName, pcomBox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void ElementProperties::addParamFlags(GParamSpec *param, GstElement *element, QGridLayout *play)
|
ElementProperties::addParamFlags (GParamSpec *param, GstElement *element,
|
||||||
|
QGridLayout *play)
|
||||||
{
|
{
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
|
|
||||||
g_value_init (&value, param -> value_type);
|
g_value_init (&value, param->value_type);
|
||||||
if(param -> flags & G_PARAM_READABLE)
|
if (param->flags & G_PARAM_READABLE)
|
||||||
g_object_get_property (G_OBJECT(element), param -> name, &value);
|
g_object_get_property (G_OBJECT (element), param->name, &value);
|
||||||
else
|
else {
|
||||||
{
|
const GValue *valueDef = g_param_spec_get_default_value (param);
|
||||||
const GValue *valueDef = g_param_spec_get_default_value(param);
|
g_value_copy (valueDef, &value);
|
||||||
g_value_copy(valueDef, &value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString propertyName = g_param_spec_get_name (param);
|
QString propertyName = g_param_spec_get_name (param);
|
||||||
int propertyValue;
|
int propertyValue;
|
||||||
|
|
||||||
propertyValue = g_value_get_flags(&value);
|
propertyValue = g_value_get_flags (&value);
|
||||||
|
|
||||||
GParamSpecFlags *pflagsSpec = G_PARAM_SPEC_FLAGS(param);
|
GParamSpecFlags *pflagsSpec = G_PARAM_SPEC_FLAGS (param);
|
||||||
|
|
||||||
if(!pflagsSpec)
|
if (!pflagsSpec)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QComboBox *pcomBox = new QComboBox;
|
QComboBox *pcomBox = new QComboBox;
|
||||||
|
|
||||||
for(std::size_t i=0; i<pflagsSpec -> flags_class -> n_values; i++)
|
for (std::size_t i = 0; i < pflagsSpec->flags_class->n_values; i++) {
|
||||||
{
|
QVariant var (pflagsSpec->flags_class->values[i].value);
|
||||||
QVariant var(pflagsSpec -> flags_class -> values[i].value);
|
QString valueName = pflagsSpec->flags_class->values[i].value_name;
|
||||||
QString valueName = pflagsSpec -> flags_class -> values[i].value_name;
|
|
||||||
|
|
||||||
pcomBox -> addItem(valueName, var);
|
pcomBox->addItem (valueName, var);
|
||||||
|
|
||||||
if(pflagsSpec -> flags_class -> values[i].value == propertyValue)
|
if (pflagsSpec->flags_class->values[i].value == propertyValue)
|
||||||
pcomBox -> setCurrentIndex(i);
|
pcomBox->setCurrentIndex (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int row = play->rowCount ();
|
||||||
|
|
||||||
int row = play -> rowCount();
|
play->addWidget (new QLabel (propertyName), row, 0);
|
||||||
|
|
||||||
play -> addWidget(new QLabel(propertyName), row, 0);
|
play->addWidget (pcomBox, row, 1);
|
||||||
|
|
||||||
play -> addWidget(pcomBox, row, 1);
|
m_values.insert (propertyName, pcomBox);
|
||||||
|
|
||||||
m_values.insert(propertyName, pcomBox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ElementProperties::addParamSimple (GParamSpec *param, GstElement *element,
|
||||||
void ElementProperties::addParamSimple(GParamSpec *param, GstElement *element, QGridLayout *play)
|
QGridLayout *play)
|
||||||
{
|
{
|
||||||
bool readOnly = true;
|
bool readOnly = true;
|
||||||
|
|
||||||
if(param->flags & G_PARAM_WRITABLE)
|
if (param->flags & G_PARAM_WRITABLE)
|
||||||
readOnly = false;
|
readOnly = false;
|
||||||
|
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
|
|
||||||
g_value_init (&value, param -> value_type);
|
g_value_init (&value, param->value_type);
|
||||||
if(param -> flags & G_PARAM_READABLE)
|
if (param->flags & G_PARAM_READABLE)
|
||||||
g_object_get_property (G_OBJECT(element), param -> name, &value);
|
g_object_get_property (G_OBJECT (element), param->name, &value);
|
||||||
else
|
else {
|
||||||
{
|
const GValue *valueDef = g_param_spec_get_default_value (param);
|
||||||
const GValue *valueDef = g_param_spec_get_default_value(param);
|
g_value_copy (valueDef, &value);
|
||||||
g_value_copy(valueDef, &value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString propertyName = g_param_spec_get_name (param);
|
QString propertyName = g_param_spec_get_name (param);
|
||||||
QString propertyValue;
|
QString propertyValue;
|
||||||
|
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
|
|
||||||
switch (G_VALUE_TYPE (&value))
|
switch (G_VALUE_TYPE (&value)) {
|
||||||
{
|
case G_TYPE_STRING: {
|
||||||
case G_TYPE_STRING:
|
|
||||||
{
|
|
||||||
const char *string_val = g_value_get_string (&value);
|
const char *string_val = g_value_get_string (&value);
|
||||||
propertyValue = string_val;
|
propertyValue = string_val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_BOOLEAN:
|
case G_TYPE_BOOLEAN: {
|
||||||
{
|
|
||||||
gboolean bool_val = g_value_get_boolean (&value);
|
gboolean bool_val = g_value_get_boolean (&value);
|
||||||
propertyValue = QString::number(bool_val);
|
propertyValue = QString::number (bool_val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_ULONG:
|
case G_TYPE_ULONG: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_ulong (&value));
|
||||||
propertyValue = QString::number(g_value_get_ulong(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_LONG:
|
case G_TYPE_LONG: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_long (&value));
|
||||||
propertyValue = QString::number(g_value_get_long(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_UINT:
|
case G_TYPE_UINT: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_uint (&value));
|
||||||
propertyValue = QString::number(g_value_get_uint(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_INT:
|
case G_TYPE_INT: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_int (&value));
|
||||||
propertyValue = QString::number(g_value_get_int(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_UINT64:
|
case G_TYPE_UINT64: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_uint64 (&value));
|
||||||
propertyValue = QString::number(g_value_get_uint64(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_INT64:
|
case G_TYPE_INT64: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_int64 (&value));
|
||||||
propertyValue = QString::number(g_value_get_int64(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_FLOAT:
|
case G_TYPE_FLOAT: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_float (&value));
|
||||||
propertyValue = QString::number(g_value_get_float(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_DOUBLE:
|
case G_TYPE_DOUBLE: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_double (&value));
|
||||||
propertyValue = QString::number(g_value_get_double(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_CHAR:
|
case G_TYPE_CHAR: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_char (&value));
|
||||||
propertyValue = QString::number(g_value_get_char(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_UCHAR:
|
case G_TYPE_UCHAR: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_uchar (&value));
|
||||||
propertyValue = QString::number(g_value_get_uchar(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
skip = true;
|
skip = true;
|
||||||
qDebug() << "property " << propertyName << " not supported";
|
qDebug () << "property " << propertyName << " not supported";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int row = play -> rowCount();
|
int row = play->rowCount ();
|
||||||
|
|
||||||
play -> addWidget(new QLabel(propertyName), row, 0);
|
play->addWidget (new QLabel (propertyName), row, 0);
|
||||||
|
|
||||||
QLineEdit *ple = new QLineEdit(propertyValue);
|
QLineEdit *ple = new QLineEdit (propertyValue);
|
||||||
ple -> setReadOnly(readOnly);
|
ple->setReadOnly (readOnly);
|
||||||
play -> addWidget(ple, row, 1);
|
play->addWidget (ple, row, 1);
|
||||||
if(!skip)
|
if (!skip)
|
||||||
m_values.insert(propertyName, ple);
|
m_values.insert (propertyName, ple);
|
||||||
else
|
else
|
||||||
ple -> setReadOnly(true);
|
ple->setReadOnly (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void ElementProperties::create()
|
ElementProperties::create ()
|
||||||
{
|
{
|
||||||
GstElement *element = gst_bin_get_by_name (GST_BIN(m_pGraphManager -> m_pGraph), m_name.toStdString().c_str());
|
GstElement *element = gst_bin_get_by_name (
|
||||||
|
GST_BIN (m_pGraphManager->m_pGraph), m_name.toStdString ().c_str ());
|
||||||
|
|
||||||
if(!element)
|
if (!element)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QGridLayout *play = new QGridLayout;
|
QGridLayout *play = new QGridLayout;
|
||||||
|
@ -243,196 +220,178 @@ void ElementProperties::create()
|
||||||
GParamSpec **prop_specs;
|
GParamSpec **prop_specs;
|
||||||
guint num_props;
|
guint num_props;
|
||||||
|
|
||||||
prop_specs = g_object_class_list_properties(G_OBJECT_GET_CLASS (element),
|
prop_specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (element),
|
||||||
&num_props);
|
&num_props);
|
||||||
|
|
||||||
for(std::size_t i = 0; i<num_props; i++)
|
for (std::size_t i = 0; i < num_props; i++) {
|
||||||
{
|
|
||||||
GParamSpec *param = prop_specs[i];
|
GParamSpec *param = prop_specs[i];
|
||||||
|
|
||||||
if(G_IS_PARAM_SPEC_ENUM(param))
|
if (G_IS_PARAM_SPEC_ENUM (param))
|
||||||
addParamEnum(param, element, play);
|
addParamEnum (param, element, play);
|
||||||
else if(G_IS_PARAM_SPEC_FLAGS(param))
|
else if (G_IS_PARAM_SPEC_FLAGS (param))
|
||||||
addParamFlags(param, element, play);
|
addParamFlags (param, element, play);
|
||||||
else
|
else
|
||||||
addParamSimple(param, element, play);
|
addParamSimple (param, element, play);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVBoxLayout *pvblay = new QVBoxLayout;
|
QVBoxLayout *pvblay = new QVBoxLayout;
|
||||||
QWidget *pwgt = new QWidget(this);
|
QWidget *pwgt = new QWidget (this);
|
||||||
pwgt -> setLayout(play);
|
pwgt->setLayout (play);
|
||||||
QScrollArea *pscroll = new QScrollArea(this);
|
QScrollArea *pscroll = new QScrollArea (this);
|
||||||
pscroll -> setWidget(pwgt);
|
pscroll->setWidget (pwgt);
|
||||||
|
|
||||||
pvblay -> addWidget(pscroll);
|
pvblay->addWidget (pscroll);
|
||||||
|
|
||||||
QHBoxLayout *phblay = new QHBoxLayout;
|
QHBoxLayout *phblay = new QHBoxLayout;
|
||||||
|
|
||||||
QPushButton *pcmdApply = new QPushButton("Apply");
|
QPushButton *pcmdApply = new QPushButton ("Apply");
|
||||||
QPushButton *pcmdOk = new QPushButton("OK");
|
QPushButton *pcmdOk = new QPushButton ("OK");
|
||||||
QPushButton *pcmdCancel = new QPushButton("Cancel");
|
QPushButton *pcmdCancel = new QPushButton ("Cancel");
|
||||||
|
|
||||||
|
phblay->addStretch (1);
|
||||||
|
phblay->addWidget (pcmdApply);
|
||||||
|
phblay->addWidget (pcmdCancel);
|
||||||
|
phblay->addWidget (pcmdOk);
|
||||||
|
|
||||||
phblay -> addStretch(1);
|
pvblay->addLayout (phblay);
|
||||||
phblay -> addWidget(pcmdApply);
|
|
||||||
phblay -> addWidget(pcmdCancel);
|
|
||||||
phblay -> addWidget(pcmdOk);
|
|
||||||
|
|
||||||
pvblay -> addLayout(phblay);
|
QObject::connect (pcmdApply, SIGNAL (clicked ()), this,
|
||||||
|
SLOT (applyClicked ()));
|
||||||
|
QObject::connect (pcmdCancel, SIGNAL (clicked ()), this, SLOT (close ()));
|
||||||
|
QObject::connect (pcmdOk, SIGNAL (clicked ()), this, SLOT (okClicked ()));
|
||||||
|
|
||||||
QObject::connect(pcmdApply, SIGNAL(clicked()), this, SLOT(applyClicked()));
|
setLayout (pvblay);
|
||||||
QObject::connect(pcmdCancel, SIGNAL(clicked()), this, SLOT(close()));
|
|
||||||
QObject::connect(pcmdOk, SIGNAL(clicked()), this, SLOT(okClicked()));
|
|
||||||
|
|
||||||
setLayout(pvblay);
|
g_free (prop_specs);
|
||||||
|
gst_object_unref (element);
|
||||||
g_free(prop_specs);
|
|
||||||
gst_object_unref(element);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElementProperties::applyClicked()
|
void
|
||||||
|
ElementProperties::applyClicked ()
|
||||||
{
|
{
|
||||||
GstElement *element = gst_bin_get_by_name (GST_BIN(m_pGraphManager -> m_pGraph),
|
GstElement *element = gst_bin_get_by_name (
|
||||||
m_name.toStdString().c_str());
|
GST_BIN (m_pGraphManager->m_pGraph), m_name.toStdString ().c_str ());
|
||||||
|
|
||||||
if(!element)
|
if (!element)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QMap<QString, QWidget *>::iterator itr = m_values.begin();
|
QMap<QString, QWidget *>::iterator itr = m_values.begin ();
|
||||||
|
|
||||||
for(;itr != m_values.end(); itr++)
|
for (; itr != m_values.end (); itr++) {
|
||||||
{
|
GParamSpec *param = g_object_class_find_property (
|
||||||
GParamSpec *param = g_object_class_find_property(G_OBJECT_GET_CLASS (element),
|
G_OBJECT_GET_CLASS (element), itr.key ().toStdString ().c_str ());
|
||||||
itr.key().toStdString().c_str());
|
|
||||||
|
|
||||||
if(!param)
|
if (!param) {
|
||||||
{
|
qDebug () << "problem with setting " << itr.key () << " property";
|
||||||
qDebug() << "problem with setting " << itr.key() << " property";
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(param -> flags & G_PARAM_WRITABLE))
|
if (!(param->flags & G_PARAM_WRITABLE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QString valStr;
|
QString valStr;
|
||||||
|
|
||||||
if(dynamic_cast<QLineEdit *>(itr.value()))
|
if (dynamic_cast<QLineEdit *> (itr.value ()))
|
||||||
valStr = ((QLineEdit *) itr.value()) -> text();
|
valStr = ((QLineEdit *) itr.value ())->text ();
|
||||||
else if(dynamic_cast<QComboBox *>(itr.value()))
|
else if (dynamic_cast<QComboBox *> (itr.value ())) {
|
||||||
{
|
QComboBox *pcomBox = (QComboBox *) itr.value ();
|
||||||
QComboBox *pcomBox = (QComboBox *) itr.value();
|
int val = pcomBox->itemData (pcomBox->currentIndex ()).toInt ();
|
||||||
int val = pcomBox -> itemData(pcomBox -> currentIndex()).toInt();
|
valStr = QString::number (val);
|
||||||
valStr = QString::number(val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string tmpStr = itr.key().toStdString();
|
std::string tmpStr = itr.key ().toStdString ();
|
||||||
const char *propName = tmpStr.c_str();
|
const char *propName = tmpStr.c_str ();
|
||||||
|
|
||||||
if(G_IS_PARAM_SPEC_ENUM(param) || G_IS_PARAM_SPEC_FLAGS(param))
|
if (G_IS_PARAM_SPEC_ENUM (param) || G_IS_PARAM_SPEC_FLAGS (param)) {
|
||||||
{
|
if (dynamic_cast<QComboBox *> (itr.value ())) {
|
||||||
if(dynamic_cast<QComboBox *>(itr.value()))
|
QComboBox *pcomBox = (QComboBox *) itr.value ();
|
||||||
{
|
int val = pcomBox->itemData (pcomBox->currentIndex ()).toInt ();
|
||||||
QComboBox *pcomBox = (QComboBox *) itr.value();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
int val = pcomBox -> itemData(pcomBox -> currentIndex()).toInt();
|
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
switch (param->value_type) {
|
||||||
switch (param -> value_type)
|
case G_TYPE_STRING: {
|
||||||
{
|
g_object_set (G_OBJECT (element), propName,
|
||||||
case G_TYPE_STRING:
|
valStr.toStdString ().c_str (), NULL);
|
||||||
{
|
|
||||||
g_object_set(G_OBJECT(element), propName, valStr.toStdString().c_str(), NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_BOOLEAN:
|
case G_TYPE_BOOLEAN: {
|
||||||
{
|
gboolean val = valStr.toInt ();
|
||||||
gboolean val = valStr.toInt();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_ULONG:
|
case G_TYPE_ULONG: {
|
||||||
{
|
gulong val = valStr.toULong ();
|
||||||
gulong val = valStr.toULong();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_LONG:
|
case G_TYPE_LONG: {
|
||||||
{
|
glong val = valStr.toLong ();
|
||||||
glong val = valStr.toLong();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_UINT:
|
case G_TYPE_UINT: {
|
||||||
{
|
guint val = valStr.toUInt ();
|
||||||
guint val = valStr.toUInt();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_INT:
|
case G_TYPE_INT: {
|
||||||
{
|
gint val = valStr.toInt ();
|
||||||
gint val = valStr.toInt();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_UINT64:
|
case G_TYPE_UINT64: {
|
||||||
{
|
guint64 val = valStr.toULongLong ();
|
||||||
guint64 val = valStr.toULongLong();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_INT64:
|
case G_TYPE_INT64: {
|
||||||
{
|
gint64 val = valStr.toLongLong ();
|
||||||
gint64 val = valStr.toLongLong();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_FLOAT:
|
case G_TYPE_FLOAT: {
|
||||||
{
|
gfloat val = valStr.toFloat ();
|
||||||
gfloat val = valStr.toFloat();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_DOUBLE:
|
case G_TYPE_DOUBLE: {
|
||||||
{
|
gdouble val = valStr.toDouble ();
|
||||||
gdouble val = valStr.toDouble();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_CHAR:
|
case G_TYPE_CHAR: {
|
||||||
{
|
gchar val = valStr.toInt ();
|
||||||
gchar val = valStr.toInt();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_UCHAR:
|
case G_TYPE_UCHAR: {
|
||||||
{
|
guchar val = valStr.toUInt ();
|
||||||
guchar val = valStr.toUInt();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
qDebug () << "property " << itr.key () << " not supported";
|
||||||
qDebug() << "property " << itr.key() << " not supported";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_unref(element);
|
gst_object_unref (element);
|
||||||
|
|
||||||
delete layout();
|
delete layout ();
|
||||||
qDeleteAll(children());
|
qDeleteAll (
|
||||||
|
children ());
|
||||||
|
|
||||||
|
create ();
|
||||||
create();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElementProperties::okClicked()
|
void
|
||||||
|
ElementProperties::okClicked ()
|
||||||
{
|
{
|
||||||
applyClicked();
|
applyClicked ();
|
||||||
close();
|
close ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,11 @@
|
||||||
|
|
||||||
class ElementProperties: public QWidget
|
class ElementProperties: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElementProperties(QSharedPointer<GraphManager> pGraphManager, const char *name,
|
ElementProperties(QSharedPointer<GraphManager> pGraphManager, const char *name,
|
||||||
QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void applyClicked();
|
void applyClicked();
|
||||||
void okClicked();
|
void okClicked();
|
||||||
|
@ -33,5 +32,4 @@ private:
|
||||||
void addParamFlags(GParamSpec *value, GstElement *element, QGridLayout *play);
|
void addParamFlags(GParamSpec *value, GstElement *element, QGridLayout *play);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -7,16 +7,12 @@
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
|
|
||||||
|
|
||||||
#include "GraphManager.h"
|
#include "GraphManager.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GraphDisplay: public QWidget
|
class GraphDisplay: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GraphDisplay(QWidget *parent=0, Qt::WindowFlags f=0);
|
GraphDisplay(QWidget *parent=0, Qt::WindowFlags f=0);
|
||||||
|
@ -28,7 +24,6 @@ public:
|
||||||
|
|
||||||
void keyPressEvent(QKeyEvent* event);
|
void keyPressEvent(QKeyEvent* event);
|
||||||
|
|
||||||
|
|
||||||
QSharedPointer<GraphManager> m_pGraph;
|
QSharedPointer<GraphManager> m_pGraph;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -57,7 +52,6 @@ private:
|
||||||
QPoint m_startPosition;
|
QPoint m_startPosition;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct ElementDisplayInfo
|
struct ElementDisplayInfo
|
||||||
{
|
{
|
||||||
QRect m_rect;
|
QRect m_rect;
|
||||||
|
@ -90,5 +84,4 @@ private:
|
||||||
MoveInfo m_moveInfo;
|
MoveInfo m_moveInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,65 +10,71 @@
|
||||||
#include "CustomSettings.h"
|
#include "CustomSettings.h"
|
||||||
|
|
||||||
#define MAX_STR_CAPS_SIZE 150
|
#define MAX_STR_CAPS_SIZE 150
|
||||||
gchar* get_str_caps_limited(gchar* str)
|
gchar*
|
||||||
|
get_str_caps_limited (gchar* str)
|
||||||
{
|
{
|
||||||
gchar* result;
|
gchar* result;
|
||||||
if(strlen(str) > MAX_STR_CAPS_SIZE) {
|
if (strlen (str) > MAX_STR_CAPS_SIZE) {
|
||||||
result = g_strndup(str, MAX_STR_CAPS_SIZE);
|
result = g_strndup (str, MAX_STR_CAPS_SIZE);
|
||||||
for(int i = strlen(result)-1;i > strlen(result)-4 ;i--)
|
for (int i = strlen (result) - 1; i > strlen (result) - 4; i--)
|
||||||
result[i] = '.';
|
result[i] = '.';
|
||||||
} else
|
}
|
||||||
result = g_strdup(str);
|
else
|
||||||
|
result = g_strdup (str);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
typefind_have_type_callback (GstElement * typefind,
|
typefind_have_type_callback (GstElement * typefind, guint probability,
|
||||||
guint probability, GstCaps * caps, GraphManager * thiz)
|
GstCaps * caps, GraphManager * thiz)
|
||||||
{
|
{
|
||||||
gchar *caps_description = gst_caps_to_string (caps);
|
gchar *caps_description = gst_caps_to_string (caps);
|
||||||
qDebug() << "Found caps " << caps_description << " with probability " << probability;
|
qDebug () << "Found caps " << caps_description << " with probability "
|
||||||
g_free(caps_description);
|
<< probability;
|
||||||
thiz->Pause();
|
g_free (caps_description);
|
||||||
|
thiz->Pause ();
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphManager::GraphManager()
|
GraphManager::GraphManager ()
|
||||||
{
|
{
|
||||||
m_pGraph = gst_pipeline_new ("pipeline");
|
m_pGraph = gst_pipeline_new ("pipeline");
|
||||||
m_pluginsList = new PluginsList();
|
m_pluginsList = new PluginsList ();
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphManager::~GraphManager()
|
GraphManager::~GraphManager ()
|
||||||
{
|
{
|
||||||
delete m_pluginsList;
|
delete m_pluginsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GraphManager::getPadCaps(ElementInfo* elementInfo, PadInfo* padInfo, ePadCapsSubset subset, bool afTruncated)
|
QString
|
||||||
|
GraphManager::getPadCaps (ElementInfo* elementInfo, PadInfo* padInfo,
|
||||||
|
ePadCapsSubset subset, bool afTruncated)
|
||||||
{
|
{
|
||||||
QString padCaps = "";
|
QString padCaps = "";
|
||||||
if(!elementInfo || !padInfo)
|
if (!elementInfo || !padInfo)
|
||||||
return padCaps;
|
return padCaps;
|
||||||
|
|
||||||
GstElement *element = gst_bin_get_by_name (GST_BIN(m_pGraph), elementInfo->m_name.c_str());
|
GstElement *element = gst_bin_get_by_name (GST_BIN (m_pGraph),
|
||||||
|
elementInfo->m_name.c_str ());
|
||||||
|
|
||||||
if(!element)
|
if (!element)
|
||||||
return padCaps;
|
return padCaps;
|
||||||
GstPad *pad = gst_element_get_static_pad(GST_ELEMENT(element), padInfo->m_name.c_str());
|
GstPad *pad = gst_element_get_static_pad (GST_ELEMENT (element),
|
||||||
if(!pad) {
|
padInfo->m_name.c_str ());
|
||||||
gst_object_unref(element);
|
if (!pad) {
|
||||||
|
gst_object_unref (element);
|
||||||
return padCaps;
|
return padCaps;
|
||||||
}
|
}
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
switch(subset)
|
switch (subset) {
|
||||||
{
|
|
||||||
case PAD_CAPS_ALLOWED:
|
case PAD_CAPS_ALLOWED:
|
||||||
caps = gst_pad_get_allowed_caps(pad);
|
caps = gst_pad_get_allowed_caps (pad);
|
||||||
break;
|
break;
|
||||||
case PAD_CAPS_NEGOCIATED:
|
case PAD_CAPS_NEGOCIATED:
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
caps = gst_pad_get_current_caps(pad);
|
caps = gst_pad_get_current_caps(pad);
|
||||||
#else
|
#else
|
||||||
caps = gst_pad_get_negotiated_caps(pad);
|
caps = gst_pad_get_negotiated_caps (pad);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case PAD_CAPS_ALL:
|
case PAD_CAPS_ALL:
|
||||||
|
@ -76,269 +82,265 @@ QString GraphManager::getPadCaps(ElementInfo* elementInfo, PadInfo* padInfo, ePa
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
caps = gst_pad_query_caps(pad, NULL);
|
caps = gst_pad_query_caps(pad, NULL);
|
||||||
#else
|
#else
|
||||||
caps = gst_pad_get_caps(pad);
|
caps = gst_pad_get_caps (pad);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
caps = gst_pad_query_caps(pad, NULL);
|
caps = gst_pad_query_caps(pad, NULL);
|
||||||
#else
|
#else
|
||||||
caps = gst_pad_get_caps(pad);
|
caps = gst_pad_get_caps (pad);
|
||||||
#endif
|
#endif
|
||||||
if(caps) {
|
if (caps) {
|
||||||
gchar* str = gst_caps_to_string(caps);
|
gchar* str = gst_caps_to_string (caps);
|
||||||
if (afTruncated) {
|
if (afTruncated) {
|
||||||
gchar* str_limited = get_str_caps_limited(str);
|
gchar* str_limited = get_str_caps_limited (str);
|
||||||
g_free(str);
|
g_free (str);
|
||||||
padCaps = str_limited;
|
padCaps = str_limited;
|
||||||
g_free(str_limited);
|
g_free (str_limited);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
padCaps = str;
|
padCaps = str;
|
||||||
g_free(str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_unref(element);
|
gst_object_unref (element);
|
||||||
gst_object_unref (pad);
|
gst_object_unref (pad);
|
||||||
return padCaps;
|
return padCaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar* GraphManager::AddPlugin(const char *plugin, const char *name)
|
gchar*
|
||||||
|
GraphManager::AddPlugin (const char *plugin, const char *name)
|
||||||
{
|
{
|
||||||
GstElement *pel = gst_element_factory_make(plugin, name);
|
GstElement *pel = gst_element_factory_make (plugin, name);
|
||||||
if(!pel)
|
if (!pel)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if(GST_IS_URI_HANDLER(pel))
|
if (GST_IS_URI_HANDLER (pel)) {
|
||||||
{
|
static const gchar * const *protocols;
|
||||||
static const gchar *const *protocols;
|
protocols = gst_uri_handler_get_protocols (GST_URI_HANDLER (pel));
|
||||||
protocols = gst_uri_handler_get_protocols(GST_URI_HANDLER(pel));
|
|
||||||
|
|
||||||
bool isFile = false;
|
bool isFile = false;
|
||||||
|
|
||||||
for(std::size_t i=0; protocols[i] != NULL; i++)
|
for (std::size_t i = 0; protocols[i] != NULL; i++) {
|
||||||
{
|
if (strcmp ("file", protocols[i]) == 0) {
|
||||||
if(strcmp("file", protocols[i]) == 0)
|
|
||||||
{
|
|
||||||
isFile = true;
|
isFile = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isFile)
|
if (isFile) {
|
||||||
{
|
|
||||||
QString path;
|
QString path;
|
||||||
QString dir = CustomSettings::lastIODirectory();
|
QString dir = CustomSettings::lastIODirectory ();
|
||||||
|
|
||||||
if(gst_uri_handler_get_uri_type(GST_URI_HANDLER(pel)) == GST_URI_SRC)
|
if (gst_uri_handler_get_uri_type (GST_URI_HANDLER (pel)) == GST_URI_SRC)
|
||||||
path = QFileDialog::getOpenFileName(NULL, "Open Media Source File...", dir);
|
path = QFileDialog::getOpenFileName (NULL, "Open Media Source File...",
|
||||||
|
dir);
|
||||||
else
|
else
|
||||||
path = QFileDialog::getSaveFileName(NULL, "Open Sink File...", dir);
|
path = QFileDialog::getSaveFileName (NULL, "Open Sink File...", dir);
|
||||||
|
|
||||||
if(!path.isEmpty())
|
if (!path.isEmpty ()) {
|
||||||
{
|
gchar *uri = gst_filename_to_uri (path.toStdString ().c_str (),
|
||||||
gchar *uri = gst_filename_to_uri(path.toStdString().c_str(), NULL);
|
NULL);
|
||||||
if(uri)
|
if (uri) {
|
||||||
{
|
qDebug () << "Set uri: " << uri;
|
||||||
qDebug() << "Set uri: " << uri;
|
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
gst_uri_handler_set_uri(GST_URI_HANDLER(pel), uri, NULL);
|
gst_uri_handler_set_uri(GST_URI_HANDLER(pel), uri, NULL);
|
||||||
#else
|
#else
|
||||||
gst_uri_handler_set_uri(GST_URI_HANDLER(pel), uri);
|
gst_uri_handler_set_uri (GST_URI_HANDLER (pel), uri);
|
||||||
#endif
|
#endif
|
||||||
g_free(uri);
|
g_free (uri);
|
||||||
|
|
||||||
QString dir = QFileInfo(path).absoluteDir().absolutePath();
|
QString dir = QFileInfo (path).absoluteDir ().absolutePath ();
|
||||||
CustomSettings::saveLastIODirectory(dir);
|
CustomSettings::saveLastIODirectory (dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
QString uri = QInputDialog::getText (NULL, "Uri...", "Uri:");
|
||||||
QString uri = QInputDialog::getText(NULL, "Uri...", "Uri:");
|
|
||||||
|
|
||||||
if(!uri.isEmpty())
|
if (!uri.isEmpty ()) {
|
||||||
{
|
qDebug () << "Set uri: " << uri;
|
||||||
qDebug() << "Set uri: " << uri;
|
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
gst_uri_handler_set_uri(GST_URI_HANDLER(pel), uri.toStdString().c_str(), NULL);
|
gst_uri_handler_set_uri(GST_URI_HANDLER(pel), uri.toStdString().c_str(), NULL);
|
||||||
#else
|
#else
|
||||||
gst_uri_handler_set_uri(GST_URI_HANDLER(pel), uri.toStdString().c_str());
|
gst_uri_handler_set_uri (GST_URI_HANDLER (pel),
|
||||||
|
uri.toStdString ().c_str ());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool res = gst_bin_add(GST_BIN(m_pGraph), pel);
|
bool res = gst_bin_add (GST_BIN (m_pGraph), pel);
|
||||||
if (res)
|
if (res)
|
||||||
gst_element_sync_state_with_parent(pel);
|
gst_element_sync_state_with_parent (pel);
|
||||||
else {
|
else {
|
||||||
gst_object_unref(pel);
|
gst_object_unref (pel);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return gst_element_get_name(pel);
|
return gst_element_get_name (pel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
bool GraphManager::RemovePlugin(const char *name)
|
GraphManager::RemovePlugin (const char *name)
|
||||||
{
|
{
|
||||||
GstElement *element = gst_bin_get_by_name (GST_BIN(m_pGraph), name);
|
GstElement *element = gst_bin_get_by_name (GST_BIN (m_pGraph), name);
|
||||||
|
|
||||||
if(!element)
|
if (!element)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool res = gst_bin_remove (GST_BIN(m_pGraph), element);
|
bool res = gst_bin_remove (GST_BIN (m_pGraph), element);
|
||||||
gst_object_unref(element);
|
gst_object_unref (element);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
bool GraphManager::OpenUri(const char *uri, const char *name)
|
GraphManager::OpenUri (const char *uri, const char *name)
|
||||||
{
|
{
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
GstElement *element = gst_element_make_from_uri(GST_URI_SRC, uri, name, NULL);
|
GstElement *element = gst_element_make_from_uri(GST_URI_SRC, uri, name, NULL);
|
||||||
#else
|
#else
|
||||||
GstElement *element = gst_element_make_from_uri(GST_URI_SRC, uri, name);
|
GstElement *element = gst_element_make_from_uri (GST_URI_SRC, uri, name);
|
||||||
#endif
|
#endif
|
||||||
if(!element)
|
if (!element)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool res = gst_bin_add(GST_BIN(m_pGraph), element);
|
bool res = gst_bin_add (GST_BIN (m_pGraph), element);
|
||||||
if(res)
|
if (res)
|
||||||
gst_element_sync_state_with_parent(element);
|
gst_element_sync_state_with_parent (element);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphManager::Connect(const char *srcElement, const char *srcPad,
|
bool
|
||||||
|
GraphManager::Connect (const char *srcElement, const char *srcPad,
|
||||||
const char *dstElement, const char *dstPad)
|
const char *dstElement, const char *dstPad)
|
||||||
{
|
{
|
||||||
GstElement *src = gst_bin_get_by_name (GST_BIN(m_pGraph), srcElement);
|
GstElement *src = gst_bin_get_by_name (GST_BIN (m_pGraph), srcElement);
|
||||||
GstElement *dst = gst_bin_get_by_name (GST_BIN(m_pGraph), dstElement);
|
GstElement *dst = gst_bin_get_by_name (GST_BIN (m_pGraph), dstElement);
|
||||||
|
|
||||||
bool res = gst_element_link_pads(src, srcPad, dst, dstPad);
|
bool res = gst_element_link_pads (src, srcPad, dst, dstPad);
|
||||||
|
|
||||||
gboolean seekRes = gst_element_seek_simple(m_pGraph, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, 0);
|
gboolean seekRes = gst_element_seek_simple (m_pGraph, GST_FORMAT_TIME,
|
||||||
|
GST_SEEK_FLAG_FLUSH, 0);
|
||||||
|
|
||||||
gst_object_unref(src);
|
gst_object_unref (src);
|
||||||
gst_object_unref(dst);
|
gst_object_unref (dst);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphManager::Connect(const char *srcElement, const char *dstElement)
|
bool
|
||||||
|
GraphManager::Connect (const char *srcElement, const char *dstElement)
|
||||||
{
|
{
|
||||||
GstElement *src = gst_bin_get_by_name (GST_BIN(m_pGraph), srcElement);
|
GstElement *src = gst_bin_get_by_name (GST_BIN (m_pGraph), srcElement);
|
||||||
GstElement *dst = gst_bin_get_by_name (GST_BIN(m_pGraph), dstElement);
|
GstElement *dst = gst_bin_get_by_name (GST_BIN (m_pGraph), dstElement);
|
||||||
|
|
||||||
bool res = gst_element_link(src, dst);
|
bool res = gst_element_link (src, dst);
|
||||||
|
|
||||||
gboolean seekRes = gst_element_seek_simple(m_pGraph, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, 0);
|
gboolean seekRes = gst_element_seek_simple (m_pGraph, GST_FORMAT_TIME,
|
||||||
|
GST_SEEK_FLAG_FLUSH, 0);
|
||||||
|
|
||||||
/* add a callback to handle have-type signal */
|
/* add a callback to handle have-type signal */
|
||||||
if (g_str_has_prefix(dstElement,"typefindelement")) {
|
if (g_str_has_prefix (dstElement, "typefindelement")) {
|
||||||
g_signal_connect (dst, "have-type",
|
g_signal_connect (dst, "have-type",
|
||||||
G_CALLBACK (typefind_have_type_callback),
|
G_CALLBACK (typefind_have_type_callback), this);
|
||||||
this);
|
Play ();
|
||||||
Play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_unref(src);
|
gst_object_unref (src);
|
||||||
gst_object_unref(dst);
|
gst_object_unref (dst);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphManager::Disconnect(const char *srcElement, const char *srcPad,
|
bool
|
||||||
|
GraphManager::Disconnect (const char *srcElement, const char *srcPad,
|
||||||
const char *dstElement, const char *dstPad)
|
const char *dstElement, const char *dstPad)
|
||||||
{
|
{
|
||||||
GstElement *src = gst_bin_get_by_name (GST_BIN(m_pGraph), srcElement);
|
GstElement *src = gst_bin_get_by_name (GST_BIN (m_pGraph), srcElement);
|
||||||
GstElement *dst = gst_bin_get_by_name (GST_BIN(m_pGraph), dstElement);
|
GstElement *dst = gst_bin_get_by_name (GST_BIN (m_pGraph), dstElement);
|
||||||
|
|
||||||
|
gst_element_unlink_pads (src, srcPad, dst, dstPad);
|
||||||
|
|
||||||
gst_element_unlink_pads(src, srcPad, dst, dstPad);
|
gst_object_unref (src);
|
||||||
|
gst_object_unref (dst);
|
||||||
gst_object_unref(src);
|
|
||||||
gst_object_unref(dst);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector <ElementInfo> GraphManager::GetInfo()
|
std::vector<ElementInfo>
|
||||||
|
GraphManager::GetInfo ()
|
||||||
{
|
{
|
||||||
std::vector <ElementInfo> res;
|
std::vector<ElementInfo> res;
|
||||||
|
|
||||||
GstIterator *iter;
|
GstIterator *iter;
|
||||||
iter = gst_bin_iterate_elements (GST_BIN (m_pGraph));
|
iter = gst_bin_iterate_elements (GST_BIN (m_pGraph));
|
||||||
GstElement* element = NULL;
|
GstElement* element = NULL;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
size_t id = 0;
|
size_t id = 0;
|
||||||
while (!done)
|
while (!done) {
|
||||||
{
|
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
GValue value = { 0 };
|
GValue value =
|
||||||
|
{ 0};
|
||||||
switch (gst_iterator_next (iter, &value))
|
switch (gst_iterator_next (iter, &value))
|
||||||
{
|
{
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
{
|
{
|
||||||
element = GST_ELEMENT(g_value_get_object(&value));
|
element = GST_ELEMENT(g_value_get_object(&value));
|
||||||
#else
|
#else
|
||||||
switch (gst_iterator_next (iter, (gpointer *)&element))
|
switch (gst_iterator_next (iter, (gpointer *) &element)) {
|
||||||
{
|
case GST_ITERATOR_OK: {
|
||||||
case GST_ITERATOR_OK:
|
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
ElementInfo elementInfo;
|
ElementInfo elementInfo;
|
||||||
elementInfo.m_id = id;
|
elementInfo.m_id = id;
|
||||||
id++;
|
id++;
|
||||||
|
|
||||||
gchar *name = gst_element_get_name(element);
|
gchar *name = gst_element_get_name (element);
|
||||||
elementInfo.m_name = name;
|
elementInfo.m_name = name;
|
||||||
g_free(name);
|
g_free (name);
|
||||||
|
|
||||||
GstElementFactory *pfactory =
|
GstElementFactory *pfactory = gst_element_get_factory (element);
|
||||||
gst_element_get_factory(element);
|
|
||||||
|
|
||||||
elementInfo.m_pluginName =
|
elementInfo.m_pluginName = gst_plugin_feature_get_name (
|
||||||
gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(pfactory));
|
GST_PLUGIN_FEATURE (pfactory));
|
||||||
|
|
||||||
GstIterator *padItr = gst_element_iterate_pads (element);
|
GstIterator *padItr = gst_element_iterate_pads (element);
|
||||||
bool padDone = FALSE;
|
bool padDone = FALSE;
|
||||||
std::size_t padId = 0;
|
std::size_t padId = 0;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
while (!padDone)
|
while (!padDone) {
|
||||||
{
|
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
GValue padVal = { 0 };
|
GValue padVal =
|
||||||
|
{ 0};
|
||||||
switch (gst_iterator_next (padItr, &padVal))
|
switch (gst_iterator_next (padItr, &padVal))
|
||||||
{
|
{
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
{
|
{
|
||||||
pad = GST_PAD(g_value_get_object(&padVal));
|
pad = GST_PAD(g_value_get_object(&padVal));
|
||||||
#else
|
#else
|
||||||
switch (gst_iterator_next (padItr, (gpointer *)&pad))
|
switch (gst_iterator_next (padItr, (gpointer *) &pad)) {
|
||||||
{
|
case GST_ITERATOR_OK: {
|
||||||
case GST_ITERATOR_OK:
|
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
PadInfo padInfo;
|
PadInfo padInfo;
|
||||||
padInfo.m_id = padId;
|
padInfo.m_id = padId;
|
||||||
|
|
||||||
gchar *pad_name = gst_pad_get_name(pad);
|
gchar *pad_name = gst_pad_get_name (pad);
|
||||||
padInfo.m_name = pad_name;
|
padInfo.m_name = pad_name;
|
||||||
g_free(pad_name);
|
g_free (pad_name);
|
||||||
|
|
||||||
GstPadDirection direction = gst_pad_get_direction(pad);
|
GstPadDirection direction = gst_pad_get_direction (pad);
|
||||||
if(direction == GST_PAD_SRC)
|
if (direction == GST_PAD_SRC)
|
||||||
padInfo.m_type = PadInfo::Out;
|
padInfo.m_type = PadInfo::Out;
|
||||||
else if(direction == GST_PAD_SINK)
|
else if (direction == GST_PAD_SINK)
|
||||||
padInfo.m_type = PadInfo::In;
|
padInfo.m_type = PadInfo::In;
|
||||||
else
|
else
|
||||||
padInfo.m_type = PadInfo::None;
|
padInfo.m_type = PadInfo::None;
|
||||||
|
|
||||||
elementInfo.m_pads.push_back(padInfo);
|
elementInfo.m_pads.push_back (padInfo);
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
g_value_reset (&padVal);
|
g_value_reset (&padVal);
|
||||||
#endif
|
#endif
|
||||||
|
@ -355,13 +357,12 @@ std::vector <ElementInfo> GraphManager::GetInfo()
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
g_value_reset (&value);
|
g_value_reset (&value);
|
||||||
#endif
|
#endif
|
||||||
res.push_back(elementInfo);
|
res.push_back (elementInfo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_ITERATOR_DONE:
|
case GST_ITERATOR_DONE:
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
case GST_ITERATOR_ERROR:
|
case GST_ITERATOR_ERROR: {
|
||||||
{
|
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -370,35 +371,30 @@ std::vector <ElementInfo> GraphManager::GetInfo()
|
||||||
|
|
||||||
gst_iterator_free (iter);
|
gst_iterator_free (iter);
|
||||||
|
|
||||||
for(std::size_t i=0; i<res.size(); i++)
|
for (std::size_t i = 0; i < res.size (); i++) {
|
||||||
{
|
res[i].m_connections.resize (res[i].m_pads.size ());
|
||||||
res[i].m_connections.resize(res[i].m_pads.size());
|
|
||||||
|
|
||||||
GstElement *element = gst_bin_get_by_name (GST_BIN(m_pGraph), res[i].m_name.c_str());
|
GstElement *element = gst_bin_get_by_name (GST_BIN (m_pGraph),
|
||||||
|
res[i].m_name.c_str ());
|
||||||
|
|
||||||
for(std::size_t j=0; j<res[i].m_pads.size(); j++)
|
for (std::size_t j = 0; j < res[i].m_pads.size (); j++) {
|
||||||
{
|
|
||||||
res[i].m_connections[j].m_elementId = -1;
|
res[i].m_connections[j].m_elementId = -1;
|
||||||
res[i].m_connections[j].m_padId = -1;
|
res[i].m_connections[j].m_padId = -1;
|
||||||
|
|
||||||
GstPad *pad = gst_element_get_static_pad (element, res[i].m_pads[j].m_name.c_str());
|
GstPad *pad = gst_element_get_static_pad (
|
||||||
GstPad *peerPad = gst_pad_get_peer(pad);
|
element, res[i].m_pads[j].m_name.c_str ());
|
||||||
|
GstPad *peerPad = gst_pad_get_peer (pad);
|
||||||
|
|
||||||
if(peerPad)
|
if (peerPad) {
|
||||||
{
|
GstElement *peerElement = GST_ELEMENT (gst_pad_get_parent (peerPad));
|
||||||
GstElement *peerElement = GST_ELEMENT(gst_pad_get_parent(peerPad));
|
|
||||||
|
|
||||||
gchar *peerName = gst_element_get_name(peerElement);
|
gchar *peerName = gst_element_get_name (peerElement);
|
||||||
gchar *peerPadName = gst_pad_get_name(peerPad);
|
gchar *peerPadName = gst_pad_get_name (peerPad);
|
||||||
|
|
||||||
for(std::size_t k=0; k<res.size(); k++)
|
for (std::size_t k = 0; k < res.size (); k++) {
|
||||||
{
|
if (res[k].m_name == peerName) {
|
||||||
if(res[k].m_name == peerName)
|
for (std::size_t l = 0; l < res[k].m_pads.size (); l++) {
|
||||||
{
|
if (res[k].m_pads[l].m_name == peerPadName) {
|
||||||
for(std::size_t l=0; l<res[k].m_pads.size(); l++)
|
|
||||||
{
|
|
||||||
if(res[k].m_pads[l].m_name == peerPadName)
|
|
||||||
{
|
|
||||||
res[i].m_connections[j].m_elementId = res[k].m_id;
|
res[i].m_connections[j].m_elementId = res[k].m_id;
|
||||||
res[i].m_connections[j].m_padId = res[k].m_pads[l].m_id;
|
res[i].m_connections[j].m_padId = res[k].m_pads[l].m_id;
|
||||||
break;
|
break;
|
||||||
|
@ -407,64 +403,64 @@ std::vector <ElementInfo> GraphManager::GetInfo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(peerName);
|
g_free (peerName);
|
||||||
g_free(peerPadName);
|
g_free (peerPadName);
|
||||||
|
|
||||||
gst_object_unref(peerPad);
|
gst_object_unref (peerPad);
|
||||||
gst_object_unref(peerElement);
|
gst_object_unref (peerElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_unref(pad);
|
gst_object_unref (pad);
|
||||||
}
|
}
|
||||||
gst_object_unref(element);
|
gst_object_unref (element);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
bool GraphManager::Play()
|
GraphManager::Play ()
|
||||||
{
|
{
|
||||||
GstStateChangeReturn res;
|
GstStateChangeReturn res;
|
||||||
gst_element_set_state(m_pGraph, GST_STATE_PLAYING);
|
gst_element_set_state (m_pGraph, GST_STATE_PLAYING);
|
||||||
|
|
||||||
GstState state;
|
GstState state;
|
||||||
res = gst_element_get_state (m_pGraph, &state, NULL, GST_SECOND);
|
res = gst_element_get_state (m_pGraph, &state, NULL, GST_SECOND);
|
||||||
|
|
||||||
if(res != GST_STATE_CHANGE_SUCCESS)
|
if (res != GST_STATE_CHANGE_SUCCESS) {
|
||||||
{
|
gst_element_abort_state (m_pGraph);
|
||||||
gst_element_abort_state(m_pGraph);
|
qDebug () << "state changing to Play was FAILED";
|
||||||
qDebug() << "state changing to Play was FAILED";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return state == GST_STATE_PLAYING;
|
return state == GST_STATE_PLAYING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
bool GraphManager::Pause()
|
GraphManager::Pause ()
|
||||||
{
|
{
|
||||||
GstStateChangeReturn res;
|
GstStateChangeReturn res;
|
||||||
|
|
||||||
GstState state;
|
GstState state;
|
||||||
gst_element_set_state(m_pGraph, GST_STATE_PAUSED);
|
gst_element_set_state (m_pGraph, GST_STATE_PAUSED);
|
||||||
res = gst_element_get_state (m_pGraph, &state, NULL, GST_SECOND);
|
res = gst_element_get_state (m_pGraph, &state, NULL, GST_SECOND);
|
||||||
if(res != GST_STATE_CHANGE_SUCCESS)
|
if (res != GST_STATE_CHANGE_SUCCESS) {
|
||||||
{
|
gst_element_abort_state (m_pGraph);
|
||||||
gst_element_abort_state(m_pGraph);
|
qDebug () << "state changing to Pause was FAILED";
|
||||||
qDebug() << "state changing to Pause was FAILED";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return state == GST_STATE_PAUSED;
|
return state == GST_STATE_PAUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphManager::Stop()
|
bool
|
||||||
|
GraphManager::Stop ()
|
||||||
{
|
{
|
||||||
GstStateChangeReturn res = gst_element_set_state(m_pGraph, GST_STATE_READY);
|
GstStateChangeReturn res = gst_element_set_state (m_pGraph, GST_STATE_READY);
|
||||||
return res == GST_STATE_CHANGE_SUCCESS;
|
return res == GST_STATE_CHANGE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
double GraphManager::GetPosition()
|
double
|
||||||
|
GraphManager::GetPosition ()
|
||||||
{
|
{
|
||||||
gint64 current, duration;
|
gint64 current, duration;
|
||||||
GstFormat fmt = GST_FORMAT_TIME;
|
GstFormat fmt = GST_FORMAT_TIME;
|
||||||
|
@ -472,7 +468,7 @@ double GraphManager::GetPosition()
|
||||||
if(!gst_element_query_position(m_pGraph, fmt, ¤t))
|
if(!gst_element_query_position(m_pGraph, fmt, ¤t))
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
if(!gst_element_query_position(m_pGraph, &fmt, ¤t))
|
if (!gst_element_query_position (m_pGraph, &fmt, ¤t))
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -480,33 +476,33 @@ double GraphManager::GetPosition()
|
||||||
if(!gst_element_query_duration(m_pGraph, fmt, &duration))
|
if(!gst_element_query_duration(m_pGraph, fmt, &duration))
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
if(!gst_element_query_duration(m_pGraph, &fmt, &duration))
|
if (!gst_element_query_duration (m_pGraph, &fmt, &duration))
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(duration < 0 || current < 0)
|
if (duration < 0 || current < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (double) current / duration;
|
return (double) current / duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
bool GraphManager::SetPosition(double pos)
|
GraphManager::SetPosition (double pos)
|
||||||
{
|
{
|
||||||
GstQuery *query = gst_query_new_seeking(GST_FORMAT_TIME);
|
GstQuery *query = gst_query_new_seeking (GST_FORMAT_TIME);
|
||||||
GstFormat fmt = GST_FORMAT_TIME;
|
GstFormat fmt = GST_FORMAT_TIME;
|
||||||
if(!query)
|
if (!query)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!gst_element_query(m_pGraph, query))
|
if (!gst_element_query (m_pGraph, query))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
gboolean seekable;
|
gboolean seekable;
|
||||||
gst_query_parse_seeking(query, NULL, &seekable, NULL, NULL);
|
gst_query_parse_seeking (query, NULL, &seekable, NULL, NULL);
|
||||||
|
|
||||||
gst_query_unref(query);
|
gst_query_unref (query);
|
||||||
|
|
||||||
if(!seekable)
|
if (!seekable)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
gint64 duration;
|
gint64 duration;
|
||||||
|
@ -515,19 +511,23 @@ bool GraphManager::SetPosition(double pos)
|
||||||
if(!gst_element_query_duration(m_pGraph, fmt, &duration))
|
if(!gst_element_query_duration(m_pGraph, fmt, &duration))
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
if(!gst_element_query_duration(m_pGraph, &fmt, &duration))
|
if (!gst_element_query_duration (m_pGraph, &fmt, &duration))
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(duration < 0)
|
if (duration < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
gboolean seekRes = gst_element_seek_simple(m_pGraph, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, duration * pos);
|
gboolean seekRes = gst_element_seek_simple (m_pGraph, GST_FORMAT_TIME,
|
||||||
|
GST_SEEK_FLAG_FLUSH,
|
||||||
|
duration * pos);
|
||||||
|
|
||||||
return seekRes;
|
return seekRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphManager::CanConnect(const char *srcName, const char *srcPadName, const char *destName, bool noANY)
|
bool
|
||||||
|
GraphManager::CanConnect (const char *srcName, const char *srcPadName,
|
||||||
|
const char *destName, bool noANY)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
bool added = false;
|
bool added = false;
|
||||||
|
@ -537,73 +537,74 @@ bool GraphManager::CanConnect(const char *srcName, const char *srcPadName, const
|
||||||
GstCaps* srcCaps = NULL;
|
GstCaps* srcCaps = NULL;
|
||||||
GstElementFactory *destFactory = NULL;
|
GstElementFactory *destFactory = NULL;
|
||||||
|
|
||||||
src = gst_bin_get_by_name (GST_BIN(m_pGraph), srcName);
|
src = gst_bin_get_by_name (GST_BIN (m_pGraph), srcName);
|
||||||
if (!src) {
|
if (!src) {
|
||||||
qDebug() << "Unable to get the src element: " << srcName;
|
qDebug () << "Unable to get the src element: " << srcName;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
srcPad = gst_element_get_static_pad(src, srcPadName);
|
srcPad = gst_element_get_static_pad (src, srcPadName);
|
||||||
if (!srcPad) {
|
if (!srcPad) {
|
||||||
qDebug() << "Unable to get the src pad";
|
qDebug () << "Unable to get the src pad";
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
srcCaps = gst_pad_get_current_caps(srcPad);
|
srcCaps = gst_pad_get_current_caps (srcPad);
|
||||||
if (!srcCaps) {
|
if (!srcCaps) {
|
||||||
qDebug() << "Unable to get the current caps for pad:" << srcPadName;
|
qDebug () << "Unable to get the current caps for pad:" << srcPadName;
|
||||||
srcCaps =gst_pad_get_pad_template_caps(srcPad);
|
srcCaps = gst_pad_get_pad_template_caps (srcPad);
|
||||||
if (!srcCaps) {
|
if (!srcCaps) {
|
||||||
qDebug() << "Unable to get the template caps for pad:" << srcPadName;
|
qDebug () << "Unable to get the template caps for pad:" << srcPadName;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dest = gst_element_factory_make(destName, NULL);
|
dest = gst_element_factory_make (destName, NULL);
|
||||||
if (!dest) {
|
if (!dest) {
|
||||||
qDebug() << "Unable to get the dest element: " << destName;
|
qDebug () << "Unable to get the dest element: " << destName;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
destFactory = gst_element_get_factory(dest);
|
destFactory = gst_element_get_factory (dest);
|
||||||
if (!destFactory) {
|
if (!destFactory) {
|
||||||
qDebug() << "Unable to get the dest factory";
|
qDebug () << "Unable to get the dest factory";
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (noANY && gst_element_factory_can_sink_any_caps(destFactory, srcCaps)) {
|
if (noANY && gst_element_factory_can_sink_any_caps (destFactory, srcCaps)) {
|
||||||
qDebug() << "The dest element " << destName << " can sink any caps";
|
qDebug () << "The dest element " << destName << " can sink any caps";
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!gst_element_factory_can_sink_all_caps(destFactory, srcCaps)) {
|
if (!gst_element_factory_can_sink_all_caps (destFactory, srcCaps)) {
|
||||||
gchar* caps_string = gst_caps_to_string(srcCaps);
|
gchar* caps_string = gst_caps_to_string (srcCaps);
|
||||||
qDebug() << "The dest element " << destName << " can not sink this caps: " << caps_string;
|
qDebug () << "The dest element " << destName << " can not sink this caps: "
|
||||||
|
<< caps_string;
|
||||||
g_free (caps_string);
|
g_free (caps_string);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
added = gst_bin_add(GST_BIN(m_pGraph), dest);
|
added = gst_bin_add (GST_BIN (m_pGraph), dest);
|
||||||
if (!added) {
|
if (!added) {
|
||||||
qDebug() << "Unable to add element to the bin";
|
qDebug () << "Unable to add element to the bin";
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gst_element_link(src,dest);
|
ret = gst_element_link (src, dest);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
qDebug() << "Can link elements src " << GST_OBJECT_NAME(src) << " with dest " << GST_OBJECT_NAME(dest);
|
qDebug () << "Can link elements src " << GST_OBJECT_NAME (src)
|
||||||
gst_element_unlink(src,dest);
|
<< " with dest " << GST_OBJECT_NAME (dest);
|
||||||
|
gst_element_unlink (src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done: if (added) {
|
||||||
if (added) {
|
gst_bin_remove (GST_BIN (m_pGraph), dest);
|
||||||
gst_bin_remove(GST_BIN(m_pGraph), dest);
|
|
||||||
dest = NULL;
|
dest = NULL;
|
||||||
}
|
}
|
||||||
if (src)
|
if (src)
|
||||||
gst_object_unref(src);
|
gst_object_unref (src);
|
||||||
if (srcPad)
|
if (srcPad)
|
||||||
gst_object_unref(srcPad);
|
gst_object_unref (srcPad);
|
||||||
if (dest)
|
if (dest)
|
||||||
gst_object_unref(dest);
|
gst_object_unref (dest);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ struct ElementInfo
|
||||||
|
|
||||||
class GraphManager
|
class GraphManager
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GraphManager();
|
GraphManager();
|
||||||
~GraphManager();
|
~GraphManager();
|
||||||
|
@ -111,8 +112,6 @@ public:
|
||||||
|
|
||||||
GstElement *m_pGraph;
|
GstElement *m_pGraph;
|
||||||
PluginsList *m_pluginsList;
|
PluginsList *m_pluginsList;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,255 +33,263 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags):
|
MainWindow::MainWindow (QWidget *parent, Qt::WindowFlags flags)
|
||||||
QMainWindow(parent, flags)
|
: QMainWindow (parent, flags),
|
||||||
,m_pGraph(new GraphManager)
|
m_pGraph (new GraphManager)
|
||||||
{
|
{
|
||||||
QToolBar *ptb = addToolBar("Menu");
|
QToolBar *ptb = addToolBar ("Menu");
|
||||||
|
|
||||||
QAction *pactAdd = ptb -> addAction("Add...");
|
QAction *pactAdd = ptb->addAction ("Add...");
|
||||||
pactAdd -> setShortcut(QKeySequence("Ctrl+F"));
|
pactAdd->setShortcut (QKeySequence ("Ctrl+F"));
|
||||||
connect(pactAdd, SIGNAL(triggered()), SLOT(AddPlugin()));
|
connect (pactAdd, SIGNAL (triggered ()), SLOT (AddPlugin ()));
|
||||||
|
|
||||||
|
QAction *pactOpenFile = ptb->addAction ("Open Media File...");
|
||||||
|
connect (pactOpenFile, SIGNAL (triggered ()), SLOT (OpenMediaFile ()));
|
||||||
|
|
||||||
QAction *pactOpenFile = ptb -> addAction("Open Media File...");
|
ptb->addSeparator ();
|
||||||
connect(pactOpenFile, SIGNAL(triggered()), SLOT(OpenMediaFile()));
|
|
||||||
|
|
||||||
ptb -> addSeparator();
|
QPixmap pxPlay (24, 24);
|
||||||
|
pxPlay.fill (QColor (0, 0, 0, 0));
|
||||||
|
QPainter pntrPlay (&pxPlay);
|
||||||
|
pntrPlay.setPen (Qt::darkGreen);
|
||||||
|
pntrPlay.setBrush (QBrush (Qt::darkGreen));
|
||||||
|
|
||||||
QPixmap pxPlay(24, 24);
|
QPolygon polygon (3);
|
||||||
pxPlay.fill(QColor(0, 0, 0, 0));
|
polygon.setPoint (0, 4, 4);
|
||||||
QPainter pntrPlay(&pxPlay);
|
polygon.setPoint (1, 4, 20);
|
||||||
pntrPlay.setPen(Qt::darkGreen);
|
polygon.setPoint (2, 20, 12);
|
||||||
pntrPlay.setBrush(QBrush(Qt::darkGreen));
|
|
||||||
|
|
||||||
QPolygon polygon(3);
|
pntrPlay.drawPolygon (polygon, Qt::WindingFill);
|
||||||
polygon.setPoint(0, 4, 4);
|
|
||||||
polygon.setPoint(1, 4, 20);
|
|
||||||
polygon.setPoint(2, 20, 12);
|
|
||||||
|
|
||||||
pntrPlay.drawPolygon(polygon, Qt::WindingFill);
|
QAction *pactPlay = ptb->addAction (QIcon (pxPlay), "Play");
|
||||||
|
connect (pactPlay, SIGNAL (triggered ()), SLOT (Play ()));
|
||||||
|
|
||||||
QAction *pactPlay = ptb -> addAction(QIcon(pxPlay), "Play");
|
QPixmap pxPause (24, 24);
|
||||||
connect(pactPlay, SIGNAL(triggered()), SLOT(Play()));
|
pxPause.fill (QColor (0, 0, 0, 0));
|
||||||
|
QPainter pntrPause (&pxPause);
|
||||||
|
pntrPause.setPen (Qt::darkGray);
|
||||||
|
pntrPause.setBrush (QBrush (Qt::darkGray));
|
||||||
|
|
||||||
QPixmap pxPause(24, 24);
|
pntrPause.drawRect (8, 4, 3, 16);
|
||||||
pxPause.fill(QColor(0, 0, 0, 0));
|
pntrPause.drawRect (13, 4, 3, 16);
|
||||||
QPainter pntrPause(&pxPause);
|
|
||||||
pntrPause.setPen(Qt::darkGray);
|
|
||||||
pntrPause.setBrush(QBrush(Qt::darkGray));
|
|
||||||
|
|
||||||
pntrPause.drawRect(8, 4, 3, 16);
|
QAction *pactPause = ptb->addAction (QIcon (pxPause), "Pause");
|
||||||
pntrPause.drawRect(13, 4, 3, 16);
|
connect (pactPause, SIGNAL (triggered ()), SLOT (Pause ()));
|
||||||
|
|
||||||
QAction *pactPause = ptb -> addAction(QIcon(pxPause), "Pause");
|
QPixmap pxStop (24, 24);
|
||||||
connect(pactPause, SIGNAL(triggered()), SLOT(Pause()));
|
pxStop.fill (QColor (0, 0, 0, 0));
|
||||||
|
QPainter pntrStop (&pxStop);
|
||||||
|
pntrStop.setPen (Qt::darkRed);
|
||||||
|
pntrStop.setBrush (QBrush (Qt::darkRed));
|
||||||
|
|
||||||
QPixmap pxStop(24, 24);
|
pntrStop.drawRect (6, 6, 12, 12);
|
||||||
pxStop.fill(QColor(0, 0, 0, 0));
|
|
||||||
QPainter pntrStop(&pxStop);
|
|
||||||
pntrStop.setPen(Qt::darkRed);
|
|
||||||
pntrStop.setBrush(QBrush(Qt::darkRed));
|
|
||||||
|
|
||||||
pntrStop.drawRect(6, 6, 12, 12);
|
QAction *pactStop = ptb->addAction (QIcon (pxStop), "Stop");
|
||||||
|
connect (pactStop, SIGNAL (triggered ()), SLOT (Stop ()));
|
||||||
|
|
||||||
QAction *pactStop = ptb -> addAction(QIcon(pxStop), "Stop");
|
QPixmap pxFulsh (24, 24);
|
||||||
connect(pactStop, SIGNAL(triggered()), SLOT(Stop()));
|
pxFulsh.fill (QColor (0, 0, 0, 0));
|
||||||
|
QPainter pntrFlush (&pxFulsh);
|
||||||
|
pntrFlush.setPen (Qt::darkGreen);
|
||||||
|
pntrFlush.setBrush (QBrush (Qt::darkGreen));
|
||||||
|
|
||||||
QPixmap pxFulsh(24, 24);
|
pntrFlush.drawRect (3, 4, 3, 16);
|
||||||
pxFulsh.fill(QColor(0, 0, 0, 0));
|
|
||||||
QPainter pntrFlush(&pxFulsh);
|
|
||||||
pntrFlush.setPen(Qt::darkGreen);
|
|
||||||
pntrFlush.setBrush(QBrush(Qt::darkGreen));
|
|
||||||
|
|
||||||
pntrFlush.drawRect(3, 4, 3, 16);
|
polygon = QPolygon (3);
|
||||||
|
polygon.setPoint (0, 9, 4);
|
||||||
|
polygon.setPoint (1, 9, 20);
|
||||||
|
polygon.setPoint (2, 21, 12);
|
||||||
|
|
||||||
polygon = QPolygon(3);
|
pntrFlush.drawPolygon (polygon, Qt::WindingFill);
|
||||||
polygon.setPoint(0, 9, 4);
|
|
||||||
polygon.setPoint(1, 9, 20);
|
|
||||||
polygon.setPoint(2, 21, 12);
|
|
||||||
|
|
||||||
pntrFlush.drawPolygon(polygon, Qt::WindingFill);
|
QAction *pactFlush = ptb->addAction (QIcon (pxFulsh), "Flush");
|
||||||
|
connect (pactFlush, SIGNAL (triggered ()), SLOT (Flush ()));
|
||||||
|
|
||||||
QAction *pactFlush = ptb -> addAction(QIcon(pxFulsh), "Flush");
|
QAction *pactClear = ptb->addAction ("Clear");
|
||||||
connect(pactFlush, SIGNAL(triggered()), SLOT(Flush()));
|
connect (pactClear, SIGNAL (triggered ()), SLOT (ClearGraph ()));
|
||||||
|
ptb->addSeparator ();
|
||||||
|
|
||||||
QAction *pactClear = ptb -> addAction("Clear");
|
m_pslider = new SeekSlider ();
|
||||||
connect(pactClear, SIGNAL(triggered()), SLOT(ClearGraph()));
|
m_pslider->setOrientation (Qt::Horizontal);
|
||||||
ptb -> addSeparator();
|
m_pslider->setRange (0, 10000);
|
||||||
|
m_pslider->setTracking (false);
|
||||||
m_pslider = new SeekSlider();
|
|
||||||
m_pslider -> setOrientation(Qt::Horizontal);
|
|
||||||
m_pslider -> setRange(0, 10000);
|
|
||||||
m_pslider -> setTracking(false);
|
|
||||||
|
|
||||||
connect(m_pslider, SIGNAL(valueChanged(int)), SLOT(Seek(int)));
|
connect(m_pslider, SIGNAL(valueChanged(int)), SLOT(Seek(int)));
|
||||||
ptb -> addWidget(m_pslider);
|
ptb->addWidget (m_pslider);
|
||||||
|
|
||||||
QMenu *pmenu = menuBar() -> addMenu("&File");
|
QMenu *pmenu = menuBar ()->addMenu ("&File");
|
||||||
|
|
||||||
QAction *pactOpen = pmenu -> addAction ("Open...", this, SLOT(Open()), QKeySequence::Open);
|
QAction *pactOpen = pmenu->addAction ("Open...", this, SLOT (Open ()),
|
||||||
|
QKeySequence::Open);
|
||||||
addAction (pactOpen);
|
addAction (pactOpen);
|
||||||
|
|
||||||
QAction *pactOpenMediaFile = pmenu -> addAction ("Open Media File...", this, SLOT(OpenMediaFile()), QKeySequence::Open);
|
QAction *pactOpenMediaFile = pmenu->addAction ("Open Media File...", this,
|
||||||
|
SLOT (OpenMediaFile ()),
|
||||||
|
QKeySequence::Open);
|
||||||
addAction (pactOpenMediaFile);
|
addAction (pactOpenMediaFile);
|
||||||
|
|
||||||
QAction *pactSave = pmenu -> addAction ("Save", this, SLOT(Save()), QKeySequence::Save);
|
QAction *pactSave = pmenu->addAction ("Save", this, SLOT (Save ()),
|
||||||
|
QKeySequence::Save);
|
||||||
addAction (pactSave);
|
addAction (pactSave);
|
||||||
|
|
||||||
QAction *pactSaveAs = pmenu -> addAction ("Save As...", this, SLOT(SaveAs()), QKeySequence::SaveAs);
|
QAction *pactSaveAs = pmenu->addAction ("Save As...", this, SLOT (SaveAs ()),
|
||||||
|
QKeySequence::SaveAs);
|
||||||
addAction (pactSaveAs);
|
addAction (pactSaveAs);
|
||||||
|
|
||||||
pmenu -> addSeparator();
|
pmenu->addSeparator ();
|
||||||
pmenu -> addAction("Exit", this, SLOT(close()));
|
pmenu->addAction ("Exit", this, SLOT (close ()));
|
||||||
|
|
||||||
|
pmenu = menuBar ()->addMenu ("&Graph");
|
||||||
|
|
||||||
pmenu = menuBar() -> addMenu("&Graph");
|
pmenu->addAction (pactAdd);
|
||||||
|
pmenu->addAction (pactOpenMediaFile);
|
||||||
|
pmenu->addAction ("Open Media Uri...", this, SLOT (OpenMediaUri ()));
|
||||||
|
pmenu->addSeparator ();
|
||||||
|
pmenu->addAction (pactPlay);
|
||||||
|
pmenu->addAction (pactPause);
|
||||||
|
pmenu->addAction (pactStop);
|
||||||
|
pmenu->addAction (pactFlush);
|
||||||
|
pmenu->addSeparator ();
|
||||||
|
pmenu->addAction (pactClear);
|
||||||
|
|
||||||
pmenu -> addAction(pactAdd);
|
pmenu = menuBar ()->addMenu ("&Help");
|
||||||
pmenu -> addAction(pactOpenMediaFile);
|
|
||||||
pmenu -> addAction ("Open Media Uri...", this, SLOT(OpenMediaUri()));
|
|
||||||
pmenu -> addSeparator();
|
|
||||||
pmenu -> addAction(pactPlay);
|
|
||||||
pmenu -> addAction(pactPause);
|
|
||||||
pmenu -> addAction(pactStop);
|
|
||||||
pmenu -> addAction(pactFlush);
|
|
||||||
pmenu -> addSeparator();
|
|
||||||
pmenu -> addAction(pactClear);
|
|
||||||
|
|
||||||
|
|
||||||
pmenu = menuBar() -> addMenu("&Help");
|
|
||||||
|
|
||||||
pmenu -> addAction ("About pipeviz...", this, SLOT(About()));
|
|
||||||
|
|
||||||
|
pmenu->addAction ("About pipeviz...", this, SLOT (About ()));
|
||||||
|
|
||||||
m_pGraphDisplay = new GraphDisplay;
|
m_pGraphDisplay = new GraphDisplay;
|
||||||
|
|
||||||
QScrollArea *pscroll = new QScrollArea;
|
QScrollArea *pscroll = new QScrollArea;
|
||||||
pscroll -> setWidget(m_pGraphDisplay);
|
pscroll->setWidget (m_pGraphDisplay);
|
||||||
pscroll -> setWidgetResizable(false);
|
pscroll->setWidgetResizable (false);
|
||||||
m_pGraphDisplay -> resize(10000, 10000);
|
m_pGraphDisplay->resize (10000, 10000);
|
||||||
m_pGraphDisplay -> m_pGraph = m_pGraph;
|
m_pGraphDisplay->m_pGraph = m_pGraph;
|
||||||
setCentralWidget(pscroll);
|
setCentralWidget (pscroll);
|
||||||
m_pstatusBar = new QStatusBar;
|
m_pstatusBar = new QStatusBar;
|
||||||
setStatusBar(m_pstatusBar);
|
setStatusBar (m_pstatusBar);
|
||||||
m_pluginListDlg = new PluginsListDialog(m_pGraph->getPluginsList(), this);
|
m_pluginListDlg = new PluginsListDialog (m_pGraph->getPluginsList (), this);
|
||||||
m_pluginListDlg->setModal(false);
|
m_pluginListDlg->setModal (false);
|
||||||
restoreGeometry(CustomSettings::mainWindowGeometry());
|
restoreGeometry (CustomSettings::mainWindowGeometry ());
|
||||||
startTimer(100);
|
startTimer (100);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow ()
|
||||||
{
|
{
|
||||||
CustomSettings::saveMainWindowGeometry(saveGeometry());
|
CustomSettings::saveMainWindowGeometry (saveGeometry ());
|
||||||
delete m_pluginListDlg;
|
delete m_pluginListDlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::AddPlugin()
|
void
|
||||||
|
MainWindow::AddPlugin ()
|
||||||
{
|
{
|
||||||
m_pluginListDlg->setGraph(m_pGraph.data());
|
m_pluginListDlg->setGraph (m_pGraph.data ());
|
||||||
m_pluginListDlg->show();
|
m_pluginListDlg->show ();
|
||||||
std::vector<ElementInfo> info = m_pGraph -> GetInfo();
|
std::vector<ElementInfo> info = m_pGraph->GetInfo ();
|
||||||
m_pGraphDisplay -> update(info);
|
m_pGraphDisplay->update (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OpenMediaFile()
|
void
|
||||||
|
MainWindow::OpenMediaFile ()
|
||||||
{
|
{
|
||||||
QString dir = CustomSettings::lastIODirectory();
|
QString dir = CustomSettings::lastIODirectory ();
|
||||||
|
|
||||||
QString path = QFileDialog::getOpenFileName(this, "Open File...", dir);
|
QString path = QFileDialog::getOpenFileName (this, "Open File...", dir);
|
||||||
if(!path.isEmpty())
|
if (!path.isEmpty ()) {
|
||||||
{
|
gchar *uri = gst_filename_to_uri (path.toStdString ().c_str (), NULL);
|
||||||
gchar *uri = gst_filename_to_uri(path.toStdString().c_str(), NULL);
|
if (uri) {
|
||||||
if(uri)
|
qDebug () << "Open Source file: " << path;
|
||||||
{
|
|
||||||
qDebug() << "Open Source file: " << path;
|
|
||||||
|
|
||||||
m_pGraph -> OpenUri(uri, NULL);
|
m_pGraph->OpenUri (uri, NULL);
|
||||||
g_free(uri);
|
g_free (uri);
|
||||||
|
|
||||||
std::vector<ElementInfo> info = m_pGraph -> GetInfo();
|
std::vector<ElementInfo> info = m_pGraph->GetInfo ();
|
||||||
m_pGraphDisplay -> update(info);
|
m_pGraphDisplay->update (info);
|
||||||
|
|
||||||
QString dir = QFileInfo(path).absoluteDir().absolutePath();
|
QString dir = QFileInfo (path).absoluteDir ().absolutePath ();
|
||||||
CustomSettings::saveLastIODirectory(dir);
|
CustomSettings::saveLastIODirectory (dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void MainWindow::OpenMediaUri()
|
MainWindow::OpenMediaUri ()
|
||||||
{
|
{
|
||||||
QString uri = QInputDialog::getText(this, "Open Uri...", "Uri:");
|
QString uri = QInputDialog::getText (this, "Open Uri...", "Uri:");
|
||||||
|
|
||||||
if(!uri.isEmpty())
|
if (!uri.isEmpty ()) {
|
||||||
{
|
qDebug () << "Open uri: " << uri;
|
||||||
qDebug() << "Open uri: " << uri;
|
m_pGraph->OpenUri (uri.toStdString ().c_str (), NULL);
|
||||||
m_pGraph -> OpenUri(uri.toStdString().c_str(), NULL);
|
|
||||||
|
|
||||||
std::vector<ElementInfo> info = m_pGraph -> GetInfo();
|
std::vector<ElementInfo> info = m_pGraph->GetInfo ();
|
||||||
m_pGraphDisplay -> update(info);
|
m_pGraphDisplay->update (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Play()
|
void
|
||||||
|
MainWindow::Play ()
|
||||||
{
|
{
|
||||||
qDebug() << "Play";
|
qDebug () << "Play";
|
||||||
m_pGraph -> Play();
|
m_pGraph->Play ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Pause()
|
void
|
||||||
|
MainWindow::Pause ()
|
||||||
{
|
{
|
||||||
qDebug() << "Pause";
|
qDebug () << "Pause";
|
||||||
m_pGraph -> Pause();
|
m_pGraph->Pause ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Stop()
|
void
|
||||||
|
MainWindow::Stop ()
|
||||||
{
|
{
|
||||||
qDebug() << "Stop";
|
qDebug () << "Stop";
|
||||||
m_pGraph -> Stop();
|
m_pGraph->Stop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Flush()
|
void
|
||||||
|
MainWindow::Flush ()
|
||||||
{
|
{
|
||||||
qDebug() << "Flush";
|
qDebug () << "Flush";
|
||||||
|
|
||||||
if(m_pGraph -> m_pGraph)
|
if (m_pGraph->m_pGraph) {
|
||||||
{
|
gst_element_send_event (GST_ELEMENT (m_pGraph->m_pGraph),
|
||||||
gst_element_send_event(GST_ELEMENT(m_pGraph -> m_pGraph), gst_event_new_flush_start());
|
gst_event_new_flush_start ());
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
gst_element_send_event(GST_ELEMENT(m_pGraph -> m_pGraph), gst_event_new_flush_stop(true));
|
gst_element_send_event(GST_ELEMENT(m_pGraph -> m_pGraph), gst_event_new_flush_stop(true));
|
||||||
#else
|
#else
|
||||||
gst_element_send_event(GST_ELEMENT(m_pGraph -> m_pGraph), gst_event_new_flush_stop());
|
gst_element_send_event (GST_ELEMENT (m_pGraph->m_pGraph),
|
||||||
|
gst_event_new_flush_stop ());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ClearGraph()
|
void
|
||||||
|
MainWindow::ClearGraph ()
|
||||||
{
|
{
|
||||||
qDebug() << "ClearGraph";
|
qDebug () << "ClearGraph";
|
||||||
PipelineIE::Clear(m_pGraph);
|
PipelineIE::Clear (m_pGraph);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Seek(int val)
|
void
|
||||||
|
MainWindow::Seek (int val)
|
||||||
{
|
{
|
||||||
if(m_pGraph -> SetPosition((double)(val) / m_pslider -> maximum()))
|
if (m_pGraph->SetPosition ((double) (val) / m_pslider->maximum ()))
|
||||||
qDebug() << "Seek to" << val;
|
qDebug () << "Seek to" << val;
|
||||||
else
|
else
|
||||||
qDebug() << "Seek to" << val << "was FAILED";
|
qDebug () << "Seek to" << val << "was FAILED";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::timerEvent(QTimerEvent *)
|
void
|
||||||
|
MainWindow::timerEvent (QTimerEvent *)
|
||||||
{
|
{
|
||||||
GstState state;
|
GstState state;
|
||||||
GstStateChangeReturn res = gst_element_get_state (m_pGraph -> m_pGraph, &state, NULL, GST_MSECOND);
|
GstStateChangeReturn res = gst_element_get_state (m_pGraph->m_pGraph, &state,
|
||||||
|
NULL,
|
||||||
|
GST_MSECOND);
|
||||||
|
|
||||||
if(res == GST_STATE_CHANGE_SUCCESS)
|
if (res == GST_STATE_CHANGE_SUCCESS) {
|
||||||
{
|
|
||||||
QString str;
|
QString str;
|
||||||
switch(state)
|
switch (state) {
|
||||||
{
|
|
||||||
case GST_STATE_VOID_PENDING:
|
case GST_STATE_VOID_PENDING:
|
||||||
str = "Pending";
|
str = "Pending";
|
||||||
break;
|
break;
|
||||||
|
@ -299,79 +307,82 @@ void MainWindow::timerEvent(QTimerEvent *)
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
m_pstatusBar -> showMessage(str);
|
m_pstatusBar->showMessage (str);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
m_pstatusBar->showMessage (
|
||||||
m_pstatusBar -> showMessage(QString(gst_element_state_change_return_get_name(res)));
|
QString (gst_element_state_change_return_get_name (res)));
|
||||||
}
|
}
|
||||||
|
|
||||||
double pos = m_pGraph -> GetPosition();
|
double pos = m_pGraph->GetPosition ();
|
||||||
|
|
||||||
if(m_pslider -> value() != (int)(m_pslider -> maximum() * pos))
|
if (m_pslider->value () != (int) (m_pslider->maximum () * pos))
|
||||||
m_pslider -> setSliderPosition(m_pslider -> maximum() * pos);
|
m_pslider->setSliderPosition (m_pslider->maximum () * pos);
|
||||||
|
|
||||||
|
m_pGraphDisplay->update (m_pGraph->GetInfo ());
|
||||||
m_pGraphDisplay -> update(m_pGraph -> GetInfo());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Save()
|
void
|
||||||
|
MainWindow::Save ()
|
||||||
{
|
{
|
||||||
if(m_fileName.isEmpty())
|
if (m_fileName.isEmpty ())
|
||||||
SaveAs();
|
SaveAs ();
|
||||||
else {
|
else {
|
||||||
QFileInfo fileInfo(m_fileName);
|
QFileInfo fileInfo (m_fileName);
|
||||||
if (fileInfo.completeSuffix().isEmpty() || fileInfo.completeSuffix() != "gpi")
|
if (fileInfo.completeSuffix ().isEmpty ()
|
||||||
|
|| fileInfo.completeSuffix () != "gpi")
|
||||||
m_fileName = m_fileName + ".gpi";
|
m_fileName = m_fileName + ".gpi";
|
||||||
|
|
||||||
|
PipelineIE::Export (m_pGraph, m_fileName);
|
||||||
PipelineIE::Export(m_pGraph, m_fileName);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SaveAs()
|
void
|
||||||
|
MainWindow::SaveAs ()
|
||||||
{
|
{
|
||||||
QString dir = CustomSettings::lastIODirectory();
|
QString dir = CustomSettings::lastIODirectory ();
|
||||||
|
|
||||||
QString path = QFileDialog::getSaveFileName(this, "Save As...", dir, tr("*.gpi"));
|
QString path = QFileDialog::getSaveFileName (this, "Save As...", dir,
|
||||||
|
tr ("*.gpi"));
|
||||||
|
|
||||||
if(!path.isEmpty())
|
if (!path.isEmpty ()) {
|
||||||
{
|
|
||||||
m_fileName = path;
|
m_fileName = path;
|
||||||
Save();
|
Save ();
|
||||||
|
|
||||||
QString dir = QFileInfo(path).absoluteDir().absolutePath();
|
QString dir = QFileInfo (path).absoluteDir ().absolutePath ();
|
||||||
CustomSettings::saveLastIODirectory(dir);
|
CustomSettings::saveLastIODirectory (dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Open()
|
void
|
||||||
|
MainWindow::Open ()
|
||||||
{
|
{
|
||||||
QString dir = CustomSettings::lastIODirectory();
|
QString dir = CustomSettings::lastIODirectory ();
|
||||||
|
|
||||||
QString path = QFileDialog::getOpenFileName(this, "Open...", dir, tr("GPI (*.gpi *.xpm);;All files (*.*)"));
|
QString path = QFileDialog::getOpenFileName (
|
||||||
|
this, "Open...", dir, tr ("GPI (*.gpi *.xpm);;All files (*.*)"));
|
||||||
|
|
||||||
if(!path.isEmpty())
|
if (!path.isEmpty ()) {
|
||||||
{
|
if (PipelineIE::Import (m_pGraph, path))
|
||||||
if(PipelineIE::Import(m_pGraph, path))
|
|
||||||
m_fileName = path;
|
m_fileName = path;
|
||||||
|
|
||||||
QString dir = QFileInfo(path).absoluteDir().absolutePath();
|
QString dir = QFileInfo (path).absoluteDir ().absolutePath ();
|
||||||
CustomSettings::saveLastIODirectory(dir);
|
CustomSettings::saveLastIODirectory (dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::About()
|
void
|
||||||
|
MainWindow::About ()
|
||||||
{
|
{
|
||||||
QString message;
|
QString message;
|
||||||
message = "<center><b>pipeviz</b></center><br>";
|
message = "<center><b>pipeviz</b></center><br>";
|
||||||
message = "<center>virinext@gmail.com</center><br>";
|
message = "<center>virinext@gmail.com</center><br>";
|
||||||
message += QString("<center>Version: ") + VERSION_STR + "</center><br>";
|
message += QString ("<center>Version: ") + VERSION_STR + "</center><br>";
|
||||||
message += "<center>GUI Based on Qt</center>";
|
message += "<center>GUI Based on Qt</center>";
|
||||||
message += "<center>using ";
|
message += "<center>using ";
|
||||||
message += gst_version_string();
|
message += gst_version_string ();
|
||||||
message += "</center>";
|
message += "</center>";
|
||||||
|
|
||||||
QMessageBox::about(this, "About", message);
|
QMessageBox::about (this, "About", message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,14 @@ class PluginsListDialog;
|
||||||
class MainWindow: public QMainWindow
|
class MainWindow: public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
MainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *);
|
void timerEvent(QTimerEvent *);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void AddPlugin();
|
void AddPlugin();
|
||||||
void OpenMediaFile();
|
void OpenMediaFile();
|
||||||
void OpenMediaUri();
|
void OpenMediaUri();
|
||||||
|
@ -44,7 +44,7 @@ class MainWindow: public QMainWindow
|
||||||
void ClearGraph();
|
void ClearGraph();
|
||||||
void About();
|
void About();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedPointer<GraphManager> m_pGraph;
|
QSharedPointer<GraphManager> m_pGraph;
|
||||||
GraphDisplay *m_pGraphDisplay;
|
GraphDisplay *m_pGraphDisplay;
|
||||||
|
|
||||||
|
@ -55,5 +55,4 @@ class MainWindow: public QMainWindow
|
||||||
PluginsListDialog *m_pluginListDlg;
|
PluginsListDialog *m_pluginListDlg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,96 +8,99 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
PadProperties::PadProperties(QSharedPointer<GraphManager> pGraphManager, const char *elementName, const char *padName,
|
PadProperties::PadProperties (QSharedPointer<GraphManager> pGraphManager,
|
||||||
QWidget *parent, Qt::WindowFlags flags):
|
const char *elementName, const char *padName,
|
||||||
QWidget(parent, flags)
|
QWidget *parent, Qt::WindowFlags flags)
|
||||||
|
: QWidget (parent, flags)
|
||||||
{
|
{
|
||||||
setWindowTitle(QString(elementName) + "::" + padName + " properties");
|
setWindowTitle (QString (elementName) + "::" + padName + " properties");
|
||||||
GstElement *element = gst_bin_get_by_name (GST_BIN(pGraphManager -> m_pGraph), elementName);
|
GstElement *element = gst_bin_get_by_name (GST_BIN (pGraphManager->m_pGraph),
|
||||||
|
elementName);
|
||||||
|
|
||||||
if(!element)
|
if (!element)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GstPad *pad = gst_element_get_static_pad(GST_ELEMENT(element), padName);
|
GstPad *pad = gst_element_get_static_pad (GST_ELEMENT (element), padName);
|
||||||
|
|
||||||
QGridLayout *play = new QGridLayout;
|
QGridLayout *play = new QGridLayout;
|
||||||
|
|
||||||
play -> addWidget(new QLabel("Name"), 0, 0);
|
play->addWidget (new QLabel ("Name"), 0, 0);
|
||||||
|
|
||||||
QLabel *plbl = new QLabel(padName);
|
QLabel *plbl = new QLabel (padName);
|
||||||
plbl -> setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
plbl->setTextInteractionFlags (
|
||||||
play -> addWidget(plbl, 0, 1);
|
Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||||
|
play->addWidget (plbl, 0, 1);
|
||||||
|
|
||||||
play -> addWidget(new QLabel("All caps:"), 1, 0);
|
play->addWidget (new QLabel ("All caps:"), 1, 0);
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
GstCaps *caps = gst_pad_query_caps(pad, NULL);
|
GstCaps *caps = gst_pad_query_caps(pad, NULL);
|
||||||
#else
|
#else
|
||||||
GstCaps *caps = gst_pad_get_caps(pad);
|
GstCaps *caps = gst_pad_get_caps (pad);
|
||||||
#endif
|
#endif
|
||||||
gchar *str;
|
gchar *str;
|
||||||
gchar *noSpecified = (gchar *)"not specified";
|
gchar *noSpecified = (gchar *) "not specified";
|
||||||
if(caps)
|
if (caps)
|
||||||
str = gst_caps_to_string(caps);
|
str = gst_caps_to_string (caps);
|
||||||
else
|
else
|
||||||
str = noSpecified;
|
str = noSpecified;
|
||||||
|
|
||||||
plbl = new QLabel(QString(str));
|
plbl = new QLabel (QString (str));
|
||||||
plbl -> setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
plbl->setTextInteractionFlags (
|
||||||
play -> addWidget(plbl, 1, 1);
|
Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||||
if(caps)
|
play->addWidget (plbl, 1, 1);
|
||||||
{
|
if (caps) {
|
||||||
g_free(str);
|
g_free (str);
|
||||||
gst_caps_unref(caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
play -> addWidget(new QLabel("Allowed caps:"), 2, 0);
|
play->addWidget (new QLabel ("Allowed caps:"), 2, 0);
|
||||||
caps = gst_pad_get_allowed_caps(pad);
|
caps = gst_pad_get_allowed_caps (pad);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
if(caps)
|
if (caps)
|
||||||
str = gst_caps_to_string(caps);
|
str = gst_caps_to_string (caps);
|
||||||
else
|
else
|
||||||
str = noSpecified;
|
str = noSpecified;
|
||||||
|
|
||||||
plbl = new QLabel(QString(str));
|
plbl = new QLabel (QString (str));
|
||||||
plbl -> setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
plbl->setTextInteractionFlags (
|
||||||
play -> addWidget(plbl, 2, 1);
|
Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||||
if(caps)
|
play->addWidget (plbl, 2, 1);
|
||||||
{
|
if (caps) {
|
||||||
g_free(str);
|
g_free (str);
|
||||||
gst_caps_unref(caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
play -> addWidget(new QLabel("Current caps"), 3, 0);
|
play->addWidget (new QLabel ("Current caps"), 3, 0);
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
caps = gst_pad_get_current_caps(pad);
|
caps = gst_pad_get_current_caps(pad);
|
||||||
#else
|
#else
|
||||||
caps = gst_pad_get_negotiated_caps(pad);
|
caps = gst_pad_get_negotiated_caps (pad);
|
||||||
#endif
|
#endif
|
||||||
str = NULL;
|
str = NULL;
|
||||||
if(caps)
|
if (caps)
|
||||||
str = gst_caps_to_string(caps);
|
str = gst_caps_to_string (caps);
|
||||||
else
|
else
|
||||||
str = noSpecified;
|
str = noSpecified;
|
||||||
|
|
||||||
plbl = new QLabel(QString(str));
|
plbl = new QLabel (QString (str));
|
||||||
plbl -> setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
plbl->setTextInteractionFlags (
|
||||||
play -> addWidget(plbl, 3, 1);
|
Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||||
if(caps)
|
play->addWidget (plbl, 3, 1);
|
||||||
{
|
if (caps) {
|
||||||
g_free(str);
|
g_free (str);
|
||||||
gst_caps_unref(caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_unref(element);
|
gst_object_unref (element);
|
||||||
gst_object_unref (pad);
|
gst_object_unref (pad);
|
||||||
|
|
||||||
QVBoxLayout *pvblay = new QVBoxLayout;
|
QVBoxLayout *pvblay = new QVBoxLayout;
|
||||||
QWidget *pwgt = new QWidget(this);
|
QWidget *pwgt = new QWidget (this);
|
||||||
pwgt -> setLayout(play);
|
pwgt->setLayout (play);
|
||||||
QScrollArea *pscroll = new QScrollArea(this);
|
QScrollArea *pscroll = new QScrollArea (this);
|
||||||
pscroll -> setWidget(pwgt);
|
pscroll->setWidget (pwgt);
|
||||||
|
|
||||||
pvblay -> addWidget(pscroll);
|
pvblay->addWidget (pscroll);
|
||||||
|
|
||||||
setLayout(pvblay);
|
setLayout (pvblay);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,5 +13,4 @@ public:
|
||||||
, QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
, QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,44 +9,42 @@
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
static void clearPipeline(GstElement *pipeline)
|
static void
|
||||||
|
clearPipeline (GstElement *pipeline)
|
||||||
{
|
{
|
||||||
if(!pipeline)
|
if (!pipeline)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GstIterator *iter;
|
GstIterator *iter;
|
||||||
iter = gst_bin_iterate_elements (GST_BIN (pipeline));
|
iter = gst_bin_iterate_elements (GST_BIN (pipeline));
|
||||||
GstElement *element = NULL;
|
GstElement *element = NULL;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
while (!done)
|
while (!done) {
|
||||||
{
|
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
GValue value = { 0 };
|
GValue value =
|
||||||
|
{ 0};
|
||||||
switch (gst_iterator_next (iter, &value))
|
switch (gst_iterator_next (iter, &value))
|
||||||
{
|
{
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
{
|
{
|
||||||
element = GST_ELEMENT(g_value_get_object(&value));
|
element = GST_ELEMENT(g_value_get_object(&value));
|
||||||
#else
|
#else
|
||||||
switch (gst_iterator_next (iter, (gpointer *)&element))
|
switch (gst_iterator_next (iter, (gpointer *) &element)) {
|
||||||
{
|
case GST_ITERATOR_OK: {
|
||||||
case GST_ITERATOR_OK:
|
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
gst_bin_remove(GST_BIN(pipeline), element);
|
gst_bin_remove (GST_BIN (pipeline), element);
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
g_value_reset (&value);
|
g_value_reset (&value);
|
||||||
#endif
|
#endif
|
||||||
iter = gst_bin_iterate_elements (GST_BIN (pipeline));
|
iter = gst_bin_iterate_elements (GST_BIN (pipeline));
|
||||||
if(!iter)
|
if (!iter)
|
||||||
done = true;
|
done = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_ITERATOR_DONE:
|
case GST_ITERATOR_DONE:
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
case GST_ITERATOR_ERROR:
|
case GST_ITERATOR_ERROR: {
|
||||||
{
|
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -67,280 +65,254 @@ namespace
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
static void writeProperties(QXmlStreamWriter &xmlWriter, const GstElement *element)
|
writeProperties (QXmlStreamWriter &xmlWriter, const GstElement *element)
|
||||||
{
|
{
|
||||||
GParamSpec **prop_specs;
|
GParamSpec **prop_specs;
|
||||||
guint num_props;
|
guint num_props;
|
||||||
|
|
||||||
prop_specs = g_object_class_list_properties(G_OBJECT_GET_CLASS (element),
|
prop_specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (element),
|
||||||
&num_props);
|
&num_props);
|
||||||
|
|
||||||
if(!num_props)
|
if (!num_props)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xmlWriter.writeStartElement("properties");
|
xmlWriter.writeStartElement ("properties");
|
||||||
|
|
||||||
for(std::size_t i = 0; i<num_props; i++)
|
for (std::size_t i = 0; i < num_props; i++) {
|
||||||
{
|
|
||||||
GParamSpec *param = prop_specs[i];
|
GParamSpec *param = prop_specs[i];
|
||||||
|
|
||||||
if((param -> flags & G_PARAM_READABLE) && (param -> flags & G_PARAM_WRITABLE))
|
if ((param->flags & G_PARAM_READABLE)
|
||||||
{
|
&& (param->flags & G_PARAM_WRITABLE)) {
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
g_value_init (&value, param -> value_type);
|
g_value_init (&value, param->value_type);
|
||||||
|
|
||||||
g_object_get_property (G_OBJECT(element), param -> name, &value);
|
g_object_get_property (G_OBJECT (element), param->name, &value);
|
||||||
|
|
||||||
if(!g_param_value_defaults(param, &value))
|
if (!g_param_value_defaults (param, &value)) {
|
||||||
{
|
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
QString propertyName = g_param_spec_get_name (param);
|
QString propertyName = g_param_spec_get_name (param);
|
||||||
QString propertyValue;
|
QString propertyValue;
|
||||||
|
|
||||||
|
switch (G_VALUE_TYPE (&value)) {
|
||||||
switch (G_VALUE_TYPE (&value))
|
case G_TYPE_STRING: {
|
||||||
{
|
|
||||||
case G_TYPE_STRING:
|
|
||||||
{
|
|
||||||
|
|
||||||
const char *string_val = g_value_get_string (&value);
|
const char *string_val = g_value_get_string (&value);
|
||||||
if(string_val)
|
if (string_val)
|
||||||
propertyValue = string_val;
|
propertyValue = string_val;
|
||||||
else
|
else
|
||||||
skip = true;
|
skip = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_BOOLEAN:
|
case G_TYPE_BOOLEAN: {
|
||||||
{
|
|
||||||
gboolean bool_val = g_value_get_boolean (&value);
|
gboolean bool_val = g_value_get_boolean (&value);
|
||||||
propertyValue = QString::number(bool_val);
|
propertyValue = QString::number (bool_val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_ULONG:
|
case G_TYPE_ULONG: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_ulong (&value));
|
||||||
propertyValue = QString::number(g_value_get_ulong(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_LONG:
|
case G_TYPE_LONG: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_long (&value));
|
||||||
propertyValue = QString::number(g_value_get_long(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_UINT:
|
case G_TYPE_UINT: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_uint (&value));
|
||||||
propertyValue = QString::number(g_value_get_uint(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_INT:
|
case G_TYPE_INT: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_int (&value));
|
||||||
propertyValue = QString::number(g_value_get_int(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_UINT64:
|
case G_TYPE_UINT64: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_uint64 (&value));
|
||||||
propertyValue = QString::number(g_value_get_uint64(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_INT64:
|
case G_TYPE_INT64: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_int64 (&value));
|
||||||
propertyValue = QString::number(g_value_get_int64(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_FLOAT:
|
case G_TYPE_FLOAT: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_float (&value));
|
||||||
propertyValue = QString::number(g_value_get_float(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_DOUBLE:
|
case G_TYPE_DOUBLE: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_double (&value));
|
||||||
propertyValue = QString::number(g_value_get_double(&value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
gchar *elementName = gst_element_get_name (element);
|
||||||
gchar *elementName = gst_element_get_name(element);
|
|
||||||
|
|
||||||
qDebug() << "property `" << propertyName << "` for `"
|
qDebug () << "property `" << propertyName << "` for `"
|
||||||
<< elementName << "` not supported";
|
<< elementName << "` not supported";
|
||||||
g_free(elementName);
|
g_free (elementName);
|
||||||
|
|
||||||
skip = true;
|
skip = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!skip)
|
if (!skip) {
|
||||||
{
|
xmlWriter.writeStartElement ("property");
|
||||||
xmlWriter.writeStartElement("property");
|
xmlWriter.writeAttribute ("name", propertyName);
|
||||||
xmlWriter.writeAttribute("name", propertyName);
|
xmlWriter.writeAttribute ("value", propertyValue);
|
||||||
xmlWriter.writeAttribute("value", propertyValue);
|
xmlWriter.writeEndElement ();
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
}
|
}
|
||||||
g_value_reset(&value);
|
g_value_reset (&value);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement ();
|
||||||
|
|
||||||
g_free(prop_specs);
|
g_free (prop_specs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
loadProperties (QDomElement node, GstElement *element)
|
||||||
static void loadProperties(QDomElement node, GstElement *element)
|
|
||||||
{
|
{
|
||||||
QDomNode child = node.firstChild();
|
QDomNode child = node.firstChild ();
|
||||||
while(!child.isNull())
|
while (!child.isNull ()) {
|
||||||
{
|
if (child.toElement ().tagName () == "property") {
|
||||||
if(child.toElement().tagName() == "property")
|
QString name = child.toElement ().attribute ("name");
|
||||||
{
|
QString value = child.toElement ().attribute ("value");
|
||||||
QString name = child.toElement().attribute("name");
|
|
||||||
QString value = child.toElement().attribute("value");
|
|
||||||
|
|
||||||
GParamSpec *param = g_object_class_find_property(G_OBJECT_GET_CLASS (element),
|
GParamSpec *param = g_object_class_find_property (
|
||||||
name.toStdString().c_str());
|
G_OBJECT_GET_CLASS (element), name.toStdString ().c_str ());
|
||||||
|
|
||||||
if(!param)
|
if (!param) {
|
||||||
{
|
gchar *elementName = gst_element_get_name (element);
|
||||||
gchar *elementName = gst_element_get_name(element);
|
qDebug () << "problem with setting property `" << name << "` for `"
|
||||||
qDebug() << "problem with setting property `" << name << "` for `" << elementName << "`";
|
<< elementName << "`";
|
||||||
g_free(elementName);
|
g_free (elementName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(param -> flags & G_PARAM_WRITABLE))
|
if (!(param->flags & G_PARAM_WRITABLE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::string tmpStr = name.toStdString();
|
std::string tmpStr = name.toStdString ();
|
||||||
const char *propName = tmpStr.c_str();
|
const char *propName = tmpStr.c_str ();
|
||||||
switch (param -> value_type)
|
switch (param->value_type) {
|
||||||
{
|
case G_TYPE_STRING: {
|
||||||
case G_TYPE_STRING:
|
g_object_set (G_OBJECT (element), propName,
|
||||||
{
|
value.toStdString ().c_str (), NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, value.toStdString().c_str(), NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_BOOLEAN:
|
case G_TYPE_BOOLEAN: {
|
||||||
{
|
gboolean val = value.toInt ();
|
||||||
gboolean val = value.toInt();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_ULONG:
|
case G_TYPE_ULONG: {
|
||||||
{
|
gulong val = value.toULong ();
|
||||||
gulong val = value.toULong();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_LONG:
|
case G_TYPE_LONG: {
|
||||||
{
|
glong val = value.toLong ();
|
||||||
glong val = value.toLong();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_UINT:
|
case G_TYPE_UINT: {
|
||||||
{
|
guint val = value.toUInt ();
|
||||||
guint val = value.toUInt();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_INT:
|
case G_TYPE_INT: {
|
||||||
{
|
gint val = value.toInt ();
|
||||||
gint val = value.toInt();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_UINT64:
|
case G_TYPE_UINT64: {
|
||||||
{
|
guint64 val = value.toULongLong ();
|
||||||
guint64 val = value.toULongLong();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_INT64:
|
case G_TYPE_INT64: {
|
||||||
{
|
gint64 val = value.toLongLong ();
|
||||||
gint64 val = value.toLongLong();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_FLOAT:
|
case G_TYPE_FLOAT: {
|
||||||
{
|
gfloat val = value.toFloat ();
|
||||||
gfloat val = value.toFloat();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_DOUBLE:
|
case G_TYPE_DOUBLE: {
|
||||||
{
|
gdouble val = value.toDouble ();
|
||||||
gdouble val = value.toDouble();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
gchar *elementName = gst_element_get_name (element);
|
||||||
gchar *elementName = gst_element_get_name(element);
|
qDebug () << "property `" << name << "` for `"
|
||||||
qDebug() << "property `" << name << "` for `" << QString(elementName) << "` not supported";
|
<< QString (elementName) << "` not supported";
|
||||||
g_free(elementName);
|
g_free (elementName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
child = child.nextSibling();
|
child = child.nextSibling ();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
static void create_requst_pad(GstElement *element, const QString &templateName, const QString &padName)
|
create_requst_pad (GstElement *element, const QString &templateName,
|
||||||
|
const QString &padName)
|
||||||
{
|
{
|
||||||
GstElementClass *klass = GST_ELEMENT_GET_CLASS(element);
|
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
|
||||||
|
|
||||||
GstPadTemplate *templ = gst_element_class_get_pad_template(klass, templateName.toStdString().c_str());
|
GstPadTemplate *templ = gst_element_class_get_pad_template (
|
||||||
|
klass, templateName.toStdString ().c_str ());
|
||||||
|
|
||||||
gst_element_request_pad(element, templ, padName.toStdString().c_str(), NULL);
|
gst_element_request_pad (element, templ, padName.toStdString ().c_str (),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PipelineIE::Export(QSharedPointer<GraphManager> pgraph, const QString &fileName)
|
bool
|
||||||
|
PipelineIE::Export (QSharedPointer<GraphManager> pgraph,
|
||||||
|
const QString &fileName)
|
||||||
{
|
{
|
||||||
QFile file(fileName);
|
QFile file (fileName);
|
||||||
|
|
||||||
if (!file.open(QIODevice::WriteOnly))
|
if (!file.open (QIODevice::WriteOnly)) {
|
||||||
{
|
QMessageBox::warning (0, "Read only", "The file is in read only mode");
|
||||||
QMessageBox::warning(0, "Read only", "The file is in read only mode");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector <ElementInfo> info = pgraph -> GetInfo();
|
std::vector<ElementInfo> info = pgraph->GetInfo ();
|
||||||
|
|
||||||
QXmlStreamWriter xmlWriter;
|
QXmlStreamWriter xmlWriter;
|
||||||
xmlWriter.setDevice(&file);
|
xmlWriter.setDevice (&file);
|
||||||
xmlWriter.writeStartDocument();
|
xmlWriter.writeStartDocument ();
|
||||||
xmlWriter.writeStartElement("pipeline");
|
xmlWriter.writeStartElement ("pipeline");
|
||||||
|
|
||||||
for(std::size_t i=0; i<info.size(); i++)
|
for (std::size_t i = 0; i < info.size (); i++) {
|
||||||
{
|
xmlWriter.writeStartElement ("element");
|
||||||
xmlWriter.writeStartElement("element");
|
|
||||||
|
|
||||||
xmlWriter.writeAttribute("name", info[i].m_name.c_str());
|
xmlWriter.writeAttribute ("name", info[i].m_name.c_str ());
|
||||||
xmlWriter.writeAttribute("plugin-name", info[i].m_pluginName.c_str());
|
xmlWriter.writeAttribute ("plugin-name", info[i].m_pluginName.c_str ());
|
||||||
|
|
||||||
GstElement *element = gst_bin_get_by_name (GST_BIN(pgraph -> m_pGraph), info[i].m_name.c_str());
|
GstElement *element = gst_bin_get_by_name (GST_BIN (pgraph->m_pGraph),
|
||||||
|
info[i].m_name.c_str ());
|
||||||
|
|
||||||
for(std::size_t j=0; j<info[i].m_pads.size(); j++)
|
for (std::size_t j = 0; j < info[i].m_pads.size (); j++) {
|
||||||
{
|
xmlWriter.writeStartElement ("pad");
|
||||||
xmlWriter.writeStartElement("pad");
|
|
||||||
|
|
||||||
xmlWriter.writeAttribute("name", info[i].m_pads[j].m_name.c_str());
|
xmlWriter.writeAttribute ("name", info[i].m_pads[j].m_name.c_str ());
|
||||||
|
|
||||||
GstPad *pad = gst_element_get_static_pad(element, info[i].m_pads[j].m_name.c_str());
|
GstPad *pad = gst_element_get_static_pad (
|
||||||
|
element, info[i].m_pads[j].m_name.c_str ());
|
||||||
|
|
||||||
GstPadTemplate *templ = gst_pad_get_pad_template(pad);
|
GstPadTemplate *templ = gst_pad_get_pad_template (pad);
|
||||||
if (templ) {
|
if (templ) {
|
||||||
QString presence;
|
QString presence;
|
||||||
switch(GST_PAD_TEMPLATE_PRESENCE(templ))
|
switch (GST_PAD_TEMPLATE_PRESENCE (templ)) {
|
||||||
{
|
|
||||||
case GST_PAD_ALWAYS:
|
case GST_PAD_ALWAYS:
|
||||||
presence = "always";
|
presence = "always";
|
||||||
break;
|
break;
|
||||||
|
@ -354,65 +326,68 @@ bool PipelineIE::Export(QSharedPointer<GraphManager> pgraph, const QString &file
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
xmlWriter.writeAttribute("presence", presence);
|
xmlWriter.writeAttribute ("presence", presence);
|
||||||
xmlWriter.writeAttribute("template-name", GST_PAD_TEMPLATE_NAME_TEMPLATE(templ));
|
xmlWriter.writeAttribute ("template-name",
|
||||||
} else {
|
GST_PAD_TEMPLATE_NAME_TEMPLATE (templ));
|
||||||
qDebug() << "Unable to find a template for" << info[i].m_pads[j].m_name.c_str();
|
|
||||||
xmlWriter.writeAttribute("presence", "always");
|
|
||||||
xmlWriter.writeAttribute("template-name", "");
|
|
||||||
}
|
}
|
||||||
gst_object_unref(pad);
|
else {
|
||||||
|
qDebug () << "Unable to find a template for"
|
||||||
|
<< info[i].m_pads[j].m_name.c_str ();
|
||||||
|
xmlWriter.writeAttribute ("presence", "always");
|
||||||
|
xmlWriter.writeAttribute ("template-name", "");
|
||||||
|
}
|
||||||
|
gst_object_unref (pad);
|
||||||
|
|
||||||
if(info[i].m_connections[j].m_elementId != (size_t)-1 &&
|
if (info[i].m_connections[j].m_elementId != (size_t) -1
|
||||||
info[i].m_connections[j].m_padId != (size_t)-1)
|
&& info[i].m_connections[j].m_padId != (size_t) -1) {
|
||||||
{
|
|
||||||
std::size_t elementPos, padPos;
|
std::size_t elementPos, padPos;
|
||||||
for(elementPos = 0; elementPos < info.size(); elementPos++)
|
for (elementPos = 0; elementPos < info.size (); elementPos++) {
|
||||||
{
|
if (info[elementPos].m_id == info[i].m_connections[j].m_elementId) {
|
||||||
if(info[elementPos].m_id == info[i].m_connections[j].m_elementId)
|
for (padPos = 0; padPos < info[elementPos].m_pads.size (); padPos++)
|
||||||
{
|
if (info[elementPos].m_pads[padPos].m_id
|
||||||
for(padPos = 0; padPos < info[elementPos].m_pads.size(); padPos++)
|
== info[i].m_connections[j].m_padId)
|
||||||
if(info[elementPos].m_pads[padPos].m_id == info[i].m_connections[j].m_padId)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(padPos < info[elementPos].m_pads.size())
|
if (padPos < info[elementPos].m_pads.size ())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(elementPos < info.size() && padPos < info[elementPos].m_pads.size())
|
if (elementPos < info.size ()
|
||||||
{
|
&& padPos < info[elementPos].m_pads.size ()) {
|
||||||
xmlWriter.writeStartElement("connected-to");
|
xmlWriter.writeStartElement ("connected-to");
|
||||||
xmlWriter.writeAttribute("element-name", info[elementPos].m_name.c_str());
|
xmlWriter.writeAttribute ("element-name",
|
||||||
xmlWriter.writeAttribute("pad-name", info[elementPos].m_pads[padPos].m_name.c_str());
|
info[elementPos].m_name.c_str ());
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeAttribute (
|
||||||
|
"pad-name", info[elementPos].m_pads[padPos].m_name.c_str ());
|
||||||
|
xmlWriter.writeEndElement ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement ();
|
||||||
}
|
}
|
||||||
|
|
||||||
writeProperties(xmlWriter, element);
|
writeProperties (xmlWriter, element);
|
||||||
gst_object_unref(element);
|
gst_object_unref (element);
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement ();
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement ();
|
||||||
xmlWriter.writeEndDocument();
|
xmlWriter.writeEndDocument ();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
bool PipelineIE::Import(QSharedPointer<GraphManager> pgraph, const QString &fileName)
|
PipelineIE::Import (QSharedPointer<GraphManager> pgraph,
|
||||||
|
const QString &fileName)
|
||||||
{
|
{
|
||||||
GstElement *pipeline = pgraph -> m_pGraph;
|
GstElement *pipeline = pgraph->m_pGraph;
|
||||||
QFile file(fileName);
|
QFile file (fileName);
|
||||||
if(!file.open(QFile::ReadOnly | QFile::Text))
|
if (!file.open (QFile::ReadOnly | QFile::Text)) {
|
||||||
{
|
QMessageBox::warning (
|
||||||
QMessageBox::warning(0, "Open failed",
|
0, "Open failed",
|
||||||
QString("Cannot read file ") + fileName +
|
QString ("Cannot read file ") + fileName + ": " + file.errorString ());
|
||||||
": " + file.errorString());
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -422,192 +397,195 @@ bool PipelineIE::Import(QSharedPointer<GraphManager> pgraph, const QString &file
|
||||||
int errorColumn;
|
int errorColumn;
|
||||||
|
|
||||||
QDomDocument doc;
|
QDomDocument doc;
|
||||||
if(!doc.setContent(&file, false, &errorStr, &errorLine, &errorColumn))
|
if (!doc.setContent (&file, false, &errorStr, &errorLine, &errorColumn)) {
|
||||||
{
|
QMessageBox::warning (
|
||||||
QMessageBox::warning(0, "Xml parsing failed",
|
0, "Xml parsing failed",
|
||||||
QString("Parse error at line ") + QString::number(errorLine) + ", "
|
QString ("Parse error at line ") + QString::number (errorLine) + ", "
|
||||||
"column " + QString::number(errorColumn) + ": " + errorStr);
|
"column " + QString::number (errorColumn) + ": " + errorStr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearPipeline(pipeline);
|
clearPipeline (pipeline);
|
||||||
|
|
||||||
QDomElement root = doc.documentElement();
|
QDomElement root = doc.documentElement ();
|
||||||
|
|
||||||
if(root.tagName() != "pipeline")
|
if (root.tagName () != "pipeline") {
|
||||||
{
|
QMessageBox::warning (0, "Parsing failed", "Is invalid pipeline file");
|
||||||
QMessageBox::warning(0, "Parsing failed", "Is invalid pipeline file");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDomNode child = root.firstChild();
|
QDomNode child = root.firstChild ();
|
||||||
|
|
||||||
std::vector<Connection> connections;
|
std::vector<Connection> connections;
|
||||||
while(!child.isNull())
|
while (!child.isNull ()) {
|
||||||
{
|
if (child.toElement ().tagName () == "element") {
|
||||||
if(child.toElement().tagName() == "element")
|
QDomElement elNode = child.toElement ();
|
||||||
{
|
|
||||||
QDomElement elNode = child.toElement();
|
|
||||||
|
|
||||||
|
GstElement *pel = gst_element_factory_make (
|
||||||
|
elNode.attribute ("plugin-name").toStdString ().c_str (),
|
||||||
|
elNode.attribute ("name").toStdString ().c_str ());
|
||||||
|
|
||||||
GstElement *pel = gst_element_factory_make(elNode.attribute("plugin-name").toStdString().c_str(),
|
if (!pel) {
|
||||||
elNode.attribute("name").toStdString().c_str());
|
QMessageBox::warning (
|
||||||
|
0,
|
||||||
|
"Element creation failed",
|
||||||
|
QString ("Could not create element of `")
|
||||||
|
+ elNode.attribute ("plugin-name") + "` with name `"
|
||||||
|
+ elNode.attribute ("name") + "`");
|
||||||
|
|
||||||
if(!pel)
|
child = child.nextSibling ();
|
||||||
{
|
|
||||||
QMessageBox::warning(0, "Element creation failed",
|
|
||||||
QString("Could not create element of `") +
|
|
||||||
elNode.attribute("plugin-name") + "` with name `" +
|
|
||||||
elNode.attribute("name") + "`");
|
|
||||||
|
|
||||||
child = child.nextSibling();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool res = gst_bin_add(GST_BIN(pipeline), pel);
|
bool res = gst_bin_add (GST_BIN (pipeline), pel);
|
||||||
|
|
||||||
if(!res)
|
if (!res) {
|
||||||
{
|
QMessageBox::warning (
|
||||||
QMessageBox::warning(0, "Element insertion failed",
|
0,
|
||||||
QString("Could not insert element `") +
|
"Element insertion failed",
|
||||||
elNode.attribute("name") + "` to pipeline");
|
QString ("Could not insert element `") + elNode.attribute ("name")
|
||||||
|
+ "` to pipeline");
|
||||||
|
|
||||||
child = child.nextSibling();
|
child = child.nextSibling ();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_element_sync_state_with_parent(pel);
|
gst_element_sync_state_with_parent (pel);
|
||||||
|
|
||||||
|
QDomNode elementChild = elNode.firstChild ();
|
||||||
QDomNode elementChild = elNode.firstChild();
|
while (!elementChild.isNull ()) {
|
||||||
while(!elementChild.isNull())
|
if (elementChild.toElement ().tagName () == "pad") {
|
||||||
{
|
QDomNode padChild = elementChild.firstChild ();
|
||||||
if(elementChild.toElement().tagName() == "pad")
|
QDomElement elPad = elementChild.toElement ();
|
||||||
{
|
|
||||||
QDomNode padChild = elementChild.firstChild();
|
|
||||||
QDomElement elPad = elementChild.toElement();
|
|
||||||
// GstPadPresence presence = GST_PAD_ALWAYS;
|
// GstPadPresence presence = GST_PAD_ALWAYS;
|
||||||
|
|
||||||
QString templaneName;
|
QString templaneName;
|
||||||
if(elPad.attribute("presence") == "request")
|
if (elPad.attribute ("presence") == "request")
|
||||||
create_requst_pad(pel, elPad.attribute("template-name"), elPad.attribute("name"));
|
create_requst_pad (pel, elPad.attribute ("template-name"),
|
||||||
|
elPad.attribute ("name"));
|
||||||
|
|
||||||
while(!padChild.isNull())
|
while (!padChild.isNull ()) {
|
||||||
{
|
if (padChild.toElement ().tagName () == "connected-to") {
|
||||||
if(padChild.toElement().tagName() == "connected-to")
|
|
||||||
{
|
|
||||||
bool isExists = false;
|
bool isExists = false;
|
||||||
QDomElement elCoonnectedTo = padChild.toElement();
|
QDomElement elCoonnectedTo = padChild.toElement ();
|
||||||
|
|
||||||
for(std::size_t i=0; i<connections.size(); i++)
|
for (std::size_t i = 0; i < connections.size (); i++) {
|
||||||
{
|
if ((connections[i].element1
|
||||||
if((connections[i].element1 == elNode.attribute("name").toStdString() &&
|
== elNode.attribute ("name").toStdString ()
|
||||||
connections[i].element2 == elCoonnectedTo.attribute("element-name").toStdString() &&
|
&& connections[i].element2
|
||||||
connections[i].pad1 == elPad.attribute("name").toStdString() &&
|
== elCoonnectedTo.attribute ("element-name").toStdString ()
|
||||||
connections[i].pad2 == elCoonnectedTo.attribute("pad-name").toStdString())
|
&& connections[i].pad1
|
||||||
||
|
== elPad.attribute ("name").toStdString ()
|
||||||
(connections[i].element2 == elNode.attribute("name").toStdString() &&
|
&& connections[i].pad2
|
||||||
connections[i].element1 == elCoonnectedTo.attribute("element-name").toStdString() &&
|
== elCoonnectedTo.attribute ("pad-name").toStdString ())
|
||||||
connections[i].pad2 == elPad.attribute("name").toStdString() &&
|
|| (connections[i].element2
|
||||||
connections[i].pad1 ==elCoonnectedTo.attribute("pad-name").toStdString())
|
== elNode.attribute ("name").toStdString ()
|
||||||
)
|
&& connections[i].element1
|
||||||
{
|
== elCoonnectedTo.attribute ("element-name").toStdString ()
|
||||||
|
&& connections[i].pad2
|
||||||
|
== elPad.attribute ("name").toStdString ()
|
||||||
|
&& connections[i].pad1
|
||||||
|
== elCoonnectedTo.attribute ("pad-name").toStdString ())) {
|
||||||
isExists = true;
|
isExists = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isExists)
|
if (!isExists) {
|
||||||
{
|
|
||||||
Connection newConnetion;
|
Connection newConnetion;
|
||||||
newConnetion.element1 = elNode.attribute("name").toStdString();
|
newConnetion.element1 =
|
||||||
newConnetion.element2 = padChild.toElement().attribute("element-name").toStdString();
|
elNode.attribute ("name").toStdString ();
|
||||||
newConnetion.pad1 = elementChild.toElement().attribute("name").toStdString();
|
newConnetion.element2 = padChild.toElement ().attribute (
|
||||||
newConnetion.pad2 = padChild.toElement().attribute("pad-name").toStdString();
|
"element-name").toStdString ();
|
||||||
|
newConnetion.pad1 =
|
||||||
|
elementChild.toElement ().attribute ("name").toStdString ();
|
||||||
|
newConnetion.pad2 =
|
||||||
|
padChild.toElement ().attribute ("pad-name").toStdString ();
|
||||||
|
|
||||||
connections.push_back(newConnetion);
|
connections.push_back (newConnetion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
padChild = padChild.nextSibling();
|
padChild = padChild.nextSibling ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(elementChild.toElement().tagName() == "properties")
|
else if (elementChild.toElement ().tagName () == "properties") {
|
||||||
{
|
loadProperties (elementChild.toElement (), pel);
|
||||||
loadProperties(elementChild.toElement(), pel);
|
|
||||||
}
|
}
|
||||||
elementChild = elementChild.nextSibling();
|
elementChild = elementChild.nextSibling ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
child = child.nextSibling();
|
child = child.nextSibling ();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t maxStarts = 5;
|
std::size_t maxStarts = 5;
|
||||||
bool setReady = true;
|
bool setReady = true;
|
||||||
for(std::size_t k=0; k<maxStarts; k++)
|
for (std::size_t k = 0; k < maxStarts; k++) {
|
||||||
{
|
if (connections.empty ())
|
||||||
if(connections.empty())
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(k > 0)
|
if (k > 0)
|
||||||
setReady = false;
|
setReady = false;
|
||||||
|
|
||||||
while(true)
|
while (true) {
|
||||||
{
|
std::size_t i = 0;
|
||||||
std::size_t i=0;
|
for (; i < connections.size (); i++) {
|
||||||
for(; i<connections.size(); i++)
|
GstElement *el1 = gst_bin_get_by_name (
|
||||||
{
|
GST_BIN (pipeline), connections[i].element1.c_str ());
|
||||||
GstElement *el1 = gst_bin_get_by_name (GST_BIN(pipeline), connections[i].element1.c_str());
|
GstElement *el2 = gst_bin_get_by_name (
|
||||||
GstElement *el2 = gst_bin_get_by_name (GST_BIN(pipeline), connections[i].element2.c_str());
|
GST_BIN (pipeline), connections[i].element2.c_str ());
|
||||||
|
|
||||||
if(!el1 || !el2)
|
if (!el1 || !el2) {
|
||||||
{
|
QMessageBox::warning (
|
||||||
QMessageBox::warning(0, "Internal error",
|
0,
|
||||||
QString("Could not find one of elements `") +
|
"Internal error",
|
||||||
QString(connections[i].element1.c_str()) + "`, `" +
|
QString ("Could not find one of elements `")
|
||||||
QString(connections[i].element2.c_str()) + "`");
|
+ QString (connections[i].element1.c_str ()) + "`, `"
|
||||||
|
+ QString (connections[i].element2.c_str ()) + "`");
|
||||||
|
|
||||||
gst_object_unref(el1);
|
gst_object_unref (el1);
|
||||||
gst_object_unref(el2);
|
gst_object_unref (el2);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstPad *pad1 = gst_element_get_static_pad(el1, connections[i].pad1.c_str());
|
GstPad *pad1 = gst_element_get_static_pad (
|
||||||
GstPad *pad2 = gst_element_get_static_pad(el2, connections[i].pad2.c_str());
|
el1, connections[i].pad1.c_str ());
|
||||||
|
GstPad *pad2 = gst_element_get_static_pad (
|
||||||
|
el2, connections[i].pad2.c_str ());
|
||||||
|
|
||||||
if(pad1 && pad2)
|
if (pad1 && pad2) {
|
||||||
{
|
if (GST_PAD_IS_SRC (pad1))
|
||||||
if(GST_PAD_IS_SRC(pad1))
|
gst_element_link_pads (el1, connections[i].pad1.c_str (), el2,
|
||||||
gst_element_link_pads(el1, connections[i].pad1.c_str(), el2, connections[i].pad2.c_str());
|
connections[i].pad2.c_str ());
|
||||||
else
|
else
|
||||||
gst_element_link_pads(el2, connections[i].pad2.c_str(), el1, connections[i].pad1.c_str());
|
gst_element_link_pads (el2, connections[i].pad2.c_str (), el1,
|
||||||
|
connections[i].pad1.c_str ());
|
||||||
|
|
||||||
gst_object_unref(pad1);
|
gst_object_unref (pad1);
|
||||||
gst_object_unref(pad2);
|
gst_object_unref (pad2);
|
||||||
connections.erase(connections.begin() + i);
|
connections.erase (connections.begin () + i);
|
||||||
|
|
||||||
gst_object_unref(el1);
|
gst_object_unref (el1);
|
||||||
gst_object_unref(el2);
|
gst_object_unref (el2);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pad1)
|
if (pad1)
|
||||||
gst_object_unref(pad1);
|
gst_object_unref (pad1);
|
||||||
|
|
||||||
if(pad2)
|
if (pad2)
|
||||||
gst_object_unref(pad2);
|
gst_object_unref (pad2);
|
||||||
|
|
||||||
gst_object_unref(el1);
|
gst_object_unref (el1);
|
||||||
gst_object_unref(el2);
|
gst_object_unref (el2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i == connections.size())
|
if (i == connections.size ())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!connections.empty())
|
if (!connections.empty ()) {
|
||||||
{
|
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
||||||
gst_element_set_state(pipeline, GST_STATE_PAUSED);
|
|
||||||
|
|
||||||
GstState state;
|
GstState state;
|
||||||
gst_element_get_state (pipeline, &state, NULL, GST_MSECOND * 2500);
|
gst_element_get_state (pipeline, &state, NULL, GST_MSECOND * 2500);
|
||||||
|
@ -615,15 +593,16 @@ bool PipelineIE::Import(QSharedPointer<GraphManager> pgraph, const QString &file
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(setReady)
|
if (setReady)
|
||||||
gst_element_set_state(pipeline, GST_STATE_READY);
|
gst_element_set_state (pipeline, GST_STATE_READY);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PipelineIE::Clear(QSharedPointer<GraphManager> pgraph)
|
bool
|
||||||
|
PipelineIE::Clear (QSharedPointer<GraphManager> pgraph)
|
||||||
{
|
{
|
||||||
GstElement *pipeline = pgraph -> m_pGraph;
|
GstElement *pipeline = pgraph->m_pGraph;
|
||||||
clearPipeline(pipeline);
|
clearPipeline (pipeline);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,31 +14,34 @@
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
static gint plugins_sort_cb (gconstpointer a, gconstpointer b)
|
static gint
|
||||||
|
plugins_sort_cb (gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
Plugin* p1 = (Plugin*)a;
|
Plugin* p1 = (Plugin*) a;
|
||||||
Plugin* p2 = (Plugin*)b;
|
Plugin* p2 = (Plugin*) b;
|
||||||
qDebug() << "Sort p1: " << p1 -> getName() << " and p2: " << p2 -> getName();
|
qDebug () << "Sort p1: " << p1->getName () << " and p2: " << p2->getName ();
|
||||||
if (p1->getRank() > p2->getRank())
|
if (p1->getRank () > p2->getRank ())
|
||||||
return 1;
|
return 1;
|
||||||
else if (p1->getRank() == p2->getRank()) {
|
else if (p1->getRank () == p2->getRank ()) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsList::PluginsList()
|
PluginsList::PluginsList ()
|
||||||
{
|
{
|
||||||
init();
|
init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsList::~PluginsList()
|
PluginsList::~PluginsList ()
|
||||||
{
|
{
|
||||||
//g_list_free(m_pluginsList);
|
//g_list_free(m_pluginsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsList::init()
|
void
|
||||||
|
PluginsList::init ()
|
||||||
{
|
{
|
||||||
std::size_t num = 0;
|
std::size_t num = 0;
|
||||||
GList *plugins;
|
GList *plugins;
|
||||||
|
@ -47,33 +50,30 @@ void PluginsList::init()
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
registry = gst_registry_get();
|
registry = gst_registry_get();
|
||||||
#else
|
#else
|
||||||
registry = gst_registry_get_default();
|
registry = gst_registry_get_default ();
|
||||||
#endif
|
#endif
|
||||||
plugins = gst_registry_get_plugin_list(registry);
|
plugins = gst_registry_get_plugin_list (registry);
|
||||||
while(plugins)
|
while (plugins) {
|
||||||
{
|
|
||||||
GstPlugin *plugin;
|
GstPlugin *plugin;
|
||||||
plugin = (GstPlugin *) (plugins->data);
|
plugin = (GstPlugin *) (plugins->data);
|
||||||
plugins = g_list_next (plugins);
|
plugins = g_list_next (plugins);
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
registry = gst_registry_get();
|
registry = gst_registry_get();
|
||||||
#else
|
#else
|
||||||
registry = gst_registry_get_default();
|
registry = gst_registry_get_default ();
|
||||||
#endif
|
#endif
|
||||||
GList *features = gst_registry_get_feature_list_by_plugin (registry,
|
GList *features = gst_registry_get_feature_list_by_plugin (
|
||||||
gst_plugin_get_name (plugin));
|
registry, gst_plugin_get_name (plugin));
|
||||||
|
|
||||||
while(features)
|
while (features) {
|
||||||
{
|
|
||||||
GstPluginFeature *feature;
|
GstPluginFeature *feature;
|
||||||
feature = GST_PLUGIN_FEATURE (features->data);
|
feature = GST_PLUGIN_FEATURE (features->data);
|
||||||
if(GST_IS_ELEMENT_FACTORY (feature))
|
if (GST_IS_ELEMENT_FACTORY (feature)) {
|
||||||
{
|
|
||||||
GstElementFactory *factory;
|
GstElementFactory *factory;
|
||||||
factory = GST_ELEMENT_FACTORY (feature);
|
factory = GST_ELEMENT_FACTORY (feature);
|
||||||
int rank = gst_plugin_feature_get_rank(GST_PLUGIN_FEATURE(factory));
|
int rank = gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory));
|
||||||
Plugin* p = new Plugin(GST_OBJECT_NAME (factory), rank);
|
Plugin* p = new Plugin (GST_OBJECT_NAME (factory), rank);
|
||||||
m_pluginsList = g_list_append(m_pluginsList, p);
|
m_pluginsList = g_list_append (m_pluginsList, p);
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,69 +82,75 @@ void PluginsList::init()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GList* PluginsList::getSortedByRank()
|
GList*
|
||||||
|
PluginsList::getSortedByRank ()
|
||||||
{
|
{
|
||||||
GList* sorted_list = g_list_sort(m_pluginsList, plugins_sort_cb);
|
GList* sorted_list = g_list_sort (m_pluginsList, plugins_sort_cb);
|
||||||
return sorted_list;
|
return sorted_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
GList* PluginsList::getPluginListByCaps(GstPadDirection direction, GstCaps* caps)
|
GList*
|
||||||
|
PluginsList::getPluginListByCaps (GstPadDirection direction, GstCaps* caps)
|
||||||
{
|
{
|
||||||
GList * caps_plugins_list = NULL;
|
GList * caps_plugins_list = NULL;
|
||||||
GList *l,*p;
|
GList *l, *p;
|
||||||
|
|
||||||
for (l = m_pluginsList; l != NULL; l = l->next) {
|
for (l = m_pluginsList; l != NULL; l = l->next) {
|
||||||
Plugin* plugin = (Plugin*)(l->data);
|
Plugin* plugin = (Plugin*) (l->data);
|
||||||
GstElementFactory* factory = gst_element_factory_find(plugin->getName().toStdString().c_str());
|
GstElementFactory* factory = gst_element_factory_find (
|
||||||
|
plugin->getName ().toStdString ().c_str ());
|
||||||
if (factory) {
|
if (factory) {
|
||||||
const GList* pads = gst_element_factory_get_static_pad_templates(factory);
|
const GList* pads = gst_element_factory_get_static_pad_templates (
|
||||||
for (p = (GList*)pads; p != NULL; p = p->next) {
|
factory);
|
||||||
GstStaticPadTemplate* padTemplate = (GstStaticPadTemplate*)(p->data);
|
for (p = (GList*) pads; p != NULL; p = p->next) {
|
||||||
if (padTemplate->direction == direction && gst_caps_can_intersect(caps, padTemplate->static_caps.caps))
|
GstStaticPadTemplate* padTemplate = (GstStaticPadTemplate*) (p->data);
|
||||||
caps_plugins_list = g_list_append(caps_plugins_list, plugin);
|
if (padTemplate->direction == direction
|
||||||
|
&& gst_caps_can_intersect (caps, padTemplate->static_caps.caps))
|
||||||
|
caps_plugins_list = g_list_append (caps_plugins_list, plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return caps_plugins_list;
|
return caps_plugins_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsListDialog::PluginsListDialog(PluginsList* pluginList, QWidget *pwgt, Qt::WindowFlags f):
|
PluginsListDialog::PluginsListDialog (PluginsList* pluginList, QWidget *pwgt,
|
||||||
QDialog(pwgt, f)
|
Qt::WindowFlags f)
|
||||||
, m_pPluginsList(pluginList)
|
: QDialog (pwgt, f),
|
||||||
, m_pGraph(NULL)
|
m_pPluginsList (pluginList),
|
||||||
|
m_pGraph (NULL)
|
||||||
{
|
{
|
||||||
m_pPlugins = new QListWidget;
|
m_pPlugins = new QListWidget;
|
||||||
m_pPlugins->setSortingEnabled(true);
|
m_pPlugins->setSortingEnabled (true);
|
||||||
m_plblInfo = new QLabel;
|
m_plblInfo = new QLabel;
|
||||||
|
|
||||||
m_plblInfo -> setTextInteractionFlags(Qt::TextSelectableByMouse);
|
m_plblInfo->setTextInteractionFlags (Qt::TextSelectableByMouse);
|
||||||
m_plblInfo -> setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
m_plblInfo->setAlignment (Qt::AlignLeft | Qt::AlignTop);
|
||||||
QScrollArea *pscroll = new QScrollArea;
|
QScrollArea *pscroll = new QScrollArea;
|
||||||
pscroll -> setWidget(m_plblInfo);
|
pscroll->setWidget (m_plblInfo);
|
||||||
m_plblInfo -> resize(pscroll -> size());
|
m_plblInfo->resize (pscroll->size ());
|
||||||
|
|
||||||
QHBoxLayout *phblay = new QHBoxLayout;
|
QHBoxLayout *phblay = new QHBoxLayout;
|
||||||
|
|
||||||
phblay -> addWidget(m_pPlugins, 1);
|
phblay->addWidget (m_pPlugins, 1);
|
||||||
phblay -> addWidget(pscroll, 2);
|
phblay->addWidget (pscroll, 2);
|
||||||
|
|
||||||
InitPluginsList();
|
InitPluginsList ();
|
||||||
|
|
||||||
QHBoxLayout *phblayFind = new QHBoxLayout;
|
QHBoxLayout *phblayFind = new QHBoxLayout;
|
||||||
|
|
||||||
QLineEdit *ple = new QLineEdit;
|
QLineEdit *ple = new QLineEdit;
|
||||||
phblayFind -> addWidget(ple);
|
phblayFind->addWidget (ple);
|
||||||
phblayFind -> addStretch(1);
|
phblayFind->addStretch (1);
|
||||||
|
|
||||||
ple -> setPlaceholderText("Search...");
|
ple->setPlaceholderText ("Search...");
|
||||||
|
|
||||||
QVBoxLayout *pvblay = new QVBoxLayout;
|
QVBoxLayout *pvblay = new QVBoxLayout;
|
||||||
pvblay -> addLayout(phblayFind);
|
pvblay->addLayout (phblayFind);
|
||||||
pvblay -> addLayout(phblay);
|
pvblay->addLayout (phblay);
|
||||||
|
|
||||||
setLayout(pvblay);
|
setLayout (pvblay);
|
||||||
|
|
||||||
setWindowTitle("Add plugin");
|
setWindowTitle ("Add plugin");
|
||||||
|
|
||||||
QObject::connect(m_pPlugins, SIGNAL(currentItemChanged (QListWidgetItem *, QListWidgetItem *)),
|
QObject::connect(m_pPlugins, SIGNAL(currentItemChanged (QListWidgetItem *, QListWidgetItem *)),
|
||||||
this, SLOT(showInfo(QListWidgetItem *, QListWidgetItem *)));
|
this, SLOT(showInfo(QListWidgetItem *, QListWidgetItem *)));
|
||||||
|
@ -154,148 +160,160 @@ QDialog(pwgt, f)
|
||||||
|
|
||||||
QObject::connect(ple, SIGNAL(textChanged(const QString &)), this, SLOT(filterPlagins(const QString &)));
|
QObject::connect(ple, SIGNAL(textChanged(const QString &)), this, SLOT(filterPlagins(const QString &)));
|
||||||
|
|
||||||
installEventFilter(this);
|
installEventFilter (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsListDialog::~PluginsListDialog()
|
PluginsListDialog::~PluginsListDialog ()
|
||||||
{
|
{
|
||||||
if (m_pPluginsList)
|
if (m_pPluginsList)
|
||||||
delete m_pPluginsList;
|
delete m_pPluginsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsListDialog::showInfo(QListWidgetItem *pitem, QListWidgetItem *previous)
|
void
|
||||||
|
PluginsListDialog::showInfo (QListWidgetItem *pitem, QListWidgetItem *previous)
|
||||||
{
|
{
|
||||||
qDebug() << "Show Info: " << pitem -> text();
|
qDebug () << "Show Info: " << pitem->text ();
|
||||||
m_plblInfo -> clear();
|
m_plblInfo->clear ();
|
||||||
QString descr;
|
QString descr;
|
||||||
descr += "<b>Plugin details</b><hr>";
|
descr += "<b>Plugin details</b><hr>";
|
||||||
|
|
||||||
GstElementFactory *factory = gst_element_factory_find(pitem -> text().toStdString().c_str());
|
GstElementFactory *factory = gst_element_factory_find (
|
||||||
if(!factory)
|
pitem->text ().toStdString ().c_str ());
|
||||||
{
|
if (!factory) {
|
||||||
qDebug() << "warning: " << pitem -> text() << " Not Found";
|
qDebug () << "warning: " << pitem->text () << " Not Found";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory = GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE(factory)));
|
factory = GST_ELEMENT_FACTORY (
|
||||||
if(!factory)
|
gst_plugin_feature_load (GST_PLUGIN_FEATURE (factory)));
|
||||||
{
|
if (!factory) {
|
||||||
qDebug() << "warning: " << pitem -> text() << " Not Found";
|
qDebug () << "warning: " << pitem->text () << " Not Found";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
GstPlugin *plugin = gst_plugin_feature_get_plugin (GST_PLUGIN_FEATURE (factory));
|
GstPlugin *plugin = gst_plugin_feature_get_plugin (GST_PLUGIN_FEATURE (factory));
|
||||||
#else
|
#else
|
||||||
const gchar* plugin_name = GST_PLUGIN_FEATURE(factory)->plugin_name;
|
const gchar* plugin_name = GST_PLUGIN_FEATURE (factory)->plugin_name;
|
||||||
if (!plugin_name) {
|
if (!plugin_name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GstPlugin* plugin = gst_default_registry_find_plugin(plugin_name);
|
GstPlugin* plugin = gst_default_registry_find_plugin (plugin_name);
|
||||||
#endif
|
#endif
|
||||||
if(!plugin)
|
if (!plugin) {
|
||||||
{
|
qDebug () << "warning: " << pitem->text () << " Not Found";
|
||||||
qDebug() << "warning: " << pitem -> text() << " Not Found";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
const gchar *release_date = gst_plugin_get_release_date_string (plugin);
|
const gchar *release_date = gst_plugin_get_release_date_string (plugin);
|
||||||
#else
|
#else
|
||||||
const gchar *release_date = (plugin->desc.release_datetime) ? plugin->desc.release_datetime : "";
|
const gchar *release_date =
|
||||||
|
(plugin->desc.release_datetime) ? plugin->desc.release_datetime : "";
|
||||||
#endif
|
#endif
|
||||||
const gchar *filename = gst_plugin_get_filename(plugin);
|
const gchar *filename = gst_plugin_get_filename (plugin);
|
||||||
|
|
||||||
descr += "<b>Name</b>: " + QString(gst_plugin_get_name(plugin)) + "<br>";
|
descr += "<b>Name</b>: " + QString (gst_plugin_get_name (plugin)) + "<br>";
|
||||||
descr += "<b>Description</b>: " + QString(gst_plugin_get_description(plugin)) + "<br>";
|
descr += "<b>Description</b>: "
|
||||||
descr += "<b>Filename</b>: " + QString((filename != NULL) ? filename : "(null)") + "<br>";
|
+ QString (gst_plugin_get_description (plugin)) + "<br>";
|
||||||
descr += "<b>Version</b>: " + QString(gst_plugin_get_version (plugin)) + "<br>";
|
descr += "<b>Filename</b>: "
|
||||||
descr += "<b>License</b>: " + QString(gst_plugin_get_license (plugin)) + "<br>";
|
+ QString ((filename != NULL) ? filename : "(null)") + "<br>";
|
||||||
descr += "<b>Source module</b>: " + QString(gst_plugin_get_source (plugin)) + "<br>";
|
descr += "<b>Version</b>: " + QString (gst_plugin_get_version (plugin))
|
||||||
|
+ "<br>";
|
||||||
|
descr += "<b>License</b>: " + QString (gst_plugin_get_license (plugin))
|
||||||
|
+ "<br>";
|
||||||
|
descr += "<b>Source module</b>: " + QString (gst_plugin_get_source (plugin))
|
||||||
|
+ "<br>";
|
||||||
|
|
||||||
if (release_date != NULL)
|
if (release_date != NULL) {
|
||||||
{
|
|
||||||
const gchar *tz = "(UTC)";
|
const gchar *tz = "(UTC)";
|
||||||
gchar *str, *sep;
|
gchar *str, *sep;
|
||||||
|
|
||||||
str = g_strdup (release_date);
|
str = g_strdup (release_date);
|
||||||
sep = strstr (str, "T");
|
sep = strstr (str, "T");
|
||||||
if (sep != NULL)
|
if (sep != NULL) {
|
||||||
{
|
|
||||||
*sep = ' ';
|
*sep = ' ';
|
||||||
sep = strstr (sep + 1, "Z");
|
sep = strstr (sep + 1, "Z");
|
||||||
if (sep != NULL)
|
if (sep != NULL)
|
||||||
*sep = ' ';
|
*sep = ' ';
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
tz = "";
|
tz = "";
|
||||||
}
|
}
|
||||||
descr += "<b>Source release date</b>: " + QString(str) + " " + QString(tz) + "<br>";
|
descr += "<b>Source release date</b>: " + QString (str) + " " + QString (tz)
|
||||||
|
+ "<br>";
|
||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
descr += "<b>Binary package</b>: " + QString(gst_plugin_get_package (plugin)) + "<br>";
|
descr += "<b>Binary package</b>: " + QString (gst_plugin_get_package (plugin))
|
||||||
descr += "<b>Origin URL</b>: " + QString(gst_plugin_get_origin (plugin)) + "<br>";
|
+ "<br>";
|
||||||
descr += "<b>Rank</b>: " + QString::number(gst_plugin_feature_get_rank(GST_PLUGIN_FEATURE(factory)));
|
descr += "<b>Origin URL</b>: " + QString (gst_plugin_get_origin (plugin))
|
||||||
m_plblInfo -> setText(descr);
|
+ "<br>";
|
||||||
|
descr += "<b>Rank</b>: "
|
||||||
|
+ QString::number (
|
||||||
|
gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory)));
|
||||||
|
m_plblInfo->setText (descr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsListDialog::insert(QListWidgetItem *pitem)
|
void
|
||||||
|
PluginsListDialog::insert (QListWidgetItem *pitem)
|
||||||
{
|
{
|
||||||
if(!pitem) {
|
if (!pitem) {
|
||||||
qDebug() << "Do not insert null item";
|
qDebug () << "Do not insert null item";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qDebug() << "Insert: " << pitem -> text();
|
qDebug () << "Insert: " << pitem->text ();
|
||||||
|
|
||||||
if(!m_pGraph || !m_pGraph -> AddPlugin(pitem -> text().toStdString().c_str(), NULL))
|
if (!m_pGraph
|
||||||
{
|
|| !m_pGraph->AddPlugin (pitem->text ().toStdString ().c_str (), NULL)) {
|
||||||
QMessageBox::warning(this, "Plugin addition problem", "Plugin `" + pitem -> text() + "` insertion was FAILED");
|
QMessageBox::warning (
|
||||||
qDebug() << "Plugin `" << pitem -> text() << "` insertion FAILED";
|
this, "Plugin addition problem",
|
||||||
|
"Plugin `" + pitem->text () + "` insertion was FAILED");
|
||||||
|
qDebug () << "Plugin `" << pitem->text () << "` insertion FAILED";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PluginsListDialog::eventFilter(QObject *obj, QEvent *event)
|
bool
|
||||||
|
PluginsListDialog::eventFilter (QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
if (event -> type() == QEvent::KeyPress)
|
if (event->type () == QEvent::KeyPress) {
|
||||||
{
|
QKeyEvent *key = static_cast<QKeyEvent*> (event);
|
||||||
QKeyEvent *key = static_cast<QKeyEvent*>(event);
|
|
||||||
|
|
||||||
if((key -> key() == Qt::Key_Enter) || (key -> key() == Qt::Key_Return) && m_pPlugins -> currentItem())
|
if ((key->key () == Qt::Key_Enter)
|
||||||
{
|
|| (key->key () == Qt::Key_Return) && m_pPlugins->currentItem ()) {
|
||||||
insert(m_pPlugins -> currentItem());
|
insert (m_pPlugins->currentItem ());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QDialog::eventFilter(obj, event);
|
return QDialog::eventFilter (obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsListDialog::filterPlagins(const QString &text)
|
void
|
||||||
|
PluginsListDialog::filterPlagins (const QString &text)
|
||||||
{
|
{
|
||||||
for(std::size_t i=0; i<m_pPlugins -> count(); i++)
|
for (std::size_t i = 0; i < m_pPlugins->count (); i++) {
|
||||||
{
|
QListWidgetItem *pitem = m_pPlugins->item (i);
|
||||||
QListWidgetItem *pitem = m_pPlugins -> item(i);
|
|
||||||
|
|
||||||
if(pitem -> text().contains(text))
|
if (pitem->text ().contains (text))
|
||||||
pitem -> setHidden(false);
|
pitem->setHidden (false);
|
||||||
else
|
else
|
||||||
pitem -> setHidden(true);
|
pitem->setHidden (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsListDialog::InitPluginsList()
|
void
|
||||||
|
PluginsListDialog::InitPluginsList ()
|
||||||
{
|
{
|
||||||
if (!m_pPluginsList)
|
if (!m_pPluginsList)
|
||||||
m_pPluginsList = new PluginsList ();
|
m_pPluginsList = new PluginsList ();
|
||||||
|
|
||||||
GList* plugins_list = m_pPluginsList->getList();
|
GList* plugins_list = m_pPluginsList->getList ();
|
||||||
GList* l;
|
GList* l;
|
||||||
std::size_t num = 0;
|
std::size_t num = 0;
|
||||||
|
|
||||||
for (l = plugins_list; l != NULL; l = l->next) {
|
for (l = plugins_list; l != NULL; l = l->next) {
|
||||||
Plugin* plugin = (Plugin*)(l->data);
|
Plugin* plugin = (Plugin*) (l->data);
|
||||||
m_pPlugins->addItem(plugin->getName());
|
m_pPlugins->addItem (plugin->getName ());
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,8 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
|
|
||||||
#include "GraphManager.h"
|
#include "GraphManager.h"
|
||||||
|
|
||||||
|
|
||||||
class Plugin
|
class Plugin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -17,8 +15,8 @@ public:
|
||||||
m_rank(rank)
|
m_rank(rank)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
const QString getName() { return m_name;}
|
const QString getName() {return m_name;}
|
||||||
int getRank() { return m_rank;}
|
int getRank() {return m_rank;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_name;
|
const QString m_name;
|
||||||
|
@ -32,25 +30,24 @@ public:
|
||||||
PluginsList();
|
PluginsList();
|
||||||
~PluginsList();
|
~PluginsList();
|
||||||
|
|
||||||
GList* getList() { return m_pluginsList;}
|
GList* getList() {return m_pluginsList;}
|
||||||
GList* getSortedByRank();
|
GList* getSortedByRank();
|
||||||
GList* getPluginListByCaps(GstPadDirection direction, GstCaps* caps);
|
GList* getPluginListByCaps(GstPadDirection direction, GstCaps* caps);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
GList* m_pluginsList;
|
GList* m_pluginsList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class PluginsListDialog: public QDialog
|
class PluginsListDialog: public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PluginsListDialog(PluginsList* pluginList, QWidget *pwgt = NULL, Qt::WindowFlags f = Qt::Window);
|
PluginsListDialog(PluginsList* pluginList, QWidget *pwgt = NULL, Qt::WindowFlags f = Qt::Window);
|
||||||
~PluginsListDialog();
|
~PluginsListDialog();
|
||||||
|
|
||||||
void setGraph(GraphManager* graph) { m_pGraph = graph;}
|
void setGraph(GraphManager* graph) {m_pGraph = graph;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *ev);
|
bool eventFilter(QObject *obj, QEvent *ev);
|
||||||
|
@ -72,7 +69,4 @@ private:
|
||||||
GraphManager *m_pGraph;
|
GraphManager *m_pGraph;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
#include "SeekSlider.h"
|
#include "SeekSlider.h"
|
||||||
|
|
||||||
void SeekSlider::mousePressEvent(QMouseEvent *event)
|
void
|
||||||
|
SeekSlider::mousePressEvent (QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if(event->button() == Qt::LeftButton)
|
if (event->button () == Qt::LeftButton) {
|
||||||
{
|
if (orientation () == Qt::Vertical)
|
||||||
if(orientation() == Qt::Vertical)
|
setValue (minimum ()
|
||||||
setValue(minimum() + ((maximum()-minimum()) * (height()-event->y())) / height() ) ;
|
+ ((maximum () - minimum ()) * (height () - event->y ())) / height ());
|
||||||
else
|
else
|
||||||
setValue(minimum() + ((maximum()-minimum()) * event->x()) / width() ) ;
|
setValue (minimum ()
|
||||||
|
+ ((maximum () - minimum ()) * event->x ()) / width ());
|
||||||
|
|
||||||
event->accept();
|
event->accept ();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSlider::mousePressEvent(event);
|
QSlider::mousePressEvent (event);
|
||||||
};
|
}
|
||||||
|
;
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
#ifndef SEEK_SLIDER_H_
|
#ifndef SEEK_SLIDER_H_
|
||||||
#define SEEK_SLIDER_H_
|
#define SEEK_SLIDER_H_
|
||||||
|
|
||||||
|
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
class SeekSlider: public QSlider
|
class SeekSlider: public QSlider
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *);
|
void mousePressEvent(QMouseEvent *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
13
src/main.cpp
13
src/main.cpp
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
|
@ -11,14 +12,14 @@ int main(int argc, char **argv)
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
registry = gst_registry_get();
|
registry = gst_registry_get();
|
||||||
#else
|
#else
|
||||||
registry = gst_registry_get_default();
|
registry = gst_registry_get_default ();
|
||||||
#endif
|
#endif
|
||||||
gst_registry_scan_path(registry, "./plugins");
|
gst_registry_scan_path (registry, "./plugins");
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app (argc, argv);
|
||||||
|
|
||||||
MainWindow wgt;
|
MainWindow wgt;
|
||||||
wgt.show();
|
wgt.show ();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue