From e4d393eb66712ddf1b34b4728c31acec29bdb041 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 27 Feb 2006 20:01:53 +0000 Subject: [PATCH] plugins/elements/gsttypefindelement.c: When we get an EOS event and have not found a type yet (most likely because we... Original commit message from CVS: * plugins/elements/gsttypefindelement.c: (gst_type_find_element_handle_event): When we get an EOS event and have not found a type yet (most likely because we had not yet accumulated TYPE_FIND_MIN_SIZE of data yet), try to determine the type given the data we have so far. Fixes typefinding for very short streams again, most notably quicktime redirections as used on Apple's trailer site (#331701). --- ChangeLog | 11 +++++++++++ plugins/elements/gsttypefindelement.c | 22 +++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d06cb5..a7f7c2f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2006-02-27 Tim-Philipp Müller + * plugins/elements/gsttypefindelement.c: + (gst_type_find_element_handle_event): + When we get an EOS event and have not found a type yet + (most likely because we had not yet accumulated + TYPE_FIND_MIN_SIZE of data yet), try to determine the + type given the data we have so far. Fixes typefinding + for very short streams again, most notably quicktime + redirections as used on Apple's trailer site (#331701). + +2006-02-27 Tim-Philipp Müller + * libs/gst/base/gsttypefindhelper.c: (type_find_factory_rank_cmp), (gst_type_find_helper): Try typefinding factories with the highest rank first. diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index d55dfe8..f120326 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -559,20 +559,24 @@ gst_type_find_element_handle_event (GstPad * pad, GstEvent * event) case MODE_TYPEFIND: switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS:{ - TypeFindEntry *entry; + GstTypeFindProbability prob; + GstCaps *caps; - entry = gst_type_find_element_get_best_possibility (typefind); + GST_INFO_OBJECT (typefind, "Got EOS and no type found yet"); - if (entry && entry->probability >= typefind->min_probability) { - GST_INFO_OBJECT (typefind, - "'%s' is the best typefind left after we got all data, using it now (probability %u)", - GST_PLUGIN_FEATURE_NAME (entry->factory), entry->probability); + /* we might not have started typefinding yet because there was not + * enough data so far; just give it a shot now and see what we get */ + caps = gst_type_find_helper_for_buffer (GST_OBJECT (typefind), + typefind->store, &prob); + + if (caps && prob >= typefind->min_probability) { g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], - 0, entry->probability, entry->caps); + 0, prob, caps); } else { - GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL), - (NULL)); + GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, + (NULL), (NULL)); } + gst_caps_replace (&caps, NULL); stop_typefinding (typefind); res = gst_pad_event_default (pad, event); break; -- 2.7.4