gst/elements/: Subtract size of internally stored data from position queries.

Original commit message from CVS:
* gst/elements/gstfakesink.c: (gst_fakesink_class_init):
* gst/elements/gstidentity.c: (gst_identity_class_init):
Use G_SIGNAL_TYPE_STATIC_SCOPE, patch by Christophe Fergeau
<teuf@gnome.org> (#157263).
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_handle_src_query):
Subtract size of internally stored data from position queries.
This commit is contained in:
Christophe Fergeau 2004-11-08 15:45:31 +00:00 committed by Ronald S. Bultje
parent 7bf7d80452
commit 93f541efef
7 changed files with 80 additions and 4 deletions

View file

@ -1,3 +1,13 @@
2004-11-08 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/elements/gstfakesink.c: (gst_fakesink_class_init):
* gst/elements/gstidentity.c: (gst_identity_class_init):
Use G_SIGNAL_TYPE_STATIC_SCOPE, patch by Christophe Fergeau
<teuf@gnome.org> (#157263).
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_handle_src_query):
Subtract size of internally stored data from position queries.
2004-11-07 Martin Soto <martinsoto@users.sourceforge.net>
* gst/schedulers/fairscheduler.c:

View file

@ -167,7 +167,7 @@ gst_fakesink_class_init (GstFakeSinkClass * klass)
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstFakeSinkClass, handoff), NULL, NULL,
gst_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 2,
GST_TYPE_BUFFER, GST_TYPE_PAD);
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesink_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesink_get_property);

View file

@ -181,7 +181,8 @@ gst_identity_class_init (GstIdentityClass * klass)
gst_identity_signals[SIGNAL_HANDOFF] =
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstIdentityClass, handoff), NULL, NULL,
gst_marshal_VOID__BOXED, G_TYPE_NONE, 1, GST_TYPE_BUFFER);
gst_marshal_VOID__BOXED, G_TYPE_NONE, 1,
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_identity_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property);

View file

@ -106,6 +106,8 @@ static void gst_type_find_element_get_property (GObject * object,
static const GstEventMask *gst_type_find_element_src_event_mask (GstPad * pad);
static gboolean gst_type_find_element_src_event (GstPad * pad,
GstEvent * event);
static gboolean gst_type_find_handle_src_query (GstPad * pad,
GstQueryType type, GstFormat * fmt, gint64 * value);
static void push_buffer_store (GstTypeFindElement * typefind);
static void gst_type_find_element_chain (GstPad * sinkpad, GstData * data);
@ -189,6 +191,8 @@ gst_type_find_element_init (GstTypeFindElement * typefind)
gst_pad_set_event_function (typefind->src, gst_type_find_element_src_event);
gst_pad_set_event_mask_function (typefind->src,
gst_type_find_element_src_event_mask);
gst_pad_set_query_function (typefind->src,
GST_DEBUG_FUNCPTR (gst_type_find_handle_src_query));
gst_pad_use_explicit_caps (typefind->src);
gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);
@ -261,6 +265,34 @@ gst_type_find_element_get_property (GObject * object, guint prop_id,
break;
}
}
static gboolean
gst_type_find_handle_src_query (GstPad * pad,
GstQueryType type, GstFormat * fmt, gint64 * value)
{
GstTypeFindElement *typefind =
GST_TYPE_FIND_ELEMENT (gst_pad_get_parent (pad));
gboolean res;
res = gst_pad_query (GST_PAD_PEER (typefind->sink), type, fmt, value);
if (!res)
return FALSE;
if (type == GST_QUERY_POSITION && typefind->store != NULL) {
/* FIXME: this code assumes that there's no discont in the queue */
switch (*fmt) {
case GST_FORMAT_BYTES:
*value -= gst_buffer_store_get_size (typefind->store, 0);
break;
default:
/* FIXME */
break;
}
}
return TRUE;
}
static const GstEventMask *
gst_type_find_element_src_event_mask (GstPad * pad)
{

View file

@ -167,7 +167,7 @@ gst_fakesink_class_init (GstFakeSinkClass * klass)
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstFakeSinkClass, handoff), NULL, NULL,
gst_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 2,
GST_TYPE_BUFFER, GST_TYPE_PAD);
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesink_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesink_get_property);

View file

@ -181,7 +181,8 @@ gst_identity_class_init (GstIdentityClass * klass)
gst_identity_signals[SIGNAL_HANDOFF] =
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstIdentityClass, handoff), NULL, NULL,
gst_marshal_VOID__BOXED, G_TYPE_NONE, 1, GST_TYPE_BUFFER);
gst_marshal_VOID__BOXED, G_TYPE_NONE, 1,
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_identity_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property);

View file

@ -106,6 +106,8 @@ static void gst_type_find_element_get_property (GObject * object,
static const GstEventMask *gst_type_find_element_src_event_mask (GstPad * pad);
static gboolean gst_type_find_element_src_event (GstPad * pad,
GstEvent * event);
static gboolean gst_type_find_handle_src_query (GstPad * pad,
GstQueryType type, GstFormat * fmt, gint64 * value);
static void push_buffer_store (GstTypeFindElement * typefind);
static void gst_type_find_element_chain (GstPad * sinkpad, GstData * data);
@ -189,6 +191,8 @@ gst_type_find_element_init (GstTypeFindElement * typefind)
gst_pad_set_event_function (typefind->src, gst_type_find_element_src_event);
gst_pad_set_event_mask_function (typefind->src,
gst_type_find_element_src_event_mask);
gst_pad_set_query_function (typefind->src,
GST_DEBUG_FUNCPTR (gst_type_find_handle_src_query));
gst_pad_use_explicit_caps (typefind->src);
gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);
@ -261,6 +265,34 @@ gst_type_find_element_get_property (GObject * object, guint prop_id,
break;
}
}
static gboolean
gst_type_find_handle_src_query (GstPad * pad,
GstQueryType type, GstFormat * fmt, gint64 * value)
{
GstTypeFindElement *typefind =
GST_TYPE_FIND_ELEMENT (gst_pad_get_parent (pad));
gboolean res;
res = gst_pad_query (GST_PAD_PEER (typefind->sink), type, fmt, value);
if (!res)
return FALSE;
if (type == GST_QUERY_POSITION && typefind->store != NULL) {
/* FIXME: this code assumes that there's no discont in the queue */
switch (*fmt) {
case GST_FORMAT_BYTES:
*value -= gst_buffer_store_get_size (typefind->store, 0);
break;
default:
/* FIXME */
break;
}
}
return TRUE;
}
static const GstEventMask *
gst_type_find_element_src_event_mask (GstPad * pad)
{