gst/elements/: (gst_fakesink_loop, gst_fakesrc_loop, gst_fakesink_chain)

Original commit message from CVS:
2005-02-21  Andy Wingo  <wingo@pobox.com>

* gst/elements/gstfakesink.c:
* gst/elements/gstfakesrc.c:
(gst_fakesink_loop, gst_fakesrc_loop, gst_fakesink_chain)
(gst_fakesrc_get_range): Assert the pad has been activated in the
proper mode. This will fail right now for fakesrc ! identity !
fakesink.
(gst_fakesrc_activate, gst_fakesink_activate): Record the pad
activation mode.

* gst/elements/gstfakesrc.h: Add a pad_mode instance variable.
This commit is contained in:
Andy Wingo 2005-02-21 15:27:23 +00:00
parent 8479cbc3fa
commit 6664bebb6d
7 changed files with 47 additions and 0 deletions

View file

@ -1,5 +1,16 @@
2005-02-21 Andy Wingo <wingo@pobox.com>
* gst/elements/gstfakesink.c:
* gst/elements/gstfakesrc.c:
(gst_fakesink_loop, gst_fakesrc_loop, gst_fakesink_chain)
(gst_fakesrc_get_range): Assert the pad has been activated in the
proper mode. This will fail right now for fakesrc ! identity !
fakesink.
(gst_fakesrc_activate, gst_fakesink_activate): Record the pad
activation mode.
* gst/elements/gstfakesrc.h: Add a pad_mode instance variable.
* gst/gstpad.c (gst_real_pad_dispose): Free the stream lock (it
wasn't being freed before).
(gst_real_pad_init): Allocate and initialize the stream lock.

View file

@ -400,6 +400,9 @@ gst_fakesink_activate (GstPad * pad, GstActivateMode mode)
result = TRUE;
break;
}
fakesink->pad_mode = mode;
return result;
}
@ -494,6 +497,9 @@ gst_fakesink_chain (GstPad * pad, GstBuffer * buf)
{
GstFlowReturn result;
g_assert (GST_FAKESINK (GST_OBJECT_PARENT (pad))->pad_mode ==
GST_ACTIVATE_PUSH);
GST_STREAM_LOCK (pad);
result = gst_fakesink_chain_unlocked (pad, buf);
@ -512,6 +518,8 @@ gst_fakesink_loop (GstPad * pad)
fakesink = GST_FAKESINK (GST_OBJECT_PARENT (pad));
g_assert (fakesink->pad_mode == GST_ACTIVATE_PULL);
GST_STREAM_LOCK (pad);
result = gst_pad_pull_range (pad, fakesink->offset, DEFAULT_SIZE, &buf);

View file

@ -328,6 +328,7 @@ gst_fakesrc_init (GstFakeSrc * fakesrc)
fakesrc->last_message = NULL;
fakesrc->datarate = DEFAULT_DATARATE;
fakesrc->sync = DEFAULT_SYNC;
fakesrc->pad_mode = GST_ACTIVATE_NONE;
}
static void
@ -869,6 +870,9 @@ gst_fakesrc_get_range (GstPad * pad, guint64 offset, guint length,
{
GstFlowReturn fret;
g_assert (GST_FAKESRC (GST_OBJECT_PARENT (pad))->pad_mode ==
GST_ACTIVATE_PULL);
GST_STREAM_LOCK (pad);
fret = gst_fakesrc_get_range_unlocked (pad, offset, length, ret);
@ -887,6 +891,8 @@ gst_fakesrc_loop (GstPad * pad)
src = GST_FAKESRC (GST_OBJECT_PARENT (pad));
g_assert (src->pad_mode == GST_ACTIVATE_PUSH);
GST_STREAM_LOCK (pad);
if (src->need_flush) {
src->need_flush = FALSE;
@ -956,6 +962,9 @@ gst_fakesrc_activate (GstPad * pad, GstActivateMode mode)
result = TRUE;
break;
}
fakesrc->pad_mode = mode;
return result;
}

View file

@ -86,6 +86,7 @@ struct _GstFakeSrc {
GstFakeSrcDataType data;
GstFakeSrcSizeType sizetype;
GstFakeSrcFillType filltype;
GstActivateMode pad_mode;
guint sizemin;
guint sizemax;

View file

@ -400,6 +400,9 @@ gst_fakesink_activate (GstPad * pad, GstActivateMode mode)
result = TRUE;
break;
}
fakesink->pad_mode = mode;
return result;
}
@ -494,6 +497,9 @@ gst_fakesink_chain (GstPad * pad, GstBuffer * buf)
{
GstFlowReturn result;
g_assert (GST_FAKESINK (GST_OBJECT_PARENT (pad))->pad_mode ==
GST_ACTIVATE_PUSH);
GST_STREAM_LOCK (pad);
result = gst_fakesink_chain_unlocked (pad, buf);
@ -512,6 +518,8 @@ gst_fakesink_loop (GstPad * pad)
fakesink = GST_FAKESINK (GST_OBJECT_PARENT (pad));
g_assert (fakesink->pad_mode == GST_ACTIVATE_PULL);
GST_STREAM_LOCK (pad);
result = gst_pad_pull_range (pad, fakesink->offset, DEFAULT_SIZE, &buf);

View file

@ -328,6 +328,7 @@ gst_fakesrc_init (GstFakeSrc * fakesrc)
fakesrc->last_message = NULL;
fakesrc->datarate = DEFAULT_DATARATE;
fakesrc->sync = DEFAULT_SYNC;
fakesrc->pad_mode = GST_ACTIVATE_NONE;
}
static void
@ -869,6 +870,9 @@ gst_fakesrc_get_range (GstPad * pad, guint64 offset, guint length,
{
GstFlowReturn fret;
g_assert (GST_FAKESRC (GST_OBJECT_PARENT (pad))->pad_mode ==
GST_ACTIVATE_PULL);
GST_STREAM_LOCK (pad);
fret = gst_fakesrc_get_range_unlocked (pad, offset, length, ret);
@ -887,6 +891,8 @@ gst_fakesrc_loop (GstPad * pad)
src = GST_FAKESRC (GST_OBJECT_PARENT (pad));
g_assert (src->pad_mode == GST_ACTIVATE_PUSH);
GST_STREAM_LOCK (pad);
if (src->need_flush) {
src->need_flush = FALSE;
@ -956,6 +962,9 @@ gst_fakesrc_activate (GstPad * pad, GstActivateMode mode)
result = TRUE;
break;
}
fakesrc->pad_mode = mode;
return result;
}

View file

@ -86,6 +86,7 @@ struct _GstFakeSrc {
GstFakeSrcDataType data;
GstFakeSrcSizeType sizetype;
GstFakeSrcFillType filltype;
GstActivateMode pad_mode;
guint sizemin;
guint sizemax;