1 /*
2 * This file is part of Wireless Display Software for Linux OS
3 *
4 * Copyright (C) 2015 Intel Corporation.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 */
21
22 #include <gst/gst.h>
23 #include "libwds/public/logging.h"
24
25
26 gboolean
mirac_gstbus_callback(GstBus * bus,GstMessage * message,gpointer data)27 mirac_gstbus_callback (GstBus *bus,
28 GstMessage *message,
29 gpointer data)
30 {
31 GError *err = NULL;
32 gchar *debug = NULL;
33
34 switch (GST_MESSAGE_TYPE (message)) {
35 case GST_MESSAGE_ERROR:
36 gst_message_parse_error (message, &err, &debug);
37 WDS_VLOG (debug);
38 WDS_ERROR ("[%s] %s", g_quark_to_string(err->domain), err->message);
39 g_error_free (err);
40 g_free (debug);
41 break;
42 case GST_MESSAGE_WARNING:
43 gst_message_parse_warning (message, &err, &debug);
44 WDS_VLOG (debug);
45 WDS_WARNING ("[%s] %s", g_quark_to_string(err->domain), err->message);
46 g_error_free (err);
47 g_free (debug);
48 break;
49 case GST_MESSAGE_INFO:
50 gst_message_parse_info (message, &err, &debug);
51 WDS_VLOG (debug);
52 WDS_LOG ("[%s] %s", g_quark_to_string(err->domain), err->message);
53 g_error_free (err);
54 g_free (debug);
55 break;
56 default:
57 /* unhandled message */
58 break;
59 }
60
61 return TRUE;
62 }
63