summaryrefslogtreecommitdiffstats
path: root/ext/esd
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2003-07-04 07:32:19 +0000
committerDavid Schleef <ds@schleef.org>2003-07-04 07:32:19 +0000
commit7a95d860f1eba380ef58c32a1d6ebdd57b66db01 (patch)
treed787ba2a35b88aa967d403982b1d957cba596d17 /ext/esd
parent0bad514d94109e9902f6df7b59f6be8a1e5bf4cf (diff)
Fix longstanding bug with esdsink seeking. esdsink still needs a clock, though.
Original commit message from CVS: Fix longstanding bug with esdsink seeking. esdsink still needs a clock, though.
Diffstat (limited to 'ext/esd')
-rw-r--r--ext/esd/esdsink.c56
-rw-r--r--ext/esd/esdsink.h2
2 files changed, 58 insertions, 0 deletions
diff --git a/ext/esd/esdsink.c b/ext/esd/esdsink.c
index af28a1cf..120a2a5f 100644
--- a/ext/esd/esdsink.c
+++ b/ext/esd/esdsink.c
@@ -89,6 +89,7 @@ static void gst_esdsink_close_audio (GstEsdsink *sink);
static GstElementStateReturn gst_esdsink_change_state (GstElement *element);
static GstPadLinkReturn gst_esdsink_sinkconnect (GstPad *pad, GstCaps *caps);
+static void gst_esdsink_set_clock (GstElement *element, GstClock *clock);
static void gst_esdsink_chain (GstPad *pad, GstBuffer *buf);
static void gst_esdsink_set_property (GObject *object, guint prop_id,
@@ -142,6 +143,8 @@ gst_esdsink_class_init (GstEsdsinkClass *klass)
gobject_class->get_property = gst_esdsink_get_property;
gstelement_class->change_state = gst_esdsink_change_state;
+ gstelement_class->set_clock = gst_esdsink_set_clock;
+ //gstelement_class->get_clock = gst_esdsink_get_clock;
}
static void
@@ -153,6 +156,8 @@ gst_esdsink_init(GstEsdsink *esdsink)
gst_pad_set_chain_function(esdsink->sinkpad, GST_DEBUG_FUNCPTR(gst_esdsink_chain));
gst_pad_set_link_function(esdsink->sinkpad, gst_esdsink_sinkconnect);
+ GST_FLAG_SET (esdsink, GST_ELEMENT_EVENT_AWARE);
+
esdsink->mute = FALSE;
esdsink->fd = -1;
/* FIXME: get default from somewhere better than just putting them inline. */
@@ -187,6 +192,28 @@ gst_esdsink_sinkconnect (GstPad *pad, GstCaps *caps)
return GST_PAD_LINK_REFUSED;
}
+#if 0
+static GstClock *
+gst_esdsink_get_clock (GstElement *element)
+{
+ GstEsdsink *esdsink;
+
+ esdsink = GET_ESDSINK (element);
+
+ return GST_CLOCK(esdsink->provided_clock);
+}
+#endif
+
+static void
+gst_esdsink_set_clock (GstElement *element, GstClock *clock)
+{
+ GstEsdsink *esdsink;
+
+ esdsink = GST_ESDSINK (element);
+
+ esdsink->clock = clock;
+}
+
static void
gst_esdsink_chain (GstPad *pad, GstBuffer *buf)
{
@@ -199,6 +226,35 @@ gst_esdsink_chain (GstPad *pad, GstBuffer *buf)
goto done;
}
+ if (GST_IS_EVENT(buf)){
+ GstEvent *event = GST_EVENT(buf);
+
+ g_print("got event\n");
+
+ switch(GST_EVENT_TYPE(event)){
+ case GST_EVENT_EOS:
+ break;
+ case GST_EVENT_DISCONTINUOUS:
+ {
+ gint64 value;
+
+ if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
+ if (!gst_clock_handle_discont (esdsink->clock, value)){
+ //gst_esdsink_clock_set_active (osssink->provided_clock, FALSE);
+ }
+ //esdsink->handled = 0;
+ }
+ //esdsink->resync = TRUE;
+ break;
+ }
+ default:
+ gst_pad_event_default(pad, event);
+ break;
+ }
+ gst_event_unref(event);
+ return;
+ }
+
if (GST_BUFFER_DATA (buf) != NULL) {
if (!esdsink->mute && esdsink->fd >= 0) {
GST_DEBUG ("esdsink: fd=%d data=%p size=%d",
diff --git a/ext/esd/esdsink.h b/ext/esd/esdsink.h
index de1564ea..458f3095 100644
--- a/ext/esd/esdsink.h
+++ b/ext/esd/esdsink.h
@@ -44,6 +44,8 @@ struct _GstEsdsink {
GstPad *sinkpad;
+ GstClock *clock;
+
gboolean mute;
int fd;
gint format;