From b12ac89da0b3624c82f593a020893221187c9e21 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Sun, 18 Mar 2012 18:32:46 +0100 Subject: [PATCH] segmentclip: port to 0.11 --- configure.ac | 2 +- gst/segmentclip/gstaudiosegmentclip.c | 71 ++++----- gst/segmentclip/gstsegmentclip.c | 204 +++++++++++--------------- gst/segmentclip/gstvideosegmentclip.c | 45 ++---- 4 files changed, 137 insertions(+), 185 deletions(-) diff --git a/configure.ac b/configure.ac index a6deb27ee3..f77181c78b 100644 --- a/configure.ac +++ b/configure.ac @@ -307,7 +307,7 @@ GST_PLUGINS_NONPORTED=" aiff asfmux \ kate liveadder legacyresample librfb mpegtsmux \ mpegpsmux mve mxf mythtv nsf nuvdemux \ patchdetect pnm rawparse real scaletempo \ - sdi segmentclip siren speed subenc stereo tta videofilters \ + sdi siren speed subenc stereo tta videofilters \ videomeasure videosignal vmnc \ decklink fbdev linsys shm vcd \ apexsink cdaudio cog curl dc1394 dirac directfb resindvd \ diff --git a/gst/segmentclip/gstaudiosegmentclip.c b/gst/segmentclip/gstaudiosegmentclip.c index 93602c5d28..0022a892e0 100644 --- a/gst/segmentclip/gstaudiosegmentclip.c +++ b/gst/segmentclip/gstaudiosegmentclip.c @@ -27,14 +27,12 @@ #include "gstaudiosegmentclip.h" static GstStaticPadTemplate sink_pad_template = - GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS - ("audio/x-raw-int, width=(int)[1,MAX], channels=(int)[1,MAX],rate=(int)[1,MAX]; audio/x-raw-float, width=(int)[1,MAX], channels=(int)[1,MAX],rate=(int)[1,MAX]")); +GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_AUDIO_CAPS_MAKE (GST_AUDIO_FORMATS_ALL))); static GstStaticPadTemplate src_pad_template = - GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS - ("audio/x-raw-int, width=(int)[1,MAX], channels=(int)[1,MAX],rate=(int)[1,MAX]; audio/x-raw-float, width=(int)[1,MAX], channels=(int)[1,MAX],rate=(int)[1,MAX]")); +GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_AUDIO_CAPS_MAKE (GST_AUDIO_FORMATS_ALL))); static void gst_audio_segment_clip_reset (GstSegmentClip * self); static GstFlowReturn gst_audio_segment_clip_clip_buffer (GstSegmentClip * self, @@ -45,13 +43,23 @@ static gboolean gst_audio_segment_clip_set_caps (GstSegmentClip * self, GST_DEBUG_CATEGORY_STATIC (gst_audio_segment_clip_debug); #define GST_CAT_DEFAULT gst_audio_segment_clip_debug -GST_BOILERPLATE (GstAudioSegmentClip, gst_audio_segment_clip, GstSegmentClip, +G_DEFINE_TYPE (GstAudioSegmentClip, gst_audio_segment_clip, GST_TYPE_SEGMENT_CLIP); static void -gst_audio_segment_clip_base_init (gpointer g_class) +gst_audio_segment_clip_class_init (GstAudioSegmentClipClass * klass) { - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + GstSegmentClipClass *segment_clip_klass = GST_SEGMENT_CLIP_CLASS (klass); + + GST_DEBUG_CATEGORY_INIT (gst_audio_segment_clip_debug, "audiosegmentclip", 0, + "audiosegmentclip element"); + + segment_clip_klass->reset = GST_DEBUG_FUNCPTR (gst_audio_segment_clip_reset); + segment_clip_klass->set_caps = + GST_DEBUG_FUNCPTR (gst_audio_segment_clip_set_caps); + segment_clip_klass->clip_buffer = + GST_DEBUG_FUNCPTR (gst_audio_segment_clip_clip_buffer); gst_element_class_set_details_simple (element_class, "Audio buffer segment clipper", @@ -66,23 +74,7 @@ gst_audio_segment_clip_base_init (gpointer g_class) } static void -gst_audio_segment_clip_class_init (GstAudioSegmentClipClass * klass) -{ - GstSegmentClipClass *segment_clip_klass = GST_SEGMENT_CLIP_CLASS (klass); - - GST_DEBUG_CATEGORY_INIT (gst_audio_segment_clip_debug, "audiosegmentclip", 0, - "audiosegmentclip element"); - - segment_clip_klass->reset = GST_DEBUG_FUNCPTR (gst_audio_segment_clip_reset); - segment_clip_klass->set_caps = - GST_DEBUG_FUNCPTR (gst_audio_segment_clip_set_caps); - segment_clip_klass->clip_buffer = - GST_DEBUG_FUNCPTR (gst_audio_segment_clip_clip_buffer); -} - -static void -gst_audio_segment_clip_init (GstAudioSegmentClip * self, - GstAudioSegmentClipClass * g_class) +gst_audio_segment_clip_init (GstAudioSegmentClip * self) { } @@ -107,7 +99,7 @@ gst_audio_segment_clip_clip_buffer (GstSegmentClip * base, GstBuffer * buffer, GstClockTime duration = GST_BUFFER_DURATION (buffer); guint64 offset = GST_BUFFER_OFFSET (buffer); guint64 offset_end = GST_BUFFER_OFFSET_END (buffer); - guint size = GST_BUFFER_SIZE (buffer); + guint size = gst_buffer_get_size (buffer); if (!self->rate || !self->framesize) { GST_ERROR_OBJECT (self, "Not negotiated yet"); @@ -139,7 +131,7 @@ gst_audio_segment_clip_clip_buffer (GstSegmentClip * base, GstBuffer * buffer, if (segment->format == GST_FORMAT_TIME) { if (segment->rate >= 0) { if (segment->stop != -1 && timestamp >= segment->stop) - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } else { if (!GST_CLOCK_TIME_IS_VALID (duration)) duration = @@ -147,18 +139,18 @@ gst_audio_segment_clip_clip_buffer (GstSegmentClip * base, GstBuffer * buffer, self->framesize * self->rate); if (segment->start != -1 && timestamp + duration <= segment->start) - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } } else { if (segment->rate >= 0) { if (segment->stop != -1 && offset != -1 && offset >= segment->stop) - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } else if (offset != -1 || offset_end != -1) { if (offset_end == -1) offset_end = offset + size / self->framesize; if (segment->start != -1 && offset_end <= segment->start) - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } } } @@ -171,18 +163,19 @@ gst_audio_segment_clip_set_caps (GstSegmentClip * base, GstCaps * caps) { GstAudioSegmentClip *self = GST_AUDIO_SEGMENT_CLIP (base); gboolean ret; - GstStructure *s; + GstAudioInfo info; gint rate, channels, width; - s = gst_caps_get_structure (caps, 0); - - ret = gst_structure_get_int (s, "rate", &rate); - ret = ret && gst_structure_get_int (s, "channels", &channels); - ret = ret && gst_structure_get_int (s, "width", &width); + gst_audio_info_init (&info); + ret = gst_audio_info_from_caps (&info, caps); if (ret) { - GST_DEBUG_OBJECT (self, "Configured: rate %d channels %d width %d", rate, - channels, width); + rate = GST_AUDIO_INFO_RATE (&info); + channels = GST_AUDIO_INFO_CHANNELS (&info); + width = GST_AUDIO_INFO_WIDTH (&info); + + GST_DEBUG_OBJECT (self, "Configured: rate %d channels %d width %d", + rate, channels, width); self->rate = rate; self->framesize = (width / 8) * channels; } diff --git a/gst/segmentclip/gstsegmentclip.c b/gst/segmentclip/gstsegmentclip.c index d328a28ebc..c09a72293c 100644 --- a/gst/segmentclip/gstsegmentclip.c +++ b/gst/segmentclip/gstsegmentclip.c @@ -31,25 +31,44 @@ static GstStateChangeReturn gst_segment_clip_change_state (GstElement * element, GstStateChange transition); static GstFlowReturn gst_segment_clip_sink_chain (GstPad * pad, - GstBuffer * buffer); -static gboolean gst_segment_clip_sink_setcaps (GstPad * pad, GstCaps * caps); -static GstFlowReturn gst_segment_clip_sink_bufferalloc (GstPad * pad, - guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); + GstObject * parent, GstBuffer * buffer); +static gboolean gst_segment_clip_sink_setcaps (GstSegmentClip * self, + GstCaps * caps); -static gboolean gst_segment_clip_event (GstPad * pad, GstEvent * event); -static GstCaps *gst_segment_clip_getcaps (GstPad * pad); -static gboolean gst_segment_clip_query (GstPad * pad, GstQuery * query); -static const GstQueryType *gst_segment_clip_query_type (GstPad * pad); +static gboolean gst_segment_clip_event (GstPad * pad, GstObject * parent, + GstEvent * event); +static GstCaps *gst_segment_clip_getcaps (GstSegmentClip * self, GstPad * pad, + GstCaps * filter); +static gboolean gst_segment_clip_query (GstPad * pad, GstObject * parent, + GstQuery * query); GST_DEBUG_CATEGORY_STATIC (gst_segment_clip_debug); #define GST_CAT_DEFAULT gst_segment_clip_debug -GST_BOILERPLATE (GstSegmentClip, gst_segment_clip, GstElement, - GST_TYPE_ELEMENT); +static void gst_segment_clip_class_init (GstSegmentClipClass * klass); +static void gst_segment_clip_init (GstSegmentClip * clip, + GstSegmentClipClass * g_class); -static void -gst_segment_clip_base_init (gpointer g_class) +static GstElementClass *parent_class; + +/* we can't use G_DEFINE_ABSTRACT_TYPE because we need the klass in the _init + * method to get to the padtemplates */ +GType +gst_segment_clip_get_type (void) { + static volatile gsize segment_clip_type = 0; + + if (g_once_init_enter (&segment_clip_type)) { + GType _type; + + _type = g_type_register_static_simple (GST_TYPE_ELEMENT, + "GstSegmentClip", sizeof (GstSegmentClipClass), + (GClassInitFunc) gst_segment_clip_class_init, sizeof (GstSegmentClip), + (GInstanceInitFunc) gst_segment_clip_init, G_TYPE_FLAG_ABSTRACT); + + g_once_init_leave (&segment_clip_type, _type); + } + return segment_clip_type; } static void @@ -57,6 +76,8 @@ gst_segment_clip_class_init (GstSegmentClipClass * klass) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); + parent_class = g_type_class_peek_parent (klass); + GST_DEBUG_CATEGORY_INIT (gst_segment_clip_debug, "segmentclip", 0, "segmentclip base class"); @@ -78,16 +99,9 @@ gst_segment_clip_init (GstSegmentClip * self, GstSegmentClipClass * g_class) GST_DEBUG_FUNCPTR (gst_segment_clip_sink_chain)); gst_pad_set_event_function (self->sinkpad, GST_DEBUG_FUNCPTR (gst_segment_clip_event)); - gst_pad_set_setcaps_function (self->sinkpad, - GST_DEBUG_FUNCPTR (gst_segment_clip_sink_setcaps)); - gst_pad_set_getcaps_function (self->sinkpad, - GST_DEBUG_FUNCPTR (gst_segment_clip_getcaps)); - gst_pad_set_bufferalloc_function (self->sinkpad, - GST_DEBUG_FUNCPTR (gst_segment_clip_sink_bufferalloc)); gst_pad_set_query_function (self->sinkpad, GST_DEBUG_FUNCPTR (gst_segment_clip_query)); - gst_pad_set_query_type_function (self->sinkpad, - GST_DEBUG_FUNCPTR (gst_segment_clip_query_type)); + GST_PAD_SET_PROXY_ALLOCATION (self->sinkpad); gst_element_add_pad (GST_ELEMENT (self), self->sinkpad); gst_object_unref (templ); @@ -98,12 +112,8 @@ gst_segment_clip_init (GstSegmentClip * self, GstSegmentClipClass * g_class) self->srcpad = gst_pad_new_from_template (templ, "src"); gst_pad_set_event_function (self->srcpad, GST_DEBUG_FUNCPTR (gst_segment_clip_event)); - gst_pad_set_getcaps_function (self->srcpad, - GST_DEBUG_FUNCPTR (gst_segment_clip_getcaps)); gst_pad_set_query_function (self->srcpad, GST_DEBUG_FUNCPTR (gst_segment_clip_query)); - gst_pad_set_query_type_function (self->srcpad, - GST_DEBUG_FUNCPTR (gst_segment_clip_query_type)); gst_element_add_pad (GST_ELEMENT (self), self->srcpad); gst_segment_clip_reset (self); @@ -121,53 +131,31 @@ gst_segment_clip_reset (GstSegmentClip * self) klass->reset (self); } -static GstFlowReturn -gst_segment_clip_sink_bufferalloc (GstPad * pad, guint64 offset, guint size, - GstCaps * caps, GstBuffer ** buf) -{ - GstSegmentClip *self = GST_SEGMENT_CLIP (gst_pad_get_parent (pad)); - GstFlowReturn ret = GST_FLOW_OK; - - GST_LOG_OBJECT (pad, "Allocating buffer with offset 0x%" G_GINT64_MODIFIER - "x and size %u with caps: %" GST_PTR_FORMAT, offset, size, caps); - - *buf = NULL; - - ret = gst_pad_alloc_buffer (self->srcpad, offset, size, caps, buf); - if (G_UNLIKELY (ret != GST_FLOW_OK)) - GST_ERROR_OBJECT (pad, "Allocating buffer failed: %s", - gst_flow_get_name (ret)); - - gst_object_unref (self); - - return ret; -} - static gboolean -gst_segment_clip_sink_setcaps (GstPad * pad, GstCaps * caps) +gst_segment_clip_sink_setcaps (GstSegmentClip * self, GstCaps * caps) { - GstSegmentClip *self = GST_SEGMENT_CLIP (gst_pad_get_parent (pad)); GstSegmentClipClass *klass = GST_SEGMENT_CLIP_GET_CLASS (self); gboolean ret; - GST_DEBUG_OBJECT (pad, "Setting caps: %" GST_PTR_FORMAT, caps); + GST_DEBUG_OBJECT (self, "Setting caps: %" GST_PTR_FORMAT, caps); ret = klass->set_caps (self, caps); - gst_object_unref (self); + /* pass along caps* */ + if (ret) + ret = gst_pad_set_caps (self->srcpad, caps); return ret; } static GstCaps * -gst_segment_clip_getcaps (GstPad * pad) +gst_segment_clip_getcaps (GstSegmentClip * self, GstPad * pad, GstCaps * filter) { - GstSegmentClip *self = GST_SEGMENT_CLIP (gst_pad_get_parent (pad)); GstPad *otherpad; GstCaps *tmp, *ret; otherpad = (pad == self->srcpad) ? self->sinkpad : self->srcpad; - tmp = gst_pad_peer_get_caps (otherpad); + tmp = gst_pad_peer_query_caps (otherpad, filter); if (tmp) { ret = gst_caps_intersect (tmp, gst_pad_get_pad_template_caps (pad)); gst_caps_unref (tmp); @@ -175,55 +163,40 @@ gst_segment_clip_getcaps (GstPad * pad) ret = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); } - gst_object_unref (self); - GST_LOG_OBJECT (pad, "Returning caps: %" GST_PTR_FORMAT, ret); return ret; } static gboolean -gst_segment_clip_query (GstPad * pad, GstQuery * query) +gst_segment_clip_query (GstPad * pad, GstObject * parent, GstQuery * query) { - GstSegmentClip *self = GST_SEGMENT_CLIP (gst_pad_get_parent (pad)); + GstSegmentClip *self = GST_SEGMENT_CLIP (parent); gboolean ret; - GstPad *otherpad; - - otherpad = (pad == self->srcpad) ? self->sinkpad : self->srcpad; GST_LOG_OBJECT (pad, "Handling query of type '%s'", gst_query_type_get_name (GST_QUERY_TYPE (query))); - ret = gst_pad_peer_query (otherpad, query); + if (GST_QUERY_TYPE (query) == GST_QUERY_CAPS) { + GstCaps *caps; + + gst_query_parse_caps (query, &caps); + caps = gst_segment_clip_getcaps (self, pad, caps); + gst_query_set_caps_result (query, caps); + gst_caps_unref (caps); + ret = TRUE; + } else { + ret = gst_pad_query_default (pad, parent, query); + } - gst_object_unref (self); return ret; } -static const GstQueryType * -gst_segment_clip_query_type (GstPad * pad) -{ - GstSegmentClip *self = GST_SEGMENT_CLIP (gst_pad_get_parent (pad)); - GstPad *otherpad, *peer; - const GstQueryType *types = NULL; - - otherpad = (pad == self->srcpad) ? self->sinkpad : self->srcpad; - peer = gst_pad_get_peer (otherpad); - if (peer) { - types = gst_pad_get_query_types (peer); - gst_object_unref (peer); - } - - gst_object_unref (self); - - return types; -} - - static GstFlowReturn -gst_segment_clip_sink_chain (GstPad * pad, GstBuffer * buffer) +gst_segment_clip_sink_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer) { - GstSegmentClip *self = GST_SEGMENT_CLIP (GST_PAD_PARENT (pad)); + GstSegmentClip *self = GST_SEGMENT_CLIP (parent); GstFlowReturn ret; GstSegmentClipClass *klass = GST_SEGMENT_CLIP_GET_CLASS (self); GstBuffer *outbuf = NULL; @@ -262,46 +235,45 @@ gst_segment_clip_change_state (GstElement * element, GstStateChange transition) } static gboolean -gst_segment_clip_event (GstPad * pad, GstEvent * event) +gst_segment_clip_event (GstPad * pad, GstObject * parent, GstEvent * event) { - GstSegmentClip *self = GST_SEGMENT_CLIP (gst_pad_get_parent (pad)); - GstPad *otherpad; - gboolean ret; + GstSegmentClip *self = GST_SEGMENT_CLIP (parent); + gboolean ret = TRUE; GST_LOG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event)); - otherpad = (pad == self->srcpad) ? self->sinkpad : self->srcpad; - ret = gst_pad_push_event (otherpad, gst_event_ref (event)); + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_CAPS: + { + GstCaps *caps; - if (ret) { - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_NEWSEGMENT:{ - GstFormat fmt; - gboolean is_update; - gint64 start, end, base; - gdouble rate; - - gst_event_parse_new_segment (event, &is_update, &rate, &fmt, &start, - &end, &base); - GST_DEBUG_OBJECT (pad, - "Got NEWSEGMENT event in %s format, passing on (%" - GST_TIME_FORMAT " - %" GST_TIME_FORMAT ")", - gst_format_get_name (fmt), GST_TIME_ARGS (start), - GST_TIME_ARGS (end)); - gst_segment_set_newsegment (&self->segment, is_update, rate, fmt, start, - end, base); - break; - } - case GST_EVENT_FLUSH_STOP: - gst_segment_clip_reset (self); - break; - default: - break; + /* should be only downstream */ + g_assert (pad == self->sinkpad); + gst_event_parse_caps (event, &caps); + ret = gst_segment_clip_sink_setcaps (self, caps); + break; } + case GST_EVENT_SEGMENT: + { + const GstSegment *segment; + + gst_event_parse_segment (event, &segment); + GST_DEBUG_OBJECT (pad, "Got NEWSEGMENT event %" GST_SEGMENT_FORMAT, + segment); + gst_segment_copy_into (segment, &self->segment); + break; + } + case GST_EVENT_FLUSH_STOP: + gst_segment_clip_reset (self); + break; + default: + break; } - gst_event_unref (event); + if (ret) + ret = gst_pad_event_default (pad, parent, event); + else + gst_event_unref (event); - gst_object_unref (self); return ret; } diff --git a/gst/segmentclip/gstvideosegmentclip.c b/gst/segmentclip/gstvideosegmentclip.c index 16a948e7f2..1e52d31574 100644 --- a/gst/segmentclip/gstvideosegmentclip.c +++ b/gst/segmentclip/gstvideosegmentclip.c @@ -27,19 +27,12 @@ #include "gstvideosegmentclip.h" static GstStaticPadTemplate sink_pad_template = - GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS - ("video/x-raw-yuv, framerate=" GST_VIDEO_FPS_RANGE "; " - "video/x-raw-rgb, framerate=" GST_VIDEO_FPS_RANGE "; " - "video/x-raw-grey, framerate=" GST_VIDEO_FPS_RANGE)); - +GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, + GST_STATIC_CAPS ("video/x-raw, framerate=" GST_VIDEO_FPS_RANGE)); static GstStaticPadTemplate src_pad_template = - GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS - ("video/x-raw-yuv, framerate=" GST_VIDEO_FPS_RANGE "; " - "video/x-raw-rgb, framerate=" GST_VIDEO_FPS_RANGE "; " - "video/x-raw-grey, framerate=" GST_VIDEO_FPS_RANGE)); +GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, + GST_STATIC_CAPS ("video/x-raw, framerate=" GST_VIDEO_FPS_RANGE)); static void gst_video_segment_clip_reset (GstSegmentClip * self); static GstFlowReturn gst_video_segment_clip_clip_buffer (GstSegmentClip * self, @@ -50,13 +43,17 @@ static gboolean gst_video_segment_clip_set_caps (GstSegmentClip * self, GST_DEBUG_CATEGORY_STATIC (gst_video_segment_clip_debug); #define GST_CAT_DEFAULT gst_video_segment_clip_debug -GST_BOILERPLATE (GstVideoSegmentClip, gst_video_segment_clip, GstSegmentClip, +G_DEFINE_TYPE (GstVideoSegmentClip, gst_video_segment_clip, GST_TYPE_SEGMENT_CLIP); static void -gst_video_segment_clip_base_init (gpointer g_class) +gst_video_segment_clip_class_init (GstVideoSegmentClipClass * klass) { - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + GstSegmentClipClass *segment_clip_klass = GST_SEGMENT_CLIP_CLASS (klass); + + GST_DEBUG_CATEGORY_INIT (gst_video_segment_clip_debug, "videosegmentclip", 0, + "videosegmentclip element"); gst_element_class_set_details_simple (element_class, "Video buffer segment clipper", @@ -68,15 +65,6 @@ gst_video_segment_clip_base_init (gpointer g_class) gst_static_pad_template_get (&sink_pad_template)); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_pad_template)); -} - -static void -gst_video_segment_clip_class_init (GstVideoSegmentClipClass * klass) -{ - GstSegmentClipClass *segment_clip_klass = GST_SEGMENT_CLIP_CLASS (klass); - - GST_DEBUG_CATEGORY_INIT (gst_video_segment_clip_debug, "videosegmentclip", 0, - "videosegmentclip element"); segment_clip_klass->reset = GST_DEBUG_FUNCPTR (gst_video_segment_clip_reset); segment_clip_klass->set_caps = @@ -86,8 +74,7 @@ gst_video_segment_clip_class_init (GstVideoSegmentClipClass * klass) } static void -gst_video_segment_clip_init (GstVideoSegmentClip * self, - GstVideoSegmentClipClass * g_class) +gst_video_segment_clip_init (GstVideoSegmentClip * self) { } @@ -109,7 +96,7 @@ gst_video_segment_clip_clip_buffer (GstSegmentClip * base, GstBuffer * buffer, GstVideoSegmentClip *self = GST_VIDEO_SEGMENT_CLIP (base); GstSegment *segment = &base->segment; GstClockTime timestamp, duration; - gint64 cstart, cstop; + guint64 cstart, cstop; gboolean in_seg; if (!self->fps_d) { @@ -146,7 +133,7 @@ gst_video_segment_clip_clip_buffer (GstSegmentClip * base, GstBuffer * buffer, timestamp + duration, &cstart, &cstop); if (in_seg) { if (timestamp != cstart || timestamp + duration != cstop) { - *outbuf = gst_buffer_make_metadata_writable (buffer); + *outbuf = gst_buffer_make_writable (buffer); GST_BUFFER_TIMESTAMP (*outbuf) = cstart; GST_BUFFER_DURATION (*outbuf) = cstop - cstart; @@ -158,10 +145,10 @@ gst_video_segment_clip_clip_buffer (GstSegmentClip * base, GstBuffer * buffer, if (segment->rate >= 0) { if (segment->stop != -1 && timestamp >= segment->stop) - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } else { if (segment->start != -1 && timestamp + duration <= segment->start) - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } gst_buffer_unref (buffer); }