mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
gst/elements/gstbufferstore.c: fix bug where buffer was not assembled correctly
Original commit message from CVS: 2004-01-25 Benjamin Otte <in7y118@public.uni-hamburg.de> * gst/elements/gstbufferstore.c: (gst_buffer_store_get_buffer): fix bug where buffer was not assembled correctly * gst/elements/gsttee.c: (gst_tee_class_init), (gst_tee_init): silence by default * gst/elements/gsttypefind.c: (gst_type_find_element_chain): only seek if there's no more buffers that could work without seeking
This commit is contained in:
parent
f21808c6a8
commit
8a1bb576b2
7 changed files with 83 additions and 48 deletions
|
@ -1,3 +1,12 @@
|
|||
2004-01-25 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||
|
||||
* gst/elements/gstbufferstore.c: (gst_buffer_store_get_buffer):
|
||||
fix bug where buffer was not assembled correctly
|
||||
* gst/elements/gsttee.c: (gst_tee_class_init), (gst_tee_init):
|
||||
silence by default
|
||||
* gst/elements/gsttypefind.c: (gst_type_find_element_chain):
|
||||
only seek if there's no more buffers that could work without seeking
|
||||
|
||||
2004-01-23 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* gst/gsttag.c: (_gst_tag_initialize):
|
||||
|
|
|
@ -364,6 +364,7 @@ gst_buffer_store_get_buffer (GstBufferStore *store, guint64 offset, guint size)
|
|||
walk = g_list_next (walk);
|
||||
tmp = MIN (GST_BUFFER_SIZE (current), size);
|
||||
memcpy (data, GST_BUFFER_DATA (current), tmp);
|
||||
data += tmp;
|
||||
size -= tmp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ gst_tee_class_init (GstTeeClass *klass)
|
|||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent", "silent",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
TRUE, G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last_message", "last_message", "last_message",
|
||||
NULL, G_PARAM_READABLE));
|
||||
|
@ -120,7 +120,6 @@ gst_tee_init (GstTee *tee)
|
|||
gst_pad_set_link_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link));
|
||||
gst_pad_set_getcaps_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
|
||||
|
||||
tee->silent = FALSE;
|
||||
tee->last_message = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -490,7 +490,12 @@ gst_type_find_element_chain (GstPad *pad, GstData *data)
|
|||
gst_pad_push (typefind->src, data);
|
||||
return;
|
||||
case MODE_TYPEFIND: {
|
||||
guint64 current_offset;
|
||||
|
||||
gst_buffer_store_add_buffer (typefind->store, GST_BUFFER (data));
|
||||
current_offset = GST_BUFFER_OFFSET_IS_VALID (data) ?
|
||||
GST_BUFFER_OFFSET (data) + GST_BUFFER_SIZE (data) :
|
||||
gst_buffer_store_get_size (typefind->store, 0);
|
||||
gst_data_unref (data);
|
||||
if (typefind->possibilities == NULL) {
|
||||
/* not yet started, get all typefinding functions into our "queue" */
|
||||
|
@ -563,30 +568,38 @@ gst_type_find_element_chain (GstPad *pad, GstData *data)
|
|||
/* set up typefind element for next iteration */
|
||||
typefind->possibilities = g_list_sort (typefind->possibilities, compare_type_find_entry);
|
||||
|
||||
walk = typefind->possibilities;
|
||||
while (walk) {
|
||||
/* look for typefind functions that require data without seeking */
|
||||
for (walk = typefind->possibilities; walk; walk = g_list_next (walk)) {
|
||||
entry = (TypeFindEntry *) walk->data;
|
||||
walk = g_list_next (walk);
|
||||
if (entry->requested_size > 0) {
|
||||
/* FIXME: need heuristic to find out if we should seek */
|
||||
gint64 seek_offset;
|
||||
GstEvent *event;
|
||||
if (entry->requested_offset <= current_offset &&
|
||||
entry->requested_offset + entry->requested_size > current_offset)
|
||||
break;
|
||||
}
|
||||
if (!walk) {
|
||||
/* find out if we should seek */
|
||||
for (walk = typefind->possibilities; walk; walk = g_list_next (walk)) {
|
||||
entry = (TypeFindEntry *) walk->data;
|
||||
if (entry->requested_size > 0) {
|
||||
/* FIXME: need heuristic to find out if we should seek */
|
||||
gint64 seek_offset;
|
||||
GstEvent *event;
|
||||
|
||||
seek_offset = entry->requested_offset > 0 ? entry->requested_offset :
|
||||
find_element_get_length (entry) + entry->requested_offset;
|
||||
seek_offset += gst_buffer_store_get_size (typefind->store, seek_offset);
|
||||
event = gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET, seek_offset);
|
||||
if (gst_pad_send_event (GST_PAD_PEER (typefind->sink), event)) {
|
||||
/* done seeking */
|
||||
GST_DEBUG_OBJECT (typefind, "'%s' was reset - seeked to %"G_GINT64_FORMAT,
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
|
||||
break;
|
||||
} else if (entry->requested_offset < 0) {
|
||||
/* impossible to seek */
|
||||
GST_DEBUG_OBJECT (typefind, "'%s' was reset - couldn't seek to %"G_GINT64_FORMAT,
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
|
||||
entry->requested_size = 0;
|
||||
entry->requested_offset = 0;
|
||||
seek_offset = entry->requested_offset > 0 ? entry->requested_offset :
|
||||
find_element_get_length (entry) + entry->requested_offset;
|
||||
seek_offset += gst_buffer_store_get_size (typefind->store, seek_offset);
|
||||
event = gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET, seek_offset);
|
||||
if (gst_pad_send_event (GST_PAD_PEER (typefind->sink), event)) {
|
||||
/* done seeking */
|
||||
GST_DEBUG_OBJECT (typefind, "'%s' was reset - seeked to %"G_GINT64_FORMAT,
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
|
||||
break;
|
||||
} else if (entry->requested_offset < 0) {
|
||||
/* impossible to seek */
|
||||
GST_DEBUG_OBJECT (typefind, "'%s' was reset - couldn't seek to %"G_GINT64_FORMAT,
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
|
||||
entry->requested_size = 0;
|
||||
entry->requested_offset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -364,6 +364,7 @@ gst_buffer_store_get_buffer (GstBufferStore *store, guint64 offset, guint size)
|
|||
walk = g_list_next (walk);
|
||||
tmp = MIN (GST_BUFFER_SIZE (current), size);
|
||||
memcpy (data, GST_BUFFER_DATA (current), tmp);
|
||||
data += tmp;
|
||||
size -= tmp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ gst_tee_class_init (GstTeeClass *klass)
|
|||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent", "silent",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
TRUE, G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last_message", "last_message", "last_message",
|
||||
NULL, G_PARAM_READABLE));
|
||||
|
@ -120,7 +120,6 @@ gst_tee_init (GstTee *tee)
|
|||
gst_pad_set_link_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link));
|
||||
gst_pad_set_getcaps_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
|
||||
|
||||
tee->silent = FALSE;
|
||||
tee->last_message = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -490,7 +490,12 @@ gst_type_find_element_chain (GstPad *pad, GstData *data)
|
|||
gst_pad_push (typefind->src, data);
|
||||
return;
|
||||
case MODE_TYPEFIND: {
|
||||
guint64 current_offset;
|
||||
|
||||
gst_buffer_store_add_buffer (typefind->store, GST_BUFFER (data));
|
||||
current_offset = GST_BUFFER_OFFSET_IS_VALID (data) ?
|
||||
GST_BUFFER_OFFSET (data) + GST_BUFFER_SIZE (data) :
|
||||
gst_buffer_store_get_size (typefind->store, 0);
|
||||
gst_data_unref (data);
|
||||
if (typefind->possibilities == NULL) {
|
||||
/* not yet started, get all typefinding functions into our "queue" */
|
||||
|
@ -563,30 +568,38 @@ gst_type_find_element_chain (GstPad *pad, GstData *data)
|
|||
/* set up typefind element for next iteration */
|
||||
typefind->possibilities = g_list_sort (typefind->possibilities, compare_type_find_entry);
|
||||
|
||||
walk = typefind->possibilities;
|
||||
while (walk) {
|
||||
/* look for typefind functions that require data without seeking */
|
||||
for (walk = typefind->possibilities; walk; walk = g_list_next (walk)) {
|
||||
entry = (TypeFindEntry *) walk->data;
|
||||
walk = g_list_next (walk);
|
||||
if (entry->requested_size > 0) {
|
||||
/* FIXME: need heuristic to find out if we should seek */
|
||||
gint64 seek_offset;
|
||||
GstEvent *event;
|
||||
if (entry->requested_offset <= current_offset &&
|
||||
entry->requested_offset + entry->requested_size > current_offset)
|
||||
break;
|
||||
}
|
||||
if (!walk) {
|
||||
/* find out if we should seek */
|
||||
for (walk = typefind->possibilities; walk; walk = g_list_next (walk)) {
|
||||
entry = (TypeFindEntry *) walk->data;
|
||||
if (entry->requested_size > 0) {
|
||||
/* FIXME: need heuristic to find out if we should seek */
|
||||
gint64 seek_offset;
|
||||
GstEvent *event;
|
||||
|
||||
seek_offset = entry->requested_offset > 0 ? entry->requested_offset :
|
||||
find_element_get_length (entry) + entry->requested_offset;
|
||||
seek_offset += gst_buffer_store_get_size (typefind->store, seek_offset);
|
||||
event = gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET, seek_offset);
|
||||
if (gst_pad_send_event (GST_PAD_PEER (typefind->sink), event)) {
|
||||
/* done seeking */
|
||||
GST_DEBUG_OBJECT (typefind, "'%s' was reset - seeked to %"G_GINT64_FORMAT,
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
|
||||
break;
|
||||
} else if (entry->requested_offset < 0) {
|
||||
/* impossible to seek */
|
||||
GST_DEBUG_OBJECT (typefind, "'%s' was reset - couldn't seek to %"G_GINT64_FORMAT,
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
|
||||
entry->requested_size = 0;
|
||||
entry->requested_offset = 0;
|
||||
seek_offset = entry->requested_offset > 0 ? entry->requested_offset :
|
||||
find_element_get_length (entry) + entry->requested_offset;
|
||||
seek_offset += gst_buffer_store_get_size (typefind->store, seek_offset);
|
||||
event = gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET, seek_offset);
|
||||
if (gst_pad_send_event (GST_PAD_PEER (typefind->sink), event)) {
|
||||
/* done seeking */
|
||||
GST_DEBUG_OBJECT (typefind, "'%s' was reset - seeked to %"G_GINT64_FORMAT,
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
|
||||
break;
|
||||
} else if (entry->requested_offset < 0) {
|
||||
/* impossible to seek */
|
||||
GST_DEBUG_OBJECT (typefind, "'%s' was reset - couldn't seek to %"G_GINT64_FORMAT,
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
|
||||
entry->requested_size = 0;
|
||||
entry->requested_offset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue