diff --git a/ChangeLog b/ChangeLog index 75806655a6..252aee25a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-03-09 Tim-Philipp Müller + + * libs/gst/base/gsttypefindhelper.c: (helper_find_get_length), + (gst_type_find_helper_get_range): + If we are provided with the size, we should implement + GstTypeFind::get_length, so that typefind functions who + want to can actually peek at the middle of a file. + 2006-03-08 Tim-Philipp Müller * docs/manual/advanced-dataaccess.xml: diff --git a/libs/gst/base/gsttypefindhelper.c b/libs/gst/base/gsttypefindhelper.c index 78d3a5d08a..5d9ad8b278 100644 --- a/libs/gst/base/gsttypefindhelper.c +++ b/libs/gst/base/gsttypefindhelper.c @@ -147,6 +147,17 @@ helper_find_suggest (gpointer data, guint probability, const GstCaps * caps) } } +static guint64 +helper_find_get_length (gpointer data) +{ + GstTypeFindHelper *find = (GstTypeFindHelper *) data; + + GST_LOG_OBJECT (find->obj, "'%s' called called get_length, returning %" + G_GUINT64_FORMAT, GST_PLUGIN_FEATURE_NAME (find->factory), find->size); + + return find->size; +} + /** * gst_type_find_helper_get_range: * @obj: A #GstObject that will be passed as first argument to @func @@ -195,7 +206,12 @@ gst_type_find_helper_get_range (GstObject * obj, gst_find.data = &find; gst_find.peek = helper_find_peek; gst_find.suggest = helper_find_suggest; - gst_find.get_length = NULL; + + if (size == 0 || size == (guint64) - 1) { + gst_find.get_length = NULL; + } else { + gst_find.get_length = helper_find_get_length; + } walk = type_list;