From 1b63854c1fc093234b7432f03c9f415936e4d21c Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 7 Jan 2004 13:18:08 +0000 Subject: Fix for instantiate-test (see core). Also remove dead code from jpegenc (which still needs fixing, but that's lower o... Original commit message from CVS: 2004-01-07 Ronald Bultje * ext/audiofile/gstafsink.c: (gst_afsink_init), (gst_afsink_chain), (gst_afsink_handle_event): * ext/jpeg/gstjpegenc.c: (gst_jpegenc_init): * gst/avi/gstavimux.c: (gst_avimux_request_new_pad): * sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init): * sys/dxr3/dxr3spusink.c: (dxr3spusink_init): * sys/dxr3/dxr3videosink.c: (dxr3videosink_init): Fix for instantiate-test (see core). Also remove dead code from jpegenc (which still needs fixing, but that's lower on my TODO list...). * sys/v4l2/gstv4l2src.c: (gst_v4l2src_getcaps): Never return NULL as caps. --- ext/audiofile/gstafsink.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'ext/audiofile') diff --git a/ext/audiofile/gstafsink.c b/ext/audiofile/gstafsink.c index 5b6b702e..02e28f8b 100644 --- a/ext/audiofile/gstafsink.c +++ b/ext/audiofile/gstafsink.c @@ -190,7 +190,6 @@ gst_afsink_init (GstAFSink *afsink) gst_element_add_pad (GST_ELEMENT (afsink), afsink->sinkpad); gst_pad_set_chain_function (afsink->sinkpad, gst_afsink_chain); - gst_pad_set_event_function (afsink->sinkpad, gst_afsink_handle_event); afsink->filename = NULL; afsink->file = NULL; @@ -387,14 +386,19 @@ gst_afsink_close_file (GstAFSink *sink) static void gst_afsink_chain (GstPad *pad, GstData *_data) { - GstBuffer *buf = GST_BUFFER (_data); + GstBuffer *buf; GstAFSink *afsink; int ret = 0; g_return_if_fail (pad != NULL); g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); + if (GST_IS_EVENT (_data)) { + gst_afsink_handle_event (pad, GST_EVENT (_data)); + return; + } + + buf = GST_BUFFER (_data); afsink = GST_AFSINK (gst_pad_get_parent (pad)); /* we use audiofile now if (GST_FLAG_IS_SET (afsink, GST_AFSINK_OPEN)) @@ -484,7 +488,16 @@ gst_afsink_handle_event (GstPad *pad, GstEvent *event) afsink = GST_AFSINK (gst_pad_get_parent (pad)); GST_DEBUG ("DEBUG: afsink: got event"); - gst_afsink_close_file (afsink); + + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_EOS: + gst_afsink_close_file (afsink); + break; + default: + break; + } + + gst_pad_event_default (pad, event); return TRUE; } -- cgit v1.2.1