mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2024-11-24 01:50:59 +00:00
Merge pull request #1 from virinext/master
Merging last patches before refacto
This commit is contained in:
commit
4ef31416a0
7 changed files with 98 additions and 23 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ pipeviz
|
|||
*.o
|
||||
moc_*
|
||||
src/version_info.h
|
||||
pipeviz.pro.user
|
||||
|
|
51
gstreamer.prf
Normal file
51
gstreamer.prf
Normal file
|
@ -0,0 +1,51 @@
|
|||
# =============================================================
|
||||
# This optional feature file adds GStreamer dependencies
|
||||
# =============================================================
|
||||
unix {
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += gstreamer-1.0
|
||||
} else {
|
||||
|
||||
GSTREAMER_PATH = $$clean_path($$(GSTREAMER_1_0_ROOT_X86))
|
||||
if(isEmpty(GSTREAMER_PATH)) {
|
||||
GSTREAMER_PATH = $$clean_path($$(GSTREAMER_1_0_ROOT_X86_64))
|
||||
}
|
||||
|
||||
if(isEmpty(GSTREAMER_PATH)|!exists($${GSTREAMER_PATH})) {
|
||||
|
||||
text = "\"GStreamer\" not found: to be able to use the debugger, don't forget to add"
|
||||
text = "$${text} \"%GSTREAMER_1_0_ROOT_X86_64%\bin\" in your PATH"
|
||||
!build:warning("$${text}")
|
||||
|
||||
} else {
|
||||
|
||||
DEFINES += GST_USE_UNSTABLE_API
|
||||
|
||||
GST_INCLUDEPATH = \
|
||||
$$clean_path($$GSTREAMER_PATH/include/gstreamer-1.0) \
|
||||
$$clean_path($$GSTREAMER_PATH/include/glib-2.0) \
|
||||
$$clean_path($$GSTREAMER_PATH/lib/glib-2.0/include)
|
||||
*-g++ {
|
||||
# To avoid warnings due to GStreamer, use -isystem automatically for any GStreamer system header:
|
||||
for(somelib, $$list($$GST_INCLUDEPATH)) {
|
||||
QMAKE_CXXFLAGS += -isystem $${somelib}
|
||||
}
|
||||
} else {
|
||||
INCLUDEPATH += $${GST_INCLUDEPATH}
|
||||
}
|
||||
unset(GST_INCLUDEPATH)
|
||||
|
||||
win32-g++ {
|
||||
LIBS += \
|
||||
$${GSTREAMER_PATH}/lib/glib-2.0.lib \
|
||||
$${GSTREAMER_PATH}/lib/gobject-2.0.lib \
|
||||
$${GSTREAMER_PATH}/lib/gstreamer-1.0.lib
|
||||
} else {
|
||||
LIBS += \
|
||||
-L$$GSTREAMER_PATH/lib \
|
||||
-lglib-2.0 \
|
||||
-lgobject-2.0 \
|
||||
-lgstreamer-1.0
|
||||
}
|
||||
} # GStreamer found
|
||||
}
|
|
@ -10,7 +10,7 @@ QT += xml
|
|||
QT += core
|
||||
INCLUDEPATH += . src
|
||||
|
||||
CONFIG += link_pkgconfig
|
||||
CONFIG += gstreamer
|
||||
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Location of our own features:
|
||||
command = $$[QT_INSTALL_BINS]/qmake -set QMAKEFEATURES $$_PRO_FILE_PWD_
|
||||
system($$command)|error("Failed to run: $$command")
|
||||
|
||||
include(pipeviz.pri)
|
||||
|
||||
PKGCONFIG += gstreamer-1.0
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ Building:
|
|||
|
||||
cd pipeviz
|
||||
|
||||
qmake pipeviz.pro
|
||||
QMAKEFEATURES=. qmake pipeviz.pro
|
||||
|
||||
make gitinfo
|
||||
|
||||
|
|
|
@ -130,10 +130,11 @@ ElementProperties::addParamSimple (GParamSpec *param, GstElement *element,
|
|||
|
||||
QString propertyName = g_param_spec_get_name (param);
|
||||
QString propertyValue;
|
||||
GType type = G_VALUE_TYPE (&value);
|
||||
|
||||
bool skip = false;
|
||||
|
||||
switch (G_VALUE_TYPE (&value)) {
|
||||
switch (type) {
|
||||
case G_TYPE_STRING: {
|
||||
const char *string_val = g_value_get_string (&value);
|
||||
propertyValue = string_val;
|
||||
|
@ -186,6 +187,16 @@ ElementProperties::addParamSimple (GParamSpec *param, GstElement *element,
|
|||
}
|
||||
|
||||
default: {
|
||||
if (type == g_type_from_name("GstCaps")) {
|
||||
GstCaps *gstcaps;
|
||||
g_object_get (G_OBJECT (element), param->name, &gstcaps, NULL);
|
||||
const char *string_val = gst_caps_to_string (gstcaps);
|
||||
if (gstcaps == NULL)
|
||||
string_val = "ANY";
|
||||
propertyValue = string_val;
|
||||
break;
|
||||
}
|
||||
|
||||
skip = true;
|
||||
LOG_INFO("property %s not supported", propertyName.toStdString ().c_str ());
|
||||
break;
|
||||
|
@ -310,7 +321,8 @@ ElementProperties::applyClicked ()
|
|||
}
|
||||
}
|
||||
else {
|
||||
switch (param->value_type) {
|
||||
GType type = param->value_type;
|
||||
switch (type) {
|
||||
case G_TYPE_STRING: {
|
||||
g_object_set (G_OBJECT (element), propName,
|
||||
valStr.toStdString ().c_str (), NULL);
|
||||
|
@ -372,6 +384,20 @@ ElementProperties::applyClicked ()
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
if (type == g_type_from_name("GstCaps")) {
|
||||
GstCaps *oldval;
|
||||
GstCaps *newval = gst_caps_from_string (valStr.toStdString ().c_str ());
|
||||
g_object_get (G_OBJECT (element), propName, &oldval, NULL);
|
||||
|
||||
if (oldval != newval && oldval != NULL) {
|
||||
/* Release old */
|
||||
gst_caps_unref (oldval);
|
||||
}
|
||||
|
||||
g_object_set (G_OBJECT (element), propName, newval, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
LOG_INFO("property %s not supported", itr.key ());
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -10,27 +10,26 @@
|
|||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
#include <QTime>
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <thread>
|
||||
|
||||
G_LOCK_DEFINE_STATIC(logger);
|
||||
|
||||
static long int getThreadID() {
|
||||
return syscall(SYS_gettid);
|
||||
return quintptr(QThread::currentThreadId());
|
||||
}
|
||||
|
||||
void
|
||||
Logger::configure_logger ()
|
||||
{
|
||||
QString lastGstDebugString = CustomSettings::lastGstDebugString ();
|
||||
setenv (lastGstDebugString.split ("=").at (0).toStdString ().c_str (), lastGstDebugString.split ("=").at (1).toStdString ().c_str (), 1);
|
||||
setenv ("GST_DEBUG_NO_COLOR", "1", 1);
|
||||
setenv ("GST_DEBUG_FILE", "/tmp/gst_pipeviz.txt", 1);
|
||||
qputenv(lastGstDebugString.split("=").at(0).toStdString ().c_str(),
|
||||
lastGstDebugString.split("=").at(1).toLocal8Bit());
|
||||
qputenv("GST_DEBUG_NO_COLOR", QByteArray("1"));
|
||||
qputenv("GST_DEBUG_FILE", QByteArray("gst_pipeviz.txt"));
|
||||
}
|
||||
|
||||
Logger::Logger()
|
||||
|
@ -57,20 +56,17 @@ void Logger::createLog(TimeStampFlag flag, const char* format, ...)
|
|||
// first check if we should add the timestamp before the string
|
||||
char* new_fmt = NULL;
|
||||
if (flag == Logger::UseTimeStamp) {
|
||||
const char* fmt_template = "%02d:%02d:%02d:%06ld %d 0x%x %s";
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
struct tm t;
|
||||
gettimeofday(&tv, &tz);
|
||||
localtime_r(&(tv.tv_sec), &t);
|
||||
int len = snprintf(NULL, 0, fmt_template, t.tm_hour,t.tm_min,t.tm_sec, tv.tv_usec, getThreadID(), std::this_thread::get_id(), format);
|
||||
QString szTimestamp(QTime::currentTime().toString("HH:mm:ss:zzz"));
|
||||
|
||||
const char* fmt_template = "%s %d 0x%x %s";
|
||||
int len = snprintf(NULL, 0, fmt_template, szTimestamp.toStdString().c_str(), getThreadID(), std::this_thread::get_id(), format);
|
||||
if (len < 0) {
|
||||
// cannot parse the string
|
||||
return;
|
||||
}
|
||||
len++; // add 1 byte for the additional terminating null character
|
||||
new_fmt = static_cast<char*>(malloc(sizeof(char) * len));
|
||||
snprintf(new_fmt, len, fmt_template, t.tm_hour,t.tm_min,t.tm_sec, tv.tv_usec, getThreadID(), std::this_thread::get_id(), format);
|
||||
snprintf(new_fmt, len, fmt_template, szTimestamp.toStdString().c_str(), getThreadID(), std::this_thread::get_id(), format);
|
||||
}
|
||||
|
||||
// create the actual string (timestamp + format...)
|
||||
|
@ -271,7 +267,7 @@ void Logger::run()
|
|||
FILE* file;
|
||||
gchar* line;
|
||||
|
||||
file = fopen("/tmp/gst_pipeviz.txt", "r");
|
||||
file = fopen("gst_pipeviz.txt", "r");
|
||||
if(!file)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in a new issue