Skip to content

Commit

Permalink
Merge branch 'release/v0.12.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
migueltaylor committed Mar 8, 2021
2 parents 87bbfbf + ca02794 commit 8b1fb13
Show file tree
Hide file tree
Showing 17 changed files with 284 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ jobs:
run: sudo make install
- name: List Pipelines Verification
run: |
gstd
gstd -e
gstd-client list_pipelines
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SUBDIRS=gstd \
libgstc \
tests \
examples \
docs
docs \
init

EXTRA_DIST=autogen.sh
87 changes: 82 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dnl required version of autoconf
AC_PREREQ([2.53])

dnl Gstreamer's daemon package name and version
AC_INIT([gstd],[0.11.3])
AC_INIT([gstd],[0.12.0])

dnl required version of gstreamer and gst-plugins-base
GST_REQUIRED=1.0.0
Expand All @@ -22,6 +22,9 @@ LIBD_REQUIRED=0.14
dnl required version of jansson
JANSSON_REQUIRED=2.7

dnl required version of systemd
SYSTEMD_REQUIRED=232

AC_CONFIG_SRCDIR([gstd/gstd.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIRS([m4])
Expand Down Expand Up @@ -189,16 +192,87 @@ default=${localstatedir}/run/gstd/
AC_ARG_WITH([gstd-runstatedir],
[AS_HELP_STRING([--with-gstd-runstatedir],
[Specify the location of the gstd's PID file @<:@default=${default}@:>@])],
[AC_SUBST(gstdrunstatedir, [$with_gstd_runstatedir])],
[AC_SUBST(gstdrunstatedir, [$default])])
[AC_SUBST(GSTD_RUN_STATE_DIR, [$with_gstd_runstatedir])],
[AC_SUBST(GSTD_RUN_STATE_DIR, [$default])])

dnl allow the user to specify the location of the log files
default=${localstatedir}/log/gstd/
AC_ARG_WITH([gstd-logstatedir],
[AS_HELP_STRING([--with-gstd-logstatedir],
[Specify the location of gstd's log files @<:@default=${default}@:>@])],
[AC_SUBST([gstdlogstatedir], [$with_gstd_logstatedir])],
[AC_SUBST([gstdlogstatedir], [$default])])
[AC_SUBST([GSTD_LOG_STATE_DIR], [$with_gstd_logstatedir/])],
[AC_SUBST([GSTD_LOG_STATE_DIR], [$default])])

dnl allow the user to disable systemd gstd.service install
systemd=true
systemd_required=true
AC_ARG_ENABLE(systemd,
AS_HELP_STRING([--enable-systemd], [Enable/disable install of systemd gstd.service]),
[ if test "x$enable_systemd" = "xno" ; then
systemd=false
systemd_required=false
fi
],
[
systemd_required=false
])

dnl check for systemd dependency
if test "$systemd" = true; then
PKG_CHECK_MODULES(SYSTEMD, [
systemd >= $SYSTEMD_REQUIRED
], [
AC_SUBST([GSTD_SYSTEMD_CONF_DIR], [$(pkg-config systemd --variable=tmpfilesdir)])
AC_SUBST([GSTD_SYSTEMD_DIR], [$(pkg-config systemd --variable=systemduserunitdir)])
], [
systemd=false
if test "$systemd_required" = true; then
AC_MSG_ERROR([
Can't find systemd development packages:
systemd >= $SYSTEMD_REQUIRED
Please make sure you have the necessary systemd
development headers installed.
])
else
AC_MSG_WARN([
Can't find systemd development packages:
gstd.service will not be installed
])
fi
])
fi
AM_CONDITIONAL(WITH_SYSTEMD, test "$systemd" = true)

dnl allow the user to specify systemd gstd.service file location
AC_ARG_WITH([gstd-systemddir],
AS_HELP_STRING([--with-gstd-systemddir@<:@=DIR@:>@],
[Install systemd gstd.service @<:@to DIR if specified@:>@, otherwise defaults to systemd variable systemduserunitdir]),
[AC_SUBST([GSTD_SYSTEMD_DIR], [$with_gstd_systemddir])], [])

dnl allow the user to enable init script install
AC_ARG_ENABLE(initd,
AS_HELP_STRING([--enable-initd], [Enable install of init.d script]),
[ initd=true ],
[ initd=false ])
AM_CONDITIONAL(WITH_INITD, test "$initd" = true)

dnl allow the user to specify init script location
default=${sysconfdir}/init.d/
AC_ARG_WITH([gstd-initddir],
AS_HELP_STRING([--with-gstd-initddir@<:@=DIR@:>@],
[Install init script @<:@to DIR if specified@:>@, otherwise defaults to ${sysconfdir}/init.d/]),
[AC_SUBST([GSTD_INITD_DIR], [$with_gstd_initddir])],
[AC_SUBST([GSTD_INITD_DIR], [$default])])

dnl allow the user to specify the owner of the state dirs
AC_ARG_WITH([statedir-owner],
AS_HELP_STRING([--with-statedir-owner@<:@=USERNAME@:>@],
[Set the state initd created dirs ownership to @<:@USERNAME@:>@, @<:@default=root@:>@]),
[AC_SUBST([GSTD_STATE_DIRS_OWNER], [$with_statedir_owner])],
[AC_SUBST([GSTD_STATE_DIRS_OWNER], ["root"])])

dnl check if compiler understands -Wall (if yes, add -Wall to GST_CFLAGS)
AC_MSG_CHECKING([to see if compiler understands -Wall])
Expand Down Expand Up @@ -233,5 +307,8 @@ tests/libgstc/python/Makefile
docs/Makefile
docs/reference/Makefile
docs/reference/gstd/Makefile
init/Makefile
init/gstd
init/gstd.service
])
AC_OUTPUT
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
gstd (0.12.0-1) unstable; urgency=medium

* Inint scripts support
* Fix race condition in GstdList

-- RidgeRun Engineering <[email protected]> Mon, 08 Mar 2021 08:00:00 -0600

gstd (0.11.3-1) unstable; urgency=medium

* Fix Javascript library for Gstd
Expand Down
2 changes: 1 addition & 1 deletion gst_client/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bin_PROGRAMS = gst-client-@GSTD_API_VERSION@

gst_client_@GSTD_API_VERSION@_SOURCES = gst_client.c
gst_client_@GSTD_API_VERSION@_CFLAGS = $(GST_CFLAGS) $(GIO_CFLAGS) $(GIO_UNIX_CFLAGS) $(GJSON_CFLAGS) $(READLINE_CFLAGS) -DGSTD_RUN_STATE_DIR=\"$(gstdrunstatedir)\"
gst_client_@GSTD_API_VERSION@_CFLAGS = $(GST_CFLAGS) $(GIO_CFLAGS) $(GIO_UNIX_CFLAGS) $(GJSON_CFLAGS) $(READLINE_CFLAGS) -DGSTD_RUN_STATE_DIR=\"$(GSTD_RUN_STATE_DIR)\"
gst_client_@GSTD_API_VERSION@_LDFLAGS = $(GST_LIBS) $(GIO_LIBS) $(GIO_UNIX_LIBS) $(GJSON_LIBS) $(READLINE_LIBS)

install-exec-hook:
Expand Down
12 changes: 6 additions & 6 deletions gstd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ libgstd_core_la_CFLAGS = $(GST_CFLAGS) \
$(GIO_UNIX_CFLAGS) \
$(LIBSOUP_CFLAGS) \
$(GJSON_CFLAGS) \
-DGSTD_LOG_STATE_DIR=\"$(gstdlogstatedir)\" \
-DGSTD_RUN_STATE_DIR=\"$(gstdrunstatedir)\"
-DGSTD_LOG_STATE_DIR=\"$(GSTD_LOG_STATE_DIR)\" \
-DGSTD_RUN_STATE_DIR=\"$(GSTD_RUN_STATE_DIR)\"

libgstd_core_la_LDFLAGS = $(GST_LIBS) $(GIO_LIBS) $(GJSON_LIBS) $(LIBSOUP_LIBS)

Expand All @@ -76,8 +76,8 @@ gstd_CFLAGS = $(GST_CFLAGS) \
$(GIO_UNIX_CFLAGS) \
$(GJSON_CFLAGS) \
$(LIBD_CFLAGS) \
-DGSTD_LOG_STATE_DIR=\"$(gstdlogstatedir)\" \
-DGSTD_RUN_STATE_DIR=\"$(gstdrunstatedir)\"
-DGSTD_LOG_STATE_DIR=\"$(GSTD_LOG_STATE_DIR)\" \
-DGSTD_RUN_STATE_DIR=\"$(GSTD_RUN_STATE_DIR)\"

gstd_LDFLAGS = $(GST_LIBS) \
$(GIO_LIBS) \
Expand Down Expand Up @@ -140,8 +140,8 @@ gstdinclude_HEADERS = \
noinst_HEADERS = gstd_daemon.h

# Create an open area for our pid and log files
install-data-hook: $(DESTDIR)$(gstdrunstatedir) $(DESTDIR)$(gstdlogstatedir)
install-data-hook: $(DESTDIR)$(GSTD_RUN_STATE_DIR) $(DESTDIR)$(GSTD_LOG_STATE_DIR)

$(DESTDIR)@gstdrunstatedir@ $(DESTDIR)@gstdlogstatedir@:
$(DESTDIR)@GSTD_RUN_STATE_DIR@ $(DESTDIR)@GSTD_LOG_STATE_DIR@:
$(MKDIR_P) $@
chmod a+w $@
10 changes: 5 additions & 5 deletions gstd/gstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ main (gint argc, gchar * argv[])
GstdSession *session;
gboolean version = FALSE;
gboolean kill = FALSE;
gboolean nodaemon = FALSE;
gboolean daemon = FALSE;
gboolean quiet = FALSE;
const gchar *gstdlogfile = NULL;
const gchar *gstlogfile = NULL;
Expand Down Expand Up @@ -180,8 +180,8 @@ main (gint argc, gchar * argv[])
{"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet,
"Don't print any startup message", NULL}
,
{"no-daemon", 'D', 0, G_OPTION_ARG_NONE, &nodaemon,
"Do not detach into a daemon", NULL}
{"daemon", 'e', 0, G_OPTION_ARG_NONE, &daemon,
"Detach into a daemon", NULL}
,
{"pid-path", 'f', 0, G_OPTION_ARG_FILENAME, &pidfile,
"Create gstd.pid file into path", NULL}
Expand Down Expand Up @@ -223,7 +223,7 @@ main (gint argc, gchar * argv[])
goto out;
}

if (!nodaemon) {
if (daemon || kill) {
if (!gstd_log_init (gstdlogfile, gstlogfile)) {
ret = EXIT_FAILURE;
goto out;
Expand All @@ -244,7 +244,7 @@ main (gint argc, gchar * argv[])
goto out;
}

if (!nodaemon) {
if (daemon) {
gboolean parent;

if (!gstd_daemon_start (&parent)) {
Expand Down
2 changes: 1 addition & 1 deletion gstd/gstd_chmod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# $1 mode
# $2 file

chmod $1 "${DESTDIR}/${MESON_INSTALL_PREFIX}/$2"
chmod $1 $2
20 changes: 17 additions & 3 deletions gstd/gstd_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,12 @@ gstd_list_dispose (GObject * object)

GST_INFO_OBJECT (self, "Disposing %s list", GSTD_OBJECT_NAME (self));

GST_OBJECT_LOCK (self);
if (self->list) {
g_list_free_full (self->list, g_object_unref);
self->list = NULL;
}
GST_OBJECT_UNLOCK (self);

G_OBJECT_CLASS (gstd_list_parent_class)->dispose (object);
}
Expand Down Expand Up @@ -252,23 +254,29 @@ gstd_list_delete (GstdObject * object, const gchar * node)
g_return_val_if_fail (object->deleter, GSTD_MISSING_INITIALIZATION);

/* Test if the resource to delete exists */
GST_OBJECT_LOCK (self);
found = g_list_find_custom (self->list, node, gstd_list_find_node);

if (!found)
if (!found) {
GST_OBJECT_UNLOCK (self);
goto unexisting;
}

todelete = GSTD_OBJECT (found->data);

GST_INFO_OBJECT (self, "Deleting %s from %s list", GSTD_OBJECT_NAME (self),
GSTD_OBJECT_NAME (self));

ret = gstd_ideleter_delete (object->deleter, todelete);
if (ret)
if (ret) {
GST_OBJECT_UNLOCK (self);
return ret;
}

self->count--;

self->list = g_list_delete_link (self->list, found);
GST_OBJECT_UNLOCK (self);

return ret;

Expand Down Expand Up @@ -327,6 +335,7 @@ gstd_list_find_child (GstdList * self, const gchar * name)
g_return_val_if_fail (self, NULL);
g_return_val_if_fail (name, NULL);

GST_OBJECT_LOCK (self);
result = g_list_find_custom (self->list, name, gstd_list_find_node);


Expand All @@ -335,6 +344,7 @@ gstd_list_find_child (GstdList * self, const gchar * name)
} else {
child = NULL;
}
GST_OBJECT_UNLOCK (self);

return child;
}
Expand All @@ -348,14 +358,18 @@ gstd_list_append_child (GstdList * self, GstdObject * child)
g_return_val_if_fail (child, GSTD_NULL_ARGUMENT);

/* Test if the resource to create already exists */
GST_OBJECT_LOCK (self);
found =
g_list_find_custom (self->list, GSTD_OBJECT_NAME (child),
gstd_list_find_node);
if (found)
if (found) {
GST_OBJECT_UNLOCK (self);
goto exists;
}

self->list = g_list_append (self->list, child);
self->count = g_list_length (self->list);
GST_OBJECT_UNLOCK (self);
GST_INFO_OBJECT (self, "Appended %s to %s list", GSTD_OBJECT_NAME (child),
GSTD_OBJECT_NAME (self));

Expand Down
11 changes: 7 additions & 4 deletions gstd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,21 @@ lib_gstd_dir = meson.current_build_dir()
# Install library headers
# install_headers(libgstd_header_files)
# Install run and log directories

install_subdir('gstd',
install_dir : get_option('prefix') + get_option('with-gstd-runstatedir'),
install_dir : runstatedir,
strip_directory : true,
)

install_subdir('gstd',
install_dir : get_option('prefix') + get_option('with-gstd-logstatedir'),
install_dir : logstatedir,
strip_directory : true,
)

# Since install_subdir function doesn't change the mode of the directories installed
# Run a script at install time to change the mode of the directories
meson.add_install_script('gstd_chmod.sh','755',get_option('with-gstd-runstatedir'))
meson.add_install_script('gstd_chmod.sh','755',get_option('with-gstd-logstatedir'))
meson.add_install_script('gstd_chmod.sh','777', runstatedir)
meson.add_install_script('gstd_chmod.sh','777', logstatedir)

## Create symbolic link to gstd
meson.add_install_script('gstd_symbolic_link.sh',
Expand Down
12 changes: 12 additions & 0 deletions init/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
if WITH_SYSTEMD
#Install service
systemd_servicedir = @GSTD_SYSTEMD_DIR@
systemd_service_DATA = gstd.service
systemd_service_SCRIPTS = gstd-check-user-xenv.sh
endif

if WITH_INITD
#Install the script
initd_scriptdir = @GSTD_INITD_DIR@
initd_script_SCRIPTS = gstd
endif
8 changes: 8 additions & 0 deletions init/gstd-check-user-xenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

if [ -z "$DISPLAY" ] || [ -z "$XAUTHORITY" ]
then
exit 1
fi

systemctl --user import-environment DISPLAY XAUTHORITY
Loading

0 comments on commit 8b1fb13

Please sign in to comment.