summaryrefslogtreecommitdiff
path: root/multimedia/gstreamer1/plugins-base/files/sndiosink.c
diff options
context:
space:
mode:
authorVineet Kumar <git@vineetk.net>2026-06-15 14:54:51 -0400
committerVineet Kumar <git@vineetk.net>2026-06-15 14:54:51 -0400
commite81f04fa53e7e01afdc834d9c22b5c982c98f59b (patch)
tree763d6d68516ca9d184ddd2402978adcc4027a99d /multimedia/gstreamer1/plugins-base/files/sndiosink.c
parent92e45e47c29ec037842c4a34ebc0c14143d413ff (diff)
remove all ports to start from clean slateHEADmaster
This is due to the following two reasons: 1. it's very out of date compared with current ports tree (like by 2+ years!) - some of the ports here were mainly just updates I didn't upstream, which have since now been part of openbsd, like verilator 2. removing dependencies is a lot of headache to stay in sync and/or for ports I no longer use - e.g. dbus is very difficult to remove in a desktop while patching to remove from gtk and downstream - I don't want to spend more time reducing number of dependencies when I can be working instead. I no longer have as much free time as I did in high school :(
Diffstat (limited to 'multimedia/gstreamer1/plugins-base/files/sndiosink.c')
-rw-r--r--multimedia/gstreamer1/plugins-base/files/sndiosink.c226
1 files changed, 0 insertions, 226 deletions
diff --git a/multimedia/gstreamer1/plugins-base/files/sndiosink.c b/multimedia/gstreamer1/plugins-base/files/sndiosink.c
deleted file mode 100644
index cc68bd2..0000000
--- a/multimedia/gstreamer1/plugins-base/files/sndiosink.c
+++ /dev/null
@@ -1,226 +0,0 @@
1/*
2 * Copyright (C) 2008 Jacob Meuser <jakemsr@sdf.lonestar.org>
3 * Copyright (C) 2012 Alexandre Ratchov <alex@caoua.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18/**
19 * SECTION:element-sndiosink
20 * @see_also: #GstAutoAudioSink
21 *
22 * <refsect2>
23 * <para>
24 * This element outputs sound to a sound card using sndio.
25 * </para>
26 * <para>
27 * Simple example pipeline that plays an Ogg/Vorbis file via sndio:
28 * <programlisting>
29 * gst-launch -v filesrc location=foo.ogg ! decodebin ! audioconvert ! audioresample ! sndiosink
30 * </programlisting>
31 * </para>
32 * </refsect2>
33 */
34
35#ifdef HAVE_CONFIG_H
36#include "config.h"
37#endif
38#include "sndiosink.h"
39
40GST_DEBUG_CATEGORY_EXTERN (gst_sndio_debug);
41#define GST_CAT_DEFAULT gst_sndio_debug
42
43#define gst_sndiosink_parent_class parent_class
44
45static GstStaticPadTemplate sndiosink_factory =
46 GST_STATIC_PAD_TEMPLATE ("sink",
47 GST_PAD_SINK,
48 GST_PAD_ALWAYS,
49 GST_STATIC_CAPS (GST_SNDIO_CAPS_STRING)
50 );
51
52G_DEFINE_TYPE_WITH_CODE (GstSndioSink, gst_sndiosink, GST_TYPE_AUDIO_SINK,
53 G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL));
54
55static void gst_sndiosink_finalize (GObject * object);
56static GstCaps *gst_sndiosink_getcaps (GstBaseSink * bsink,
57 GstCaps * filter);
58static gboolean gst_sndiosink_open (GstAudioSink * asink);
59static gboolean gst_sndiosink_close (GstAudioSink * asink);
60static gboolean gst_sndiosink_prepare (GstAudioSink * asink,
61 GstAudioRingBufferSpec * spec);
62static gboolean gst_sndiosink_unprepare (GstAudioSink * asink);
63static gint gst_sndiosink_write (GstAudioSink * asink, gpointer data,
64 guint length);
65static guint gst_sndiosink_delay (GstAudioSink * asink);
66static void gst_sndiosink_reset (GstAudioSink * asink);
67static void gst_sndiosink_set_property (GObject * object, guint prop_id,
68 const GValue * value, GParamSpec * pspec);
69static void gst_sndiosink_get_property (GObject * object, guint prop_id,
70 GValue * value, GParamSpec * pspec);
71
72static void
73gst_sndiosink_init (GstSndioSink * sink)
74{
75 gst_sndio_init (&sink->sndio, G_OBJECT(sink));
76}
77
78static void
79gst_sndiosink_finalize (GObject * object)
80{
81 GstSndioSink *sink = GST_SNDIOSINK (object);
82
83 gst_sndio_finalize (&sink->sndio);
84 G_OBJECT_CLASS (parent_class)->finalize (object);
85}
86
87static GstCaps *
88gst_sndiosink_getcaps (GstBaseSink * bsink, GstCaps * filter)
89{
90 GstSndioSink *sink = GST_SNDIOSINK (bsink);
91
92 return gst_sndio_getcaps (&sink->sndio, filter);
93}
94
95static gboolean
96gst_sndiosink_open (GstAudioSink * asink)
97{
98 GstSndioSink *sink = GST_SNDIOSINK (asink);
99
100 return gst_sndio_open (&sink->sndio, SIO_PLAY);
101}
102
103static gboolean
104gst_sndiosink_close (GstAudioSink * asink)
105{
106 GstSndioSink *sink = GST_SNDIOSINK (asink);
107
108 return gst_sndio_close (&sink->sndio);
109}
110
111static gboolean
112gst_sndiosink_prepare (GstAudioSink * asink, GstAudioRingBufferSpec * spec)
113{
114 GstSndioSink *sink = GST_SNDIOSINK (asink);
115
116 return gst_sndio_prepare (&sink->sndio, spec);
117}
118
119static gboolean
120gst_sndiosink_unprepare (GstAudioSink * asink)
121{
122 GstSndioSink *sink = GST_SNDIOSINK (asink);
123
124 return gst_sndio_unprepare (&sink->sndio);
125}
126
127static gint
128gst_sndiosink_write (GstAudioSink * asink, gpointer data, guint length)
129{
130 GstSndioSink *sink = GST_SNDIOSINK (asink);
131 guint done;
132
133 if (length == 0)
134 return 0;
135 done = sio_write (sink->sndio.hdl, data, length);
136 if (done == 0) {
137 GST_ELEMENT_ERROR (sink, RESOURCE, WRITE,
138 ("Failed to write data to sndio"), (NULL));
139 return 0;
140 }
141 sink->sndio.delay += done;
142 return done;
143}
144
145static guint
146gst_sndiosink_delay (GstAudioSink * asink)
147{
148 GstSndioSink *sink = GST_SNDIOSINK (asink);
149
150 return GST_SNDIO_DELAY(&sink->sndio);
151}
152
153static void
154gst_sndiosink_reset (GstAudioSink * asink)
155{
156}
157
158static void
159gst_sndiosink_set_property (GObject * object, guint prop_id,
160 const GValue * value, GParamSpec * pspec)
161{
162 GstSndioSink *sink = GST_SNDIOSINK (object);
163
164 gst_sndio_set_property (&sink->sndio, prop_id, value, pspec);
165}
166
167static void
168gst_sndiosink_get_property (GObject * object, guint prop_id, GValue * value,
169 GParamSpec * pspec)
170{
171 GstSndioSink *sink = GST_SNDIOSINK (object);
172
173 gst_sndio_get_property (&sink->sndio, prop_id, value, pspec);
174}
175
176static void
177gst_sndiosink_class_init (GstSndioSinkClass * klass)
178{
179 GObjectClass *gobject_class;
180 GstElementClass *gstelement_class;
181 GstBaseSinkClass *gstbasesink_class;
182 GstAudioBaseSinkClass *gstbaseaudiosink_class;
183 GstAudioSinkClass *gstaudiosink_class;
184
185 gobject_class = (GObjectClass *) klass;
186 gstelement_class = (GstElementClass *) klass;
187 gstbasesink_class = (GstBaseSinkClass *) klass;
188 gstbaseaudiosink_class = (GstAudioBaseSinkClass *) klass;
189 gstaudiosink_class = (GstAudioSinkClass *) klass;
190
191 parent_class = g_type_class_peek_parent (klass);
192
193 gobject_class->finalize = gst_sndiosink_finalize;
194 gobject_class->get_property = gst_sndiosink_get_property;
195 gobject_class->set_property = gst_sndiosink_set_property;
196
197 gst_element_class_set_static_metadata (gstelement_class,
198 "Audio sink (sndio)", "Sink/Audio",
199 "Output to a sound card via sndio",
200 "Jacob Meuser <jakemsr@sdf.lonestar.org>");
201
202 gst_element_class_add_pad_template (gstelement_class,
203 gst_static_pad_template_get (&sndiosink_factory));
204
205 gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_sndiosink_getcaps);
206 gstaudiosink_class->open = GST_DEBUG_FUNCPTR (gst_sndiosink_open);
207 gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR (gst_sndiosink_prepare);
208 gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR (gst_sndiosink_unprepare);
209 gstaudiosink_class->close = GST_DEBUG_FUNCPTR (gst_sndiosink_close);
210 gstaudiosink_class->write = GST_DEBUG_FUNCPTR (gst_sndiosink_write);
211 gstaudiosink_class->delay = GST_DEBUG_FUNCPTR (gst_sndiosink_delay);
212 gstaudiosink_class->reset = GST_DEBUG_FUNCPTR (gst_sndiosink_reset);
213
214 g_object_class_install_property (gobject_class, PROP_DEVICE,
215 g_param_spec_string ("device", "Device",
216 "sndio device as defined in sndio(7)",
217 SIO_DEVANY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
218 g_object_class_install_property (gobject_class, PROP_VOLUME,
219 g_param_spec_double ("volume", "Volume",
220 "Linear volume of this stream, 1.0=100%", 0.0, 1.0,
221 1.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
222 g_object_class_install_property (gobject_class, PROP_MUTE,
223 g_param_spec_boolean ("mute", "Mute",
224 "Mute state of this stream", FALSE,
225 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
226}