2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000,2005 Wim Taymans <wim@fluendo.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
31 #include "gstbasesrc.h"
32 #include "gsttypefindhelper.h"
33 #include <gst/gstmarshal.h>
35 #define DEFAULT_BLOCKSIZE 4096
37 GST_DEBUG_CATEGORY_STATIC (gst_base_src_debug);
38 #define GST_CAT_DEFAULT gst_base_src_debug
40 /* BaseSrc signals and args */
55 static GstElementClass *parent_class = NULL;
57 static void gst_base_src_base_init (gpointer g_class);
58 static void gst_base_src_class_init (GstBaseSrcClass * klass);
59 static void gst_base_src_init (GstBaseSrc * src, gpointer g_class);
62 gst_base_src_get_type (void)
64 static GType base_src_type = 0;
67 static const GTypeInfo base_src_info = {
68 sizeof (GstBaseSrcClass),
69 (GBaseInitFunc) gst_base_src_base_init,
71 (GClassInitFunc) gst_base_src_class_init,
76 (GInstanceInitFunc) gst_base_src_init,
79 base_src_type = g_type_register_static (GST_TYPE_ELEMENT,
80 "GstBaseSrc", &base_src_info, G_TYPE_FLAG_ABSTRACT);
84 static GstCaps *gst_base_src_getcaps (GstPad * pad);
85 static gboolean gst_base_src_setcaps (GstPad * pad, GstCaps * caps);
87 static gboolean gst_base_src_activate_push (GstPad * pad, gboolean active);
88 static gboolean gst_base_src_activate_pull (GstPad * pad, gboolean active);
89 static void gst_base_src_set_property (GObject * object, guint prop_id,
90 const GValue * value, GParamSpec * pspec);
91 static void gst_base_src_get_property (GObject * object, guint prop_id,
92 GValue * value, GParamSpec * pspec);
93 static gboolean gst_base_src_event_handler (GstPad * pad, GstEvent * event);
95 static gboolean gst_base_src_query (GstPad * pad, GstQuery * query);
98 static const GstEventMask *gst_base_src_get_event_mask (GstPad * pad);
100 static gboolean gst_base_src_default_negotiate (GstBaseSrc * basesrc);
102 static gboolean gst_base_src_unlock (GstBaseSrc * basesrc);
103 static gboolean gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size);
104 static gboolean gst_base_src_start (GstBaseSrc * basesrc);
105 static gboolean gst_base_src_stop (GstBaseSrc * basesrc);
107 static GstElementStateReturn gst_base_src_change_state (GstElement * element);
109 static void gst_base_src_set_dataflow_funcs (GstBaseSrc * this);
110 static void gst_base_src_loop (GstPad * pad);
111 static gboolean gst_base_src_check_get_range (GstPad * pad);
112 static GstFlowReturn gst_base_src_get_range (GstPad * pad, guint64 offset,
113 guint length, GstBuffer ** buf);
116 gst_base_src_base_init (gpointer g_class)
118 GST_DEBUG_CATEGORY_INIT (gst_base_src_debug, "basesrc", 0, "basesrc element");
122 gst_base_src_class_init (GstBaseSrcClass * klass)
124 GObjectClass *gobject_class;
125 GstElementClass *gstelement_class;
127 gobject_class = (GObjectClass *) klass;
128 gstelement_class = (GstElementClass *) klass;
130 parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
132 gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_base_src_set_property);
133 gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_base_src_get_property);
135 g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BLOCKSIZE,
136 g_param_spec_ulong ("blocksize", "Block size",
137 "Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE,
140 g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_LOOP,
141 g_param_spec_boolean ("has-loop", "Has loop function",
142 "True if the element should expose a loop function", TRUE,
143 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
145 g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_GETRANGE,
146 g_param_spec_boolean ("has-getrange", "Has getrange function",
147 "True if the element should expose a getrange function", TRUE,
148 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
150 gstelement_class->change_state =
151 GST_DEBUG_FUNCPTR (gst_base_src_change_state);
153 klass->negotiate = gst_base_src_default_negotiate;
157 gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class)
160 GstPadTemplate *pad_template;
162 basesrc->is_live = FALSE;
163 basesrc->live_lock = g_mutex_new ();
164 basesrc->live_cond = g_cond_new ();
167 gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "src");
168 g_return_if_fail (pad_template != NULL);
170 pad = gst_pad_new_from_template (pad_template, "src");
172 gst_pad_set_activatepush_function (pad, gst_base_src_activate_push);
173 gst_pad_set_activatepull_function (pad, gst_base_src_activate_pull);
174 gst_pad_set_event_function (pad, gst_base_src_event_handler);
175 gst_pad_set_query_function (pad, gst_base_src_query);
176 gst_pad_set_checkgetrange_function (pad, gst_base_src_check_get_range);
177 gst_pad_set_getcaps_function (pad, gst_base_src_getcaps);
178 gst_pad_set_setcaps_function (pad, gst_base_src_setcaps);
180 /* hold ref to pad */
181 basesrc->srcpad = pad;
182 gst_element_add_pad (GST_ELEMENT (basesrc), pad);
184 basesrc->segment_start = -1;
185 basesrc->segment_end = -1;
186 basesrc->blocksize = DEFAULT_BLOCKSIZE;
187 basesrc->clock_id = NULL;
189 GST_FLAG_UNSET (basesrc, GST_BASE_SRC_STARTED);
193 gst_base_src_set_live (GstBaseSrc * src, gboolean live)
197 GST_LIVE_UNLOCK (src);
201 gst_base_src_is_live (GstBaseSrc * src)
206 result = src->is_live;
207 GST_LIVE_UNLOCK (src);
213 gst_base_src_set_dataflow_funcs (GstBaseSrc * this)
215 GST_DEBUG ("updating dataflow functions");
217 if (this->has_getrange)
218 gst_pad_set_getrange_function (this->srcpad, gst_base_src_get_range);
220 gst_pad_set_getrange_function (this->srcpad, NULL);
224 gst_base_src_setcaps (GstPad * pad, GstCaps * caps)
226 GstBaseSrcClass *bclass;
230 bsrc = GST_BASE_SRC (GST_PAD_PARENT (pad));
231 bclass = GST_BASE_SRC_GET_CLASS (bsrc);
233 if (bclass->set_caps)
234 res = bclass->set_caps (bsrc, caps);
240 gst_base_src_getcaps (GstPad * pad)
242 GstBaseSrcClass *bclass;
244 GstCaps *caps = NULL;
246 bsrc = GST_BASE_SRC (GST_PAD_PARENT (pad));
247 bclass = GST_BASE_SRC_GET_CLASS (bsrc);
248 if (bclass->get_caps)
249 caps = bclass->get_caps (bsrc);
252 GstPadTemplate *pad_template;
255 gst_element_class_get_pad_template (GST_ELEMENT_CLASS (bclass), "src");
256 if (pad_template != NULL) {
257 caps = gst_caps_ref (gst_pad_template_get_caps (pad_template));
264 gst_base_src_query (GstPad * pad, GstQuery * query)
271 src = GST_BASE_SRC (GST_PAD_PARENT (pad));
273 switch (GST_QUERY_TYPE (query)) {
274 case GST_QUERY_POSITION:
278 gst_query_parse_position (query, &format, NULL, NULL);
280 case GST_FORMAT_DEFAULT:
281 case GST_FORMAT_BYTES:
282 b = gst_base_src_get_size (src, &ui64);
283 /* better to make get_size take an int64 */
284 i64 = b ? (gint64) ui64 : -1;
285 gst_query_set_position (query, GST_FORMAT_BYTES, src->offset, i64);
287 case GST_FORMAT_PERCENT:
288 b = gst_base_src_get_size (src, &ui64);
289 i64 = GST_FORMAT_PERCENT_MAX;
290 i64 *= b ? (src->offset / (gdouble) ui64) : 1.0;
291 gst_query_set_position (query, GST_FORMAT_PERCENT,
292 i64, GST_FORMAT_PERCENT_MAX);
299 case GST_QUERY_SEEKING:
300 gst_query_set_seeking (query, GST_FORMAT_BYTES,
301 src->seekable, src->segment_start, src->segment_end);
304 case GST_QUERY_FORMATS:
305 gst_query_set_formats (query, 3, GST_FORMAT_DEFAULT,
306 GST_FORMAT_BYTES, GST_FORMAT_PERCENT);
309 case GST_QUERY_LATENCY:
310 case GST_QUERY_JITTER:
312 case GST_QUERY_CONVERT:
314 return gst_pad_query_default (pad, query);
319 static const GstEventMask *
320 gst_base_src_get_event_mask (GstPad * pad)
322 static const GstEventMask masks[] = {
323 {GST_EVENT_SEEK, GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_SET |
324 GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH |
325 GST_SEEK_FLAG_SEGMENT_LOOP},
326 {GST_EVENT_FLUSH, 0},
335 gst_base_src_do_seek (GstBaseSrc * src, GstEvent * event)
340 format = GST_EVENT_SEEK_FORMAT (event);
342 /* get seek format */
343 if (format == GST_FORMAT_DEFAULT)
344 format = GST_FORMAT_BYTES;
345 /* we can only seek bytes */
346 if (format != GST_FORMAT_BYTES)
349 /* get seek positions */
350 offset = GST_EVENT_SEEK_OFFSET (event);
351 src->segment_loop = GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_SEGMENT_LOOP;
353 switch (GST_EVENT_SEEK_METHOD (event)) {
354 case GST_SEEK_METHOD_SET:
357 src->offset = MIN (offset, src->size);
358 src->segment_start = src->offset;
359 src->segment_end = MIN (GST_EVENT_SEEK_ENDOFFSET (event), src->size);
360 GST_DEBUG_OBJECT (src, "seek set pending to %" G_GINT64_FORMAT,
363 case GST_SEEK_METHOD_CUR:
364 offset += src->offset;
365 src->offset = CLAMP (offset, 0, src->size);
366 src->segment_start = src->offset;
367 src->segment_end = GST_EVENT_SEEK_ENDOFFSET (event);
368 GST_DEBUG_OBJECT (src, "seek cur pending to %" G_GINT64_FORMAT,
371 case GST_SEEK_METHOD_END:
374 offset = src->size + offset;
375 src->offset = MAX (0, offset);
376 src->segment_start = src->offset;
377 src->segment_end = GST_EVENT_SEEK_ENDOFFSET (event);
378 GST_DEBUG_OBJECT (src, "seek end pending to %" G_GINT64_FORMAT,
385 /* send flush start */
386 gst_pad_push_event (src->srcpad, gst_event_new_flush (FALSE));
388 /* unblock streaming thread */
389 gst_base_src_unlock (src);
391 /* grab streaming lock */
392 GST_STREAM_LOCK (src->srcpad);
395 gst_pad_push_event (src->srcpad, gst_event_new_flush (TRUE));
397 /* now send discont */
401 event = gst_event_new_discontinuous (1.0,
403 (gint64) src->segment_start, (gint64) src->segment_end, NULL);
405 gst_pad_push_event (src->srcpad, event);
408 /* and restart the task */
409 gst_pad_start_task (src->srcpad, (GstTaskFunction) gst_base_src_loop,
411 GST_STREAM_UNLOCK (src->srcpad);
413 gst_event_unref (event);
420 GST_DEBUG_OBJECT (src, "seek error");
421 gst_event_unref (event);
427 gst_base_src_event_handler (GstPad * pad, GstEvent * event)
430 GstBaseSrcClass *bclass;
433 src = GST_BASE_SRC (GST_PAD_PARENT (pad));
434 bclass = GST_BASE_SRC_GET_CLASS (src);
437 result = bclass->event (src, event);
439 switch (GST_EVENT_TYPE (event)) {
441 return gst_base_src_do_seek (src, event);
446 format = GST_EVENT_SIZE_FORMAT (event);
447 if (format == GST_FORMAT_DEFAULT)
448 format = GST_FORMAT_BYTES;
449 /* we can only accept bytes */
450 if (format != GST_FORMAT_BYTES)
453 src->blocksize = GST_EVENT_SIZE_VALUE (event);
454 g_object_notify (G_OBJECT (src), "blocksize");
457 case GST_EVENT_FLUSH:
458 /* cancel any blocking getrange */
459 if (!GST_EVENT_FLUSH_DONE (event))
460 gst_base_src_unlock (src);
465 gst_event_unref (event);
471 gst_base_src_set_property (GObject * object, guint prop_id,
472 const GValue * value, GParamSpec * pspec)
476 src = GST_BASE_SRC (object);
480 src->blocksize = g_value_get_ulong (value);
483 src->has_loop = g_value_get_boolean (value);
484 gst_base_src_set_dataflow_funcs (src);
486 case PROP_HAS_GETRANGE:
487 src->has_getrange = g_value_get_boolean (value);
488 gst_base_src_set_dataflow_funcs (src);
491 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
497 gst_base_src_get_property (GObject * object, guint prop_id, GValue * value,
502 src = GST_BASE_SRC (object);
506 g_value_set_ulong (value, src->blocksize);
509 g_value_set_boolean (value, src->has_loop);
511 case PROP_HAS_GETRANGE:
512 g_value_set_boolean (value, src->has_getrange);
515 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
521 gst_base_src_get_range (GstPad * pad, guint64 offset, guint length,
526 GstBaseSrcClass *bclass;
528 src = GST_BASE_SRC (GST_OBJECT_PARENT (pad));
529 bclass = GST_BASE_SRC_GET_CLASS (src);
533 while (!src->live_running) {
534 GST_DEBUG ("live source signal waiting");
535 GST_LIVE_SIGNAL (src);
536 GST_DEBUG ("live source waiting for running state");
538 GST_DEBUG ("live source unlocked");
541 GST_LIVE_UNLOCK (src);
543 if (!GST_FLAG_IS_SET (src, GST_BASE_SRC_STARTED))
550 if (src->size != -1) {
551 if (offset > src->size)
552 goto unexpected_length;
554 if (offset + length > src->size) {
555 if (bclass->get_size)
556 bclass->get_size (src, &src->size);
558 if (offset + length > src->size) {
559 length = src->size - offset;
564 goto unexpected_length;
566 ret = bclass->create (src, offset, length, buf);
573 GST_DEBUG_OBJECT (src, "getrange but not started");
574 return GST_FLOW_WRONG_STATE;
578 GST_DEBUG_OBJECT (src, "no create function");
579 return GST_FLOW_ERROR;
583 GST_DEBUG_OBJECT (src, "unexpected length %u", length);
584 return GST_FLOW_UNEXPECTED;
589 gst_base_src_check_get_range (GstPad * pad)
593 src = GST_BASE_SRC (GST_OBJECT_PARENT (pad));
595 if (!GST_FLAG_IS_SET (src, GST_BASE_SRC_STARTED)) {
596 gst_base_src_start (src);
597 gst_base_src_stop (src);
600 return src->seekable;
604 gst_base_src_loop (GstPad * pad)
607 GstBuffer *buf = NULL;
610 src = GST_BASE_SRC (GST_OBJECT_PARENT (pad));
612 ret = gst_base_src_get_range (pad, src->offset, src->blocksize, &buf);
613 if (ret != GST_FLOW_OK)
619 src->offset += GST_BUFFER_SIZE (buf);
621 ret = gst_pad_push (pad, buf);
622 if (ret != GST_FLOW_OK)
629 GST_DEBUG_OBJECT (src, "going to EOS");
630 gst_pad_pause_task (pad);
631 gst_pad_push_event (pad, gst_event_new (GST_EVENT_EOS));
636 GST_DEBUG_OBJECT (src, "pausing task");
637 gst_pad_pause_task (pad);
642 GST_DEBUG_OBJECT (src, "got error, pausing task");
643 gst_pad_pause_task (pad);
644 gst_pad_push_event (pad, gst_event_new (GST_EVENT_EOS));
650 gst_base_src_unlock (GstBaseSrc * basesrc)
652 GstBaseSrcClass *bclass;
653 gboolean result = FALSE;
655 GST_DEBUG ("unlock");
656 /* unblock whatever the subclass is doing */
657 bclass = GST_BASE_SRC_GET_CLASS (basesrc);
659 result = bclass->unlock (basesrc);
661 GST_DEBUG ("unschedule clock");
662 /* and unblock the clock as well, if any */
664 if (basesrc->clock_id) {
665 gst_clock_id_unschedule (basesrc->clock_id);
667 GST_UNLOCK (basesrc);
669 GST_DEBUG ("unlock done");
675 gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size)
677 GstBaseSrcClass *bclass;
678 gboolean result = FALSE;
680 bclass = GST_BASE_SRC_GET_CLASS (basesrc);
681 if (bclass->get_size)
682 result = bclass->get_size (basesrc, size);
685 basesrc->size = *size;
691 gst_base_src_is_seekable (GstBaseSrc * basesrc)
693 GstBaseSrcClass *bclass;
695 bclass = GST_BASE_SRC_GET_CLASS (basesrc);
697 /* check if we can seek */
698 if (bclass->is_seekable)
699 basesrc->seekable = bclass->is_seekable (basesrc);
701 basesrc->seekable = FALSE;
703 return basesrc->seekable;
707 gst_base_src_default_negotiate (GstBaseSrc * basesrc)
710 GstCaps *caps = NULL;
711 GstCaps *peercaps = NULL;
712 gboolean result = FALSE;
714 thiscaps = gst_pad_get_caps (GST_BASE_SRC_PAD (basesrc));
715 GST_DEBUG ("caps of src: %" GST_PTR_FORMAT, thiscaps);
716 if (thiscaps == NULL || gst_caps_is_any (thiscaps))
719 peercaps = gst_pad_peer_get_caps (GST_BASE_SRC_PAD (basesrc));
720 GST_DEBUG ("caps of peer: %" GST_PTR_FORMAT, peercaps);
724 icaps = gst_caps_intersect (thiscaps, peercaps);
725 GST_DEBUG ("intersect: %" GST_PTR_FORMAT, icaps);
726 gst_caps_unref (thiscaps);
727 gst_caps_unref (peercaps);
729 caps = gst_caps_copy_nth (icaps, 0);
730 gst_caps_unref (icaps);
736 caps = gst_caps_make_writable (caps);
737 gst_pad_fixate_caps (GST_BASE_SRC_PAD (basesrc), caps);
738 GST_DEBUG ("fixated to: %" GST_PTR_FORMAT, caps);
740 if (gst_caps_is_any (caps)) {
741 gst_caps_unref (caps);
743 } else if (gst_caps_is_fixed (caps)) {
744 gst_pad_set_caps (GST_BASE_SRC_PAD (basesrc), caps);
745 gst_caps_unref (caps);
753 GST_DEBUG ("no negotiation needed");
755 gst_caps_unref (thiscaps);
761 gst_base_src_negotiate (GstBaseSrc * basesrc)
763 GstBaseSrcClass *bclass;
764 gboolean result = TRUE;
766 bclass = GST_BASE_SRC_GET_CLASS (basesrc);
768 if (bclass->negotiate)
769 result = bclass->negotiate (basesrc);
775 gst_base_src_start (GstBaseSrc * basesrc)
777 GstBaseSrcClass *bclass;
780 if (GST_FLAG_IS_SET (basesrc, GST_BASE_SRC_STARTED))
783 bclass = GST_BASE_SRC_GET_CLASS (basesrc);
785 result = bclass->start (basesrc);
790 goto could_not_start;
792 GST_FLAG_SET (basesrc, GST_BASE_SRC_STARTED);
794 /* start in the beginning */
796 basesrc->segment_start = 0;
798 /* figure out the size */
799 if (bclass->get_size) {
800 result = bclass->get_size (basesrc, &basesrc->size);
808 GST_DEBUG ("size %d %lld", result, basesrc->size);
810 /* we always run to the end */
811 basesrc->segment_end = -1;
813 /* check if we can seek, updates ->seekable */
814 gst_base_src_is_seekable (basesrc);
818 if (basesrc->seekable) {
821 caps = gst_type_find_helper (basesrc->srcpad, basesrc->size);
822 gst_pad_set_caps (basesrc->srcpad, caps);
823 gst_caps_unref (caps);
827 if (!gst_base_src_negotiate (basesrc))
828 goto could_not_negotiate;
835 GST_DEBUG_OBJECT (basesrc, "could not start");
840 GST_DEBUG_OBJECT (basesrc, "could not negotiate, stopping");
841 gst_base_src_stop (basesrc);
847 gst_base_src_stop (GstBaseSrc * basesrc)
849 GstBaseSrcClass *bclass;
850 gboolean result = TRUE;
852 if (!GST_FLAG_IS_SET (basesrc, GST_BASE_SRC_STARTED))
855 bclass = GST_BASE_SRC_GET_CLASS (basesrc);
857 result = bclass->stop (basesrc);
860 GST_FLAG_UNSET (basesrc, GST_BASE_SRC_STARTED);
866 gst_base_src_deactivate (GstBaseSrc * basesrc, GstPad * pad)
870 GST_LIVE_LOCK (basesrc);
871 basesrc->live_running = TRUE;
872 GST_LIVE_SIGNAL (basesrc);
873 GST_LIVE_UNLOCK (basesrc);
875 /* step 1, unblock clock sync (if any) */
876 gst_base_src_unlock (basesrc);
878 /* step 2, make sure streaming finishes */
879 result = gst_pad_stop_task (pad);
885 gst_base_src_activate_push (GstPad * pad, gboolean active)
889 basesrc = GST_BASE_SRC (GST_OBJECT_PARENT (pad));
891 /* prepare subclass first */
893 if (!gst_base_src_start (basesrc))
896 return gst_pad_start_task (pad, (GstTaskFunction) gst_base_src_loop, pad);
898 return gst_base_src_deactivate (basesrc, pad);
903 GST_DEBUG_OBJECT (basesrc, "failed to start");
909 gst_base_src_activate_pull (GstPad * pad, gboolean active)
913 basesrc = GST_BASE_SRC (GST_OBJECT_PARENT (pad));
915 /* prepare subclass first */
917 if (!gst_base_src_start (basesrc))
920 if (!basesrc->seekable) {
921 gst_base_src_stop (basesrc);
927 return gst_base_src_deactivate (basesrc, pad);
932 GST_DEBUG_OBJECT (basesrc, "failed to start");
937 static GstElementStateReturn
938 gst_base_src_change_state (GstElement * element)
941 GstElementStateReturn result = GST_STATE_SUCCESS;
942 GstElementStateReturn presult;
943 GstElementState transition;
945 basesrc = GST_BASE_SRC (element);
947 transition = GST_STATE_TRANSITION (element);
949 switch (transition) {
950 case GST_STATE_NULL_TO_READY:
952 case GST_STATE_READY_TO_PAUSED:
953 GST_LIVE_LOCK (element);
954 if (basesrc->is_live) {
955 result = GST_STATE_NO_PREROLL;
956 basesrc->live_running = FALSE;
958 GST_LIVE_UNLOCK (element);
960 case GST_STATE_PAUSED_TO_PLAYING:
961 GST_LIVE_LOCK (element);
962 if (basesrc->is_live) {
963 basesrc->live_running = TRUE;
964 GST_LIVE_SIGNAL (element);
966 GST_LIVE_UNLOCK (element);
972 if ((presult = GST_ELEMENT_CLASS (parent_class)->change_state (element)) !=
976 switch (transition) {
977 case GST_STATE_PLAYING_TO_PAUSED:
978 GST_LIVE_LOCK (element);
979 if (basesrc->is_live) {
980 result = GST_STATE_NO_PREROLL;
981 basesrc->live_running = FALSE;
983 GST_LIVE_UNLOCK (element);
985 case GST_STATE_PAUSED_TO_READY:
986 if (!gst_base_src_stop (basesrc))
987 result = GST_STATE_FAILURE;
989 case GST_STATE_READY_TO_NULL: