2 * Copyright (c) 2005 Edward Hervey <bilboed@bilboed.com>
3 * Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
22 * SECTION:element-imagefreeze
24 * The imagefreeze element generates a still frame video stream from
25 * the input. It duplicates the first frame with the framerate requested
26 * by downstream, allows seeking and answers queries.
29 * <title>Example launch line</title>
31 * gst-launch-1.0 -v filesrc location=some.png ! decodebin2 ! imagefreeze ! autovideosink
32 * ]| This pipeline shows a still frame stream of a PNG file.
36 /* This is based on the imagefreeze element from PiTiVi:
37 * http://git.gnome.org/browse/pitivi/tree/pitivi/elements/imagefreeze.py
44 #include <gst/glib-compat-private.h>
46 #include "gstimagefreeze.h"
48 static void gst_image_freeze_finalize (GObject * object);
50 static void gst_image_freeze_reset (GstImageFreeze * self);
52 static GstStateChangeReturn gst_image_freeze_change_state (GstElement * element,
53 GstStateChange transition);
55 static GstFlowReturn gst_image_freeze_sink_chain (GstPad * pad,
56 GstObject * parent, GstBuffer * buffer);
57 static gboolean gst_image_freeze_sink_event (GstPad * pad, GstObject * parent,
59 static gboolean gst_image_freeze_sink_setcaps (GstImageFreeze * self,
61 static GstCaps *gst_image_freeze_sink_getcaps (GstImageFreeze * self,
63 static gboolean gst_image_freeze_sink_query (GstPad * pad, GstObject * parent,
65 static void gst_image_freeze_src_loop (GstPad * pad);
66 static gboolean gst_image_freeze_src_event (GstPad * pad, GstObject * parent,
68 static gboolean gst_image_freeze_src_query (GstPad * pad, GstObject * parent,
71 static GstStaticPadTemplate sink_pad_template = GST_STATIC_PAD_TEMPLATE ("sink",
74 GST_STATIC_CAPS ("video/x-raw"));
76 static GstStaticPadTemplate src_pad_template =
77 GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
78 GST_STATIC_CAPS ("video/x-raw"));
80 GST_DEBUG_CATEGORY_STATIC (gst_image_freeze_debug);
81 #define GST_CAT_DEFAULT gst_image_freeze_debug
83 #define gst_image_freeze_parent_class parent_class
84 G_DEFINE_TYPE (GstImageFreeze, gst_image_freeze, GST_TYPE_ELEMENT);
88 gst_image_freeze_class_init (GstImageFreezeClass * klass)
90 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
91 GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
93 gobject_class->finalize = gst_image_freeze_finalize;
95 gstelement_class->change_state =
96 GST_DEBUG_FUNCPTR (gst_image_freeze_change_state);
98 gst_element_class_set_static_metadata (gstelement_class,
99 "Still frame stream generator",
101 "Generates a still frame stream from an image",
102 "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
104 gst_element_class_add_pad_template (gstelement_class,
105 gst_static_pad_template_get (&sink_pad_template));
106 gst_element_class_add_pad_template (gstelement_class,
107 gst_static_pad_template_get (&src_pad_template));
111 gst_image_freeze_init (GstImageFreeze * self)
113 self->sinkpad = gst_pad_new_from_static_template (&sink_pad_template, "sink");
114 gst_pad_set_chain_function (self->sinkpad,
115 GST_DEBUG_FUNCPTR (gst_image_freeze_sink_chain));
116 gst_pad_set_event_function (self->sinkpad,
117 GST_DEBUG_FUNCPTR (gst_image_freeze_sink_event));
118 gst_pad_set_query_function (self->sinkpad,
119 GST_DEBUG_FUNCPTR (gst_image_freeze_sink_query));
120 GST_PAD_SET_PROXY_ALLOCATION (self->sinkpad);
121 gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
123 self->srcpad = gst_pad_new_from_static_template (&src_pad_template, "src");
124 gst_pad_set_event_function (self->srcpad,
125 GST_DEBUG_FUNCPTR (gst_image_freeze_src_event));
126 gst_pad_set_query_function (self->srcpad,
127 GST_DEBUG_FUNCPTR (gst_image_freeze_src_query));
128 gst_pad_use_fixed_caps (self->srcpad);
129 gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
131 g_mutex_init (&self->lock);
133 gst_image_freeze_reset (self);
137 gst_image_freeze_finalize (GObject * object)
139 GstImageFreeze *self = GST_IMAGE_FREEZE (object);
141 gst_image_freeze_reset (self);
143 g_mutex_clear (&self->lock);
145 G_OBJECT_CLASS (parent_class)->finalize (object);
149 gst_image_freeze_reset (GstImageFreeze * self)
151 GST_DEBUG_OBJECT (self, "Resetting internal state");
153 g_mutex_lock (&self->lock);
154 gst_buffer_replace (&self->buffer, NULL);
156 gst_segment_init (&self->segment, GST_FORMAT_TIME);
157 self->need_segment = TRUE;
159 self->fps_n = self->fps_d = 0;
161 g_mutex_unlock (&self->lock);
163 g_atomic_int_set (&self->seeking, 0);
167 gst_image_freeze_sink_setcaps (GstImageFreeze * self, GstCaps * caps)
169 gboolean ret = FALSE;
172 GstCaps *othercaps, *intersection;
177 caps = gst_caps_make_writable (gst_caps_ref (caps));
179 GST_DEBUG_OBJECT (pad, "Setting caps: %" GST_PTR_FORMAT, caps);
181 s = gst_caps_get_structure (caps, 0);
183 /* 1. Remove framerate */
184 gst_structure_remove_field (s, "framerate");
185 gst_structure_set (s, "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1,
188 /* 2. Intersect with template caps */
189 othercaps = (GstCaps *) gst_pad_get_pad_template_caps (pad);
190 intersection = gst_caps_intersect (caps, othercaps);
191 GST_DEBUG_OBJECT (pad, "Intersecting: %" GST_PTR_FORMAT, caps);
192 GST_DEBUG_OBJECT (pad, "with: %" GST_PTR_FORMAT, othercaps);
193 GST_DEBUG_OBJECT (pad, "gave: %" GST_PTR_FORMAT, intersection);
194 gst_caps_unref (caps);
196 intersection = othercaps = NULL;
198 /* 3. Intersect with downstream peer caps */
199 othercaps = gst_pad_peer_query_caps (self->srcpad, caps);
200 GST_DEBUG_OBJECT (pad, "Peer query resulted: %" GST_PTR_FORMAT, othercaps);
201 gst_caps_unref (caps);
205 /* 4. For every candidate check if it's accepted downstream
206 * and fixate framerate to nearest 25/1 */
207 n = gst_caps_get_size (caps);
208 for (i = 0; i < n; i++) {
209 GstCaps *candidate = gst_caps_new_empty ();
210 GstStructure *s = gst_structure_copy (gst_caps_get_structure (caps, i));
212 gst_caps_append_structure (candidate, s);
213 if (gst_structure_has_field_typed (s, "framerate", GST_TYPE_FRACTION) ||
214 gst_structure_fixate_field_nearest_fraction (s, "framerate", 25, 1)) {
215 if (gst_pad_peer_query_accept_caps (self->srcpad, candidate)) {
216 gst_structure_get_fraction (s, "framerate", &fps_n, &fps_d);
218 g_mutex_lock (&self->lock);
221 g_mutex_unlock (&self->lock);
222 GST_DEBUG_OBJECT (pad, "Setting caps %" GST_PTR_FORMAT, candidate);
223 gst_pad_set_caps (self->srcpad, candidate);
224 gst_caps_unref (candidate);
228 GST_WARNING_OBJECT (pad, "Invalid caps with framerate %d/%d", fps_n,
233 gst_caps_unref (candidate);
238 GST_ERROR_OBJECT (pad, "No usable caps found");
240 gst_caps_unref (caps);
245 /* remove framerate in writable @caps */
247 gst_image_freeze_remove_fps (GstImageFreeze * self, GstCaps * caps)
251 n = gst_caps_get_size (caps);
252 for (i = 0; i < n; i++) {
253 GstStructure *s = gst_caps_get_structure (caps, i);
255 gst_structure_remove_field (s, "framerate");
256 gst_structure_set (s, "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT,
262 gst_image_freeze_sink_getcaps (GstImageFreeze * self, GstCaps * filter)
264 GstCaps *ret, *tmp, *templ;
268 if (gst_pad_has_current_caps (pad)) {
269 ret = gst_pad_get_current_caps (pad);
274 filter = gst_caps_copy (filter);
275 gst_image_freeze_remove_fps (self, filter);
277 templ = gst_pad_get_pad_template_caps (pad);
278 tmp = gst_pad_peer_query_caps (self->srcpad, filter);
280 GST_LOG_OBJECT (self, "peer caps %" GST_PTR_FORMAT, tmp);
281 ret = gst_caps_intersect (tmp, templ);
282 gst_caps_unref (tmp);
284 GST_LOG_OBJECT (self, "going to copy");
285 ret = gst_caps_copy (templ);
287 gst_caps_unref (templ);
289 gst_caps_unref (filter);
291 ret = gst_caps_make_writable (ret);
292 gst_image_freeze_remove_fps (self, ret);
295 GST_LOG_OBJECT (pad, "Returning caps: %" GST_PTR_FORMAT, ret);
301 gst_image_freeze_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
303 GstImageFreeze *self = GST_IMAGE_FREEZE (parent);
306 GST_LOG_OBJECT (pad, "Handling query of type '%s'",
307 gst_query_type_get_name (GST_QUERY_TYPE (query)));
309 switch (GST_QUERY_TYPE (query)) {
314 gst_query_parse_caps (query, &caps);
315 caps = gst_image_freeze_sink_getcaps (self, caps);
316 gst_query_set_caps_result (query, caps);
317 gst_caps_unref (caps);
322 ret = gst_pad_query_default (pad, parent, query);
329 gst_image_freeze_convert (GstImageFreeze * self,
330 GstFormat src_format, gint64 src_value,
331 GstFormat * dest_format, gint64 * dest_value)
333 gboolean ret = FALSE;
335 if (src_format == *dest_format) {
336 *dest_value = src_value;
340 if (src_value == -1) {
345 switch (src_format) {
346 case GST_FORMAT_DEFAULT:{
347 switch (*dest_format) {
348 case GST_FORMAT_TIME:
349 g_mutex_lock (&self->lock);
350 if (self->fps_n == 0)
354 gst_util_uint64_scale (src_value, GST_SECOND * self->fps_d,
356 g_mutex_unlock (&self->lock);
364 case GST_FORMAT_TIME:{
365 switch (*dest_format) {
366 case GST_FORMAT_DEFAULT:
367 g_mutex_lock (&self->lock);
369 gst_util_uint64_scale (src_value, self->fps_n,
370 self->fps_d * GST_SECOND);
371 g_mutex_unlock (&self->lock);
387 gst_image_freeze_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
389 GstImageFreeze *self = GST_IMAGE_FREEZE (parent);
390 gboolean ret = FALSE;
392 GST_LOG_OBJECT (pad, "Handling query of type '%s'",
393 gst_query_type_get_name (GST_QUERY_TYPE (query)));
395 switch (GST_QUERY_TYPE (query)) {
396 case GST_QUERY_CONVERT:{
397 GstFormat src_format, dest_format;
398 gint64 src_value, dest_value;
400 gst_query_parse_convert (query, &src_format, &src_value, &dest_format,
403 gst_image_freeze_convert (self, src_format, src_value, &dest_format,
406 gst_query_set_convert (query, src_format, src_value, dest_format,
410 case GST_QUERY_POSITION:{
414 gst_query_parse_position (query, &format, NULL);
416 case GST_FORMAT_DEFAULT:{
417 g_mutex_lock (&self->lock);
418 position = self->offset;
419 g_mutex_unlock (&self->lock);
423 case GST_FORMAT_TIME:{
424 g_mutex_lock (&self->lock);
425 position = self->segment.position;
426 g_mutex_unlock (&self->lock);
435 gst_query_set_position (query, format, position);
436 GST_DEBUG_OBJECT (pad,
437 "Returning position %" G_GINT64_FORMAT " in format %s", position,
438 gst_format_get_name (format));
440 GST_DEBUG_OBJECT (pad, "Position query failed");
444 case GST_QUERY_DURATION:{
448 gst_query_parse_duration (query, &format, NULL);
450 case GST_FORMAT_TIME:{
451 g_mutex_lock (&self->lock);
452 duration = self->segment.stop;
453 g_mutex_unlock (&self->lock);
457 case GST_FORMAT_DEFAULT:{
458 g_mutex_lock (&self->lock);
459 duration = self->segment.stop;
462 gst_util_uint64_scale (duration, self->fps_n,
463 GST_SECOND * self->fps_d);
464 g_mutex_unlock (&self->lock);
473 gst_query_set_duration (query, format, duration);
474 GST_DEBUG_OBJECT (pad,
475 "Returning duration %" G_GINT64_FORMAT " in format %s", duration,
476 gst_format_get_name (format));
478 GST_DEBUG_OBJECT (pad, "Duration query failed");
482 case GST_QUERY_SEEKING:{
486 gst_query_parse_seeking (query, &format, NULL, NULL, NULL);
487 seekable = (format == GST_FORMAT_TIME || format == GST_FORMAT_DEFAULT);
489 gst_query_set_seeking (query, format, seekable, (seekable ? 0 : -1), -1);
503 gst_image_freeze_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
505 GstImageFreeze *self = GST_IMAGE_FREEZE (parent);
508 GST_LOG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event));
510 switch (GST_EVENT_TYPE (event)) {
515 gst_event_parse_caps (event, &caps);
516 gst_image_freeze_sink_setcaps (self, caps);
517 gst_event_unref (event);
523 /* if we receive EOS before a buffer arrives, then let it pass */
524 GST_DEBUG_OBJECT (self, "EOS without input buffer, passing on");
525 ret = gst_pad_push_event (self->srcpad, event);
529 case GST_EVENT_SEGMENT:
530 GST_DEBUG_OBJECT (pad, "Dropping event");
531 gst_event_unref (event);
534 case GST_EVENT_FLUSH_START:
535 gst_image_freeze_reset (self);
538 ret = gst_pad_push_event (self->srcpad, event);
546 gst_image_freeze_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
548 GstImageFreeze *self = GST_IMAGE_FREEZE (parent);
551 GST_LOG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event));
553 switch (GST_EVENT_TYPE (event)) {
554 case GST_EVENT_NAVIGATION:
556 case GST_EVENT_LATENCY:
558 GST_DEBUG_OBJECT (pad, "Dropping event");
559 gst_event_unref (event);
562 case GST_EVENT_SEEK:{
566 GstSeekType start_type, stop_type;
572 gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
574 gst_event_unref (event);
576 flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
578 if (format != GST_FORMAT_TIME && format != GST_FORMAT_DEFAULT) {
579 GST_ERROR_OBJECT (pad, "Seek in invalid format: %s",
580 gst_format_get_name (format));
585 if (format == GST_FORMAT_DEFAULT) {
586 format = GST_FORMAT_TIME;
587 if (!gst_image_freeze_convert (self, GST_FORMAT_DEFAULT, start, &format,
589 || !gst_image_freeze_convert (self, GST_FORMAT_DEFAULT, stop,
591 || start == -1 || stop == -1) {
592 GST_ERROR_OBJECT (pad,
593 "Failed to convert seek from DEFAULT format into TIME format");
602 g_atomic_int_set (&self->seeking, 1);
603 e = gst_event_new_flush_start ();
604 gst_pad_push_event (self->srcpad, e);
606 gst_pad_pause_task (self->srcpad);
609 GST_PAD_STREAM_LOCK (self->srcpad);
611 g_mutex_lock (&self->lock);
613 gst_segment_do_seek (&self->segment, rate, format, flags, start_type,
614 start, stop_type, stop, NULL);
615 self->need_segment = TRUE;
616 last_stop = self->segment.position;
618 start_task = self->buffer != NULL;
619 g_mutex_unlock (&self->lock);
624 e = gst_event_new_flush_stop (TRUE);
625 gst_pad_push_event (self->srcpad, e);
626 g_atomic_int_set (&self->seeking, 0);
629 if (flags & GST_SEEK_FLAG_SEGMENT) {
632 m = gst_message_new_segment_start (GST_OBJECT (self),
634 gst_element_post_message (GST_ELEMENT (self), m);
637 GST_PAD_STREAM_UNLOCK (self->srcpad);
639 GST_DEBUG_OBJECT (pad, "Seek successful");
642 g_mutex_lock (&self->lock);
644 if (self->buffer != NULL)
645 gst_pad_start_task (self->srcpad,
646 (GstTaskFunction) gst_image_freeze_src_loop, self->srcpad, NULL);
648 g_mutex_unlock (&self->lock);
654 case GST_EVENT_FLUSH_START:
655 gst_image_freeze_reset (self);
658 ret = gst_pad_push_event (self->sinkpad, event);
666 gst_image_freeze_sink_chain (GstPad * pad, GstObject * parent,
669 GstImageFreeze *self = GST_IMAGE_FREEZE (parent);
671 g_mutex_lock (&self->lock);
673 GST_DEBUG_OBJECT (pad, "Already have a buffer, dropping");
674 gst_buffer_unref (buffer);
675 g_mutex_unlock (&self->lock);
679 self->buffer = buffer;
681 gst_pad_start_task (self->srcpad, (GstTaskFunction) gst_image_freeze_src_loop,
683 g_mutex_unlock (&self->lock);
688 gst_image_freeze_src_loop (GstPad * pad)
690 GstImageFreeze *self = GST_IMAGE_FREEZE (GST_PAD_PARENT (pad));
693 GstClockTime timestamp, timestamp_end;
694 guint64 cstart, cstop;
695 gboolean in_seg, eos;
696 GstFlowReturn flow_ret = GST_FLOW_OK;
698 g_mutex_lock (&self->lock);
699 if (!gst_pad_has_current_caps (self->srcpad)) {
700 GST_ERROR_OBJECT (pad, "Not negotiated yet");
701 flow_ret = GST_FLOW_NOT_NEGOTIATED;
702 g_mutex_unlock (&self->lock);
707 GST_ERROR_OBJECT (pad, "Have no buffer yet");
708 flow_ret = GST_FLOW_ERROR;
709 g_mutex_unlock (&self->lock);
712 buffer = gst_buffer_ref (self->buffer);
713 buffer = gst_buffer_make_writable (buffer);
714 g_mutex_unlock (&self->lock);
716 if (self->need_segment) {
719 GST_DEBUG_OBJECT (pad, "Pushing SEGMENT event: %" GST_SEGMENT_FORMAT,
721 e = gst_event_new_segment (&self->segment);
723 g_mutex_lock (&self->lock);
724 if (self->segment.rate >= 0) {
726 gst_util_uint64_scale (self->segment.start, self->fps_n,
727 self->fps_d * GST_SECOND);
730 gst_util_uint64_scale (self->segment.stop, self->fps_n,
731 self->fps_d * GST_SECOND);
733 g_mutex_unlock (&self->lock);
735 self->need_segment = FALSE;
737 gst_pad_push_event (self->srcpad, e);
740 g_mutex_lock (&self->lock);
741 offset = self->offset;
743 if (self->fps_n != 0) {
745 gst_util_uint64_scale (offset, self->fps_d * GST_SECOND, self->fps_n);
747 gst_util_uint64_scale (offset + 1, self->fps_d * GST_SECOND,
750 timestamp = self->segment.start;
751 timestamp_end = GST_CLOCK_TIME_NONE;
754 eos = (self->fps_n == 0 && offset > 0) ||
755 (self->segment.rate >= 0 && self->segment.stop != -1
756 && timestamp > self->segment.stop) || (self->segment.rate < 0
757 && offset == 0) || (self->segment.rate < 0
758 && self->segment.start != -1 && timestamp_end < self->segment.start);
760 if (self->fps_n == 0 && offset > 0)
764 gst_segment_clip (&self->segment, GST_FORMAT_TIME, timestamp,
765 timestamp_end, &cstart, &cstop);
768 self->segment.position = cstart;
769 if (self->segment.rate >= 0)
770 self->segment.position = cstop;
773 if (self->segment.rate >= 0)
777 g_mutex_unlock (&self->lock);
779 GST_DEBUG_OBJECT (pad, "Handling buffer with timestamp %" GST_TIME_FORMAT,
780 GST_TIME_ARGS (timestamp));
783 GST_BUFFER_DTS (buffer) = GST_CLOCK_TIME_NONE;
784 GST_BUFFER_PTS (buffer) = cstart;
785 GST_BUFFER_DURATION (buffer) = cstop - cstart;
786 GST_BUFFER_OFFSET (buffer) = offset;
787 GST_BUFFER_OFFSET_END (buffer) = offset + 1;
788 flow_ret = gst_pad_push (self->srcpad, buffer);
789 GST_DEBUG_OBJECT (pad, "Pushing buffer resulted in %s",
790 gst_flow_get_name (flow_ret));
791 if (flow_ret != GST_FLOW_OK)
794 gst_buffer_unref (buffer);
798 flow_ret = GST_FLOW_EOS;
806 const gchar *reason = gst_flow_get_name (flow_ret);
808 GST_LOG_OBJECT (self, "pausing task, reason %s", reason);
809 gst_pad_pause_task (pad);
811 if (flow_ret == GST_FLOW_EOS) {
812 if ((self->segment.flags & GST_SEEK_FLAG_SEGMENT)) {
816 GST_DEBUG_OBJECT (pad, "Sending segment done at end of segment");
817 if (self->segment.rate >= 0) {
818 m = gst_message_new_segment_done (GST_OBJECT_CAST (self),
819 GST_FORMAT_TIME, self->segment.stop);
820 e = gst_event_new_segment_done (GST_FORMAT_TIME, self->segment.stop);
822 m = gst_message_new_segment_done (GST_OBJECT_CAST (self),
823 GST_FORMAT_TIME, self->segment.start);
824 e = gst_event_new_segment_done (GST_FORMAT_TIME, self->segment.start);
826 gst_element_post_message (GST_ELEMENT_CAST (self), m);
827 gst_pad_push_event (self->srcpad, e);
829 GST_DEBUG_OBJECT (pad, "Sending EOS at end of segment");
830 gst_pad_push_event (self->srcpad, gst_event_new_eos ());
832 } else if (flow_ret == GST_FLOW_NOT_LINKED || flow_ret < GST_FLOW_EOS) {
833 GST_ELEMENT_ERROR (self, STREAM, FAILED,
834 ("Internal data stream error."),
835 ("stream stopped, reason %s", reason));
836 gst_pad_push_event (self->srcpad, gst_event_new_eos ());
842 static GstStateChangeReturn
843 gst_image_freeze_change_state (GstElement * element, GstStateChange transition)
845 GstImageFreeze *self = GST_IMAGE_FREEZE (element);
846 GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
848 switch (transition) {
849 case GST_STATE_CHANGE_READY_TO_PAUSED:
850 gst_image_freeze_reset (self);
852 case GST_STATE_CHANGE_PAUSED_TO_READY:
853 gst_pad_stop_task (self->srcpad);
854 gst_image_freeze_reset (self);
860 if (GST_ELEMENT_CLASS (parent_class)->change_state)
861 ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
863 switch (transition) {
872 plugin_init (GstPlugin * plugin)
874 GST_DEBUG_CATEGORY_INIT (gst_image_freeze_debug, "imagefreeze", 0,
875 "imagefreeze element");
877 if (!gst_element_register (plugin, "imagefreeze", GST_RANK_NONE,
878 GST_TYPE_IMAGE_FREEZE))
884 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
887 "Still frame stream generator",
888 plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)