diff --git a/ChangeLog b/ChangeLog index 58d8439550..78c338b06e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-02-15 Tim-Philipp Müller + + * plugins/elements/gsttypefindelement.c: (find_peek): + We can do peeks at non-zero offsets, as long as they + fall within the buffer we have. + 2006-02-15 Jan Schmidt * tests/check/Makefile.am: diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index 180509c3c5..5cbd91c161 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -607,8 +607,22 @@ find_peek (gpointer data, gint64 offset, guint size) GST_LOG_OBJECT (entry->self, "'%s' called peek (%" G_GINT64_FORMAT ", %u)", GST_PLUGIN_FEATURE_NAME (entry->factory), offset, size); - if (offset != 0) + + if (offset < 0) { + GST_LOG_OBJECT (entry->self, "peek at end not supported in push mode"); return NULL; + } + + if (offset > 0) { + if ((offset + size) <= entry->self->store->size) { + entry->requested_size = 0; + return GST_BUFFER_DATA (entry->self->store) + offset; + } + /* no can do */ + return NULL; + } + + /* offset == 0 ... */ if (size <= entry->self->store->size) { entry->requested_size = 0;