2015-02-26 12:11:51 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Raspberry Pi Foundation
|
|
|
|
* Author: Thibault Saunier <thibault.saunier@collabora.com>
|
|
|
|
*
|
|
|
|
* gstvalidategapplication.c: GstValidateAction overrides for gapplication
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gio/gio.h>
|
|
|
|
|
2015-05-25 16:52:34 +00:00
|
|
|
#include "../../gst/validate/validate.h"
|
|
|
|
#include "../../gst/validate/gst-validate-scenario.h"
|
|
|
|
#include "../../gst/validate/gst-validate-utils.h"
|
2015-02-26 12:11:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
_execute_stop (GstValidateScenario * scenario, GstValidateAction * action)
|
|
|
|
{
|
|
|
|
g_application_quit (g_application_get_default ());
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_validate_gapplication_init (GstPlugin * plugin)
|
|
|
|
{
|
2015-03-02 10:03:08 +00:00
|
|
|
GList *config, *tmp;
|
2024-11-13 06:02:00 +00:00
|
|
|
const gchar *appname = NULL;
|
2015-02-26 12:11:51 +00:00
|
|
|
|
2015-03-02 10:03:08 +00:00
|
|
|
config = gst_validate_plugin_get_config (plugin);
|
2015-02-26 12:11:51 +00:00
|
|
|
|
2015-03-02 10:03:08 +00:00
|
|
|
if (!config)
|
2015-02-26 12:11:51 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2015-03-02 10:03:08 +00:00
|
|
|
for (tmp = config; tmp; tmp = tmp->next) {
|
|
|
|
appname = gst_structure_get_string (tmp->data, "application-name");
|
2015-02-26 12:11:51 +00:00
|
|
|
}
|
|
|
|
|
2015-03-02 10:03:08 +00:00
|
|
|
if (appname && g_strcmp0 (g_get_prgname (), appname)) {
|
|
|
|
GST_INFO_OBJECT (plugin, "App: %s is not %s", g_get_prgname (), appname);
|
2015-02-26 12:11:51 +00:00
|
|
|
return TRUE;
|
2015-03-02 10:03:08 +00:00
|
|
|
}
|
2015-02-26 12:11:51 +00:00
|
|
|
|
|
|
|
gst_validate_register_action_type_dynamic (plugin, "stop",
|
|
|
|
GST_RANK_PRIMARY, _execute_stop, NULL,
|
|
|
|
"Sets the pipeline state to NULL",
|
2015-05-13 10:18:18 +00:00
|
|
|
GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL |
|
|
|
|
GST_VALIDATE_ACTION_TYPE_DOESNT_NEED_PIPELINE);
|
2015-02-26 12:11:51 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
2017-03-04 16:13:33 +00:00
|
|
|
validategapplication,
|
2015-02-26 12:11:51 +00:00
|
|
|
"GstValidate plugin to run validate on gapplication",
|
|
|
|
gst_validate_gapplication_init, VERSION, "LGPL", GST_PACKAGE_NAME,
|
|
|
|
GST_PACKAGE_ORIGIN)
|