aboutsummaryrefslogtreecommitdiff
path: root/libs/gst
diff options
context:
space:
mode:
Diffstat (limited to 'libs/gst')
-rw-r--r--libs/gst/Makefile.in2
-rw-r--r--libs/gst/base/Makefile.am4
-rw-r--r--libs/gst/base/Makefile.in28
-rw-r--r--libs/gst/base/gstadapter.c159
-rw-r--r--libs/gst/base/gstadapter.h31
-rw-r--r--libs/gst/base/gstbasesink.c1
-rw-r--r--libs/gst/base/gstbasesrc.c119
-rw-r--r--libs/gst/base/gstbasetransform.c95
-rw-r--r--libs/gst/base/gstcollectpads.c (renamed from libs/gst/base/gstcollectpads2.c)960
-rw-r--r--libs/gst/base/gstcollectpads.h396
-rw-r--r--libs/gst/base/gstcollectpads2.h371
-rw-r--r--libs/gst/base/gsttypefindhelper.c18
-rw-r--r--libs/gst/check/Makefile.in12
-rw-r--r--libs/gst/check/gstconsistencychecker.c2
-rw-r--r--libs/gst/check/libcheck/Makefile.in2
-rw-r--r--libs/gst/controller/Makefile.in10
-rw-r--r--libs/gst/controller/gstargbcontrolbinding.c80
-rw-r--r--libs/gst/controller/gstdirectcontrolbinding.c147
-rw-r--r--libs/gst/controller/gstdirectcontrolbinding.h18
-rw-r--r--libs/gst/controller/gstlfocontrolsource.c3
-rw-r--r--libs/gst/controller/gsttimedvaluecontrolsource.c3
-rw-r--r--libs/gst/helpers/Makefile.in2
-rw-r--r--libs/gst/net/Makefile.in10
23 files changed, 1474 insertions, 999 deletions
diff --git a/libs/gst/Makefile.in b/libs/gst/Makefile.in
index 82e7a95..2f91786 100644
--- a/libs/gst/Makefile.in
+++ b/libs/gst/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.4 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
diff --git a/libs/gst/base/Makefile.am b/libs/gst/base/Makefile.am
index 18b8e48..069f96b 100644
--- a/libs/gst/base/Makefile.am
+++ b/libs/gst/base/Makefile.am
@@ -11,7 +11,7 @@ libgstbase_@GST_API_VERSION@_la_SOURCES = \
gstbitreader.c \
gstbytereader.c \
gstbytewriter.c \
- gstcollectpads2.c \
+ gstcollectpads.c \
gstpushsrc.c \
gsttypefindhelper.c
@@ -31,7 +31,7 @@ libgstbase_@GST_API_VERSION@include_HEADERS = \
gstbitreader.h \
gstbytereader.h \
gstbytewriter.h \
- gstcollectpads2.h \
+ gstcollectpads.h \
gstpushsrc.h \
gsttypefindhelper.h
diff --git a/libs/gst/base/Makefile.in b/libs/gst/base/Makefile.in
index 3e7bc71..ed702b5 100644
--- a/libs/gst/base/Makefile.in
+++ b/libs/gst/base/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.4 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -140,7 +140,7 @@ am_libgstbase_@GST_API_VERSION@_la_OBJECTS = \
libgstbase_@GST_API_VERSION@_la-gstbitreader.lo \
libgstbase_@GST_API_VERSION@_la-gstbytereader.lo \
libgstbase_@GST_API_VERSION@_la-gstbytewriter.lo \
- libgstbase_@GST_API_VERSION@_la-gstcollectpads2.lo \
+ libgstbase_@GST_API_VERSION@_la-gstcollectpads.lo \
libgstbase_@GST_API_VERSION@_la-gstpushsrc.lo \
libgstbase_@GST_API_VERSION@_la-gsttypefindhelper.lo
libgstbase_@GST_API_VERSION@_la_OBJECTS = \
@@ -469,7 +469,7 @@ libgstbase_@GST_API_VERSION@_la_SOURCES = \
gstbitreader.c \
gstbytereader.c \
gstbytewriter.c \
- gstcollectpads2.c \
+ gstcollectpads.c \
gstpushsrc.c \
gsttypefindhelper.c
@@ -488,7 +488,7 @@ libgstbase_@GST_API_VERSION@include_HEADERS = \
gstbitreader.h \
gstbytereader.h \
gstbytewriter.h \
- gstcollectpads2.h \
+ gstcollectpads.h \
gstpushsrc.h \
gsttypefindhelper.h
@@ -555,7 +555,7 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(libdir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
@@ -594,7 +594,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstbitreader.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstbytereader.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstbytewriter.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstcollectpads2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstcollectpads.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstpushsrc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gsttypefindhelper.Plo@am__quote@
@@ -675,12 +675,12 @@ libgstbase_@GST_API_VERSION@_la-gstbytewriter.lo: gstbytewriter.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbase_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstbase_@GST_API_VERSION@_la-gstbytewriter.lo `test -f 'gstbytewriter.c' || echo '$(srcdir)/'`gstbytewriter.c
-libgstbase_@GST_API_VERSION@_la-gstcollectpads2.lo: gstcollectpads2.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbase_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstbase_@GST_API_VERSION@_la-gstcollectpads2.lo -MD -MP -MF $(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstcollectpads2.Tpo -c -o libgstbase_@GST_API_VERSION@_la-gstcollectpads2.lo `test -f 'gstcollectpads2.c' || echo '$(srcdir)/'`gstcollectpads2.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstcollectpads2.Tpo $(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstcollectpads2.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstcollectpads2.c' object='libgstbase_@GST_API_VERSION@_la-gstcollectpads2.lo' libtool=yes @AMDEPBACKSLASH@
+libgstbase_@GST_API_VERSION@_la-gstcollectpads.lo: gstcollectpads.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbase_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstbase_@GST_API_VERSION@_la-gstcollectpads.lo -MD -MP -MF $(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstcollectpads.Tpo -c -o libgstbase_@GST_API_VERSION@_la-gstcollectpads.lo `test -f 'gstcollectpads.c' || echo '$(srcdir)/'`gstcollectpads.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstcollectpads.Tpo $(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstcollectpads.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstcollectpads.c' object='libgstbase_@GST_API_VERSION@_la-gstcollectpads.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbase_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstbase_@GST_API_VERSION@_la-gstcollectpads2.lo `test -f 'gstcollectpads2.c' || echo '$(srcdir)/'`gstcollectpads2.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbase_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstbase_@GST_API_VERSION@_la-gstcollectpads.lo `test -f 'gstcollectpads.c' || echo '$(srcdir)/'`gstcollectpads.c
libgstbase_@GST_API_VERSION@_la-gstpushsrc.lo: gstpushsrc.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbase_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstbase_@GST_API_VERSION@_la-gstpushsrc.lo -MD -MP -MF $(DEPDIR)/libgstbase_@GST_API_VERSION@_la-gstpushsrc.Tpo -c -o libgstbase_@GST_API_VERSION@_la-gstpushsrc.lo `test -f 'gstpushsrc.c' || echo '$(srcdir)/'`gstpushsrc.c
@@ -706,7 +706,7 @@ install-girDATA: $(gir_DATA)
@list='$(gir_DATA)'; test -n "$(girdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(girdir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(girdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
@@ -727,7 +727,7 @@ install-typelibsDATA: $(typelibs_DATA)
@list='$(typelibs_DATA)'; test -n "$(typelibsdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(typelibsdir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(typelibsdir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(typelibsdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
@@ -748,7 +748,7 @@ install-libgstbase_@GST_API_VERSION@includeHEADERS: $(libgstbase_@GST_API_VERSIO
@list='$(libgstbase_@GST_API_VERSION@include_HEADERS)'; test -n "$(libgstbase_@GST_API_VERSION@includedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(libgstbase_@GST_API_VERSION@includedir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(libgstbase_@GST_API_VERSION@includedir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(libgstbase_@GST_API_VERSION@includedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
diff --git a/libs/gst/base/gstadapter.c b/libs/gst/base/gstadapter.c
index 3342536..b27edcf 100644
--- a/libs/gst/base/gstadapter.c
+++ b/libs/gst/base/gstadapter.c
@@ -124,11 +124,21 @@ static void gst_adapter_flush_unchecked (GstAdapter * adapter, gsize flush);
GST_DEBUG_CATEGORY_STATIC (gst_adapter_debug);
#define GST_CAT_DEFAULT gst_adapter_debug
-#define GST_ADAPTER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_ADAPTER, GstAdapterPrivate))
-
-struct _GstAdapterPrivate
+struct _GstAdapter
{
+ GObject object;
+
+ /*< private > */
+ GSList *buflist;
+ GSList *buflist_end;
+ gsize size;
+ gsize skip;
+
+ /* we keep state of assembled pieces */
+ gpointer assembled_data;
+ gsize assembled_size;
+ gsize assembled_len;
+
GstClockTime pts;
guint64 pts_distance;
GstClockTime dts;
@@ -140,6 +150,11 @@ struct _GstAdapterPrivate
GstMapInfo info;
};
+struct _GstAdapterClass
+{
+ GObjectClass parent_class;
+};
+
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_adapter_debug, "adapter", 0, "object to splice and merge buffers to desired size")
#define gst_adapter_parent_class parent_class
@@ -153,8 +168,6 @@ gst_adapter_class_init (GstAdapterClass * klass)
{
GObjectClass *object = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (GstAdapterPrivate));
-
object->dispose = gst_adapter_dispose;
object->finalize = gst_adapter_finalize;
}
@@ -162,13 +175,12 @@ gst_adapter_class_init (GstAdapterClass * klass)
static void
gst_adapter_init (GstAdapter * adapter)
{
- adapter->priv = GST_ADAPTER_GET_PRIVATE (adapter);
adapter->assembled_data = g_malloc (DEFAULT_SIZE);
adapter->assembled_size = DEFAULT_SIZE;
- adapter->priv->pts = GST_CLOCK_TIME_NONE;
- adapter->priv->pts_distance = 0;
- adapter->priv->dts = GST_CLOCK_TIME_NONE;
- adapter->priv->dts_distance = 0;
+ adapter->pts = GST_CLOCK_TIME_NONE;
+ adapter->pts_distance = 0;
+ adapter->dts = GST_CLOCK_TIME_NONE;
+ adapter->dts_distance = 0;
}
static void
@@ -213,13 +225,9 @@ gst_adapter_new (void)
void
gst_adapter_clear (GstAdapter * adapter)
{
- GstAdapterPrivate *priv;
-
g_return_if_fail (GST_IS_ADAPTER (adapter));
- priv = adapter->priv;
-
- if (priv->info.memory)
+ if (adapter->info.memory)
gst_adapter_unmap (adapter);
g_slist_foreach (adapter->buflist, (GFunc) gst_mini_object_unref, NULL);
@@ -229,12 +237,12 @@ gst_adapter_clear (GstAdapter * adapter)
adapter->size = 0;
adapter->skip = 0;
adapter->assembled_len = 0;
- priv->pts = GST_CLOCK_TIME_NONE;
- priv->pts_distance = 0;
- priv->dts = GST_CLOCK_TIME_NONE;
- priv->dts_distance = 0;
- priv->scan_offset = 0;
- priv->scan_entry = NULL;
+ adapter->pts = GST_CLOCK_TIME_NONE;
+ adapter->pts_distance = 0;
+ adapter->dts = GST_CLOCK_TIME_NONE;
+ adapter->dts_distance = 0;
+ adapter->scan_offset = 0;
+ adapter->scan_entry = NULL;
}
static inline void
@@ -245,14 +253,14 @@ update_timestamps (GstAdapter * adapter, GstBuffer * buf)
pts = GST_BUFFER_PTS (buf);
if (GST_CLOCK_TIME_IS_VALID (pts)) {
GST_LOG_OBJECT (adapter, "new pts %" GST_TIME_FORMAT, GST_TIME_ARGS (pts));
- adapter->priv->pts = pts;
- adapter->priv->pts_distance = 0;
+ adapter->pts = pts;
+ adapter->pts_distance = 0;
}
dts = GST_BUFFER_DTS (buf);
if (GST_CLOCK_TIME_IS_VALID (dts)) {
GST_LOG_OBJECT (adapter, "new dts %" GST_TIME_FORMAT, GST_TIME_ARGS (dts));
- adapter->priv->dts = dts;
- adapter->priv->dts_distance = 0;
+ adapter->dts = dts;
+ adapter->dts_distance = 0;
}
}
@@ -267,9 +275,9 @@ copy_into_unchecked (GstAdapter * adapter, guint8 * dest, gsize skip,
/* first step, do skipping */
/* we might well be copying where we were scanning */
- if (adapter->priv->scan_entry && (adapter->priv->scan_offset <= skip)) {
- g = adapter->priv->scan_entry;
- skip -= adapter->priv->scan_offset;
+ if (adapter->scan_entry && (adapter->scan_offset <= skip)) {
+ g = adapter->scan_entry;
+ skip -= adapter->scan_offset;
} else {
g = adapter->buflist;
}
@@ -341,6 +349,7 @@ gst_adapter_push (GstAdapter * adapter, GstBuffer * buf)
}
}
+#if 0
/* Internal method only. Tries to merge buffers at the head of the queue
* to form a single larger buffer of size 'size'.
*
@@ -359,13 +368,18 @@ gst_adapter_try_to_merge_up (GstAdapter * adapter, gsize size)
return FALSE;
head = g->data;
- g = g_slist_next (g);
- /* How large do we want our head buffer? The requested size, plus whatever's
- * been skipped already */
- size += adapter->skip;
hsize = gst_buffer_get_size (head);
+ /* Remove skipped part from the buffer (otherwise the buffer might grow indefinitely) */
+ head = gst_buffer_make_writable (head);
+ gst_buffer_resize (head, adapter->skip, hsize - adapter->skip);
+ hsize -= adapter->skip;
+ adapter->skip = 0;
+ g->data = head;
+
+ g = g_slist_next (g);
+
while (g != NULL && hsize < size) {
cur = g->data;
/* Merge the head buffer and the next in line */
@@ -383,14 +397,15 @@ gst_adapter_try_to_merge_up (GstAdapter * adapter, gsize size)
g->data = head;
/* invalidate scan position */
- adapter->priv->scan_offset = 0;
- adapter->priv->scan_entry = NULL;
+ adapter->scan_offset = 0;
+ adapter->scan_entry = NULL;
g = g_slist_next (g);
}
return ret;
}
+#endif
/**
* gst_adapter_map:
@@ -417,7 +432,6 @@ gst_adapter_try_to_merge_up (GstAdapter * adapter, gsize size)
gconstpointer
gst_adapter_map (GstAdapter * adapter, gsize size)
{
- GstAdapterPrivate *priv;
GstBuffer *cur;
gsize skip, csize;
gsize toreuse, tocopy;
@@ -426,9 +440,7 @@ gst_adapter_map (GstAdapter * adapter, gsize size)
g_return_val_if_fail (GST_IS_ADAPTER (adapter), NULL);
g_return_val_if_fail (size > 0, NULL);
- priv = adapter->priv;
-
- if (priv->info.memory)
+ if (adapter->info.memory)
gst_adapter_unmap (adapter);
/* we don't have enough data, return NULL. This is unlikely
@@ -441,20 +453,24 @@ gst_adapter_map (GstAdapter * adapter, gsize size)
if (adapter->assembled_len >= size)
return adapter->assembled_data;
+#if 0
do {
+#endif
cur = adapter->buflist->data;
skip = adapter->skip;
csize = gst_buffer_get_size (cur);
if (csize >= size + skip) {
- if (!gst_buffer_map (cur, &priv->info, GST_MAP_READ))
+ if (!gst_buffer_map (cur, &adapter->info, GST_MAP_READ))
return FALSE;
- return (guint8 *) priv->info.data + skip;
+ return (guint8 *) adapter->info.data + skip;
}
/* We may be able to efficiently merge buffers in our pool to
* gather a big enough chunk to return it from the head buffer directly */
+#if 0
} while (gst_adapter_try_to_merge_up (adapter, size));
+#endif
/* see how much data we can reuse from the assembled memory and how much
* we need to copy */
@@ -498,17 +514,13 @@ gst_adapter_map (GstAdapter * adapter, gsize size)
void
gst_adapter_unmap (GstAdapter * adapter)
{
- GstAdapterPrivate *priv;
-
g_return_if_fail (GST_IS_ADAPTER (adapter));
- priv = adapter->priv;
-
- if (priv->info.memory) {
+ if (adapter->info.memory) {
GstBuffer *cur = adapter->buflist->data;
GST_LOG_OBJECT (adapter, "unmap memory buffer %p", cur);
- gst_buffer_unmap (cur, &priv->info);
- priv->info.memory = NULL;
+ gst_buffer_unmap (cur, &adapter->info);
+ adapter->info.memory = NULL;
}
}
@@ -553,14 +565,11 @@ gst_adapter_flush_unchecked (GstAdapter * adapter, gsize flush)
{
GstBuffer *cur;
gsize size;
- GstAdapterPrivate *priv;
GSList *g;
GST_LOG_OBJECT (adapter, "flushing %" G_GSIZE_FORMAT " bytes", flush);
- priv = adapter->priv;
-
- if (priv->info.memory)
+ if (adapter->info.memory)
gst_adapter_unmap (adapter);
/* clear state */
@@ -570,8 +579,8 @@ gst_adapter_flush_unchecked (GstAdapter * adapter, gsize flush)
/* take skip into account */
flush += adapter->skip;
/* distance is always at least the amount of skipped bytes */
- priv->pts_distance -= adapter->skip;
- priv->dts_distance -= adapter->skip;
+ adapter->pts_distance -= adapter->skip;
+ adapter->dts_distance -= adapter->skip;
g = adapter->buflist;
cur = g->data;
@@ -579,8 +588,8 @@ gst_adapter_flush_unchecked (GstAdapter * adapter, gsize flush)
while (flush >= size) {
/* can skip whole buffer */
GST_LOG_OBJECT (adapter, "flushing out head buffer");
- priv->pts_distance += size;
- priv->dts_distance += size;
+ adapter->pts_distance += size;
+ adapter->dts_distance += size;
flush -= size;
gst_buffer_unref (cur);
@@ -599,11 +608,11 @@ gst_adapter_flush_unchecked (GstAdapter * adapter, gsize flush)
adapter->buflist = g;
/* account for the remaining bytes */
adapter->skip = flush;
- adapter->priv->pts_distance += flush;
- adapter->priv->dts_distance += flush;
+ adapter->pts_distance += flush;
+ adapter->dts_distance += flush;
/* invalidate scan position */
- priv->scan_offset = 0;
- priv->scan_entry = NULL;
+ adapter->scan_offset = 0;
+ adapter->scan_entry = NULL;
}
void
@@ -754,10 +763,11 @@ gst_adapter_take_buffer (GstAdapter * adapter, gsize nbytes)
buffer = gst_buffer_copy_region (cur, GST_BUFFER_COPY_ALL, skip, nbytes);
goto done;
}
-
+#if 0
if (gst_adapter_try_to_merge_up (adapter, nbytes)) {
/* Merged something, let's try again for sub-buffering */
cur = adapter->buflist->data;
+ skip = adapter->skip;
if (gst_buffer_get_size (cur) >= nbytes + skip) {
GST_LOG_OBJECT (adapter, "providing buffer of %" G_GSIZE_FORMAT " bytes"
" via sub-buffer", nbytes);
@@ -765,6 +775,7 @@ gst_adapter_take_buffer (GstAdapter * adapter, gsize nbytes)
goto done;
}
}
+#endif
data = gst_adapter_take_internal (adapter, nbytes);
@@ -903,9 +914,9 @@ gst_adapter_prev_pts (GstAdapter * adapter, guint64 * distance)
g_return_val_if_fail (GST_IS_ADAPTER (adapter), GST_CLOCK_TIME_NONE);
if (distance)
- *distance = adapter->priv->pts_distance;
+ *distance = adapter->pts_distance;
- return adapter->priv->pts;
+ return adapter->pts;
}
/**
@@ -930,9 +941,9 @@ gst_adapter_prev_dts (GstAdapter * adapter, guint64 * distance)
g_return_val_if_fail (GST_IS_ADAPTER (adapter), GST_CLOCK_TIME_NONE);
if (distance)
- *distance = adapter->priv->dts_distance;
+ *distance = adapter->dts_distance;
- return adapter->priv->dts;
+ return adapter->dts;
}
/**
@@ -983,21 +994,21 @@ gst_adapter_masked_scan_uint32_peek (GstAdapter * adapter, guint32 mask,
/* first step, do skipping and position on the first buffer */
/* optimistically assume scanning continues sequentially */
- if (adapter->priv->scan_entry && (adapter->priv->scan_offset <= skip)) {
- g = adapter->priv->scan_entry;
- skip -= adapter->priv->scan_offset;
+ if (adapter->scan_entry && (adapter->scan_offset <= skip)) {
+ g = adapter->scan_entry;
+ skip -= adapter->scan_offset;
} else {
g = adapter->buflist;
- adapter->priv->scan_offset = 0;
- adapter->priv->scan_entry = NULL;
+ adapter->scan_offset = 0;
+ adapter->scan_entry = NULL;
}
buf = g->data;
bsize = gst_buffer_get_size (buf);
while (G_UNLIKELY (skip >= bsize)) {
skip -= bsize;
g = g_slist_next (g);
- adapter->priv->scan_offset += bsize;
- adapter->priv->scan_entry = g;
+ adapter->scan_offset += bsize;
+ adapter->scan_entry = g;
buf = g->data;
bsize = gst_buffer_get_size (buf);
}
@@ -1035,8 +1046,8 @@ gst_adapter_masked_scan_uint32_peek (GstAdapter * adapter, guint32 mask,
/* nothing found yet, go to next buffer */
skip += bsize;
g = g_slist_next (g);
- adapter->priv->scan_offset += info.size;
- adapter->priv->scan_entry = g;
+ adapter->scan_offset += info.size;
+ adapter->scan_entry = g;
gst_buffer_unmap (buf, &info);
buf = g->data;
diff --git a/libs/gst/base/gstadapter.h b/libs/gst/base/gstadapter.h
index 17bf323..5b89744 100644
--- a/libs/gst/base/gstadapter.h
+++ b/libs/gst/base/gstadapter.h
@@ -38,40 +38,13 @@ G_BEGIN_DECLS
#define GST_IS_ADAPTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ADAPTER))
-typedef struct _GstAdapter GstAdapter;
-typedef struct _GstAdapterClass GstAdapterClass;
-typedef struct _GstAdapterPrivate GstAdapterPrivate;
-
/**
* GstAdapter:
*
* The opaque #GstAdapter data structure.
*/
-struct _GstAdapter {
- GObject object;
-
- /*< private >*/
- GSList * buflist;
- GSList * buflist_end;
- gsize size;
- gsize skip;
-
- /* we keep state of assembled pieces */
- gpointer assembled_data;
- gsize assembled_size;
- gsize assembled_len;
-
- GstAdapterPrivate *priv;
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-struct _GstAdapterClass {
- GObjectClass parent_class;
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
+typedef struct _GstAdapter GstAdapter;
+typedef struct _GstAdapterClass GstAdapterClass;
GType gst_adapter_get_type (void);
diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c
index 151015d..e404ed4 100644
--- a/libs/gst/base/gstbasesink.c
+++ b/libs/gst/base/gstbasesink.c
@@ -4546,6 +4546,7 @@ gst_base_sink_default_query (GstBaseSink * basesink, GstQuery * query)
gst_query_parse_accept_caps (query, &caps);
allowed = gst_base_sink_query_caps (basesink, basesink->sinkpad, NULL);
subset = gst_caps_is_subset (caps, allowed);
+ gst_caps_unref (allowed);
gst_query_set_accept_caps_result (query, subset);
res = TRUE;
break;
diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c
index fdd3a4d..7b8ec85 100644
--- a/libs/gst/base/gstbasesrc.c
+++ b/libs/gst/base/gstbasesrc.c
@@ -314,6 +314,8 @@ static GstFlowReturn gst_base_src_default_create (GstBaseSrc * basesrc,
guint64 offset, guint size, GstBuffer ** buf);
static GstFlowReturn gst_base_src_default_alloc (GstBaseSrc * basesrc,
guint64 offset, guint size, GstBuffer ** buf);
+static gboolean gst_base_src_decide_allocation_default (GstBaseSrc * basesrc,
+ GstQuery * query);
static gboolean gst_base_src_set_flushing (GstBaseSrc * basesrc,
gboolean flushing, gboolean live_play, gboolean unlock, gboolean * playing);
@@ -385,6 +387,8 @@ gst_base_src_class_init (GstBaseSrcClass * klass)
klass->event = GST_DEBUG_FUNCPTR (gst_base_src_default_event);
klass->create = GST_DEBUG_FUNCPTR (gst_base_src_default_create);
klass->alloc = GST_DEBUG_FUNCPTR (gst_base_src_default_alloc);
+ klass->decide_allocation =
+ GST_DEBUG_FUNCPTR (gst_base_src_decide_allocation_default);
/* Registering debug symbols for function pointers */
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_activate_mode);
@@ -1451,7 +1455,7 @@ not_ok:
* When we are in the loop() function, we might be in the middle
* of pushing a buffer, which might block in a sink. To make sure
* that the push gets unblocked we push out a FLUSH_START event.
- * Our loop function will get a WRONG_STATE return value from
+ * Our loop function will get a FLUSHING return value from
* the push and will pause, effectively releasing the STREAM_LOCK.
*
* For a non-flushing seek, we pause the task, which might eventually
@@ -1698,7 +1702,7 @@ gst_base_src_send_event (GstElement * element, GstEvent * event)
* first and do EOS instead of entering it.
* - If we are in the _create function or we did not manage to set the
* flag fast enough and we are about to enter the _create function,
- * we unlock it so that we exit with WRONG_STATE immediately. We then
+ * we unlock it so that we exit with FLUSHING immediately. We then
* check the EOS flag and do the EOS logic.
*/
g_atomic_int_set (&src->priv->pending_eos, TRUE);
@@ -2344,10 +2348,10 @@ again:
gst_buffer_unref (res_buf);
if (!src->live_running) {
- /* We return WRONG_STATE when we are not running to stop the dataflow also
+ /* We return FLUSHING when we are not running to stop the dataflow also
* get rid of the produced buffer. */
GST_DEBUG_OBJECT (src,
- "clock was unscheduled (%d), returning WRONG_STATE", status);
+ "clock was unscheduled (%d), returning FLUSHING", status);
ret = GST_FLOW_FLUSHING;
} else {
/* If we are running when this happens, we quickly switched between
@@ -2697,7 +2701,7 @@ pause:
gst_event_set_seqnum (event, src->priv->seqnum);
/* for fatal errors we post an error message, post the error
* first so the app knows about the error first.
- * Also don't do this for WRONG_STATE because it happens
+ * Also don't do this for FLUSHING because it happens
* due to flushing and posting an error message because of
* that is the wrong thing to do, e.g. when we're doing
* a flushing seek. */
@@ -2784,47 +2788,37 @@ gst_base_src_activate_pool (GstBaseSrc * basesrc, gboolean active)
return res;
}
+
static gboolean
-gst_base_src_prepare_allocation (GstBaseSrc * basesrc, GstCaps * caps)
+gst_base_src_decide_allocation_default (GstBaseSrc * basesrc, GstQuery * query)
{
- GstBaseSrcClass *bclass;
- gboolean result = TRUE;
- GstQuery *query;
- GstBufferPool *pool = NULL;
- GstAllocator *allocator = NULL;
+ GstCaps *outcaps;
+ GstBufferPool *pool;
guint size, min, max;
+ GstAllocator *allocator;
GstAllocationParams params;
+ GstStructure *config;
+ gboolean update_allocator;
- bclass = GST_BASE_SRC_GET_CLASS (basesrc);
-
- /* make query and let peer pad answer, we don't really care if it worked or
- * not, if it failed, the allocation query would contain defaults and the
- * subclass would then set better values if needed */
- query = gst_query_new_allocation (caps, TRUE);
- if (!gst_pad_peer_query (basesrc->srcpad, query)) {
- /* not a problem, just debug a little */
- GST_DEBUG_OBJECT (basesrc, "peer ALLOCATION query failed");
- }
-
- if (G_LIKELY (bclass->decide_allocation))
- result = bclass->decide_allocation (basesrc, query);
-
- GST_DEBUG_OBJECT (basesrc, "ALLOCATION (%d) params: %" GST_PTR_FORMAT, result,
- query);
+ gst_query_parse_allocation (query, &outcaps, NULL);
+ /* we got configuration from our peer or the decide_allocation method,
+ * parse them */
if (gst_query_get_n_allocation_params (query) > 0) {
/* try the allocator */
gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
+ update_allocator = TRUE;
} else {
allocator = NULL;
gst_allocation_params_init (&params);
+ update_allocator = FALSE;
}
if (gst_query_get_n_allocation_pools (query) > 0) {
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
if (pool == NULL) {
- /* no pool, just parameters, we can make our own */
+ /* no pool, we can make our own */
GST_DEBUG_OBJECT (basesrc, "no pool, making new pool");
pool = gst_buffer_pool_new ();
}
@@ -2835,20 +2829,83 @@ gst_base_src_prepare_allocation (GstBaseSrc * basesrc, GstCaps * caps)
/* now configure */
if (pool) {
- GstStructure *config;
-
config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set_params (config, caps, size, min, max);
+ gst_buffer_pool_config_set_params (config, outcaps, size, min, max);
gst_buffer_pool_config_set_allocator (config, allocator, &params);
gst_buffer_pool_set_config (pool, config);
}
+ if (update_allocator)
+ gst_query_set_nth_allocation_param (query, 0, allocator, &params);
+ else
+ gst_query_add_allocation_param (query, allocator, &params);
+ if (allocator)
+ gst_allocator_unref (allocator);
+
+ if (pool) {
+ gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
+ gst_object_unref (pool);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+gst_base_src_prepare_allocation (GstBaseSrc * basesrc, GstCaps * caps)
+{
+ GstBaseSrcClass *bclass;
+ gboolean result = TRUE;
+ GstQuery *query;
+ GstBufferPool *pool = NULL;
+ GstAllocator *allocator = NULL;
+ GstAllocationParams params;
+
+ bclass = GST_BASE_SRC_GET_CLASS (basesrc);
+
+ /* make query and let peer pad answer, we don't really care if it worked or
+ * not, if it failed, the allocation query would contain defaults and the
+ * subclass would then set better values if needed */
+ query = gst_query_new_allocation (caps, TRUE);
+ if (!gst_pad_peer_query (basesrc->srcpad, query)) {
+ /* not a problem, just debug a little */
+ GST_DEBUG_OBJECT (basesrc, "peer ALLOCATION query failed");
+ }
+
+ g_assert (bclass->decide_allocation != NULL);
+ result = bclass->decide_allocation (basesrc, query);
+
+ GST_DEBUG_OBJECT (basesrc, "ALLOCATION (%d) params: %" GST_PTR_FORMAT, result,
+ query);
+
+ if (!result)
+ goto no_decide_allocation;
+
+ /* we got configuration from our peer or the decide_allocation method,
+ * parse them */
+ if (gst_query_get_n_allocation_params (query) > 0) {
+ gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
+ } else {
+ allocator = NULL;
+ gst_allocation_params_init (&params);
+ }
+
+ if (gst_query_get_n_allocation_pools (query) > 0)
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
+
result = gst_base_src_set_allocation (basesrc, pool, allocator, &params);
gst_query_unref (query);
return result;
+ /* Errors */
+no_decide_allocation:
+ {
+ GST_WARNING_OBJECT (basesrc, "Subclass failed to decide allocation");
+ gst_query_unref (query);
+
+ return result;
+ }
}
/* default negotiation code.
diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c
index b5e30e1..3941392 100644
--- a/libs/gst/base/gstbasetransform.c
+++ b/libs/gst/base/gstbasetransform.c
@@ -802,6 +802,13 @@ gst_base_transform_default_decide_allocation (GstBaseTransform * trans,
{
guint i, n_metas;
GstBaseTransformClass *klass;
+ GstCaps *outcaps;
+ GstBufferPool *pool;
+ guint size, min, max;
+ GstAllocator *allocator;
+ GstAllocationParams params;
+ GstStructure *config;
+ gboolean update_allocator;
klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
@@ -836,6 +843,54 @@ gst_base_transform_default_decide_allocation (GstBaseTransform * trans,
n_metas--;
}
}
+
+ gst_query_parse_allocation (query, &outcaps, NULL);
+
+ /* we got configuration from our peer or the decide_allocation method,
+ * parse them */
+ if (gst_query_get_n_allocation_params (query) > 0) {
+ /* try the allocator */
+ gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
+ update_allocator = TRUE;
+ } else {
+ allocator = NULL;
+ gst_allocation_params_init (&params);
+ update_allocator = FALSE;
+ }
+
+ if (gst_query_get_n_allocation_pools (query) > 0) {
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
+
+ if (pool == NULL) {
+ /* no pool, we can make our own */
+ GST_DEBUG_OBJECT (trans, "no pool, making new pool");
+ pool = gst_buffer_pool_new ();
+ }
+ } else {
+ pool = NULL;
+ size = min = max = 0;
+ }
+
+ /* now configure */
+ if (pool) {
+ config = gst_buffer_pool_get_config (pool);
+ gst_buffer_pool_config_set_params (config, outcaps, size, min, max);
+ gst_buffer_pool_config_set_allocator (config, allocator, &params);
+ gst_buffer_pool_set_config (pool, config);
+ }
+
+ if (update_allocator)
+ gst_query_set_nth_allocation_param (query, 0, allocator, &params);
+ else
+ gst_query_add_allocation_param (query, allocator, &params);
+ if (allocator)
+ gst_allocator_unref (allocator);
+
+ if (pool) {
+ gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
+ gst_object_unref (pool);
+ }
+
return TRUE;
}
@@ -844,8 +899,7 @@ gst_base_transform_do_bufferpool (GstBaseTransform * trans, GstCaps * outcaps)
{
GstQuery *query;
gboolean result = TRUE;
- GstBufferPool *pool;
- guint size, min, max;
+ GstBufferPool *pool = NULL;
GstBaseTransformClass *klass;
GstBaseTransformPrivate *priv = trans->priv;
GstAllocator *allocator;
@@ -882,43 +936,28 @@ gst_base_transform_do_bufferpool (GstBaseTransform * trans, GstCaps * outcaps)
klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
GST_DEBUG_OBJECT (trans, "calling decide_allocation");
- if (G_LIKELY (klass->decide_allocation))
- if ((result = klass->decide_allocation (trans, query)) == FALSE)
- goto no_decide_allocation;
+ g_assert (klass->decide_allocation != NULL);
+ result = klass->decide_allocation (trans, query);
+
+ GST_DEBUG_OBJECT (trans, "ALLOCATION (%d) params: %" GST_PTR_FORMAT, result,
+ query);
+
+ if (!result)
+ goto no_decide_allocation;
/* we got configuration from our peer or the decide_allocation method,
* parse them */
if (gst_query_get_n_allocation_params (query) > 0) {
- /* try the allocator */
gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
} else {
allocator = NULL;
gst_allocation_params_init (&params);
}
- if (gst_query_get_n_allocation_pools (query) > 0) {
- gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
+ if (gst_query_get_n_allocation_pools (query) > 0)
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
- if (pool == NULL) {
- /* no pool, just parameters, we can make our own */
- GST_DEBUG_OBJECT (trans, "no pool, making new pool");
- pool = gst_buffer_pool_new ();
- }
- } else {
- pool = NULL;
- size = min = max = 0;
- }
-
- /* now configure */
- if (pool) {
- GstStructure *config;
-
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set_params (config, outcaps, size, min, max);
- gst_buffer_pool_config_set_allocator (config, allocator, &params);
- gst_buffer_pool_set_config (pool, config);
- }
- /* and store */
+ /* now store */
result =
gst_base_transform_set_allocation (trans, pool, allocator, &params,
query);
diff --git a/libs/gst/base/gstcollectpads2.c b/libs/gst/base/gstcollectpads.c
index 600fd4f..f40463c 100644
--- a/libs/gst/base/gstcollectpads2.c
+++ b/libs/gst/base/gstcollectpads.c
@@ -3,7 +3,7 @@
* Copyright (C) 2008 Mark Nauwelaerts <mnauw@users.sourceforge.net>
* Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
- * gstcollectpads2.c:
+ * gstcollectpads.c:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -21,7 +21,7 @@
* Boston, MA 02111-1307, USA.
*/
/**
- * SECTION:gstcollectpads2
+ * SECTION:gstcollectpads
* @short_description: manages a set of pads that operate in collect mode
* @see_also:
*
@@ -29,12 +29,12 @@
* is given to the manager of this object when all pads have data.
* <itemizedlist>
* <listitem><para>
- * Collectpads are created with gst_collect_pads2_new(). A callback should then
- * be installed with gst_collect_pads2_set_function ().
+ * Collectpads are created with gst_collect_pads_new(). A callback should then
+ * be installed with gst_collect_pads_set_function ().
* </para></listitem>
* <listitem><para>
- * Pads are added to the collection with gst_collect_pads2_add_pad()/
- * gst_collect_pads2_remove_pad(). The pad
+ * Pads are added to the collection with gst_collect_pads_add_pad()/
+ * gst_collect_pads_remove_pad(). The pad
* has to be a sinkpad. The chain and event functions of the pad are
* overridden. The element_private of the pad is used to store
* private information for the collectpads.
@@ -47,30 +47,30 @@
* When data is queued on all pads in waiting mode, the callback function is called.
* </para></listitem>
* <listitem><para>
- * Data can be dequeued from the pad with the gst_collect_pads2_pop() method.
- * One can peek at the data with the gst_collect_pads2_peek() function.
+ * Data can be dequeued from the pad with the gst_collect_pads_pop() method.
+ * One can peek at the data with the gst_collect_pads_peek() function.
* These functions will return NULL if the pad received an EOS event. When all
- * pads return NULL from a gst_collect_pads2_peek(), the element can emit an EOS
+ * pads return NULL from a gst_collect_pads_peek(), the element can emit an EOS
* event itself.
* </para></listitem>
* <listitem><para>
- * Data can also be dequeued in byte units using the gst_collect_pads2_available(),
- * gst_collect_pads2_read() and gst_collect_pads2_flush() calls.
+ * Data can also be dequeued in byte units using the gst_collect_pads_available(),
+ * gst_collect_pads_read() and gst_collect_pads_flush() calls.
* </para></listitem>
* <listitem><para>
- * Elements should call gst_collect_pads2_start() and gst_collect_pads2_stop() in
+ * Elements should call gst_collect_pads_start() and gst_collect_pads_stop() in
* their state change functions to start and stop the processing of the collectpads.
- * The gst_collect_pads2_stop() call should be called before calling the parent
+ * The gst_collect_pads_stop() call should be called before calling the parent
* element state change function in the PAUSED_TO_READY state change to ensure
* no pad is blocked and the element can finish streaming.
* </para></listitem>
* <listitem><para>
- * gst_collect_pads2_collect() and gst_collect_pads2_collect_range() can be used by
- * elements that start a #GstTask to drive the collect_pads2. This feature is however
+ * gst_collect_pads_collect() and gst_collect_pads_collect_range() can be used by
+ * elements that start a #GstTask to drive the collect_pads. This feature is however
* not yet implemented.
* </para></listitem>
* <listitem><para>
- * gst_collect_pads2_set_waiting() sets a pad to waiting or non-waiting mode.
+ * gst_collect_pads_set_waiting() sets a pad to waiting or non-waiting mode.
* CollectPads element is not waiting for data to be collected on non-waiting pads.
* Thus these pads may but need not have data when the callback is called.
* All pads are in waiting mode by default.
@@ -88,24 +88,24 @@
#include <gst/gst_private.h>
-#include "gstcollectpads2.h"
+#include "gstcollectpads.h"
#include "../../../gst/glib-compat-private.h"
-GST_DEBUG_CATEGORY_STATIC (collect_pads2_debug);
-#define GST_CAT_DEFAULT collect_pads2_debug
+GST_DEBUG_CATEGORY_STATIC (collect_pads_debug);
+#define GST_CAT_DEFAULT collect_pads_debug
-#define parent_class gst_collect_pads2_parent_class
-G_DEFINE_TYPE (GstCollectPads2, gst_collect_pads2, GST_TYPE_OBJECT);
+#define parent_class gst_collect_pads_parent_class
+G_DEFINE_TYPE (GstCollectPads, gst_collect_pads, GST_TYPE_OBJECT);
-struct _GstCollectData2Private
+struct _GstCollectDataPrivate
{
/* refcounting for struct, and destroy callback */
- GstCollectData2DestroyNotify destroy_notify;
+ GstCollectDataDestroyNotify destroy_notify;
gint refcount;
};
-struct _GstCollectPads2Private
+struct _GstCollectPadsPrivate
{
/* with LOCK and/or STREAM_LOCK */
gboolean started;
@@ -116,21 +116,23 @@ struct _GstCollectPads2Private
guint queuedpads; /* number of pads with a buffer */
guint eospads; /* number of pads that are EOS */
GstClockTime earliest_time; /* Current earliest time */
- GstCollectData2 *earliest_data; /* Pad data for current earliest time */
+ GstCollectData *earliest_data; /* Pad data for current earliest time */
/* with LOCK */
GSList *pad_list; /* updated pad list */
guint32 pad_cookie; /* updated cookie */
- GstCollectPads2Function func; /* function and user_data for callback */
+ GstCollectPadsFunction func; /* function and user_data for callback */
gpointer user_data;
- GstCollectPads2BufferFunction buffer_func; /* function and user_data for buffer callback */
+ GstCollectPadsBufferFunction buffer_func; /* function and user_data for buffer callback */
gpointer buffer_user_data;
- GstCollectPads2CompareFunction compare_func;
+ GstCollectPadsCompareFunction compare_func;
gpointer compare_user_data;
- GstCollectPads2EventFunction event_func; /* function and data for event callback */
+ GstCollectPadsEventFunction event_func; /* function and data for event callback */
gpointer event_user_data;
- GstCollectPads2ClipFunction clip_func;
+ GstCollectPadsQueryFunction query_func;
+ gpointer query_user_data;
+ GstCollectPadsClipFunction clip_func;
gpointer clip_user_data;
/* no other lock needed */
@@ -139,21 +141,29 @@ struct _GstCollectPads2Private
guint32 evt_cookie;
};
-static void gst_collect_pads2_clear (GstCollectPads2 * pads,
- GstCollectData2 * data);
-static GstFlowReturn gst_collect_pads2_chain (GstPad * pad, GstObject * parent,
+static void gst_collect_pads_clear (GstCollectPads * pads,
+ GstCollectData * data);
+static GstFlowReturn gst_collect_pads_chain (GstPad * pad, GstObject * parent,
GstBuffer * buffer);
-static gboolean gst_collect_pads2_event (GstPad * pad, GstObject * parent,
+static gboolean gst_collect_pads_event (GstPad * pad, GstObject * parent,
GstEvent * event);
-static void gst_collect_pads2_finalize (GObject * object);
-static GstFlowReturn gst_collect_pads2_default_collected (GstCollectPads2 *
+static gboolean gst_collect_pads_query (GstPad * pad, GstObject * parent,
+ GstQuery * query);
+static void gst_collect_pads_finalize (GObject * object);
+static GstFlowReturn gst_collect_pads_default_collected (GstCollectPads *
pads, gpointer user_data);
-static gint gst_collect_pads2_default_compare_func (GstCollectPads2 * pads,
- GstCollectData2 * data1, GstClockTime timestamp1, GstCollectData2 * data2,
+static gint gst_collect_pads_default_compare_func (GstCollectPads * pads,
+ GstCollectData * data1, GstClockTime timestamp1, GstCollectData * data2,
GstClockTime timestamp2, gpointer user_data);
-static gboolean gst_collect_pads2_recalculate_full (GstCollectPads2 * pads);
-static void ref_data (GstCollectData2 * data);
-static void unref_data (GstCollectData2 * data);
+static gboolean gst_collect_pads_recalculate_full (GstCollectPads * pads);
+static void ref_data (GstCollectData * data);
+static void unref_data (GstCollectData * data);
+
+static gboolean gst_collect_pads_event_default_internal (GstCollectPads *
+ pads, GstCollectData * data, GstEvent * event, gpointer user_data);
+static gboolean gst_collect_pads_query_default_internal (GstCollectPads *
+ pads, GstCollectData * data, GstQuery * query, gpointer user_data);
+
/* Some properties are protected by LOCK, others by STREAM_LOCK
* However, manipulating either of these partitions may require
@@ -161,63 +171,63 @@ static void unref_data (GstCollectData2 * data);
* Alternative implementations are possible, e.g. some low-level re-implementing
* of the 2 above locks to drop both of them atomically when going into _WAIT.
*/
-#define GST_COLLECT_PADS2_GET_EVT_COND(pads) (&((GstCollectPads2 *)pads)->priv->evt_cond)
-#define GST_COLLECT_PADS2_GET_EVT_LOCK(pads) (&((GstCollectPads2 *)pads)->priv->evt_lock)
-#define GST_COLLECT_PADS2_EVT_WAIT(pads, cookie) G_STMT_START { \
- g_mutex_lock (GST_COLLECT_PADS2_GET_EVT_LOCK (pads)); \
+#define GST_COLLECT_PADS_GET_EVT_COND(pads) (&((GstCollectPads *)pads)->priv->evt_cond)
+#define GST_COLLECT_PADS_GET_EVT_LOCK(pads) (&((GstCollectPads *)pads)->priv->evt_lock)
+#define GST_COLLECT_PADS_EVT_WAIT(pads, cookie) G_STMT_START { \
+ g_mutex_lock (GST_COLLECT_PADS_GET_EVT_LOCK (pads)); \
/* should work unless a lot of event'ing and thread starvation */\
- while (cookie == ((GstCollectPads2 *) pads)->priv->evt_cookie) \
- g_cond_wait (GST_COLLECT_PADS2_GET_EVT_COND (pads), \
- GST_COLLECT_PADS2_GET_EVT_LOCK (pads)); \
- cookie = ((GstCollectPads2 *) pads)->priv->evt_cookie; \
- g_mutex_unlock (GST_COLLECT_PADS2_GET_EVT_LOCK (pads)); \
+ while (cookie == ((GstCollectPads *) pads)->priv->evt_cookie) \
+ g_cond_wait (GST_COLLECT_PADS_GET_EVT_COND (pads), \
+ GST_COLLECT_PADS_GET_EVT_LOCK (pads)); \
+ cookie = ((GstCollectPads *) pads)->priv->evt_cookie; \
+ g_mutex_unlock (GST_COLLECT_PADS_GET_EVT_LOCK (pads)); \
} G_STMT_END
-#define GST_COLLECT_PADS2_EVT_WAIT_TIMED(pads, cookie, timeout) G_STMT_START { \
+#define GST_COLLECT_PADS_EVT_WAIT_TIMED(pads, cookie, timeout) G_STMT_START { \
GTimeVal __tv; \
\
g_get_current_time (&tv); \
g_time_val_add (&tv, timeout); \
\
- g_mutex_lock (GST_COLLECT_PADS2_GET_EVT_LOCK (pads)); \
+ g_mutex_lock (GST_COLLECT_PADS_GET_EVT_LOCK (pads)); \
/* should work unless a lot of event'ing and thread starvation */\
- while (cookie == ((GstCollectPads2 *) pads)->priv->evt_cookie) \
- g_cond_timed_wait (GST_COLLECT_PADS2_GET_EVT_COND (pads), \
- GST_COLLECT_PADS2_GET_EVT_LOCK (pads), &tv); \
- cookie = ((GstCollectPads2 *) pads)->priv->evt_cookie; \
- g_mutex_unlock (GST_COLLECT_PADS2_GET_EVT_LOCK (pads)); \
+ while (cookie == ((GstCollectPads *) pads)->priv->evt_cookie) \
+ g_cond_timed_wait (GST_COLLECT_PADS_GET_EVT_COND (pads), \
+ GST_COLLECT_PADS_GET_EVT_LOCK (pads), &tv); \
+ cookie = ((GstCollectPads *) pads)->priv->evt_cookie; \
+ g_mutex_unlock (GST_COLLECT_PADS_GET_EVT_LOCK (pads)); \
} G_STMT_END
-#define GST_COLLECT_PADS2_EVT_BROADCAST(pads) G_STMT_START { \
- g_mutex_lock (GST_COLLECT_PADS2_GET_EVT_LOCK (pads)); \
+#define GST_COLLECT_PADS_EVT_BROADCAST(pads) G_STMT_START { \
+ g_mutex_lock (GST_COLLECT_PADS_GET_EVT_LOCK (pads)); \
/* never mind wrap-around */ \
- ++(((GstCollectPads2 *) pads)->priv->evt_cookie); \
- g_cond_broadcast (GST_COLLECT_PADS2_GET_EVT_COND (pads)); \
- g_mutex_unlock (GST_COLLECT_PADS2_GET_EVT_LOCK (pads)); \
+ ++(((GstCollectPads *) pads)->priv->evt_cookie); \
+ g_cond_broadcast (GST_COLLECT_PADS_GET_EVT_COND (pads)); \
+ g_mutex_unlock (GST_COLLECT_PADS_GET_EVT_LOCK (pads)); \
} G_STMT_END
-#define GST_COLLECT_PADS2_EVT_INIT(cookie) G_STMT_START { \
- g_mutex_lock (GST_COLLECT_PADS2_GET_EVT_LOCK (pads)); \
- cookie = ((GstCollectPads2 *) pads)->priv->evt_cookie; \
- g_mutex_unlock (GST_COLLECT_PADS2_GET_EVT_LOCK (pads)); \
+#define GST_COLLECT_PADS_EVT_INIT(cookie) G_STMT_START { \
+ g_mutex_lock (GST_COLLECT_PADS_GET_EVT_LOCK (pads)); \
+ cookie = ((GstCollectPads *) pads)->priv->evt_cookie; \
+ g_mutex_unlock (GST_COLLECT_PADS_GET_EVT_LOCK (pads)); \
} G_STMT_END
static void
-gst_collect_pads2_class_init (GstCollectPads2Class * klass)
+gst_collect_pads_class_init (GstCollectPadsClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
- g_type_class_add_private (klass, sizeof (GstCollectPads2Private));
+ g_type_class_add_private (klass, sizeof (GstCollectPadsPrivate));
- GST_DEBUG_CATEGORY_INIT (collect_pads2_debug, "collectpads2", 0,
- "GstCollectPads2");
+ GST_DEBUG_CATEGORY_INIT (collect_pads_debug, "collectpads", 0,
+ "GstCollectPads");
- gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_collect_pads2_finalize);
+ gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_collect_pads_finalize);
}
static void
-gst_collect_pads2_init (GstCollectPads2 * pads)
+gst_collect_pads_init (GstCollectPads * pads)
{
pads->priv =
- G_TYPE_INSTANCE_GET_PRIVATE (pads, GST_TYPE_COLLECT_PADS2,
- GstCollectPads2Private);
+ G_TYPE_INSTANCE_GET_PRIVATE (pads, GST_TYPE_COLLECT_PADS,
+ GstCollectPadsPrivate);
pads->data = NULL;
pads->priv->cookie = 0;
@@ -228,7 +238,7 @@ gst_collect_pads2_init (GstCollectPads2 * pads)
g_rec_mutex_init (&pads->stream_lock);
- pads->priv->func = gst_collect_pads2_default_collected;
+ pads->priv->func = gst_collect_pads_default_collected;
pads->priv->user_data = NULL;
pads->priv->event_func = NULL;
pads->priv->event_user_data = NULL;
@@ -236,11 +246,14 @@ gst_collect_pads2_init (GstCollectPads2 * pads)
/* members for default muxing */
pads->priv->buffer_func = NULL;
pads->priv->buffer_user_data = NULL;
- pads->priv->compare_func = gst_collect_pads2_default_compare_func;
+ pads->priv->compare_func = gst_collect_pads_default_compare_func;
pads->priv->compare_user_data = NULL;
pads->priv->earliest_data = NULL;
pads->priv->earliest_time = GST_CLOCK_TIME_NONE;
+ pads->priv->event_func = gst_collect_pads_event_default_internal;
+ pads->priv->query_func = gst_collect_pads_query_default_internal;
+
/* members to manage the pad list */
pads->priv->pad_cookie = 0;
pads->priv->pad_list = NULL;
@@ -252,9 +265,9 @@ gst_collect_pads2_init (GstCollectPads2 * pads)
}
static void
-gst_collect_pads2_finalize (GObject * object)
+gst_collect_pads_finalize (GObject * object)
{
- GstCollectPads2 *pads = GST_COLLECT_PADS2 (object);
+ GstCollectPads *pads = GST_COLLECT_PADS (object);
GST_DEBUG_OBJECT (object, "finalize");
@@ -273,37 +286,37 @@ gst_collect_pads2_finalize (GObject * object)
}
/**
- * gst_collect_pads2_new:
+ * gst_collect_pads_new:
*
* Create a new instance of #GstCollectsPads.
*
* MT safe.
*
- * Returns: (transfer full): a new #GstCollectPads2, or NULL in case of an error.
+ * Returns: (transfer full): a new #GstCollectPads, or NULL in case of an error.
*
* Since: 0.10.36
*/
-GstCollectPads2 *
-gst_collect_pads2_new (void)
+GstCollectPads *
+gst_collect_pads_new (void)
{
- GstCollectPads2 *newcoll;
+ GstCollectPads *newcoll;
- newcoll = g_object_new (GST_TYPE_COLLECT_PADS2, NULL);
+ newcoll = g_object_new (GST_TYPE_COLLECT_PADS, NULL);
return newcoll;
}
/* Must be called with GstObject lock! */
static void
-gst_collect_pads2_set_buffer_function_locked (GstCollectPads2 * pads,
- GstCollectPads2BufferFunction func, gpointer user_data)
+gst_collect_pads_set_buffer_function_locked (GstCollectPads * pads,
+ GstCollectPadsBufferFunction func, gpointer user_data)
{
pads->priv->buffer_func = func;
pads->priv->buffer_user_data = user_data;
}
/**
- * gst_collect_pads2_set_buffer_function:
+ * gst_collect_pads_set_buffer_function:
* @pads: the collectpads to use
* @func: the function to set
* @user_data: (closure): user data passed to the function
@@ -316,19 +329,19 @@ gst_collect_pads2_set_buffer_function_locked (GstCollectPads2 * pads,
* Since: 0.10.36
*/
void
-gst_collect_pads2_set_buffer_function (GstCollectPads2 * pads,
- GstCollectPads2BufferFunction func, gpointer user_data)
+gst_collect_pads_set_buffer_function (GstCollectPads * pads,
+ GstCollectPadsBufferFunction func, gpointer user_data)
{
g_return_if_fail (pads != NULL);
- g_return_if_fail (GST_IS_COLLECT_PADS2 (pads));
+ g_return_if_fail (GST_IS_COLLECT_PADS (pads));
GST_OBJECT_LOCK (pads);
- gst_collect_pads2_set_buffer_function_locked (pads, func, user_data);
+ gst_collect_pads_set_buffer_function_locked (pads, func, user_data);
GST_OBJECT_UNLOCK (pads);
}
/**
- * gst_collect_pads2_set_compare_function:
+ * gst_collect_pads_set_compare_function:
* @pads: the pads to use
* @func: the function to set
* @user_data: (closure): user data passed to the function
@@ -344,11 +357,11 @@ no known use-case, and collaboration with default algorithm is unpredictable.
If custom compairing/operation is needed, just use a collect function of
your own */
void
-gst_collect_pads2_set_compare_function (GstCollectPads2 * pads,
- GstCollectPads2CompareFunction func, gpointer user_data)
+gst_collect_pads_set_compare_function (GstCollectPads * pads,
+ GstCollectPadsCompareFunction func, gpointer user_data)
{
g_return_if_fail (pads != NULL);
- g_return_if_fail (GST_IS_COLLECT_PADS2 (pads));
+ g_return_if_fail (GST_IS_COLLECT_PADS (pads));
GST_OBJECT_LOCK (pads);
pads->priv->compare_func = func;
@@ -357,7 +370,7 @@ gst_collect_pads2_set_compare_function (GstCollectPads2 * pads,
}
/**
- * gst_collect_pads2_set_function:
+ * gst_collect_pads_set_function:
* @pads: the collectspads to use
* @func: the function to set
* @user_data: user data passed to the function
@@ -369,7 +382,7 @@ gst_collect_pads2_set_compare_function (GstCollectPads2 * pads,
* is desired, this sets a callback that will be invoked instead when
* all the pads added to the collection have buffers queued.
* Evidently, this callback is not compatible with
- * gst_collect_pads2_set_buffer_function() callback.
+ * gst_collect_pads_set_buffer_function() callback.
* If this callback is set, the former will be unset.
*
* MT safe.
@@ -377,21 +390,21 @@ gst_collect_pads2_set_compare_function (GstCollectPads2 * pads,
* Since: 0.10.36
*/
void
-gst_collect_pads2_set_function (GstCollectPads2 * pads,
- GstCollectPads2Function func, gpointer user_data)
+gst_collect_pads_set_function (GstCollectPads * pads,
+ GstCollectPadsFunction func, gpointer user_data)
{
g_return_if_fail (pads != NULL);
- g_return_if_fail (GST_IS_COLLECT_PADS2 (pads));
+ g_return_if_fail (GST_IS_COLLECT_PADS (pads));
GST_OBJECT_LOCK (pads);
pads->priv->func = func;
pads->priv->user_data = user_data;
- gst_collect_pads2_set_buffer_function_locked (pads, NULL, NULL);
+ gst_collect_pads_set_buffer_function_locked (pads, NULL, NULL);
GST_OBJECT_UNLOCK (pads);
}
static void
-ref_data (GstCollectData2 * data)
+ref_data (GstCollectData * data)
{
g_assert (data != NULL);
@@ -399,7 +412,7 @@ ref_data (GstCollectData2 * data)
}
static void
-unref_data (GstCollectData2 * data)
+unref_data (GstCollectData * data)
{
g_assert (data != NULL);
g_assert (data->priv->refcount > 0);
@@ -419,13 +432,13 @@ unref_data (GstCollectData2 * data)
}
/**
- * gst_collect_pads2_set_event_function:
+ * gst_collect_pads_set_event_function:
* @pads: the collectspads to use
* @func: the function to set
* @user_data: user data passed to the function
*
- * Set the event callback function and user data that will be called after
- * collectpads has processed and event originating from one of the collected
+ * Set the event callback function and user data that will be called when
+ * collectpads has received an event originating from one of the collected
* pads. If the event being processed is a serialized one, this callback is
* called with @pads STREAM_LOCK held, otherwise not. As this lock should be
* held when calling a number of CollectPads functions, it should be acquired
@@ -436,11 +449,11 @@ unref_data (GstCollectData2 * data)
* Since: 0.10.36
*/
void
-gst_collect_pads2_set_event_function (GstCollectPads2 * pads,
- GstCollectPads2EventFunction func, gpointer user_data)
+gst_collect_pads_set_event_function (GstCollectPads * pads,
+ GstCollectPadsEventFunction func, gpointer user_data)
{
g_return_if_fail (pads != NULL);
- g_return_if_fail (GST_IS_COLLECT_PADS2 (pads));
+ g_return_if_fail (GST_IS_COLLECT_PADS (pads));
GST_OBJECT_LOCK (pads);
pads->priv->event_func = func;
@@ -449,7 +462,37 @@ gst_collect_pads2_set_event_function (GstCollectPads2 * pads,
}
/**
-* gst_collect_pads2_clip_running_time:
+ * gst_collect_pads_set_query_function:
+ * @pads: the collectspads to use
+ * @func: the function to set
+ * @user_data: user data passed to the function
+ *
+ * Set the query callback function and user data that will be called after
+ * collectpads has received a query originating from one of the collected
+ * pads. If the query being processed is a serialized one, this callback is
+ * called with @pads STREAM_LOCK held, otherwise not. As this lock should be
+ * held when calling a number of CollectPads functions, it should be acquired
+ * if so (unusually) needed.
+ *
+ * MT safe.
+ *
+ * Since: 0.10.36
+ */
+void
+gst_collect_pads_set_query_function (GstCollectPads * pads,
+ GstCollectPadsQueryFunction func, gpointer user_data)
+{
+ g_return_if_fail (pads != NULL);
+ g_return_if_fail (GST_IS_COLLECT_PADS (pads));
+
+ GST_OBJECT_LOCK (pads);
+ pads->priv->query_func = func;
+ pads->priv->query_user_data = user_data;
+ GST_OBJECT_UNLOCK (pads);
+}
+
+/**
+* gst_collect_pads_clip_running_time:
* @pads: the collectspads to use
* @cdata: collect data of corresponding pad
* @buf: buffer being clipped
@@ -462,8 +505,8 @@ gst_collect_pads2_set_event_function (GstCollectPads2 * pads,
* Since: 0.10.37
*/
GstFlowReturn
-gst_collect_pads2_clip_running_time (GstCollectPads2 * pads,
- GstCollectData2 * cdata, GstBuffer * buf, GstBuffer ** outbuf,
+gst_collect_pads_clip_running_time (GstCollectPads * pads,
+ GstCollectData * cdata, GstBuffer * buf, GstBuffer ** outbuf,
gpointer user_data)
{
GstClockTime time;
@@ -491,7 +534,7 @@ gst_collect_pads2_clip_running_time (GstCollectPads2 * pads,
}
/**
- * gst_collect_pads2_set_clip_function:
+ * gst_collect_pads_set_clip_function:
* @pads: the collectspads to use
* @clipfunc: clip function to install
* @user_data: user data to pass to @clip_func
@@ -502,68 +545,68 @@ gst_collect_pads2_clip_running_time (GstCollectPads2 * pads,
* Since: 0.10.36
*/
void
-gst_collect_pads2_set_clip_function (GstCollectPads2 * pads,
- GstCollectPads2ClipFunction clipfunc, gpointer user_data)
+gst_collect_pads_set_clip_function (GstCollectPads * pads,
+ GstCollectPadsClipFunction clipfunc, gpointer user_data)
{
g_return_if_fail (pads != NULL);
- g_return_if_fail (GST_IS_COLLECT_PADS2 (pads));
+ g_return_if_fail (GST_IS_COLLECT_PADS (pads));
pads->priv->clip_func = clipfunc;
pads->priv->clip_user_data = user_data;
}
/**
- * gst_collect_pads2_add_pad:
+ * gst_collect_pads_add_pad:
* @pads: the collectspads to use
* @pad: (transfer none): the pad to add
- * @size: the size of the returned #GstCollectData2 structure
+ * @size: the size of the returned #GstCollectData structure
*
* Add a pad to the collection of collect pads. The pad has to be
* a sinkpad. The refcount of the pad is incremented. Use
- * gst_collect_pads2_remove_pad() to remove the pad from the collection
+ * gst_collect_pads_remove_pad() to remove the pad from the collection
* again.
*
- * You specify a size for the returned #GstCollectData2 structure
+ * You specify a size for the returned #GstCollectData structure
* so that you can use it to store additional information.
*
* The pad will be automatically activated in push mode when @pads is
* started.
*
- * This function calls gst_collect_pads2_add_pad_full() passing a value of NULL
+ * This function calls gst_collect_pads_add_pad_full() passing a value of NULL
* for destroy_notify and TRUE for locked.
*
* MT safe.
*
- * Returns: a new #GstCollectData2 to identify the new pad. Or NULL
+ * Returns: a new #GstCollectData to identify the new pad. Or NULL
* if wrong parameters are supplied.
*
* Since: 0.10.36
*/
-GstCollectData2 *
-gst_collect_pads2_add_pad (GstCollectPads2 * pads, GstPad * pad, guint size)
+GstCollectData *
+gst_collect_pads_add_pad (GstCollectPads * pads, GstPad * pad, guint size)
{
- return gst_collect_pads2_add_pad_full (pads, pad, size, NULL, TRUE);
+ return gst_collect_pads_add_pad_full (pads, pad, size, NULL, TRUE);
}
/**
- * gst_collect_pads2_add_pad_full:
+ * gst_collect_pads_add_pad_full:
* @pads: the collectspads to use
* @pad: (transfer none): the pad to add
- * @size: the size of the returned #GstCollectData2 structure
- * @destroy_notify: function to be called before the returned #GstCollectData2
+ * @size: the size of the returned #GstCollectData structure
+ * @destroy_notify: function to be called before the returned #GstCollectData
* structure is freed
* @lock: whether to lock this pad in usual waiting state
*
* Add a pad to the collection of collect pads. The pad has to be
* a sinkpad. The refcount of the pad is incremented. Use
- * gst_collect_pads2_remove_pad() to remove the pad from the collection
+ * gst_collect_pads_remove_pad() to remove the pad from the collection
* again.
*
- * You specify a size for the returned #GstCollectData2 structure
+ * You specify a size for the returned #GstCollectData structure
* so that you can use it to store additional information.
*
- * You can also specify a #GstCollectData2DestroyNotify that will be called
- * just before the #GstCollectData2 structure is freed. It is passed the
+ * You can also specify a #GstCollectDataDestroyNotify that will be called
+ * just before the #GstCollectData structure is freed. It is passed the
* pointer to the structure and should free any custom memory and resources
* allocated for it.
*
@@ -582,32 +625,32 @@ gst_collect_pads2_add_pad (GstCollectPads2 * pads, GstPad * pad, guint size)
*
* Since: 0.10.36
*
- * Returns: a new #GstCollectData2 to identify the new pad. Or NULL
+ * Returns: a new #GstCollectData to identify the new pad. Or NULL
* if wrong parameters are supplied.
*/
-GstCollectData2 *
-gst_collect_pads2_add_pad_full (GstCollectPads2 * pads, GstPad * pad,
- guint size, GstCollectData2DestroyNotify destroy_notify, gboolean lock)
+GstCollectData *
+gst_collect_pads_add_pad_full (GstCollectPads * pads, GstPad * pad,
+ guint size, GstCollectDataDestroyNotify destroy_notify, gboolean lock)
{
- GstCollectData2 *data;
+ GstCollectData *data;
g_return_val_if_fail (pads != NULL, NULL);
- g_return_val_if_fail (GST_IS_COLLECT_PADS2 (pads), NULL);
+ g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), NULL);
g_return_val_if_fail (pad != NULL, NULL);
g_return_val_if_fail (GST_PAD_IS_SINK (pad), NULL);
- g_return_val_if_fail (size >= sizeof (GstCollectData2), NULL);
+ g_return_val_if_fail (size >= sizeof (GstCollectData), NULL);
GST_DEBUG_OBJECT (pads, "adding pad %s:%s", GST_DEBUG_PAD_NAME (pad));
data = g_malloc0 (size);
- data->priv = g_new0 (GstCollectData2Private, 1);
+ data->priv = g_new0 (GstCollectDataPrivate, 1);
data->collect = pads;
data->pad = gst_object_ref (pad);
data->buffer = NULL;
data->pos = 0;
gst_segment_init (&data->segment, GST_FORMAT_UNDEFINED);
- data->state = GST_COLLECT_PADS2_STATE_WAITING;
- data->state |= lock ? GST_COLLECT_PADS2_STATE_LOCKED : 0;
+ data->state = GST_COLLECT_PADS_STATE_WAITING;
+ data->state |= lock ? GST_COLLECT_PADS_STATE_LOCKED : 0;
data->priv->refcount = 1;
data->priv->destroy_notify = destroy_notify;
@@ -616,8 +659,9 @@ gst_collect_pads2_add_pad_full (GstCollectPads2 * pads, GstPad * pad,
gst_pad_set_element_private (pad, data);
GST_OBJECT_UNLOCK (pad);
pads->priv->pad_list = g_slist_append (pads->priv->pad_list, data);
- gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_collect_pads2_chain));
- gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_collect_pads2_event));
+ gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_collect_pads_chain));
+ gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_collect_pads_event));
+ gst_pad_set_query_function (pad, GST_DEBUG_FUNCPTR (gst_collect_pads_query));
/* backward compat, also add to data if stopped, so that the element already
* has this in the public data list before going PAUSED (typically)
* this can only be done when we are stopped because we don't take the
@@ -636,7 +680,7 @@ gst_collect_pads2_add_pad_full (GstCollectPads2 * pads, GstPad * pad,
}
static gint
-find_pad (GstCollectData2 * data, GstPad * pad)
+find_pad (GstCollectData * data, GstPad * pad)
{
if (data->pad == pad)
return 0;
@@ -644,13 +688,13 @@ find_pad (GstCollectData2 * data, GstPad * pad)
}
/**
- * gst_collect_pads2_remove_pad:
+ * gst_collect_pads_remove_pad:
* @pads: the collectspads to use
* @pad: (transfer none): the pad to remove
*
* Remove a pad from the collection of collect pads. This function will also
- * free the #GstCollectData2 and all the resources that were allocated with
- * gst_collect_pads2_add_pad().
+ * free the #GstCollectData and all the resources that were allocated with
+ * gst_collect_pads_add_pad().
*
* The pad will be deactivated automatically when @pads is stopped.
*
@@ -661,13 +705,13 @@ find_pad (GstCollectData2 * data, GstPad * pad)
* Since: 0.10.36
*/
gboolean
-gst_collect_pads2_remove_pad (GstCollectPads2 * pads, GstPad * pad)
+gst_collect_pads_remove_pad (GstCollectPads * pads, GstPad * pad)
{
- GstCollectData2 *data;
+ GstCollectData *data;
GSList *list;
g_return_val_if_fail (pads != NULL, FALSE);
- g_return_val_if_fail (GST_IS_COLLECT_PADS2 (pads), FALSE);
+ g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), FALSE);
g_return_val_if_fail (pad != NULL, FALSE);
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
@@ -679,7 +723,7 @@ gst_collect_pads2_remove_pad (GstCollectPads2 * pads, GstPad * pad)
if (!list)
goto unknown_pad;
- data = (GstCollectData2 *) list->data;
+ data = (GstCollectData *) list->data;
GST_DEBUG_OBJECT (pads, "found pad %s:%s at %p", GST_DEBUG_PAD_NAME (pad),
data);
@@ -699,7 +743,7 @@ gst_collect_pads2_remove_pad (GstCollectPads2 * pads, GstPad * pad)
dlist = g_slist_find_custom (pads->data, pad, (GCompareFunc) find_pad);
if (dlist) {
- GstCollectData2 *pdata = dlist->data;
+ GstCollectData *pdata = dlist->data;
pads->data = g_slist_delete_link (pads->data, dlist);
unref_data (pdata);
@@ -710,7 +754,7 @@ gst_collect_pads2_remove_pad (GstCollectPads2 * pads, GstPad * pad)
pads->priv->pad_cookie++;
/* signal waiters because something changed */
- GST_COLLECT_PADS2_EVT_BROADCAST (pads);
+ GST_COLLECT_PADS_EVT_BROADCAST (pads);
/* deactivate the pad when needed */
if (!pads->priv->started)
@@ -733,7 +777,7 @@ unknown_pad:
}
/**
- * gst_collect_pads2_is_active:
+ * gst_collect_pads_is_active:
* @pads: the collectspads to use
* @pad: the pad to check
*
@@ -748,20 +792,20 @@ unknown_pad:
* Since: 0.10.36
*/
gboolean
-gst_collect_pads2_is_active (GstCollectPads2 * pads, GstPad * pad)
+gst_collect_pads_is_active (GstCollectPads * pads, GstPad * pad)
{
g_return_val_if_fail (pads != NULL, FALSE);
- g_return_val_if_fail (GST_IS_COLLECT_PADS2 (pads), FALSE);
+ g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), FALSE);
g_return_val_if_fail (pad != NULL, FALSE);
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- g_warning ("gst_collect_pads2_is_active() is not implemented");
+ g_warning ("gst_collect_pads_is_active() is not implemented");
return FALSE;
}
/**
- * gst_collect_pads2_collect:
+ * gst_collect_pads_collect:
* @pads: the collectspads to use
*
* Collect data on all pads. This function is usually called
@@ -776,18 +820,18 @@ gst_collect_pads2_is_active (GstCollectPads2 * pads, GstPad * pad)
* Since: 0.10.36
*/
GstFlowReturn
-gst_collect_pads2_collect (GstCollectPads2 * pads)
+gst_collect_pads_collect (GstCollectPads * pads)
{
g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);
- g_return_val_if_fail (GST_IS_COLLECT_PADS2 (pads), GST_FLOW_ERROR);
+ g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), GST_FLOW_ERROR);
- g_warning ("gst_collect_pads2_collect() is not implemented");
+ g_warning ("gst_collect_pads_collect() is not implemented");
return GST_FLOW_NOT_SUPPORTED;
}
/**
- * gst_collect_pads2_collect_range:
+ * gst_collect_pads_collect_range:
* @pads: the collectspads to use
* @offset: the offset to collect
* @length: the length to collect
@@ -804,13 +848,13 @@ gst_collect_pads2_collect (GstCollectPads2 * pads)
* Since: 0.10.36
*/
GstFlowReturn
-gst_collect_pads2_collect_range (GstCollectPads2 * pads, guint64 offset,
+gst_collect_pads_collect_range (GstCollectPads * pads, guint64 offset,
guint length)
{
g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);
- g_return_val_if_fail (GST_IS_COLLECT_PADS2 (pads), GST_FLOW_ERROR);
+ g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), GST_FLOW_ERROR);
- g_warning ("gst_collect_pads2_collect_range() is not implemented");
+ g_warning ("gst_collect_pads_collect_range() is not implemented");
return GST_FLOW_NOT_SUPPORTED;
}
@@ -819,14 +863,14 @@ gst_collect_pads2_collect_range (GstCollectPads2 * pads, guint64 offset,
* Must be called with STREAM_LOCK.
*/
static void
-gst_collect_pads2_set_flushing_unlocked (GstCollectPads2 * pads,
+gst_collect_pads_set_flushing_unlocked (GstCollectPads * pads,
gboolean flushing)
{
GSList *walk = NULL;
/* Update the pads flushing flag */
for (walk = pads->data; walk; walk = g_slist_next (walk)) {
- GstCollectData2 *cdata = walk->data;
+ GstCollectData *cdata = walk->data;
if (GST_IS_PAD (cdata->pad)) {
GST_OBJECT_LOCK (cdata->pad);
@@ -835,20 +879,20 @@ gst_collect_pads2_set_flushing_unlocked (GstCollectPads2 * pads,
else
GST_PAD_UNSET_FLUSHING (cdata->pad);
if (flushing)
- GST_COLLECT_PADS2_STATE_SET (cdata, GST_COLLECT_PADS2_STATE_FLUSHING);
+ GST_COLLECT_PADS_STATE_SET (cdata, GST_COLLECT_PADS_STATE_FLUSHING);
else
- GST_COLLECT_PADS2_STATE_UNSET (cdata, GST_COLLECT_PADS2_STATE_FLUSHING);
- gst_collect_pads2_clear (pads, cdata);
+ GST_COLLECT_PADS_STATE_UNSET (cdata, GST_COLLECT_PADS_STATE_FLUSHING);
+ gst_collect_pads_clear (pads, cdata);
GST_OBJECT_UNLOCK (cdata->pad);
}
}
/* inform _chain of changes */
- GST_COLLECT_PADS2_EVT_BROADCAST (pads);
+ GST_COLLECT_PADS_EVT_BROADCAST (pads);
}
/**
- * gst_collect_pads2_set_flushing:
+ * gst_collect_pads_set_flushing:
* @pads: the collectspads to use
* @flushing: desired state of the pads
*
@@ -863,39 +907,39 @@ gst_collect_pads2_set_flushing_unlocked (GstCollectPads2 * pads,
* Since: 0.10.36
*/
void
-gst_collect_pads2_set_flushing (GstCollectPads2 * pads, gboolean flushing)
+gst_collect_pads_set_flushing (GstCollectPads * pads, gboolean flushing)
{
g_return_if_fail (pads != NULL);
- g_return_if_fail (GST_IS_COLLECT_PADS2 (pads));
+ g_return_if_fail (GST_IS_COLLECT_PADS (pads));
/* NOTE since this eventually calls _pop, some (STREAM_)LOCK is needed here */
- GST_COLLECT_PADS2_STREAM_LOCK (pads);
- gst_collect_pads2_set_flushing_unlocked (pads, flushing);
- GST_COLLECT_PADS2_STREAM_UNLOCK (pads);
+ GST_COLLECT_PADS_STREAM_LOCK (pads);
+ gst_collect_pads_set_flushing_unlocked (pads, flushing);
+ GST_COLLECT_PADS_STREAM_UNLOCK (pads);
}
/**
- * gst_collect_pads2_start:
+ * gst_collect_pads_start:
* @pads: the collectspads to use
*
- * Starts the processing of data in the collect_pads2.
+ * Starts the processing of data in the collect_pads.
*
* MT safe.
*
* Since: 0.10.36
*/
void
-gst_collect_pads2_start (GstCollectPads2 * pads)
+gst_collect_pads_start (GstCollectPads * pads)
{
GSList *collected;
g_return_if_fail (pads != NULL);
- g_return_if_fail (GST_IS_COLLECT_PADS2 (pads));
+ g_return_if_fail (GST_IS_COLLECT_PADS (pads));
GST_DEBUG_OBJECT (pads, "starting collect pads");
/* make sure stop and collect cannot be called anymore */
- GST_COLLECT_PADS2_STREAM_LOCK (pads);
+ GST_COLLECT_PADS_STREAM_LOCK (pads);
/* make pads streamable */
GST_OBJECT_LOCK (pads);
@@ -903,25 +947,25 @@ gst_collect_pads2_start (GstCollectPads2 * pads)
/* loop over the master pad list and reset the segment */
collected = pads->priv->pad_list;
for (; collected; collected = g_slist_next (collected)) {
- GstCollectData2 *data;
+ GstCollectData *data;
data = collected->data;
gst_segment_init (&data->segment, GST_FORMAT_UNDEFINED);
}
- gst_collect_pads2_set_flushing_unlocked (pads, FALSE);
+ gst_collect_pads_set_flushing_unlocked (pads, FALSE);
/* Start collect pads */
pads->priv->started = TRUE;
GST_OBJECT_UNLOCK (pads);
- GST_COLLECT_PADS2_STREAM_UNLOCK (pads);
+ GST_COLLECT_PADS_STREAM_UNLOCK (pads);
}
/**
- * gst_collect_pads2_stop:
+ * gst_collect_pads_stop:
* @pads: the collectspads to use
*
- * Stops the processing of data in the collect_pads2. this function
+ * Stops the processing of data in the collect_pads. this function
* will also unblock any blocking operations.
*
* MT safe.
@@ -929,21 +973,21 @@ gst_collect_pads2_start (GstCollectPads2 * pads)
* Since: 0.10.36
*/
void
-gst_collect_pads2_stop (GstCollectPads2 * pads)
+gst_collect_pads_stop (GstCollectPads * pads)
{
GSList *collected;
g_return_if_fail (pads != NULL);
- g_return_if_fail (GST_IS_COLLECT_PADS2 (pads));
+ g_return_if_fail (GST_IS_COLLECT_PADS (pads));
GST_DEBUG_OBJECT (pads, "stopping collect pads");
/* make sure collect and start cannot be called anymore */
- GST_COLLECT_PADS2_STREAM_LOCK (pads);
+ GST_COLLECT_PADS_STREAM_LOCK (pads);
/* make pads not accept data anymore */
GST_OBJECT_LOCK (pads);
- gst_collect_pads2_set_flushing_unlocked (pads, TRUE);
+ gst_collect_pads_set_flushing_unlocked (pads, TRUE);
/* Stop collect pads */
pads->priv->started = FALSE;
@@ -953,7 +997,7 @@ gst_collect_pads2_stop (GstCollectPads2 * pads)
/* loop over the master pad list and flush buffers */
collected = pads->priv->pad_list;
for (; collected; collected = g_slist_next (collected)) {
- GstCollectData2 *data;
+ GstCollectData *data;
GstBuffer **buffer_p;
data = collected->data;
@@ -962,7 +1006,7 @@ gst_collect_pads2_stop (GstCollectPads2 * pads)
gst_buffer_replace (buffer_p, NULL);
data->pos = 0;
}
- GST_COLLECT_PADS2_STATE_UNSET (data, GST_COLLECT_PADS2_STATE_EOS);
+ GST_COLLECT_PADS_STATE_UNSET (data, GST_COLLECT_PADS_STATE_EOS);
}
if (pads->priv->earliest_data)
@@ -972,13 +1016,13 @@ gst_collect_pads2_stop (GstCollectPads2 * pads)
GST_OBJECT_UNLOCK (pads);
/* Wake them up so they can end the chain functions. */
- GST_COLLECT_PADS2_EVT_BROADCAST (pads);
+ GST_COLLECT_PADS_EVT_BROADCAST (pads);
- GST_COLLECT_PADS2_STREAM_UNLOCK (pads);
+ GST_COLLECT_PADS_STREAM_UNLOCK (pads);
}
/**
- * gst_collect_pads2_peek:
+ * gst_collect_pads_peek:
* @pads: the collectspads to peek
* @data: the data to use
*
@@ -994,12 +1038,12 @@ gst_collect_pads2_stop (GstCollectPads2 * pads)
* Since: 0.10.36
*/
GstBuffer *
-gst_collect_pads2_peek (GstCollectPads2 * pads, GstCollectData2 * data)
+gst_collect_pads_peek (GstCollectPads * pads, GstCollectData * data)
{
GstBuffer *result;
g_return_val_if_fail (pads != NULL, NULL);
- g_return_val_if_fail (GST_IS_COLLECT_PADS2 (pads), NULL);
+ g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), NULL);
g_return_val_if_fail (data != NULL, NULL);
if ((result = data->buffer))
@@ -1012,7 +1056,7 @@ gst_collect_pads2_peek (GstCollectPads2 * pads, GstCollectData2 * data)
}
/**
- * gst_collect_pads2_pop:
+ * gst_collect_pads_pop:
* @pads: the collectspads to pop
* @data: the data to use
*
@@ -1028,23 +1072,23 @@ gst_collect_pads2_peek (GstCollectPads2 * pads, GstCollectData2 * data)
* Since: 0.10.36
*/
GstBuffer *
-gst_collect_pads2_pop (GstCollectPads2 * pads, GstCollectData2 * data)
+gst_collect_pads_pop (GstCollectPads * pads, GstCollectData * data)
{
GstBuffer *result;
g_return_val_if_fail (pads != NULL, NULL);
- g_return_val_if_fail (GST_IS_COLLECT_PADS2 (pads), NULL);
+ g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), NULL);
g_return_val_if_fail (data != NULL, NULL);
if ((result = data->buffer)) {
data->buffer = NULL;
data->pos = 0;
/* one less pad with queued data now */
- if (GST_COLLECT_PADS2_STATE_IS_SET (data, GST_COLLECT_PADS2_STATE_WAITING))
+ if (GST_COLLECT_PADS_STATE_IS_SET (data, GST_COLLECT_PADS_STATE_WAITING))
pads->priv->queuedpads--;
}
- GST_COLLECT_PADS2_EVT_BROADCAST (pads);
+ GST_COLLECT_PADS_EVT_BROADCAST (pads);
GST_DEBUG_OBJECT (pads, "Pop buffer on pad %s:%s: buffer=%p",
GST_DEBUG_PAD_NAME (data->pad), result);
@@ -1055,16 +1099,16 @@ gst_collect_pads2_pop (GstCollectPads2 * pads, GstCollectData2 * data)
/* pop and unref the currently queued buffer, should be called with STREAM_LOCK
* held */
static void
-gst_collect_pads2_clear (GstCollectPads2 * pads, GstCollectData2 * data)
+gst_collect_pads_clear (GstCollectPads * pads, GstCollectData * data)
{
GstBuffer *buf;
- if ((buf = gst_collect_pads2_pop (pads, data)))
+ if ((buf = gst_collect_pads_pop (pads, data)))
gst_buffer_unref (buf);
}
/**
- * gst_collect_pads2_available:
+ * gst_collect_pads_available:
* @pads: the collectspads to query
*
* Query how much bytes can be read from each queued buffer. This means
@@ -1085,25 +1129,25 @@ gst_collect_pads2_clear (GstCollectPads2 * pads, GstCollectData2 * data)
* but would then have to maintain this in _chain and particularly _pop, etc,
* even if element is never interested in this information */
guint
-gst_collect_pads2_available (GstCollectPads2 * pads)
+gst_collect_pads_available (GstCollectPads * pads)
{
GSList *collected;
guint result = G_MAXUINT;
g_return_val_if_fail (pads != NULL, 0);
- g_return_val_if_fail (GST_IS_COLLECT_PADS2 (pads), 0);
+ g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), 0);
collected = pads->data;
for (; collected; collected = g_slist_next (collected)) {
- GstCollectData2 *pdata;
+ GstCollectData *pdata;
GstBuffer *buffer;
gint size;
- pdata = (GstCollectData2 *) collected->data;
+ pdata = (GstCollectData *) collected->data;
/* ignore pad with EOS */
- if (G_UNLIKELY (GST_COLLECT_PADS2_STATE_IS_SET (pdata,
- GST_COLLECT_PADS2_STATE_EOS))) {
+ if (G_UNLIKELY (GST_COLLECT_PADS_STATE_IS_SET (pdata,
+ GST_COLLECT_PADS_STATE_EOS))) {
GST_DEBUG_OBJECT (pads, "pad %p is EOS", pdata);
continue;
}
@@ -1135,7 +1179,7 @@ not_filled:
}
/**
- * gst_collect_pads2_flush:
+ * gst_collect_pads_flush:
* @pads: the collectspads to query
* @data: the data to use
* @size: the number of bytes to flush
@@ -1153,7 +1197,7 @@ not_filled:
* Since: 0.10.36
*/
guint
-gst_collect_pads2_flush (GstCollectPads2 * pads, GstCollectData2 * data,
+gst_collect_pads_flush (GstCollectPads * pads, GstCollectData * data,
guint size)
{
guint flushsize;
@@ -1161,7 +1205,7 @@ gst_collect_pads2_flush (GstCollectPads2 * pads, GstCollectData2 * data,
GstBuffer *buffer;
g_return_val_if_fail (pads != NULL, 0);
- g_return_val_if_fail (GST_IS_COLLECT_PADS2 (pads), 0);
+ g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), 0);
g_return_val_if_fail (data != NULL, 0);
/* no buffer, must be EOS */
@@ -1177,13 +1221,13 @@ gst_collect_pads2_flush (GstCollectPads2 * pads, GstCollectData2 * data,
if (data->pos >= bsize)
/* _clear will also reset data->pos to 0 */
- gst_collect_pads2_clear (pads, data);
+ gst_collect_pads_clear (pads, data);
return flushsize;
}
/**
- * gst_collect_pads2_read_buffer:
+ * gst_collect_pads_read_buffer:
* @pads: the collectspads to query
* @data: the data to use
* @size: the number of bytes to read
@@ -1202,14 +1246,14 @@ gst_collect_pads2_flush (GstCollectPads2 * pads, GstCollectData2 * data,
* Unref the buffer after use.
*/
GstBuffer *
-gst_collect_pads2_read_buffer (GstCollectPads2 * pads, GstCollectData2 * data,
+gst_collect_pads_read_buffer (GstCollectPads * pads, GstCollectData * data,
guint size)
{
guint readsize;
GstBuffer *buffer;
g_return_val_if_fail (pads != NULL, NULL);
- g_return_val_if_fail (GST_IS_COLLECT_PADS2 (pads), NULL);
+ g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), NULL);
g_return_val_if_fail (data != NULL, NULL);
/* no buffer, must be EOS */
@@ -1223,7 +1267,7 @@ gst_collect_pads2_read_buffer (GstCollectPads2 * pads, GstCollectData2 * data,
}
/**
- * gst_collect_pads2_take_buffer:
+ * gst_collect_pads_take_buffer:
* @pads: the collectspads to query
* @data: the data to use
* @size: the number of bytes to read
@@ -1243,19 +1287,19 @@ gst_collect_pads2_read_buffer (GstCollectPads2 * pads, GstCollectData2 * data,
* Unref the buffer after use.
*/
GstBuffer *
-gst_collect_pads2_take_buffer (GstCollectPads2 * pads, GstCollectData2 * data,
+gst_collect_pads_take_buffer (GstCollectPads * pads, GstCollectData * data,
guint size)
{
- GstBuffer *buffer = gst_collect_pads2_read_buffer (pads, data, size);
+ GstBuffer *buffer = gst_collect_pads_read_buffer (pads, data, size);
if (buffer) {
- gst_collect_pads2_flush (pads, data, gst_buffer_get_size (buffer));
+ gst_collect_pads_flush (pads, data, gst_buffer_get_size (buffer));
}
return buffer;
}
/**
- * gst_collect_pads2_set_waiting:
+ * gst_collect_pads_set_waiting:
* @pads: the collectspads
* @data: the data to use
* @waiting: boolean indicating whether this pad should operate
@@ -1273,29 +1317,29 @@ gst_collect_pads2_take_buffer (GstCollectPads2 * pads, GstCollectData2 * data,
* Since: 0.10.36
*/
void
-gst_collect_pads2_set_waiting (GstCollectPads2 * pads, GstCollectData2 * data,
+gst_collect_pads_set_waiting (GstCollectPads * pads, GstCollectData * data,
gboolean waiting)
{
g_return_if_fail (pads != NULL);
- g_return_if_fail (GST_IS_COLLECT_PADS2 (pads));
+ g_return_if_fail (GST_IS_COLLECT_PADS (pads));
g_return_if_fail (data != NULL);
GST_DEBUG_OBJECT (pads, "Setting pad %s to waiting %d, locked %d",
GST_PAD_NAME (data->pad), waiting,
- GST_COLLECT_PADS2_STATE_IS_SET (data, GST_COLLECT_PADS2_STATE_LOCKED));
+ GST_COLLECT_PADS_STATE_IS_SET (data, GST_COLLECT_PADS_STATE_LOCKED));
/* Do something only on a change and if not locked */
- if (!GST_COLLECT_PADS2_STATE_IS_SET (data, GST_COLLECT_PADS2_STATE_LOCKED) &&
- (GST_COLLECT_PADS2_STATE_IS_SET (data, GST_COLLECT_PADS2_STATE_WAITING) !=
+ if (!GST_COLLECT_PADS_STATE_IS_SET (data, GST_COLLECT_PADS_STATE_LOCKED) &&
+ (GST_COLLECT_PADS_STATE_IS_SET (data, GST_COLLECT_PADS_STATE_WAITING) !=
! !waiting)) {
/* Set waiting state for this pad */
if (waiting)
- GST_COLLECT_PADS2_STATE_SET (data, GST_COLLECT_PADS2_STATE_WAITING);
+ GST_COLLECT_PADS_STATE_SET (data, GST_COLLECT_PADS_STATE_WAITING);
else
- GST_COLLECT_PADS2_STATE_UNSET (data, GST_COLLECT_PADS2_STATE_WAITING);
+ GST_COLLECT_PADS_STATE_UNSET (data, GST_COLLECT_PADS_STATE_WAITING);
/* Update number of queued pads if needed */
if (!data->buffer &&
- !GST_COLLECT_PADS2_STATE_IS_SET (data, GST_COLLECT_PADS2_STATE_EOS)) {
+ !GST_COLLECT_PADS_STATE_IS_SET (data, GST_COLLECT_PADS_STATE_EOS)) {
if (waiting)
pads->priv->queuedpads--;
else
@@ -1303,7 +1347,7 @@ gst_collect_pads2_set_waiting (GstCollectPads2 * pads, GstCollectData2 * data,
}
/* signal waiters because something changed */
- GST_COLLECT_PADS2_EVT_BROADCAST (pads);
+ GST_COLLECT_PADS_EVT_BROADCAST (pads);
}
}
@@ -1317,7 +1361,7 @@ gst_collect_pads2_set_waiting (GstCollectPads2 * pads, GstCollectData2 * data,
* Must be called with STREAM_LOCK.
*/
static void
-gst_collect_pads2_check_pads (GstCollectPads2 * pads)
+gst_collect_pads_check_pads (GstCollectPads * pads)
{
/* the master list and cookie are protected with LOCK */
GST_OBJECT_LOCK (pads);
@@ -1339,15 +1383,15 @@ gst_collect_pads2_check_pads (GstCollectPads2 * pads)
/* loop over the master pad list */
collected = pads->priv->pad_list;
for (; collected; collected = g_slist_next (collected)) {
- GstCollectData2 *data;
+ GstCollectData *data;
/* update the stats */
pads->priv->numpads++;
data = collected->data;
- if (GST_COLLECT_PADS2_STATE_IS_SET (data, GST_COLLECT_PADS2_STATE_EOS))
+ if (GST_COLLECT_PADS_STATE_IS_SET (data, GST_COLLECT_PADS_STATE_EOS))
pads->priv->eospads++;
- else if (data->buffer || !GST_COLLECT_PADS2_STATE_IS_SET (data,
- GST_COLLECT_PADS2_STATE_WAITING))
+ else if (data->buffer || !GST_COLLECT_PADS_STATE_IS_SET (data,
+ GST_COLLECT_PADS_STATE_WAITING))
pads->priv->queuedpads++;
/* add to the list of pads to collect */
@@ -1368,13 +1412,13 @@ gst_collect_pads2_check_pads (GstCollectPads2 * pads)
* Returns: The #GstFlowReturn of collection.
*/
static GstFlowReturn
-gst_collect_pads2_check_collected (GstCollectPads2 * pads)
+gst_collect_pads_check_collected (GstCollectPads * pads)
{
GstFlowReturn flow_ret = GST_FLOW_OK;
- GstCollectPads2Function func;
+ GstCollectPadsFunction func;
gpointer user_data;
- g_return_val_if_fail (GST_IS_COLLECT_PADS2 (pads), GST_FLOW_ERROR);
+ g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), GST_FLOW_ERROR);
GST_OBJECT_LOCK (pads);
func = pads->priv->func;
@@ -1384,7 +1428,7 @@ gst_collect_pads2_check_collected (GstCollectPads2 * pads)
g_return_val_if_fail (pads->priv->func != NULL, GST_FLOW_NOT_SUPPORTED);
/* check for new pads, update stats etc.. */
- gst_collect_pads2_check_pads (pads);
+ gst_collect_pads_check_pads (pads);
if (G_UNLIKELY (pads->priv->eospads == pads->priv->numpads)) {
/* If all our pads are EOS just collect once to let the element
@@ -1438,7 +1482,7 @@ gst_collect_pads2_check_collected (GstCollectPads2 * pads)
* (from non-waiting state).
*/
static gboolean
-gst_collect_pads2_recalculate_waiting (GstCollectPads2 * pads)
+gst_collect_pads_recalculate_waiting (GstCollectPads * pads)
{
GSList *collected;
gboolean result = FALSE;
@@ -1448,16 +1492,20 @@ gst_collect_pads2_recalculate_waiting (GstCollectPads2 * pads)
return FALSE;
for (collected = pads->data; collected; collected = g_slist_next (collected)) {
- GstCollectData2 *data = (GstCollectData2 *) collected->data;
+ GstCollectData *data = (GstCollectData *) collected->data;
int cmp_res;
/* check if pad has a segment */
- if (data->segment.format == GST_FORMAT_UNDEFINED)
- continue;
+ if (data->segment.format == GST_FORMAT_UNDEFINED) {
+ GST_WARNING_OBJECT (pads,
+ "GstCollectPads has no time segment, assuming 0 based.");
+ gst_segment_init (&data->segment, GST_FORMAT_TIME);
+ GST_COLLECT_PADS_STATE_SET (data, GST_COLLECT_PADS_STATE_NEW_SEGMENT);
+ }
/* check segment format */
if (data->segment.format != GST_FORMAT_TIME) {
- GST_ERROR_OBJECT (pads, "GstCollectPads2 can handle only time segments.");
+ GST_ERROR_OBJECT (pads, "GstCollectPads can handle only time segments.");
continue;
}
@@ -1467,12 +1515,11 @@ gst_collect_pads2_recalculate_waiting (GstCollectPads2 * pads)
pads->priv->compare_user_data);
if (cmp_res > 0)
/* stop waiting */
- gst_collect_pads2_set_waiting (pads, data, FALSE);
+ gst_collect_pads_set_waiting (pads, data, FALSE);
else {
- if (!GST_COLLECT_PADS2_STATE_IS_SET (data,
- GST_COLLECT_PADS2_STATE_WAITING)) {
+ if (!GST_COLLECT_PADS_STATE_IS_SET (data, GST_COLLECT_PADS_STATE_WAITING)) {
/* start waiting */
- gst_collect_pads2_set_waiting (pads, data, TRUE);
+ gst_collect_pads_set_waiting (pads, data, TRUE);
result = TRUE;
}
}
@@ -1482,13 +1529,13 @@ gst_collect_pads2_recalculate_waiting (GstCollectPads2 * pads)
}
/**
- * gst_collect_pads2_find_best_pad:
+ * gst_collect_pads_find_best_pad:
* @pads: the collectpads to use
* @data: returns the collectdata for earliest data
* @time: returns the earliest available buffertime
*
* Find the oldest/best pad, i.e. pad holding the oldest buffer and
- * and return the corresponding #GstCollectData2 and buffertime.
+ * and return the corresponding #GstCollectData and buffertime.
*
* This function should be called with STREAM_LOCK held,
* such as in the callback.
@@ -1496,11 +1543,11 @@ gst_collect_pads2_recalculate_waiting (GstCollectPads2 * pads)
* Since: 0.10.36
*/
static void
-gst_collect_pads2_find_best_pad (GstCollectPads2 * pads,
- GstCollectData2 ** data, GstClockTime * time)
+gst_collect_pads_find_best_pad (GstCollectPads * pads,
+ GstCollectData ** data, GstClockTime * time)
{
GSList *collected;
- GstCollectData2 *best = NULL;
+ GstCollectData *best = NULL;
GstClockTime best_time = GST_CLOCK_TIME_NONE;
g_return_if_fail (data != NULL);
@@ -1508,10 +1555,10 @@ gst_collect_pads2_find_best_pad (GstCollectPads2 * pads,
for (collected = pads->data; collected; collected = g_slist_next (collected)) {
GstBuffer *buffer;
- GstCollectData2 *data = (GstCollectData2 *) collected->data;
+ GstCollectData *data = (GstCollectData *) collected->data;
GstClockTime timestamp;
- buffer = gst_collect_pads2_peek (pads, data);
+ buffer = gst_collect_pads_peek (pads, data);
/* if we have a buffer check if it is better then the current best one */
if (buffer != NULL) {
timestamp = GST_BUFFER_TIMESTAMP (buffer);
@@ -1529,43 +1576,43 @@ gst_collect_pads2_find_best_pad (GstCollectPads2 * pads,
*time = best_time;
GST_DEBUG_OBJECT (pads, "best pad %s, best time %" GST_TIME_FORMAT,
- best ? GST_PAD_NAME (((GstCollectData2 *) best)->pad) : "(nil)",
+ best ? GST_PAD_NAME (((GstCollectData *) best)->pad) : "(nil)",
GST_TIME_ARGS (best_time));
}
/*
* Function to recalculate earliest_data and earliest_timestamp. This also calls
- * gst_collect_pads2_recalculate_waiting
+ * gst_collect_pads_recalculate_waiting
*
* Must be called with STREAM_LOCK.
*/
static gboolean
-gst_collect_pads2_recalculate_full (GstCollectPads2 * pads)
+gst_collect_pads_recalculate_full (GstCollectPads * pads)
{
if (pads->priv->earliest_data)
unref_data (pads->priv->earliest_data);
- gst_collect_pads2_find_best_pad (pads, &pads->priv->earliest_data,
+ gst_collect_pads_find_best_pad (pads, &pads->priv->earliest_data,
&pads->priv->earliest_time);
if (pads->priv->earliest_data)
ref_data (pads->priv->earliest_data);
- return gst_collect_pads2_recalculate_waiting (pads);
+ return gst_collect_pads_recalculate_waiting (pads);
}
/*
- * Default collect callback triggered when #GstCollectPads2 gathered all data.
+ * Default collect callback triggered when #GstCollectPads gathered all data.
*
* Called with STREAM_LOCK.
*/
static GstFlowReturn
-gst_collect_pads2_default_collected (GstCollectPads2 * pads, gpointer user_data)
+gst_collect_pads_default_collected (GstCollectPads * pads, gpointer user_data)
{
- GstCollectData2 *best = NULL;
+ GstCollectData *best = NULL;
GstBuffer *buffer;
GstFlowReturn ret = GST_FLOW_OK;
- GstCollectPads2BufferFunction func;
+ GstCollectPadsBufferFunction func;
gpointer buffer_user_data;
- g_return_val_if_fail (GST_IS_COLLECT_PADS2 (pads), GST_FLOW_ERROR);
+ g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), GST_FLOW_ERROR);
GST_OBJECT_LOCK (pads);
func = pads->priv->buffer_func;
@@ -1575,7 +1622,7 @@ gst_collect_pads2_default_collected (GstCollectPads2 * pads, gpointer user_data)
g_return_val_if_fail (func != NULL, GST_FLOW_NOT_SUPPORTED);
/* Find the oldest pad at all cost */
- if (gst_collect_pads2_recalculate_full (pads)) {
+ if (gst_collect_pads_recalculate_full (pads)) {
/* waiting was switched on,
* so give another thread a chance to deliver a possibly
* older buffer; don't charge on yet with the current oldest */
@@ -1596,16 +1643,16 @@ gst_collect_pads2_default_collected (GstCollectPads2 * pads, gpointer user_data)
/* make sure that the pad we take a buffer from is waiting;
* otherwise popping a buffer will seem not to have happened
* and collectpads can get into a busy loop */
- gst_collect_pads2_set_waiting (pads, best, TRUE);
+ gst_collect_pads_set_waiting (pads, best, TRUE);
/* Send buffer */
- buffer = gst_collect_pads2_pop (pads, best);
+ buffer = gst_collect_pads_pop (pads, best);
ret = func (pads, best, buffer, buffer_user_data);
/* maybe non-waiting was forced to waiting above due to
* newsegment events coming too sparsely,
* so re-check to restore state to avoid hanging/waiting */
- gst_collect_pads2_recalculate_full (pads);
+ gst_collect_pads_recalculate_full (pads);
done:
return ret;
@@ -1615,9 +1662,9 @@ done:
* Default timestamp compare function.
*/
static gint
-gst_collect_pads2_default_compare_func (GstCollectPads2 * pads,
- GstCollectData2 * data1, GstClockTime timestamp1,
- GstCollectData2 * data2, GstClockTime timestamp2, gpointer user_data)
+gst_collect_pads_default_compare_func (GstCollectPads * pads,
+ GstCollectData * data1, GstClockTime timestamp1,
+ GstCollectData * data2, GstClockTime timestamp2, gpointer user_data)
{
GST_LOG_OBJECT (pads, "comparing %" GST_TIME_FORMAT
@@ -1640,59 +1687,54 @@ gst_collect_pads2_default_compare_func (GstCollectPads2 * pads,
return 0;
}
-static gboolean
-gst_collect_pads2_event (GstPad * pad, GstObject * parent, GstEvent * event)
+/**
+ * gst_collect_pads_event_default:
+ * @pads: the collectspads to use
+ * @data: collect data of corresponding pad
+ * @event: event being processed
+ * @discard: process but do not send event downstream
+ *
+ * Default GstCollectPads event handling that elements should always
+ * chain up to to ensure proper operation. Element might however indicate
+ * event should not be forwarded downstream.
+ *
+ * Since: 0.11.x
+ */
+gboolean
+gst_collect_pads_event_default (GstCollectPads * pads, GstCollectData * data,
+ GstEvent * event, gboolean discard)
{
- gboolean res = FALSE, need_unlock = FALSE;
- GstCollectData2 *data;
- GstCollectPads2 *pads;
- GstCollectPads2EventFunction event_func;
- GstCollectPads2BufferFunction buffer_func;
- gpointer event_user_data;
-
- /* some magic to get the managing collect_pads2 */
- GST_OBJECT_LOCK (pad);
- data = (GstCollectData2 *) gst_pad_get_element_private (pad);
- if (G_UNLIKELY (data == NULL))
- goto pad_removed;
- ref_data (data);
- GST_OBJECT_UNLOCK (pad);
-
- res = FALSE;
-
- pads = data->collect;
-
- GST_DEBUG_OBJECT (data->pad, "Got %s event on sink pad",
- GST_EVENT_TYPE_NAME (event));
+ gboolean res = TRUE;
+ GstCollectPadsBufferFunction buffer_func;
+ GstObject *parent;
+ GstPad *pad;
GST_OBJECT_LOCK (pads);
- event_func = pads->priv->event_func;
- event_user_data = pads->priv->event_user_data;
buffer_func = pads->priv->buffer_func;
GST_OBJECT_UNLOCK (pads);
+ pad = data->pad;
+ parent = GST_OBJECT_PARENT (pad);
+
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_START:
{
/* forward event to unblock check_collected */
- if (event_func) {
- res = event_func (pads, data, event, event_user_data);
- } else {
- GST_DEBUG_OBJECT (pad, "forwarding flush start");
- res = gst_pad_event_default (pad, parent, event);
- }
+ GST_DEBUG_OBJECT (pad, "forwarding flush start");
+ res = gst_pad_event_default (pad, parent, event);
+ event = NULL;
/* now unblock the chain function.
- * no cond per pad, so they all unblock,
+ * no cond per pad, so they all unblock,
* non-flushing block again */
- GST_COLLECT_PADS2_STREAM_LOCK (pads);
- GST_COLLECT_PADS2_STATE_SET (data, GST_COLLECT_PADS2_STATE_FLUSHING);
- gst_collect_pads2_clear (pads, data);
+ GST_COLLECT_PADS_STREAM_LOCK (pads);
+ GST_COLLECT_PADS_STATE_SET (data, GST_COLLECT_PADS_STATE_FLUSHING);
+ gst_collect_pads_clear (pads, data);
/* cater for possible default muxing functionality */
if (buffer_func) {
/* restore to initial state */
- gst_collect_pads2_set_waiting (pads, data, TRUE);
+ gst_collect_pads_set_waiting (pads, data, TRUE);
/* if the current pad is affected, reset state, recalculate later */
if (pads->priv->earliest_data == data) {
unref_data (data);
@@ -1701,84 +1743,81 @@ gst_collect_pads2_event (GstPad * pad, GstObject * parent, GstEvent * event)
}
}
- GST_COLLECT_PADS2_STREAM_UNLOCK (pads);
+ GST_COLLECT_PADS_STREAM_UNLOCK (pads);
- /* event already cleaned up by forwarding */
- res = TRUE;
- goto done;
+ goto eat;
}
case GST_EVENT_FLUSH_STOP:
{
/* flush the 1 buffer queue */
- GST_COLLECT_PADS2_STREAM_LOCK (pads);
- GST_COLLECT_PADS2_STATE_UNSET (data, GST_COLLECT_PADS2_STATE_FLUSHING);
- gst_collect_pads2_clear (pads, data);
+ GST_COLLECT_PADS_STREAM_LOCK (pads);
+ GST_COLLECT_PADS_STATE_UNSET (data, GST_COLLECT_PADS_STATE_FLUSHING);
+ gst_collect_pads_clear (pads, data);
/* we need new segment info after the flush */
gst_segment_init (&data->segment, GST_FORMAT_UNDEFINED);
- GST_COLLECT_PADS2_STATE_UNSET (data, GST_COLLECT_PADS2_STATE_NEW_SEGMENT);
+ GST_COLLECT_PADS_STATE_UNSET (data, GST_COLLECT_PADS_STATE_NEW_SEGMENT);
/* if the pad was EOS, remove the EOS flag and
* decrement the number of eospads */
- if (G_UNLIKELY (GST_COLLECT_PADS2_STATE_IS_SET (data,
- GST_COLLECT_PADS2_STATE_EOS))) {
- if (!GST_COLLECT_PADS2_STATE_IS_SET (data,
- GST_COLLECT_PADS2_STATE_WAITING))
+ if (G_UNLIKELY (GST_COLLECT_PADS_STATE_IS_SET (data,
+ GST_COLLECT_PADS_STATE_EOS))) {
+ if (!GST_COLLECT_PADS_STATE_IS_SET (data,
+ GST_COLLECT_PADS_STATE_WAITING))
pads->priv->queuedpads++;
pads->priv->eospads--;
- GST_COLLECT_PADS2_STATE_UNSET (data, GST_COLLECT_PADS2_STATE_EOS);
+ GST_COLLECT_PADS_STATE_UNSET (data, GST_COLLECT_PADS_STATE_EOS);
}
- GST_COLLECT_PADS2_STREAM_UNLOCK (pads);
+ GST_COLLECT_PADS_STREAM_UNLOCK (pads);
- /* forward event */
- goto forward_or_default;
+ goto forward;
}
case GST_EVENT_EOS:
{
- GST_COLLECT_PADS2_STREAM_LOCK (pads);
+ GST_COLLECT_PADS_STREAM_LOCK (pads);
/* if the pad was not EOS, make it EOS and so we
* have one more eospad */
- if (G_LIKELY (!GST_COLLECT_PADS2_STATE_IS_SET (data,
- GST_COLLECT_PADS2_STATE_EOS))) {
- GST_COLLECT_PADS2_STATE_SET (data, GST_COLLECT_PADS2_STATE_EOS);
- if (!GST_COLLECT_PADS2_STATE_IS_SET (data,
- GST_COLLECT_PADS2_STATE_WAITING))
+ if (G_LIKELY (!GST_COLLECT_PADS_STATE_IS_SET (data,
+ GST_COLLECT_PADS_STATE_EOS))) {
+ GST_COLLECT_PADS_STATE_SET (data, GST_COLLECT_PADS_STATE_EOS);
+ if (!GST_COLLECT_PADS_STATE_IS_SET (data,
+ GST_COLLECT_PADS_STATE_WAITING))
pads->priv->queuedpads--;
pads->priv->eospads++;
}
/* check if we need collecting anything, we ignore the result. */
- gst_collect_pads2_check_collected (pads);
- GST_COLLECT_PADS2_STREAM_UNLOCK (pads);
+ gst_collect_pads_check_collected (pads);
+ GST_COLLECT_PADS_STREAM_UNLOCK (pads);
- goto forward_or_eat;
+ goto eat;
}
case GST_EVENT_SEGMENT:
{
GstSegment seg;
gint cmp_res;
- GST_COLLECT_PADS2_STREAM_LOCK (pads);
+ GST_COLLECT_PADS_STREAM_LOCK (pads);
gst_event_copy_segment (event, &seg);
GST_DEBUG_OBJECT (data->pad, "got segment %" GST_SEGMENT_FORMAT, &seg);
+ /* default collection can not handle other segment formats than time */
+ if (buffer_func && seg.format != GST_FORMAT_TIME) {
+ GST_WARNING_OBJECT (pads, "GstCollectPads default collecting "
+ "can only handle time segments. Non time segment ignored.");
+ goto newsegment_done;
+ }
+
data->segment = seg;
- GST_COLLECT_PADS2_STATE_SET (data, GST_COLLECT_PADS2_STATE_NEW_SEGMENT);
+ GST_COLLECT_PADS_STATE_SET (data, GST_COLLECT_PADS_STATE_NEW_SEGMENT);
/* default muxing functionality */
if (!buffer_func)
goto newsegment_done;
- /* default collection can not handle other segment formats than time */
- if (seg.format != GST_FORMAT_TIME) {
- GST_ERROR_OBJECT (pads, "GstCollectPads2 default collecting "
- "can only handle time segments.");
- goto newsegment_done;
- }
-
/* If oldest time is not known, or current pad got newsegment;
* recalculate the state */
if (!pads->priv->earliest_data || pads->priv->earliest_data == data) {
- gst_collect_pads2_recalculate_full (pads);
+ gst_collect_pads_recalculate_full (pads);
goto newsegment_done;
}
@@ -1790,54 +1829,188 @@ gst_collect_pads2_event (GstPad * pad, GstObject * parent, GstEvent * event)
if (cmp_res > 0)
/* Stop waiting */
- gst_collect_pads2_set_waiting (pads, data, FALSE);
+ gst_collect_pads_set_waiting (pads, data, FALSE);
newsegment_done:
- GST_COLLECT_PADS2_STREAM_UNLOCK (pads);
+ GST_COLLECT_PADS_STREAM_UNLOCK (pads);
/* we must not forward this event since multiple segments will be
* accumulated and this is certainly not what we want. */
- goto forward_or_eat;
+ goto eat;
}
case GST_EVENT_CAPS:
case GST_EVENT_STREAM_START:
case GST_EVENT_STREAM_CONFIG:
- goto forward_or_eat;
+ goto eat;
default:
/* forward other events */
- goto forward_or_default;
+ goto forward;
}
-forward_or_default:
+eat:
+ if (event)
+ gst_event_unref (event);
+ return res;
+
+forward:
+ if (discard)
+ goto eat;
+ else
+ return gst_pad_event_default (pad, parent, event);
+}
+
+static gboolean
+gst_collect_pads_event_default_internal (GstCollectPads * pads,
+ GstCollectData * data, GstEvent * event, gpointer user_data)
+{
+ return gst_collect_pads_event_default (pads, data, event, FALSE);
+}
+
+static gboolean
+gst_collect_pads_event (GstPad * pad, GstObject * parent, GstEvent * event)
+{
+ gboolean res = FALSE, need_unlock = FALSE;
+ GstCollectData *data;
+ GstCollectPads *pads;
+ GstCollectPadsEventFunction event_func;
+ gpointer event_user_data;
+
+ /* some magic to get the managing collect_pads */
+ GST_OBJECT_LOCK (pad);
+ data = (GstCollectData *) gst_pad_get_element_private (pad);
+ if (G_UNLIKELY (data == NULL))
+ goto pad_removed;
+ ref_data (data);
+ GST_OBJECT_UNLOCK (pad);
+
+ res = FALSE;
+
+ pads = data->collect;
+
+ GST_DEBUG_OBJECT (data->pad, "Got %s event on sink pad",
+ GST_EVENT_TYPE_NAME (event));
+
+ GST_OBJECT_LOCK (pads);
+ event_func = pads->priv->event_func;
+ event_user_data = pads->priv->event_user_data;
+ GST_OBJECT_UNLOCK (pads);
+
if (GST_EVENT_IS_SERIALIZED (event)) {
- GST_COLLECT_PADS2_STREAM_LOCK (pads);
+ GST_COLLECT_PADS_STREAM_LOCK (pads);
need_unlock = TRUE;
}
- if (event_func) {
+
+ if (G_LIKELY (event_func)) {
res = event_func (pads, data, event, event_user_data);
- } else {
- GST_DEBUG_OBJECT (pad, "forwarding %s", GST_EVENT_TYPE_NAME (event));
- res = gst_pad_event_default (pad, parent, event);
}
+
if (need_unlock)
- GST_COLLECT_PADS2_STREAM_UNLOCK (pads);
- goto done;
+ GST_COLLECT_PADS_STREAM_UNLOCK (pads);
-forward_or_eat:
- if (GST_EVENT_IS_SERIALIZED (event)) {
- GST_COLLECT_PADS2_STREAM_LOCK (pads);
+ unref_data (data);
+ return res;
+
+ /* ERRORS */
+pad_removed:
+ {
+ GST_DEBUG ("%s got removed from collectpads", GST_OBJECT_NAME (pad));
+ GST_OBJECT_UNLOCK (pad);
+ return FALSE;
+ }
+}
+
+/**
+ * gst_collect_pads_query_default:
+ * @pads: the collectspads to use
+ * @data: collect data of corresponding pad
+ * @query: query being processed
+ * @discard: process but do not send event downstream
+ *
+ * Default GstCollectPads query handling that elements should always
+ * chain up to to ensure proper operation. Element might however indicate
+ * query should not be forwarded downstream.
+ *
+ * Since: 0.11.x
+ */
+gboolean
+gst_collect_pads_query_default (GstCollectPads * pads, GstCollectData * data,
+ GstQuery * query, gboolean discard)
+{
+ gboolean res = TRUE;
+ GstObject *parent;
+ GstPad *pad;
+
+ pad = data->pad;
+ parent = GST_OBJECT_PARENT (pad);
+
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_SEEKING:
+ {
+ GstFormat format;
+
+ /* don't pass it along as some (file)sink might claim it does
+ * whereas with a collectpads in between that will not likely work */
+ gst_query_parse_seeking (query, &format, NULL, NULL, NULL);
+ gst_query_set_seeking (query, format, FALSE, 0, -1);
+ res = TRUE;
+ discard = TRUE;
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (!discard)
+ return gst_pad_query_default (pad, parent, query);
+ else
+ return res;
+}
+
+static gboolean
+gst_collect_pads_query_default_internal (GstCollectPads * pads,
+ GstCollectData * data, GstQuery * query, gpointer user_data)
+{
+ return gst_collect_pads_query_default (pads, data, query, FALSE);
+}
+
+static gboolean
+gst_collect_pads_query (GstPad * pad, GstObject * parent, GstQuery * query)
+{
+ gboolean res = FALSE, need_unlock = FALSE;
+ GstCollectData *data;
+ GstCollectPads *pads;
+ GstCollectPadsQueryFunction query_func;
+ gpointer query_user_data;
+
+ GST_DEBUG_OBJECT (pad, "Got %s query on sink pad",
+ GST_QUERY_TYPE_NAME (query));
+
+ /* some magic to get the managing collect_pads */
+ GST_OBJECT_LOCK (pad);
+ data = (GstCollectData *) gst_pad_get_element_private (pad);
+ if (G_UNLIKELY (data == NULL))
+ goto pad_removed;
+ ref_data (data);
+ GST_OBJECT_UNLOCK (pad);
+
+ pads = data->collect;
+
+ GST_OBJECT_LOCK (pads);
+ query_func = pads->priv->query_func;
+ query_user_data = pads->priv->query_user_data;
+ GST_OBJECT_UNLOCK (pads);
+
+ if (GST_QUERY_IS_SERIALIZED (query)) {
+ GST_COLLECT_PADS_STREAM_LOCK (pads);
need_unlock = TRUE;
}
- if (event_func) {
- res = event_func (pads, data, event, event_user_data);
- } else {
- gst_event_unref (event);
- res = TRUE;
+
+ if (G_LIKELY (query_func)) {
+ res = query_func (pads, data, query, query_user_data);
}
+
if (need_unlock)
- GST_COLLECT_PADS2_STREAM_UNLOCK (pads);
- goto done;
+ GST_COLLECT_PADS_STREAM_UNLOCK (pads);
-done:
unref_data (data);
return res;
@@ -1850,6 +2023,7 @@ pad_removed:
}
}
+
/* For each buffer we receive we check if our collected condition is reached
* and if so we call the collected function. When this is done we check if
* data has been unqueued. If data is still queued we wait holding the stream
@@ -1857,19 +2031,19 @@ pad_removed:
* collected
*/
static GstFlowReturn
-gst_collect_pads2_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
+gst_collect_pads_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
{
- GstCollectData2 *data;
- GstCollectPads2 *pads;
+ GstCollectData *data;
+ GstCollectPads *pads;
GstFlowReturn ret;
GstBuffer **buffer_p;
guint32 cookie;
GST_DEBUG ("Got buffer for pad %s:%s", GST_DEBUG_PAD_NAME (pad));
- /* some magic to get the managing collect_pads2 */
+ /* some magic to get the managing collect_pads */
GST_OBJECT_LOCK (pad);
- data = (GstCollectData2 *) gst_pad_get_element_private (pad);
+ data = (GstCollectData *) gst_pad_get_element_private (pad);
if (G_UNLIKELY (data == NULL))
goto no_data;
ref_data (data);
@@ -1877,17 +2051,17 @@ gst_collect_pads2_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
pads = data->collect;
- GST_COLLECT_PADS2_STREAM_LOCK (pads);
+ GST_COLLECT_PADS_STREAM_LOCK (pads);
/* if not started, bail out */
if (G_UNLIKELY (!pads->priv->started))
goto not_started;
/* check if this pad is flushing */
- if (G_UNLIKELY (GST_COLLECT_PADS2_STATE_IS_SET (data,
- GST_COLLECT_PADS2_STATE_FLUSHING)))
+ if (G_UNLIKELY (GST_COLLECT_PADS_STATE_IS_SET (data,
+ GST_COLLECT_PADS_STATE_FLUSHING)))
goto flushing;
/* pad was EOS, we can refuse this data */
- if (G_UNLIKELY (GST_COLLECT_PADS2_STATE_IS_SET (data,
- GST_COLLECT_PADS2_STATE_EOS)))
+ if (G_UNLIKELY (GST_COLLECT_PADS_STATE_IS_SET (data,
+ GST_COLLECT_PADS_STATE_EOS)))
goto eos;
/* see if we need to clip */
@@ -1911,7 +2085,7 @@ gst_collect_pads2_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
GST_DEBUG_PAD_NAME (pad));
/* One more pad has data queued */
- if (GST_COLLECT_PADS2_STATE_IS_SET (data, GST_COLLECT_PADS2_STATE_WAITING))
+ if (GST_COLLECT_PADS_STATE_IS_SET (data, GST_COLLECT_PADS_STATE_WAITING))
pads->priv->queuedpads++;
buffer_p = &data->buffer;
gst_buffer_replace (buffer_p, buffer);
@@ -1928,7 +2102,7 @@ gst_collect_pads2_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
do {
/* Check if our collected condition is matched and call the collected
* function if it is */
- ret = gst_collect_pads2_check_collected (pads);
+ ret = gst_collect_pads_check_collected (pads);
/* when an error occurs, we want to report this back to the caller ASAP
* without having to block if the buffer was not popped */
if (G_UNLIKELY (ret != GST_FLOW_OK))
@@ -1944,7 +2118,7 @@ gst_collect_pads2_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
* point. Putting it here also makes this thread ignores any evt it raised
* itself (as is a usual WAIT semantic).
*/
- GST_COLLECT_PADS2_EVT_INIT (cookie);
+ GST_COLLECT_PADS_EVT_INIT (cookie);
/* pad could be removed and re-added */
unref_data (data);
@@ -1962,9 +2136,9 @@ gst_collect_pads2_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
* can get stopped or flushed as well. We can however not get EOS
* because we still hold the STREAM_LOCK.
*/
- GST_COLLECT_PADS2_STREAM_UNLOCK (pads);
- GST_COLLECT_PADS2_EVT_WAIT (pads, cookie);
- GST_COLLECT_PADS2_STREAM_LOCK (pads);
+ GST_COLLECT_PADS_STREAM_UNLOCK (pads);
+ GST_COLLECT_PADS_EVT_WAIT (pads, cookie);
+ GST_COLLECT_PADS_STREAM_LOCK (pads);
GST_DEBUG_OBJECT (pads, "Pad %s:%s resuming", GST_DEBUG_PAD_NAME (pad));
@@ -1972,14 +2146,14 @@ gst_collect_pads2_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
if (G_UNLIKELY (!pads->priv->started))
goto not_started;
/* check if this pad is flushing */
- if (G_UNLIKELY (GST_COLLECT_PADS2_STATE_IS_SET (data,
- GST_COLLECT_PADS2_STATE_FLUSHING)))
+ if (G_UNLIKELY (GST_COLLECT_PADS_STATE_IS_SET (data,
+ GST_COLLECT_PADS_STATE_FLUSHING)))
goto flushing;
}
while (data->buffer != NULL);
unlock_done:
- GST_COLLECT_PADS2_STREAM_UNLOCK (pads);
+ GST_COLLECT_PADS_STREAM_UNLOCK (pads);
unref_data (data);
if (buffer)
gst_buffer_unref (buffer);
@@ -2003,14 +2177,14 @@ no_data:
not_started:
{
GST_DEBUG ("not started");
- gst_collect_pads2_clear (pads, data);
+ gst_collect_pads_clear (pads, data);
ret = GST_FLOW_FLUSHING;
goto unlock_done;
}
flushing:
{
GST_DEBUG ("pad %s:%s is flushing", GST_DEBUG_PAD_NAME (pad));
- gst_collect_pads2_clear (pads, data);
+ gst_collect_pads_clear (pads, data);
ret = GST_FLOW_FLUSHING;
goto unlock_done;
}
@@ -2033,7 +2207,7 @@ error:
/* we print the error, the element should post a reasonable error
* message for fatal errors */
GST_DEBUG ("collect failed, reason %d (%s)", ret, gst_flow_get_name (ret));
- gst_collect_pads2_clear (pads, data);
+ gst_collect_pads_clear (pads, data);
goto unlock_done;
}
}
diff --git a/libs/gst/base/gstcollectpads.h b/libs/gst/base/gstcollectpads.h
new file mode 100644
index 0000000..b4dfa75
--- /dev/null
+++ b/libs/gst/base/gstcollectpads.h
@@ -0,0 +1,396 @@
+/* GStreamer
+ * Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
+ * Copyright (C) 2008 Mark Nauwelaerts <mnauw@users.sourceforge.net>
+ *
+ * gstcollectpads.h:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_COLLECT_PADS_H__
+#define __GST_COLLECT_PADS_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_COLLECT_PADS (gst_collect_pads_get_type())
+#define GST_COLLECT_PADS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_COLLECT_PADS,GstCollectPads))
+#define GST_COLLECT_PADS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_COLLECT_PADS,GstCollectPadsClass))
+#define GST_COLLECT_PADS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_COLLECT_PADS,GstCollectPadsClass))
+#define GST_IS_COLLECT_PADS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_COLLECT_PADS))
+#define GST_IS_COLLECT_PADS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_COLLECT_PADS))
+
+typedef struct _GstCollectData GstCollectData;
+typedef struct _GstCollectDataPrivate GstCollectDataPrivate;
+typedef struct _GstCollectPads GstCollectPads;
+typedef struct _GstCollectPadsPrivate GstCollectPadsPrivate;
+typedef struct _GstCollectPadsClass GstCollectPadsClass;
+
+/**
+ * GstCollectDataDestroyNotify:
+ * @data: the #GstCollectData that will be freed
+ *
+ * A function that will be called when the #GstCollectData will be freed.
+ * It is passed the pointer to the structure and should free any custom
+ * memory and resources allocated for it.
+ *
+ * Since: 0.10.36
+ */
+typedef void (*GstCollectDataDestroyNotify) (GstCollectData *data);
+
+/**
+ * GstCollectPadsStateFlags:
+ * @GST_COLLECT_PADS_STATE_EOS: Set if collectdata's pad is EOS.
+ * @GST_COLLECT_PADS_STATE_FLUSHING: Set if collectdata's pad is flushing.
+ * @GST_COLLECT_PADS_STATE_NEW_SEGMENT: Set if collectdata's pad received a
+ * new_segment event.
+ * @GST_COLLECT_PADS_STATE_WAITING: Set if collectdata's pad must be waited
+ * for when collecting.
+ * @GST_COLLECT_PADS_STATE_LOCKED: Set collectdata's pad WAITING state must
+ * not be changed.
+ * #GstCollectPadsStateFlags indicate private state of a collectdata('s pad).
+ *
+ * Since: 0.10.36
+ */
+typedef enum {
+ GST_COLLECT_PADS_STATE_EOS = 1 << 0,
+ GST_COLLECT_PADS_STATE_FLUSHING = 1 << 1,
+ GST_COLLECT_PADS_STATE_NEW_SEGMENT = 1 << 2,
+ GST_COLLECT_PADS_STATE_WAITING = 1 << 3,
+ GST_COLLECT_PADS_STATE_LOCKED = 1 << 4
+} GstCollectPadsStateFlags;
+
+/**
+ * GST_COLLECT_PADS_STATE:
+ * @data: a #GstCollectData.
+ *
+ * A flags word containing #GstCollectPadsStateFlags flags set
+ * on this collected pad.
+ *
+ * Since: 0.10.36
+ */
+#define GST_COLLECT_PADS_STATE(data) (((GstCollectData *) data)->state)
+/**
+ * GST_COLLECT_PADS_STATE_IS_SET:
+ * @data: a #GstCollectData.
+ * @flag: the #GstCollectPadsStateFlags to check.
+ *
+ * Gives the status of a specific flag on a collected pad.
+ *
+ * Since: 0.10.36
+ */
+#define GST_COLLECT_PADS_STATE_IS_SET(data,flag) !!(GST_COLLECT_PADS_STATE (data) & flag)
+/**
+ * GST_COLLECT_PADS_STATE_SET:
+ * @data: a #GstCollectData.
+ * @flag: the #GstCollectPadsStateFlags to set.
+ *
+ * Sets a state flag on a collected pad.
+ *
+ * Since: 0.10.36
+ */
+#define GST_COLLECT_PADS_STATE_SET(data,flag) (GST_COLLECT_PADS_STATE (data) |= flag)
+/**
+ * GST_COLLECT_PADS_STATE_UNSET:
+ * @data: a #GstCollectData.
+ * @flag: the #GstCollectPadsStateFlags to clear.
+ *
+ * Clears a state flag on a collected pad.
+ *
+ * Since: 0.10.36
+ */
+#define GST_COLLECT_PADS_STATE_UNSET(data,flag) (GST_COLLECT_PADS_STATE (data) &= ~(flag))
+
+/**
+ * GstCollectData:
+ * @collect: owner #GstCollectPads
+ * @pad: #GstPad managed by this data
+ * @buffer: currently queued buffer.
+ * @pos: position in the buffer
+ * @segment: last segment received.
+ *
+ * Structure used by the collect_pads.
+ *
+ * Since: 0.10.36
+ */
+struct _GstCollectData
+{
+ /* with STREAM_LOCK of @collect */
+ GstCollectPads *collect;
+ GstPad *pad;
+ GstBuffer *buffer;
+ guint pos;
+ GstSegment segment;
+
+ /*< private >*/
+ /* state: bitfield for easier extension;
+ * eos, flushing, new_segment, waiting */
+ GstCollectPadsStateFlags state;
+
+ GstCollectDataPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstCollectPadsFunction:
+ * @pads: the #GstCollectPads that trigered the callback
+ * @user_data: user data passed to gst_collect_pads_set_function()
+ *
+ * A function that will be called when all pads have received data.
+ *
+ * Returns: #GST_FLOW_OK for success
+ *
+ * Since: 0.10.36
+ */
+typedef GstFlowReturn (*GstCollectPadsFunction) (GstCollectPads *pads, gpointer user_data);
+
+/**
+ * GstCollectPadsBufferFunction:
+ * @pads: the #GstCollectPads that trigered the callback
+ * @data: the #GstCollectData of pad that has received the buffer
+ * @buffer: the #GstBuffer
+ * @user_data: user data passed to gst_collect_pads_set_buffer_function()
+ *
+ * A function that will be called when a (considered oldest) buffer can be muxed.
+ * If all pads have reached EOS, this function is called with NULL @buffer
+ * and NULL @data.
+ *
+ * Returns: #GST_FLOW_OK for success
+ *
+ * Since: 0.10.36
+ */
+typedef GstFlowReturn (*GstCollectPadsBufferFunction) (GstCollectPads *pads, GstCollectData *data,
+ GstBuffer *buffer, gpointer user_data);
+
+/**
+ * GstCollectPadsCompareFunction:
+ * @pads: the #GstCollectPads that is comparing the timestamps
+ * @data1: the first #GstCollectData
+ * @timestamp1: the first timestamp
+ * @data2: the second #GstCollectData
+ * @timestamp2: the second timestamp
+ * @user_data: user data passed to gst_collect_pads_set_compare_function()
+ *
+ * A function for comparing two timestamps of buffers or newsegments collected on one pad.
+ *
+ * Returns: Integer less than zero when first timestamp is deemed older than the second one.
+ * Zero if the timestamps are deemed equally old.
+ * Integer greate than zero when second timestamp is deemed older than the first one.
+ *
+ * Since: 0.10.36
+ */
+typedef gint (*GstCollectPadsCompareFunction) (GstCollectPads *pads,
+ GstCollectData * data1, GstClockTime timestamp1,
+ GstCollectData * data2, GstClockTime timestamp2,
+ gpointer user_data);
+
+/**
+ * GstCollectPadsEventFunction:
+ * @pads: the #GstCollectPads that trigered the callback
+ * @pad: the #GstPad that received an event
+ * @event: the #GstEvent received
+ * @user_data: user data passed to gst_collect_pads_set_event_function()
+ *
+ * A function that will be called while processing an event. It takes
+ * ownership of the event and is responsible for chaining up (to
+ * gst_collect_pads_event_default()) or dropping events (such typical cases
+ * being handled by the default handler).
+ *
+ * Returns: %TRUE if the pad could handle the event
+ *
+ * Since: 0.10.36
+ */
+typedef gboolean (*GstCollectPadsEventFunction) (GstCollectPads *pads, GstCollectData * pad,
+ GstEvent * event, gpointer user_data);
+
+
+/**
+ * GstCollectPadsQueryFunction:
+ * @pads: the #GstCollectPads that trigered the callback
+ * @pad: the #GstPad that received an event
+ * @query: the #GstEvent received
+ * @user_data: user data passed to gst_collect_pads_set_query_function()
+ *
+ * A function that will be called while processing a query. It takes
+ * ownership of the query and is responsible for chaining up (to
+ * events downstream (with gst_pad_event_default()).
+ *
+ * Returns: %TRUE if the pad could handle the event
+ *
+ * Since: 0.11.x
+ */
+typedef gboolean (*GstCollectPadsQueryFunction) (GstCollectPads *pads, GstCollectData * pad,
+ GstQuery * query, gpointer user_data);
+
+/**
+ * GstCollectPadsClipFunction:
+ * @pads: a #GstCollectPads
+ * @data: a #GstCollectData
+ * @inbuffer: the input #GstBuffer
+ * @outbuffer: the output #GstBuffer
+ * @user_data: user data
+ *
+ * A function that will be called when @inbuffer is received on the pad managed
+ * by @data in the collecpad object @pads.
+ *
+ * The function should use the segment of @data and the negotiated media type on
+ * the pad to perform clipping of @inbuffer.
+ *
+ * This function takes ownership of @inbuffer and should output a buffer in
+ * @outbuffer or return %NULL in @outbuffer if the buffer should be dropped.
+ *
+ * Returns: a #GstFlowReturn that corresponds to the result of clipping.
+ *
+ * Since: 0.10.36
+ */
+typedef GstFlowReturn (*GstCollectPadsClipFunction) (GstCollectPads *pads, GstCollectData *data,
+ GstBuffer *inbuffer, GstBuffer **outbuffer,
+ gpointer user_data);
+
+/**
+ * GST_COLLECT_PADS_GET_STREAM_LOCK:
+ * @pads: a #GstCollectPads
+ *
+ * Get the stream lock of @pads. The stream lock is used to coordinate and
+ * serialize execution among the various streams being collected, and in
+ * protecting the resources used to accomplish this.
+ *
+ * Since: 0.10.36
+ */
+#define GST_COLLECT_PADS_GET_STREAM_LOCK(pads) (&((GstCollectPads *)pads)->stream_lock)
+/**
+ * GST_COLLECT_PADS_STREAM_LOCK:
+ * @pads: a #GstCollectPads
+ *
+ * Lock the stream lock of @pads.
+ *
+ * Since: 0.10.36
+ */
+#define GST_COLLECT_PADS_STREAM_LOCK(pads) g_rec_mutex_lock(GST_COLLECT_PADS_GET_STREAM_LOCK (pads))
+/**
+ * GST_COLLECT_PADS_STREAM_UNLOCK:
+ * @pads: a #GstCollectPads
+ *
+ * Unlock the stream lock of @pads.
+ *
+ * Since: 0.10.36
+ */
+#define GST_COLLECT_PADS_STREAM_UNLOCK(pads) g_rec_mutex_unlock(GST_COLLECT_PADS_GET_STREAM_LOCK (pads))
+
+/**
+ * GstCollectPads:
+ * @data: #GList of #GstCollectData managed by this #GstCollectPads.
+ *
+ * Collectpads object.
+ *
+ * Since: 0.10.36
+ */
+struct _GstCollectPads {
+ GstObject object;
+
+ /*< public >*/ /* with LOCK and/or STREAM_LOCK */
+ GSList *data; /* list of CollectData items */
+
+ /*< private >*/
+ GRecMutex stream_lock; /* used to serialize collection among several streams */
+
+ GstCollectPadsPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstCollectPadsClass {
+ GstObjectClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GType gst_collect_pads_get_type(void);
+
+/* creating the object */
+GstCollectPads* gst_collect_pads_new (void);
+
+/* set the callbacks */
+void gst_collect_pads_set_function (GstCollectPads *pads,
+ GstCollectPadsFunction func,
+ gpointer user_data);
+void gst_collect_pads_set_buffer_function (GstCollectPads *pads,
+ GstCollectPadsBufferFunction func,
+ gpointer user_data);
+void gst_collect_pads_set_event_function (GstCollectPads *pads,
+ GstCollectPadsEventFunction func,
+ gpointer user_data);
+void gst_collect_pads_set_query_function (GstCollectPads *pads,
+ GstCollectPadsQueryFunction func,
+ gpointer user_data);
+void gst_collect_pads_set_compare_function (GstCollectPads *pads,
+ GstCollectPadsCompareFunction func,
+ gpointer user_data);
+void gst_collect_pads_set_clip_function (GstCollectPads *pads,
+ GstCollectPadsClipFunction clipfunc,
+ gpointer user_data);
+
+/* pad management */
+GstCollectData* gst_collect_pads_add_pad (GstCollectPads *pads, GstPad *pad, guint size);
+GstCollectData* gst_collect_pads_add_pad_full (GstCollectPads *pads, GstPad *pad, guint size,
+ GstCollectDataDestroyNotify destroy_notify,
+ gboolean lock);
+gboolean gst_collect_pads_remove_pad (GstCollectPads *pads, GstPad *pad);
+gboolean gst_collect_pads_is_active (GstCollectPads *pads, GstPad *pad);
+
+/* start/stop collection */
+GstFlowReturn gst_collect_pads_collect (GstCollectPads *pads);
+GstFlowReturn gst_collect_pads_collect_range (GstCollectPads *pads, guint64 offset, guint length);
+
+void gst_collect_pads_start (GstCollectPads *pads);
+void gst_collect_pads_stop (GstCollectPads *pads);
+void gst_collect_pads_set_flushing (GstCollectPads *pads, gboolean flushing);
+
+/* get collected buffers */
+GstBuffer* gst_collect_pads_peek (GstCollectPads *pads, GstCollectData *data);
+GstBuffer* gst_collect_pads_pop (GstCollectPads *pads, GstCollectData *data);
+
+/* get collected bytes */
+guint gst_collect_pads_available (GstCollectPads *pads);
+guint gst_collect_pads_flush (GstCollectPads *pads, GstCollectData *data,
+ guint size);
+GstBuffer* gst_collect_pads_read_buffer (GstCollectPads * pads, GstCollectData * data,
+ guint size);
+GstBuffer* gst_collect_pads_take_buffer (GstCollectPads * pads, GstCollectData * data,
+ guint size);
+
+/* setting and unsetting waiting mode */
+void gst_collect_pads_set_waiting (GstCollectPads *pads, GstCollectData *data,
+ gboolean waiting);
+
+/* convenience helper */
+GstFlowReturn gst_collect_pads_clip_running_time (GstCollectPads * pads,
+ GstCollectData * cdata, GstBuffer * buf, GstBuffer ** outbuf,
+ gpointer user_data);
+
+/* default handlers */
+gboolean gst_collect_pads_event_default (GstCollectPads * pads, GstCollectData * data,
+ GstEvent * event, gboolean discard);
+gboolean gst_collect_pads_query_default (GstCollectPads * pads, GstCollectData * data,
+ GstQuery * query, gboolean discard);
+
+
+G_END_DECLS
+
+#endif /* __GST_COLLECT_PADS_H__ */
diff --git a/libs/gst/base/gstcollectpads2.h b/libs/gst/base/gstcollectpads2.h
deleted file mode 100644
index e8bfcf2..0000000
--- a/libs/gst/base/gstcollectpads2.h
+++ /dev/null
@@ -1,371 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
- * Copyright (C) 2008 Mark Nauwelaerts <mnauw@users.sourceforge.net>
- *
- * gstcollectpads2.h:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_COLLECT_PADS2_H__
-#define __GST_COLLECT_PADS2_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_COLLECT_PADS2 (gst_collect_pads2_get_type())
-#define GST_COLLECT_PADS2(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_COLLECT_PADS2,GstCollectPads2))
-#define GST_COLLECT_PADS2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_COLLECT_PADS2,GstCollectPads2Class))
-#define GST_COLLECT_PADS2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_COLLECT_PADS2,GstCollectPads2Class))
-#define GST_IS_COLLECT_PADS2(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_COLLECT_PADS2))
-#define GST_IS_COLLECT_PADS2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_COLLECT_PADS2))
-
-typedef struct _GstCollectData2 GstCollectData2;
-typedef struct _GstCollectData2Private GstCollectData2Private;
-typedef struct _GstCollectPads2 GstCollectPads2;
-typedef struct _GstCollectPads2Private GstCollectPads2Private;
-typedef struct _GstCollectPads2Class GstCollectPads2Class;
-
-/**
- * GstCollectData2DestroyNotify:
- * @data: the #GstCollectData2 that will be freed
- *
- * A function that will be called when the #GstCollectData2 will be freed.
- * It is passed the pointer to the structure and should free any custom
- * memory and resources allocated for it.
- *
- * Since: 0.10.36
- */
-typedef void (*GstCollectData2DestroyNotify) (GstCollectData2 *data);
-
-/**
- * GstCollectPads2StateFlags:
- * @GST_COLLECT_PADS2_STATE_EOS: Set if collectdata's pad is EOS.
- * @GST_COLLECT_PADS2_STATE_FLUSHING: Set if collectdata's pad is flushing.
- * @GST_COLLECT_PADS2_STATE_NEW_SEGMENT: Set if collectdata's pad received a
- * new_segment event.
- * @GST_COLLECT_PADS2_STATE_WAITING: Set if collectdata's pad must be waited
- * for when collecting.
- * @GST_COLLECT_PADS2_STATE_LOCKED: Set collectdata's pad WAITING state must
- * not be changed.
- * #GstCollectPads2StateFlags indicate private state of a collectdata('s pad).
- *
- * Since: 0.10.36
- */
-typedef enum {
- GST_COLLECT_PADS2_STATE_EOS = 1 << 0,
- GST_COLLECT_PADS2_STATE_FLUSHING = 1 << 1,
- GST_COLLECT_PADS2_STATE_NEW_SEGMENT = 1 << 2,
- GST_COLLECT_PADS2_STATE_WAITING = 1 << 3,
- GST_COLLECT_PADS2_STATE_LOCKED = 1 << 4
-} GstCollectPads2StateFlags;
-
-/**
- * GST_COLLECT_PADS2_STATE:
- * @data: a #GstCollectData2.
- *
- * A flags word containing #GstCollectPads2StateFlags flags set
- * on this collected pad.
- *
- * Since: 0.10.36
- */
-#define GST_COLLECT_PADS2_STATE(data) (((GstCollectData2 *) data)->state)
-/**
- * GST_COLLECT_PADS2_STATE_IS_SET:
- * @data: a #GstCollectData2.
- * @flag: the #GstCollectPads2StateFlags to check.
- *
- * Gives the status of a specific flag on a collected pad.
- *
- * Since: 0.10.36
- */
-#define GST_COLLECT_PADS2_STATE_IS_SET(data,flag) !!(GST_COLLECT_PADS2_STATE (data) & flag)
-/**
- * GST_COLLECT_PADS2_STATE_SET:
- * @data: a #GstCollectData2.
- * @flag: the #GstCollectPads2StateFlags to set.
- *
- * Sets a state flag on a collected pad.
- *
- * Since: 0.10.36
- */
-#define GST_COLLECT_PADS2_STATE_SET(data,flag) (GST_COLLECT_PADS2_STATE (data) |= flag)
-/**
- * GST_COLLECT_PADS2_STATE_UNSET:
- * @data: a #GstCollectData2.
- * @flag: the #GstCollectPads2StateFlags to clear.
- *
- * Clears a state flag on a collected pad.
- *
- * Since: 0.10.36
- */
-#define GST_COLLECT_PADS2_STATE_UNSET(data,flag) (GST_COLLECT_PADS2_STATE (data) &= ~(flag))
-
-/**
- * GstCollectData2:
- * @collect: owner #GstCollectPads2
- * @pad: #GstPad managed by this data
- * @buffer: currently queued buffer.
- * @pos: position in the buffer
- * @segment: last segment received.
- *
- * Structure used by the collect_pads2.
- *
- * Since: 0.10.36
- */
-struct _GstCollectData2
-{
- /* with STREAM_LOCK of @collect */
- GstCollectPads2 *collect;
- GstPad *pad;
- GstBuffer *buffer;
- guint pos;
- GstSegment segment;
-
- /*< private >*/
- /* state: bitfield for easier extension;
- * eos, flushing, new_segment, waiting */
- GstCollectPads2StateFlags state;
-
- GstCollectData2Private *priv;
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-/**
- * GstCollectPads2Function:
- * @pads: the #GstCollectPads2 that trigered the callback
- * @user_data: user data passed to gst_collect_pads2_set_function()
- *
- * A function that will be called when all pads have received data.
- *
- * Returns: #GST_FLOW_OK for success
- *
- * Since: 0.10.36
- */
-typedef GstFlowReturn (*GstCollectPads2Function) (GstCollectPads2 *pads, gpointer user_data);
-
-/**
- * GstCollectPads2BufferFunction:
- * @pads: the #GstCollectPads2 that trigered the callback
- * @data: the #GstCollectData2 of pad that has received the buffer
- * @buffer: the #GstBuffer
- * @user_data: user data passed to gst_collect_pads2_set_buffer_function()
- *
- * A function that will be called when a (considered oldest) buffer can be muxed.
- * If all pads have reached EOS, this function is called with NULL @buffer
- * and NULL @data.
- *
- * Returns: #GST_FLOW_OK for success
- *
- * Since: 0.10.36
- */
-typedef GstFlowReturn (*GstCollectPads2BufferFunction) (GstCollectPads2 *pads, GstCollectData2 *data,
- GstBuffer *buffer, gpointer user_data);
-
-/**
- * GstCollectPads2CompareFunction:
- * @pads: the #GstCollectPads that is comparing the timestamps
- * @data1: the first #GstCollectData2
- * @timestamp1: the first timestamp
- * @data2: the second #GstCollectData2
- * @timestamp2: the second timestamp
- * @user_data: user data passed to gst_collect_pads2_set_compare_function()
- *
- * A function for comparing two timestamps of buffers or newsegments collected on one pad.
- *
- * Returns: Integer less than zero when first timestamp is deemed older than the second one.
- * Zero if the timestamps are deemed equally old.
- * Integer greate than zero when second timestamp is deemed older than the first one.
- *
- * Since: 0.10.36
- */
-typedef gint (*GstCollectPads2CompareFunction) (GstCollectPads2 *pads,
- GstCollectData2 * data1, GstClockTime timestamp1,
- GstCollectData2 * data2, GstClockTime timestamp2,
- gpointer user_data);
-
-/**
- * GstCollectPads2EventFunction:
- * @pads: the #GstCollectPads2 that trigered the callback
- * @pad: the #GstPad that received an event
- * @event: the #GstEvent received
- * @user_data: user data passed to gst_collect_pads2_set_event_function()
- *
- * A function that will be called while processing an event. It takes
- * ownership of the event and is responsible for forwarding
- * events downstream (with gst_pad_event_default()) or dropping events.
- *
- * The STREAM_START, CAPS, STREAM_CONFIG, SEGMENT and EOS events should
- * usually be dropped by this function.
- *
- * Returns: %TRUE if the pad could handle the event
- *
- * Since: 0.10.36
- */
-typedef gboolean (*GstCollectPads2EventFunction) (GstCollectPads2 *pads, GstCollectData2 * pad,
- GstEvent * event, gpointer user_data);
-
-
-/**
- * GstCollectPads2ClipFunction:
- * @pads: a #GstCollectPads2
- * @data: a #GstCollectData2
- * @inbuffer: the input #GstBuffer
- * @outbuffer: the output #GstBuffer
- * @user_data: user data
- *
- * A function that will be called when @inbuffer is received on the pad managed
- * by @data in the collecpad object @pads.
- *
- * The function should use the segment of @data and the negotiated media type on
- * the pad to perform clipping of @inbuffer.
- *
- * This function takes ownership of @inbuffer and should output a buffer in
- * @outbuffer or return %NULL in @outbuffer if the buffer should be dropped.
- *
- * Returns: a #GstFlowReturn that corresponds to the result of clipping.
- *
- * Since: 0.10.36
- */
-typedef GstFlowReturn (*GstCollectPads2ClipFunction) (GstCollectPads2 *pads, GstCollectData2 *data,
- GstBuffer *inbuffer, GstBuffer **outbuffer,
- gpointer user_data);
-
-/**
- * GST_COLLECT_PADS2_GET_STREAM_LOCK:
- * @pads: a #GstCollectPads2
- *
- * Get the stream lock of @pads. The stream lock is used to coordinate and
- * serialize execution among the various streams being collected, and in
- * protecting the resources used to accomplish this.
- *
- * Since: 0.10.36
- */
-#define GST_COLLECT_PADS2_GET_STREAM_LOCK(pads) (&((GstCollectPads2 *)pads)->stream_lock)
-/**
- * GST_COLLECT_PADS2_STREAM_LOCK:
- * @pads: a #GstCollectPads2
- *
- * Lock the stream lock of @pads.
- *
- * Since: 0.10.36
- */
-#define GST_COLLECT_PADS2_STREAM_LOCK(pads) g_rec_mutex_lock(GST_COLLECT_PADS2_GET_STREAM_LOCK (pads))
-/**
- * GST_COLLECT_PADS2_STREAM_UNLOCK:
- * @pads: a #GstCollectPads2
- *
- * Unlock the stream lock of @pads.
- *
- * Since: 0.10.36
- */
-#define GST_COLLECT_PADS2_STREAM_UNLOCK(pads) g_rec_mutex_unlock(GST_COLLECT_PADS2_GET_STREAM_LOCK (pads))
-
-/**
- * GstCollectPads2:
- * @data: #GList of #GstCollectData2 managed by this #GstCollectPads2.
- *
- * Collectpads object.
- *
- * Since: 0.10.36
- */
-struct _GstCollectPads2 {
- GstObject object;
-
- /*< public >*/ /* with LOCK and/or STREAM_LOCK */
- GSList *data; /* list of CollectData items */
-
- /*< private >*/
- GRecMutex stream_lock; /* used to serialize collection among several streams */
-
- GstCollectPads2Private *priv;
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-struct _GstCollectPads2Class {
- GstObjectClass parent_class;
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_collect_pads2_get_type(void);
-
-/* creating the object */
-GstCollectPads2* gst_collect_pads2_new (void);
-
-/* set the callbacks */
-void gst_collect_pads2_set_function (GstCollectPads2 *pads,
- GstCollectPads2Function func,
- gpointer user_data);
-void gst_collect_pads2_set_buffer_function (GstCollectPads2 *pads,
- GstCollectPads2BufferFunction func,
- gpointer user_data);
-void gst_collect_pads2_set_event_function (GstCollectPads2 *pads,
- GstCollectPads2EventFunction func,
- gpointer user_data);
-void gst_collect_pads2_set_compare_function (GstCollectPads2 *pads,
- GstCollectPads2CompareFunction func,
- gpointer user_data);
-void gst_collect_pads2_set_clip_function (GstCollectPads2 *pads,
- GstCollectPads2ClipFunction clipfunc,
- gpointer user_data);
-
-/* pad management */
-GstCollectData2* gst_collect_pads2_add_pad (GstCollectPads2 *pads, GstPad *pad, guint size);
-GstCollectData2* gst_collect_pads2_add_pad_full (GstCollectPads2 *pads, GstPad *pad, guint size,
- GstCollectData2DestroyNotify destroy_notify,
- gboolean lock);
-gboolean gst_collect_pads2_remove_pad (GstCollectPads2 *pads, GstPad *pad);
-gboolean gst_collect_pads2_is_active (GstCollectPads2 *pads, GstPad *pad);
-
-/* start/stop collection */
-GstFlowReturn gst_collect_pads2_collect (GstCollectPads2 *pads);
-GstFlowReturn gst_collect_pads2_collect_range (GstCollectPads2 *pads, guint64 offset, guint length);
-
-void gst_collect_pads2_start (GstCollectPads2 *pads);
-void gst_collect_pads2_stop (GstCollectPads2 *pads);
-void gst_collect_pads2_set_flushing (GstCollectPads2 *pads, gboolean flushing);
-
-/* get collected buffers */
-GstBuffer* gst_collect_pads2_peek (GstCollectPads2 *pads, GstCollectData2 *data);
-GstBuffer* gst_collect_pads2_pop (GstCollectPads2 *pads, GstCollectData2 *data);
-
-/* get collected bytes */
-guint gst_collect_pads2_available (GstCollectPads2 *pads);
-guint gst_collect_pads2_flush (GstCollectPads2 *pads, GstCollectData2 *data,
- guint size);
-GstBuffer* gst_collect_pads2_read_buffer (GstCollectPads2 * pads, GstCollectData2 * data,
- guint size);
-GstBuffer* gst_collect_pads2_take_buffer (GstCollectPads2 * pads, GstCollectData2 * data,
- guint size);
-
-/* setting and unsetting waiting mode */
-void gst_collect_pads2_set_waiting (GstCollectPads2 *pads, GstCollectData2 *data,
- gboolean waiting);
-
-/* convenience helper */
-GstFlowReturn gst_collect_pads2_clip_running_time (GstCollectPads2 * pads,
- GstCollectData2 * cdata, GstBuffer * buf, GstBuffer ** outbuf,
- gpointer user_data);
-
-
-G_END_DECLS
-
-#endif /* __GST_COLLECT_PADS22_H__ */
diff --git a/libs/gst/base/gsttypefindhelper.c b/libs/gst/base/gsttypefindhelper.c
index 41f66bf..cdb267a 100644
--- a/libs/gst/base/gsttypefindhelper.c
+++ b/libs/gst/base/gsttypefindhelper.c
@@ -308,9 +308,8 @@ gst_type_find_helper_get_range (GstObject * obj, GstObject * parent,
extension);
for (l = type_list; l; l = next) {
+ const gchar *const *ext;
GstTypeFindFactory *factory;
- gint i;
- gchar **ext;
next = l->next;
@@ -323,8 +322,8 @@ gst_type_find_helper_get_range (GstObject * obj, GstObject * parent,
GST_LOG_OBJECT (obj, "testing factory %s for extension %s",
GST_OBJECT_NAME (factory), extension);
- for (i = 0; ext[i]; i++) {
- if (strcmp (ext[i], extension) == 0) {
+ while (*ext != NULL) {
+ if (strcmp (*ext, extension) == 0) {
/* found extension, move in front */
GST_LOG_OBJECT (obj, "moving typefind for extension %s to head",
extension);
@@ -336,6 +335,7 @@ gst_type_find_helper_get_range (GstObject * obj, GstObject * parent,
pos++;
break;
}
+ ++ext;
}
}
}
@@ -617,13 +617,12 @@ gst_type_find_helper_for_extension (GstObject * obj, const gchar * extension)
for (l = type_list; l; l = g_list_next (l)) {
GstTypeFindFactory *factory;
- gchar **ext;
- gint i;
+ const gchar *const *ext;
factory = GST_TYPE_FIND_FACTORY (l->data);
/* we only want to check those factories without a function */
- if (factory->function != NULL)
+ if (gst_type_find_factory_has_function (factory))
continue;
/* get the extension that this typefind factory can handle */
@@ -633,14 +632,15 @@ gst_type_find_helper_for_extension (GstObject * obj, const gchar * extension)
/* there are extension, see if one of them matches the requested
* extension */
- for (i = 0; ext[i]; i++) {
- if (strcmp (ext[i], extension) == 0) {
+ while (*ext != NULL) {
+ if (strcmp (*ext, extension) == 0) {
/* we found a matching extension, take the caps */
if ((result = gst_type_find_factory_get_caps (factory))) {
gst_caps_ref (result);
goto done;
}
}
+ ++ext;
}
}
done:
diff --git a/libs/gst/check/Makefile.in b/libs/gst/check/Makefile.in
index e1f5ac4..617f5a6 100644
--- a/libs/gst/check/Makefile.in
+++ b/libs/gst/check/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.4 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -637,7 +637,7 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(libdir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
@@ -724,7 +724,7 @@ install-girDATA: $(gir_DATA)
@list='$(gir_DATA)'; test -n "$(girdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(girdir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(girdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
@@ -745,7 +745,7 @@ install-typelibsDATA: $(typelibs_DATA)
@list='$(typelibs_DATA)'; test -n "$(typelibsdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(typelibsdir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(typelibsdir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(typelibsdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
@@ -766,7 +766,7 @@ install-libgstcheck_@GST_API_VERSION@includeHEADERS: $(libgstcheck_@GST_API_VERS
@list='$(libgstcheck_@GST_API_VERSION@include_HEADERS)'; test -n "$(libgstcheck_@GST_API_VERSION@includedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(libgstcheck_@GST_API_VERSION@includedir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(libgstcheck_@GST_API_VERSION@includedir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(libgstcheck_@GST_API_VERSION@includedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
@@ -787,7 +787,7 @@ install-nodist_libgstcheck_@GST_API_VERSION@includeHEADERS: $(nodist_libgstcheck
@list='$(nodist_libgstcheck_@GST_API_VERSION@include_HEADERS)'; test -n "$(libgstcheck_@GST_API_VERSION@includedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(libgstcheck_@GST_API_VERSION@includedir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(libgstcheck_@GST_API_VERSION@includedir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(libgstcheck_@GST_API_VERSION@includedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
diff --git a/libs/gst/check/gstconsistencychecker.c b/libs/gst/check/gstconsistencychecker.c
index 35f325f..576b575 100644
--- a/libs/gst/check/gstconsistencychecker.c
+++ b/libs/gst/check/gstconsistencychecker.c
@@ -276,7 +276,7 @@ gst_consistency_checker_free (GstStreamConsistency * consist)
for (node = consist->pads; node; node = g_list_next (node)) {
p = (GstStreamConsistencyProbe *) node->data;
gst_pad_remove_probe (p->pad, p->probeid);
- g_object_unref (p->pad);
+ gst_object_unref (p->pad);
g_free (p);
}
g_list_free (consist->pads);
diff --git a/libs/gst/check/libcheck/Makefile.in b/libs/gst/check/libcheck/Makefile.in
index df73417..085986e 100644
--- a/libs/gst/check/libcheck/Makefile.in
+++ b/libs/gst/check/libcheck/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.4 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
diff --git a/libs/gst/controller/Makefile.in b/libs/gst/controller/Makefile.in
index 3c71914..aa3cbda 100644
--- a/libs/gst/controller/Makefile.in
+++ b/libs/gst/controller/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.4 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -529,7 +529,7 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(libdir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
@@ -640,7 +640,7 @@ install-girDATA: $(gir_DATA)
@list='$(gir_DATA)'; test -n "$(girdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(girdir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(girdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
@@ -661,7 +661,7 @@ install-typelibsDATA: $(typelibs_DATA)
@list='$(typelibs_DATA)'; test -n "$(typelibsdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(typelibsdir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(typelibsdir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(typelibsdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
@@ -682,7 +682,7 @@ install-libgstcontroller_@GST_API_VERSION@_includeHEADERS: $(libgstcontroller_@G
@list='$(libgstcontroller_@GST_API_VERSION@_include_HEADERS)'; test -n "$(libgstcontroller_@GST_API_VERSION@_includedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(libgstcontroller_@GST_API_VERSION@_includedir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(libgstcontroller_@GST_API_VERSION@_includedir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(libgstcontroller_@GST_API_VERSION@_includedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
diff --git a/libs/gst/controller/gstargbcontrolbinding.c b/libs/gst/controller/gstargbcontrolbinding.c
index 829b616..9e4728a 100644
--- a/libs/gst/controller/gstargbcontrolbinding.c
+++ b/libs/gst/controller/gstargbcontrolbinding.c
@@ -53,12 +53,16 @@ static GValue *gst_argb_control_binding_get_value (GstControlBinding * _self,
GstClockTime timestamp);
static gboolean gst_argb_control_binding_get_value_array (GstControlBinding *
_self, GstClockTime timestamp, GstClockTime interval, guint n_values,
+ gpointer values);
+static gboolean gst_argb_control_binding_get_g_value_array (GstControlBinding *
+ _self, GstClockTime timestamp, GstClockTime interval, guint n_values,
GValue * values);
#define _do_init \
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "gstargbcontrolbinding", 0, \
"dynamic parameter control source attachment");
+#define gst_argb_control_binding_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstARGBControlBinding, gst_argb_control_binding,
GST_TYPE_CONTROL_BINDING, _do_init);
@@ -93,6 +97,8 @@ gst_argb_control_binding_class_init (GstARGBControlBindingClass * klass)
control_binding_class->get_value = gst_argb_control_binding_get_value;
control_binding_class->get_value_array =
gst_argb_control_binding_get_value_array;
+ control_binding_class->get_g_value_array =
+ gst_argb_control_binding_get_g_value_array;
properties[PROP_CS_A] =
g_param_spec_object ("control-source-a", "ControlSource A",
@@ -133,9 +139,8 @@ gst_argb_control_binding_constructor (GType type, guint n_construct_params,
GstARGBControlBinding *self;
self =
- GST_ARGB_CONTROL_BINDING (G_OBJECT_CLASS
- (gst_argb_control_binding_parent_class)
- ->constructor (type, n_construct_params, construct_params));
+ GST_ARGB_CONTROL_BINDING (G_OBJECT_CLASS (parent_class)->constructor
+ (type, n_construct_params, construct_params));
if (GST_CONTROL_BINDING_PSPEC (self)) {
if (!(G_PARAM_SPEC_VALUE_TYPE (GST_CONTROL_BINDING_PSPEC (self)) ==
@@ -213,6 +218,8 @@ gst_argb_control_binding_dispose (GObject * object)
gst_object_replace ((GstObject **) & self->cs_g, NULL);
if (self->cs_b)
gst_object_replace ((GstObject **) & self->cs_b, NULL);
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
@@ -221,6 +228,8 @@ gst_argb_control_binding_finalize (GObject * object)
GstARGBControlBinding *self = GST_ARGB_CONTROL_BINDING (object);
g_value_unset (&self->cur_value);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean
@@ -312,6 +321,71 @@ gst_argb_control_binding_get_value (GstControlBinding * _self,
static gboolean
gst_argb_control_binding_get_value_array (GstControlBinding * _self,
GstClockTime timestamp, GstClockTime interval, guint n_values,
+ gpointer values_)
+{
+ GstARGBControlBinding *self = GST_ARGB_CONTROL_BINDING (_self);
+ gint i;
+ gdouble *src_val_a = NULL, *src_val_r = NULL, *src_val_g = NULL, *src_val_b =
+ NULL;
+ guint *values = (guint *) values_;
+ gboolean ret = TRUE;
+
+ g_return_val_if_fail (GST_IS_ARGB_CONTROL_BINDING (self), FALSE);
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (interval), FALSE);
+ g_return_val_if_fail (values, FALSE);
+ g_return_val_if_fail (GST_CONTROL_BINDING_PSPEC (self), FALSE);
+
+ if (self->cs_a) {
+ src_val_a = g_new0 (gdouble, n_values);
+ ret &= gst_control_source_get_value_array (self->cs_a, timestamp,
+ interval, n_values, src_val_a);
+ }
+ if (self->cs_r) {
+ src_val_r = g_new0 (gdouble, n_values);
+ ret &= gst_control_source_get_value_array (self->cs_r, timestamp,
+ interval, n_values, src_val_r);
+ }
+ if (self->cs_g) {
+ src_val_g = g_new0 (gdouble, n_values);
+ ret &= gst_control_source_get_value_array (self->cs_g, timestamp,
+ interval, n_values, src_val_g);
+ }
+ if (self->cs_b) {
+ src_val_b = g_new0 (gdouble, n_values);
+ ret &= gst_control_source_get_value_array (self->cs_b, timestamp,
+ interval, n_values, src_val_b);
+ }
+ if (G_LIKELY (ret)) {
+ for (i = 0; i < n_values; i++) {
+ gdouble a = 1.0, r = 0.0, g = 0.0, b = 0.0;
+ if (src_val_a && !isnan (src_val_a[i]))
+ a = src_val_a[i];
+ if (src_val_r && !isnan (src_val_r[i]))
+ r = src_val_r[i];
+ if (src_val_g && !isnan (src_val_g[i]))
+ g = src_val_g[i];
+ if (src_val_b && !isnan (src_val_b[i]))
+ b = src_val_b[i];
+ values[i] = (((guint) (CLAMP (a, 0.0, 1.0) * 255)) << 24) |
+ (((guint) (CLAMP (r, 0.0, 1.0) * 255)) << 16) |
+ (((guint) (CLAMP (g, 0.0, 1.0) * 255)) << 8) |
+ ((guint) (CLAMP (b, 0.0, 1.0) * 255));
+ }
+ } else {
+ GST_LOG ("failed to get control value for property %s at ts %"
+ GST_TIME_FORMAT, _self->name, GST_TIME_ARGS (timestamp));
+ }
+ g_free (src_val_a);
+ g_free (src_val_r);
+ g_free (src_val_g);
+ g_free (src_val_b);
+ return ret;
+}
+
+static gboolean
+gst_argb_control_binding_get_g_value_array (GstControlBinding * _self,
+ GstClockTime timestamp, GstClockTime interval, guint n_values,
GValue * values)
{
GstARGBControlBinding *self = GST_ARGB_CONTROL_BINDING (_self);
diff --git a/libs/gst/controller/gstdirectcontrolbinding.c b/libs/gst/controller/gstdirectcontrolbinding.c
index 97a23b2..0596489 100644
--- a/libs/gst/controller/gstdirectcontrolbinding.c
+++ b/libs/gst/controller/gstdirectcontrolbinding.c
@@ -52,12 +52,16 @@ static GValue *gst_direct_control_binding_get_value (GstControlBinding * _self,
GstClockTime timestamp);
static gboolean gst_direct_control_binding_get_value_array (GstControlBinding *
_self, GstClockTime timestamp, GstClockTime interval, guint n_values,
+ gpointer values);
+static gboolean gst_direct_control_binding_get_g_value_array (GstControlBinding
+ * _self, GstClockTime timestamp, GstClockTime interval, guint n_values,
GValue * values);
#define _do_init \
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "gstdirectcontrolbinding", 0, \
"dynamic parameter control source attachment");
+#define gst_direct_control_binding_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstDirectControlBinding, gst_direct_control_binding,
GST_TYPE_CONTROL_BINDING, _do_init);
@@ -74,7 +78,7 @@ static GParamSpec *properties[PROP_LAST];
#define DEFINE_CONVERT(type,Type,TYPE) \
static void \
-convert_to_##type (GstDirectControlBinding *self, gdouble s, GValue *d) \
+convert_g_value_to_##type (GstDirectControlBinding *self, gdouble s, GValue *d) \
{ \
GParamSpec##Type *pspec = G_PARAM_SPEC_##TYPE (((GstControlBinding *)self)->pspec); \
g##type v; \
@@ -82,8 +86,19 @@ convert_to_##type (GstDirectControlBinding *self, gdouble s, GValue *d) \
s = CLAMP (s, 0.0, 1.0); \
v = pspec->minimum + (g##type) ((pspec->maximum - pspec->minimum) * s); \
g_value_set_##type (d, v); \
+} \
+\
+static void \
+convert_value_to_##type (GstDirectControlBinding *self, gdouble s, gpointer d_) \
+{ \
+ GParamSpec##Type *pspec = G_PARAM_SPEC_##TYPE (((GstControlBinding *)self)->pspec); \
+ g##type *d = (g##type *)d_; \
+ \
+ s = CLAMP (s, 0.0, 1.0); \
+ *d = pspec->minimum + (g##type) ((pspec->maximum - pspec->minimum) * s); \
}
+
DEFINE_CONVERT (int, Int, INT);
DEFINE_CONVERT (uint, UInt, UINT);
DEFINE_CONVERT (long, Long, LONG);
@@ -94,14 +109,25 @@ DEFINE_CONVERT (float, Float, FLOAT);
DEFINE_CONVERT (double, Double, DOUBLE);
static void
-convert_to_boolean (GstDirectControlBinding * self, gdouble s, GValue * d)
+convert_g_value_to_boolean (GstDirectControlBinding * self, gdouble s,
+ GValue * d)
{
s = CLAMP (s, 0.0, 1.0);
g_value_set_boolean (d, (gboolean) (s + 0.5));
}
static void
-convert_to_enum (GstDirectControlBinding * self, gdouble s, GValue * d)
+convert_value_to_boolean (GstDirectControlBinding * self, gdouble s,
+ gpointer d_)
+{
+ gboolean *d = (gboolean *) d_;
+
+ s = CLAMP (s, 0.0, 1.0);
+ *d = (gboolean) (s + 0.5);
+}
+
+static void
+convert_g_value_to_enum (GstDirectControlBinding * self, gdouble s, GValue * d)
{
GParamSpecEnum *pspec =
G_PARAM_SPEC_ENUM (((GstControlBinding *) self)->pspec);
@@ -113,6 +139,18 @@ convert_to_enum (GstDirectControlBinding * self, gdouble s, GValue * d)
g_value_set_enum (d, e->values[v].value);
}
+static void
+convert_value_to_enum (GstDirectControlBinding * self, gdouble s, gpointer d_)
+{
+ GParamSpecEnum *pspec =
+ G_PARAM_SPEC_ENUM (((GstControlBinding *) self)->pspec);
+ GEnumClass *e = pspec->enum_class;
+ gint *d = (gint *) d_;
+
+ s = CLAMP (s, 0.0, 1.0);
+ *d = e->values[(gint) (s * (e->n_values - 1))].value;
+}
+
/* vmethods */
static void
@@ -132,6 +170,8 @@ gst_direct_control_binding_class_init (GstDirectControlBindingClass * klass)
control_binding_class->get_value = gst_direct_control_binding_get_value;
control_binding_class->get_value_array =
gst_direct_control_binding_get_value_array;
+ control_binding_class->get_g_value_array =
+ gst_direct_control_binding_get_g_value_array;
properties[PROP_CS] =
g_param_spec_object ("control-source", "ControlSource",
@@ -154,9 +194,8 @@ gst_direct_control_binding_constructor (GType type, guint n_construct_params,
GstDirectControlBinding *self;
self =
- GST_DIRECT_CONTROL_BINDING (G_OBJECT_CLASS
- (gst_direct_control_binding_parent_class)
- ->constructor (type, n_construct_params, construct_params));
+ GST_DIRECT_CONTROL_BINDING (G_OBJECT_CLASS (parent_class)->constructor
+ (type, n_construct_params, construct_params));
if (GST_CONTROL_BINDING_PSPEC (self)) {
GType type, base;
@@ -171,34 +210,54 @@ gst_direct_control_binding_constructor (GType type, guint n_construct_params,
// select mapping function
switch (base) {
case G_TYPE_INT:
- self->convert = convert_to_int;
+ self->convert_g_value = convert_g_value_to_int;
+ self->convert_value = convert_value_to_int;
+ self->byte_size = sizeof (gint);
break;
case G_TYPE_UINT:
- self->convert = convert_to_uint;
+ self->convert_g_value = convert_g_value_to_uint;
+ self->convert_value = convert_value_to_uint;
+ self->byte_size = sizeof (guint);
break;
case G_TYPE_LONG:
- self->convert = convert_to_long;
+ self->convert_g_value = convert_g_value_to_long;
+ self->convert_value = convert_value_to_long;
+ self->byte_size = sizeof (glong);
break;
case G_TYPE_ULONG:
- self->convert = convert_to_ulong;
+ self->convert_g_value = convert_g_value_to_ulong;
+ self->convert_value = convert_value_to_ulong;
+ self->byte_size = sizeof (gulong);
break;
case G_TYPE_INT64:
- self->convert = convert_to_int64;
+ self->convert_g_value = convert_g_value_to_int64;
+ self->convert_value = convert_value_to_int64;
+ self->byte_size = sizeof (gint64);
break;
case G_TYPE_UINT64:
- self->convert = convert_to_uint64;
+ self->convert_g_value = convert_g_value_to_uint64;
+ self->convert_value = convert_value_to_uint64;
+ self->byte_size = sizeof (guint64);
break;
case G_TYPE_FLOAT:
- self->convert = convert_to_float;
+ self->convert_g_value = convert_g_value_to_float;
+ self->convert_value = convert_value_to_float;
+ self->byte_size = sizeof (gfloat);
break;
case G_TYPE_DOUBLE:
- self->convert = convert_to_double;
+ self->convert_g_value = convert_g_value_to_double;
+ self->convert_value = convert_value_to_double;
+ self->byte_size = sizeof (gdouble);
break;
case G_TYPE_BOOLEAN:
- self->convert = convert_to_boolean;
+ self->convert_g_value = convert_g_value_to_boolean;
+ self->convert_value = convert_value_to_boolean;
+ self->byte_size = sizeof (gboolean);
break;
case G_TYPE_ENUM:
- self->convert = convert_to_enum;
+ self->convert_g_value = convert_g_value_to_enum;
+ self->convert_value = convert_value_to_enum;
+ self->byte_size = sizeof (gint);
break;
default:
GST_WARNING ("incomplete implementation for paramspec type '%s'",
@@ -249,6 +308,8 @@ gst_direct_control_binding_dispose (GObject * object)
if (self->cs)
gst_object_replace ((GstObject **) & self->cs, NULL);
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
@@ -257,6 +318,8 @@ gst_direct_control_binding_finalize (GObject * object)
GstDirectControlBinding *self = GST_DIRECT_CONTROL_BINDING (object);
g_value_unset (&self->cur_value);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean
@@ -286,7 +349,7 @@ gst_direct_control_binding_sync_values (GstControlBinding * _self,
GST_LOG_OBJECT (object, " mapping %s to value of type %s", _self->name,
G_VALUE_TYPE_NAME (dst_val));
/* run mapping function to convert gdouble to GValue */
- self->convert (self, src_val, dst_val);
+ self->convert_g_value (self, src_val, dst_val);
/* we can make this faster
* http://bugzilla.gnome.org/show_bug.cgi?id=536939
*/
@@ -315,7 +378,7 @@ gst_direct_control_binding_get_value (GstControlBinding * _self,
if (gst_control_source_get_value (self->cs, timestamp, &src_val)) {
dst_val = g_new0 (GValue, 1);
g_value_init (dst_val, G_PARAM_SPEC_VALUE_TYPE (_self->pspec));
- self->convert (self, src_val, dst_val);
+ self->convert_g_value (self, src_val, dst_val);
} else {
GST_LOG ("no control value for property %s at ts %" GST_TIME_FORMAT,
_self->name, GST_TIME_ARGS (timestamp));
@@ -327,6 +390,49 @@ gst_direct_control_binding_get_value (GstControlBinding * _self,
static gboolean
gst_direct_control_binding_get_value_array (GstControlBinding * _self,
GstClockTime timestamp, GstClockTime interval, guint n_values,
+ gpointer values_)
+{
+ GstDirectControlBinding *self = GST_DIRECT_CONTROL_BINDING (_self);
+ gint i;
+ gdouble *src_val;
+ gboolean res = FALSE;
+ GstDirectControlBindingConvertValue convert;
+ gint byte_size;
+ guint8 *values = (guint8 *) values_;
+
+ g_return_val_if_fail (GST_IS_DIRECT_CONTROL_BINDING (self), FALSE);
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (interval), FALSE);
+ g_return_val_if_fail (values, FALSE);
+ g_return_val_if_fail (GST_CONTROL_BINDING_PSPEC (self), FALSE);
+
+ convert = self->convert_value;
+ byte_size = self->byte_size;
+
+ src_val = g_new0 (gdouble, n_values);
+ if ((res = gst_control_source_get_value_array (self->cs, timestamp,
+ interval, n_values, src_val))) {
+ for (i = 0; i < n_values; i++) {
+ /* we will only get NAN for sparse control sources, such as triggers */
+ if (!isnan (src_val[i])) {
+ convert (self, src_val[i], (gpointer) values);
+ } else {
+ GST_LOG ("no control value for property %s at index %d", _self->name,
+ i);
+ }
+ values += byte_size;
+ }
+ } else {
+ GST_LOG ("failed to get control value for property %s at ts %"
+ GST_TIME_FORMAT, _self->name, GST_TIME_ARGS (timestamp));
+ }
+ g_free (src_val);
+ return res;
+}
+
+static gboolean
+gst_direct_control_binding_get_g_value_array (GstControlBinding * _self,
+ GstClockTime timestamp, GstClockTime interval, guint n_values,
GValue * values)
{
GstDirectControlBinding *self = GST_DIRECT_CONTROL_BINDING (_self);
@@ -334,7 +440,7 @@ gst_direct_control_binding_get_value_array (GstControlBinding * _self,
gdouble *src_val;
gboolean res = FALSE;
GType type;
- GstDirectControlBindingConvert convert;
+ GstDirectControlBindingConvertGValue convert;
g_return_val_if_fail (GST_IS_DIRECT_CONTROL_BINDING (self), FALSE);
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
@@ -342,13 +448,14 @@ gst_direct_control_binding_get_value_array (GstControlBinding * _self,
g_return_val_if_fail (values, FALSE);
g_return_val_if_fail (GST_CONTROL_BINDING_PSPEC (self), FALSE);
- convert = self->convert;
+ convert = self->convert_g_value;
type = G_PARAM_SPEC_VALUE_TYPE (_self->pspec);
src_val = g_new0 (gdouble, n_values);
if ((res = gst_control_source_get_value_array (self->cs, timestamp,
interval, n_values, src_val))) {
for (i = 0; i < n_values; i++) {
+ /* we will only get NAN for sparse control sources, such as triggers */
if (!isnan (src_val[i])) {
g_value_init (&values[i], type);
convert (self, src_val[i], &values[i]);
diff --git a/libs/gst/controller/gstdirectcontrolbinding.h b/libs/gst/controller/gstdirectcontrolbinding.h
index 729d117..24ece6d 100644
--- a/libs/gst/controller/gstdirectcontrolbinding.h
+++ b/libs/gst/controller/gstdirectcontrolbinding.h
@@ -48,14 +48,24 @@ typedef struct _GstDirectControlBinding GstDirectControlBinding;
typedef struct _GstDirectControlBindingClass GstDirectControlBindingClass;
/**
- * GstDirectControlBindingConvert:
+ * GstDirectControlBindingConvertValue:
+ * @self: the #GstDirectControlBinding instance
+ * @src_value: the value returned by the cotnrol source
+ * @dest_value: the target location
+ *
+ * Function to map a control-value to the target plain data type.
+ */
+typedef void (* GstDirectControlBindingConvertValue) (GstDirectControlBinding *self, gdouble src_value, gpointer dest_value);
+
+/**
+ * GstDirectControlBindingConvertGValue:
* @self: the #GstDirectControlBinding instance
* @src_value: the value returned by the cotnrol source
* @dest_value: the target GValue
*
* Function to map a control-value to the target GValue.
*/
-typedef void (* GstDirectControlBindingConvert) (GstDirectControlBinding *self, gdouble src_value, GValue *dest_value);
+typedef void (* GstDirectControlBindingConvertGValue) (GstDirectControlBinding *self, gdouble src_value, GValue *dest_value);
/**
* GstDirectControlBinding:
@@ -70,8 +80,10 @@ struct _GstDirectControlBinding {
GstControlSource *cs; /* GstControlSource for this property */
GValue cur_value;
gdouble last_value;
+ gint byte_size;
- GstDirectControlBindingConvert convert;
+ GstDirectControlBindingConvertValue convert_value;
+ GstDirectControlBindingConvertGValue convert_g_value;
gpointer _gst_reserved[GST_PADDING];
};
diff --git a/libs/gst/controller/gstlfocontrolsource.c b/libs/gst/controller/gstlfocontrolsource.c
index d5f23f6..819518d 100644
--- a/libs/gst/controller/gstlfocontrolsource.c
+++ b/libs/gst/controller/gstlfocontrolsource.c
@@ -399,6 +399,7 @@ gst_lfo_waveform_get_type (void)
#define _do_init \
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "lfo control source", 0, "low frequency oscillator control source")
+#define gst_lfo_control_source_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstLFOControlSource, gst_lfo_control_source,
GST_TYPE_CONTROL_SOURCE, _do_init);
@@ -466,7 +467,7 @@ gst_lfo_control_source_finalize (GObject * obj)
gst_lfo_control_source_reset (self);
g_mutex_clear (&self->lock);
- G_OBJECT_CLASS (gst_lfo_control_source_parent_class)->finalize (obj);
+ G_OBJECT_CLASS (parent_class)->finalize (obj);
}
static void
diff --git a/libs/gst/controller/gsttimedvaluecontrolsource.c b/libs/gst/controller/gsttimedvaluecontrolsource.c
index 38723eb..cd24549 100644
--- a/libs/gst/controller/gsttimedvaluecontrolsource.c
+++ b/libs/gst/controller/gsttimedvaluecontrolsource.c
@@ -48,6 +48,7 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "timed value control source", 0, \
"timed value control source base class")
+#define gst_timed_value_control_source_parent_class parent_class
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstTimedValueControlSource,
gst_timed_value_control_source, GST_TYPE_CONTROL_SOURCE, _do_init);
@@ -408,7 +409,7 @@ gst_timed_value_control_source_finalize (GObject * obj)
g_mutex_unlock (&self->lock);
g_mutex_clear (&self->lock);
- G_OBJECT_CLASS (gst_timed_value_control_source_parent_class)->finalize (obj);
+ G_OBJECT_CLASS (parent_class)->finalize (obj);
}
static void
diff --git a/libs/gst/helpers/Makefile.in b/libs/gst/helpers/Makefile.in
index 70bd6b2..c12b276 100644
--- a/libs/gst/helpers/Makefile.in
+++ b/libs/gst/helpers/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.4 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
diff --git a/libs/gst/net/Makefile.in b/libs/gst/net/Makefile.in
index 9db5659..c4b49a1 100644
--- a/libs/gst/net/Makefile.in
+++ b/libs/gst/net/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.4 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -524,7 +524,7 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(libdir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
@@ -619,7 +619,7 @@ install-girDATA: $(gir_DATA)
@list='$(gir_DATA)'; test -n "$(girdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(girdir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(girdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
@@ -640,7 +640,7 @@ install-typelibsDATA: $(typelibs_DATA)
@list='$(typelibs_DATA)'; test -n "$(typelibsdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(typelibsdir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(typelibsdir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(typelibsdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
@@ -661,7 +661,7 @@ install-libgstnet_@GST_API_VERSION@_includeHEADERS: $(libgstnet_@GST_API_VERSION
@list='$(libgstnet_@GST_API_VERSION@_include_HEADERS)'; test -n "$(libgstnet_@GST_API_VERSION@_includedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(libgstnet_@GST_API_VERSION@_includedir)'"; \
- $(MKDIR_P) '$(DESTDIR)$(libgstnet_@GST_API_VERSION@_includedir)' || exit 1; \
+ $(MKDIR_P) "$(DESTDIR)$(libgstnet_@GST_API_VERSION@_includedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \