No issues found
Tool | Failure ID | Location | Function | Message | Data |
---|---|---|---|---|---|
clang-analyzer | no-output-found | gvc/gvc-mixer-sink-input.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None |
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2 *
3 * Copyright (C) 2008 William Jon McCann
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 */
20
21 #include "config.h"
22
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <unistd.h>
26
27 #include <glib.h>
28 #include <glib/gi18n-lib.h>
29
30 #include <pulse/pulseaudio.h>
31
32 #include "gvc-mixer-sink-input.h"
33 #include "gvc-mixer-stream-private.h"
34 #include "gvc-channel-map-private.h"
35
36 #define GVC_MIXER_SINK_INPUT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_MIXER_SINK_INPUT, GvcMixerSinkInputPrivate))
37
38 struct GvcMixerSinkInputPrivate
39 {
40 gpointer dummy;
41 };
42
43 static void gvc_mixer_sink_input_class_init (GvcMixerSinkInputClass *klass);
44 static void gvc_mixer_sink_input_init (GvcMixerSinkInput *mixer_sink_input);
45 static void gvc_mixer_sink_input_finalize (GObject *object);
46
47 G_DEFINE_TYPE (GvcMixerSinkInput, gvc_mixer_sink_input, GVC_TYPE_MIXER_STREAM)
48
49 static gboolean
50 gvc_mixer_sink_input_push_volume (GvcMixerStream *stream, gpointer *op)
51 {
52 pa_operation *o;
53 guint index;
54 const GvcChannelMap *map;
55 pa_context *context;
56 const pa_cvolume *cv;
57
58 index = gvc_mixer_stream_get_index (stream);
59
60 map = gvc_mixer_stream_get_channel_map (stream);
61
62 cv = gvc_channel_map_get_cvolume(map);
63
64 context = gvc_mixer_stream_get_pa_context (stream);
65
66 o = pa_context_set_sink_input_volume (context,
67 index,
68 cv,
69 NULL,
70 NULL);
71
72 if (o == NULL) {
73 g_warning ("pa_context_set_sink_input_volume() failed");
74 return FALSE;
75 }
76
77 *op = o;
78
79 return TRUE;
80 }
81
82 static gboolean
83 gvc_mixer_sink_input_change_is_muted (GvcMixerStream *stream,
84 gboolean is_muted)
85 {
86 pa_operation *o;
87 guint index;
88 pa_context *context;
89
90 index = gvc_mixer_stream_get_index (stream);
91 context = gvc_mixer_stream_get_pa_context (stream);
92
93 o = pa_context_set_sink_input_mute (context,
94 index,
95 is_muted,
96 NULL,
97 NULL);
98
99 if (o == NULL) {
100 g_warning ("pa_context_set_sink_input_mute_by_index() failed");
101 return FALSE;
102 }
103
104 pa_operation_unref(o);
105
106 return TRUE;
107 }
108
109 static void
110 gvc_mixer_sink_input_class_init (GvcMixerSinkInputClass *klass)
111 {
112 GObjectClass *object_class = G_OBJECT_CLASS (klass);
113 GvcMixerStreamClass *stream_class = GVC_MIXER_STREAM_CLASS (klass);
114
115 object_class->finalize = gvc_mixer_sink_input_finalize;
116
117 stream_class->push_volume = gvc_mixer_sink_input_push_volume;
118 stream_class->change_is_muted = gvc_mixer_sink_input_change_is_muted;
119
120 g_type_class_add_private (klass, sizeof (GvcMixerSinkInputPrivate));
121 }
122
123 static void
124 gvc_mixer_sink_input_init (GvcMixerSinkInput *sink_input)
125 {
126 sink_input->priv = GVC_MIXER_SINK_INPUT_GET_PRIVATE (sink_input);
127 }
128
129 static void
130 gvc_mixer_sink_input_finalize (GObject *object)
131 {
132 GvcMixerSinkInput *mixer_sink_input;
133
134 g_return_if_fail (object != NULL);
135 g_return_if_fail (GVC_IS_MIXER_SINK_INPUT (object));
136
137 mixer_sink_input = GVC_MIXER_SINK_INPUT (object);
138
139 g_return_if_fail (mixer_sink_input->priv != NULL);
140 G_OBJECT_CLASS (gvc_mixer_sink_input_parent_class)->finalize (object);
141 }
142
143 /**
144 * gvc_mixer_sink_input_new: (skip)
145 * @context:
146 * @index:
147 * @map:
148 *
149 * Returns:
150 */
151 GvcMixerStream *
152 gvc_mixer_sink_input_new (pa_context *context,
153 guint index,
154 GvcChannelMap *channel_map)
155 {
156 GObject *object;
157
158 object = g_object_new (GVC_TYPE_MIXER_SINK_INPUT,
159 "pa-context", context,
160 "index", index,
161 "channel-map", channel_map,
162 NULL);
163
164 return GVC_MIXER_STREAM (object);
165 }