-
Notifications
You must be signed in to change notification settings - Fork 0
/
av_utils.c
57 lines (40 loc) · 1.19 KB
/
av_utils.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// SPDX-License-Identifier: GPL-2.0-or-later
/* GLib2 headers */
#include <glib.h>
/* AV headers */
#include <av.h>
void av_utils_print_gerror(GError **current_error) {
if (!current_error || !*current_error)
return;
g_printerr("ERROR: %s\n",(*current_error)->message ? (*current_error)->message : "(no error message in passed GError");
g_error_free(*current_error);
*current_error = NULL;
return;
}
gint av_utils_async_start(GObject *o) {
ll->async_counter++;
if (ll->async_counter > 2)
g_printerr("WARNING - suspicious async_counter value (%" G_GINT16_FORMAT")\n",ll->async_counter);
if (o)
g_object_ref(o);
return ll->async_counter;
}
gint av_utils_async_end(GObject *o) {
ll->async_counter--;
if (ll->async_counter < 0)
g_printerr("BUG - async counter got negative!\n");
if (o)
g_object_unref(o);
return ll->async_counter;
}
MMCall *av_utils_mm_call_search(GList *l, const gchar *object_path) {
MMCall *c = NULL;
GList *k; /* because I always use l, but it's already in use ... :) like I am in high school again */
for (k = l; k; k = g_list_next(k)) {
if (!g_strcmp0(mm_call_get_path(MM_CALL(k->data)), object_path)) {
c = MM_CALL(k->data);
break;
}
}
return c;
}