summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2005-11-07 17:35:20 +0000
committerTim-Philipp Müller <tim@centricular.net>2005-11-07 17:35:20 +0000
commitef3e55d3a61de68379cdac5e65374f156d565cba (patch)
tree2f273235e0a7d9069e79d8706ad8d749d895a3ce
parent8af7381d5cac93a8af28a303533f34de7aade137 (diff)
sys/oss/gstosssink.*: Cache probed caps; fix debug output for SET_PARAM macros.
Original commit message from CVS: * sys/oss/gstosssink.c: (gst_oss_sink_dispose), (gst_oss_sink_set_property), (gst_oss_sink_getcaps), (gst_oss_sink_prepare): * sys/oss/gstosssink.h: Cache probed caps; fix debug output for SET_PARAM macros.
-rw-r--r--ChangeLog10
-rw-r--r--sys/oss/gstosssink.c38
-rw-r--r--sys/oss/gstosssink.h2
3 files changed, 38 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 502b4a841..1aebca438 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2005-11-07 Tim-Philipp Müller <tim at centricular dot net>
+ * sys/oss/gstosssink.c: (gst_oss_sink_dispose),
+ (gst_oss_sink_set_property), (gst_oss_sink_getcaps),
+ (gst_oss_sink_prepare):
+ * sys/oss/gstosssink.h:
+ Cache probed caps; fix debug output for SET_PARAM macros.
+
+2005-11-07 Tim-Philipp Müller <tim at centricular dot net>
+
* ext/cairo/Makefile.am:
* ext/cairo/gstcairo.c: (plugin_init):
* ext/cairo/gsttextoverlay.c: (gst_text_overlay_base_init),
@@ -15,7 +23,7 @@
(gst_text_overlay_change_state):
* ext/cairo/gsttextoverlay.h:
Port cairo textoverlay plugin to 0.9. Add 'shaded-background'
- property and redo position. Doesn't handle upstream renegotiation
+ property and redo positioning. Doesn't handle upstream renegotiation
yet though.
2005-11-07 Tim-Philipp Müller <tim at centricular dot net>
diff --git a/sys/oss/gstosssink.c b/sys/oss/gstosssink.c
index bc9a3a6bf..a4f70636c 100644
--- a/sys/oss/gstosssink.c
+++ b/sys/oss/gstosssink.c
@@ -129,6 +129,13 @@ gst_oss_sink_get_type (void)
static void
gst_oss_sink_dispose (GObject * object)
{
+ GstOssSink *osssink = GST_OSSSINK (object);
+
+ if (osssink->probed_caps) {
+ gst_caps_unref (osssink->probed_caps);
+ osssink->probed_caps = NULL;
+ }
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -199,6 +206,10 @@ gst_oss_sink_set_property (GObject * object, guint prop_id,
case PROP_DEVICE:
g_free (sink->device);
sink->device = g_value_dup_string (value);
+ if (sink->probed_caps) {
+ gst_caps_unref (sink->probed_caps);
+ sink->probed_caps = NULL;
+ }
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -235,8 +246,13 @@ gst_oss_sink_getcaps (GstBaseSink * bsink)
if (osssink->fd == -1) {
caps = gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD
(bsink)));
+ } else if (osssink->probed_caps) {
+ caps = gst_caps_copy (osssink->probed_caps);
} else {
caps = gst_oss_helper_probe_caps (osssink->fd);
+ if (caps && !gst_caps_is_empty (caps)) {
+ osssink->probed_caps = gst_caps_copy (caps);
+ }
}
return caps;
@@ -259,24 +275,24 @@ ilog2 (gint x)
return (x & 0x0000003f) - 1;
}
-#define SET_PARAM(_oss, _name, _val) \
+#define SET_PARAM(_oss, _name, _val, _detail) \
G_STMT_START { \
int _tmp = _val; \
if (ioctl(_oss->fd, _name, &_tmp) == -1) { \
GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE, \
- ("Unable to set param "G_STRINGIFY (_name)": %s", \
+ ("Unable to set param " _detail ": %s", \
g_strerror (errno)), \
(NULL)); \
return FALSE; \
} \
- GST_DEBUG(G_STRINGIFY (name) " %d", _tmp); \
+ GST_DEBUG(_detail " %d", _tmp); \
} G_STMT_END
-#define GET_PARAM(_oss, _name, _val) \
+#define GET_PARAM(_oss, _name, _val, _detail) \
G_STMT_START { \
if (ioctl(oss->fd, _name, _val) == -1) { \
GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE, \
- ("Unable to get param "G_STRINGIFY (_name)": %s", \
+ ("Unable to get param " _detail ": %s", \
g_strerror (errno)), \
(NULL)); \
return FALSE; \
@@ -381,19 +397,19 @@ gst_oss_sink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
if (spec->width != 16 && spec->width != 8)
goto dodgy_width;
- SET_PARAM (oss, SNDCTL_DSP_SETFMT, tmp);
+ SET_PARAM (oss, SNDCTL_DSP_SETFMT, tmp, "SETFMT");
if (spec->channels == 2)
- SET_PARAM (oss, SNDCTL_DSP_STEREO, 1);
- SET_PARAM (oss, SNDCTL_DSP_CHANNELS, spec->channels);
- SET_PARAM (oss, SNDCTL_DSP_SPEED, spec->rate);
+ SET_PARAM (oss, SNDCTL_DSP_STEREO, 1, "STEREO");
+ SET_PARAM (oss, SNDCTL_DSP_CHANNELS, spec->channels, "CHANNELS");
+ SET_PARAM (oss, SNDCTL_DSP_SPEED, spec->rate, "SPEED");
tmp = ilog2 (spec->segsize);
tmp = ((spec->segtotal & 0x7fff) << 16) | tmp;
GST_DEBUG ("set segsize: %d, segtotal: %d, value: %08x", spec->segsize,
spec->segtotal, tmp);
- SET_PARAM (oss, SNDCTL_DSP_SETFRAGMENT, tmp);
- GET_PARAM (oss, SNDCTL_DSP_GETOSPACE, &info);
+ SET_PARAM (oss, SNDCTL_DSP_SETFRAGMENT, tmp, "SETFRAGMENT");
+ GET_PARAM (oss, SNDCTL_DSP_GETOSPACE, &info, "GETOSPACE");
spec->segsize = info.fragsize;
spec->segtotal = info.fragstotal;
diff --git a/sys/oss/gstosssink.h b/sys/oss/gstosssink.h
index c97f003ce..f22828bbe 100644
--- a/sys/oss/gstosssink.h
+++ b/sys/oss/gstosssink.h
@@ -47,6 +47,8 @@ struct _GstOssSink {
gchar *device;
gint fd;
gint bytes_per_sample;
+
+ GstCaps *probed_caps;
};
struct _GstOssSinkClass {