From b53dc49d8dab3f9bc9e8c5dc36c10ccf9bb8f6c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 9 Mar 2006 10:46:35 +0000 Subject: [PATCH] libs/gst/base/gsttypefindhelper.c: If we are provided with the size, we should implement Original commit message from CVS: * 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. --- ChangeLog | 8 ++++++++ libs/gst/base/gsttypefindhelper.c | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7580665..252aee2 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 78d3a5d..5d9ad8b 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; -- 2.7.4