compute offsets correctly for internal buffers so timestamps are set correctly when we can't seek. Also handle cases ...

Original commit message from CVS:
* autogen.sh:
* configure.ac:
* ext/mad/gstid3tag.c: (gst_id3_tag_chain):
compute offsets correctly for internal buffers so timestamps are set
correctly when we can't seek. Also handle cases where there are no
offsets. (based on a patch by David Moore, fixes #142507)
This commit is contained in:
David Moore 2004-05-17 00:25:30 +00:00 committed by Benjamin Otte
parent a05c349c99
commit 21b44450ec
4 changed files with 36 additions and 14 deletions

View file

@ -1,3 +1,12 @@
2004-05-17 Benjamin Otte <otte@gnome.org>
* autogen.sh:
* configure.ac:
* ext/mad/gstid3tag.c: (gst_id3_tag_chain):
compute offsets correctly for internal buffers so timestamps are set
correctly when we can't seek. Also handle cases where there are no
offsets. (based on a patch by David Moore, fixes #142507)
2004-05-17 Benjamin Otte <otte@gnome.org>
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):

View file

@ -72,7 +72,7 @@ fi
tool_run "$autopoint --force"
patch -p0 < common/gettext.patch
tool_run "$aclocal" "-I m4 -I common/m4 $ACLOCAL_FLAGS"
tool_run "$aclocal" "-I m4 -I common/m4 -I . $ACLOCAL_FLAGS"
tool_run "$libtoolize" "--copy --force"
tool_run "$autoheader"

View file

@ -36,7 +36,7 @@ AM_CONFIG_HEADER(config.h)
dnl Add parameters for aclocal
dnl (This must come after AM_INIT_AUTOMAKE, since it modifies ACLOCAL)
ACLOCAL_FLAGS="-I m4 -I common/m4"
ACLOCAL_FLAGS="-I m4 -I common/m4 -I ."
AC_SUBST(ACLOCAL_AMFLAGS, $ACLOCAL_FLAGS)
AC_PROG_CC

View file

@ -1098,6 +1098,13 @@ gst_id3_tag_chain (GstPad * pad, GstData * data)
buffer =
gst_buffer_create_sub (tag->buffer, tag->v2tag_size,
GST_BUFFER_SIZE (tag->buffer) - tag->v2tag_size);
/* the offsets will be corrected further down, we just copy them */
if (GST_BUFFER_OFFSET_IS_VALID (tag->buffer))
GST_BUFFER_OFFSET (buffer) =
GST_BUFFER_OFFSET (tag->buffer) + tag->v2tag_size;
if (GST_BUFFER_OFFSET_END_IS_VALID (tag->buffer))
GST_BUFFER_OFFSET_END (buffer) =
GST_BUFFER_OFFSET_END (tag->buffer) + tag->v2tag_size;
gst_data_unref (GST_DATA (tag->buffer));
tag->buffer = NULL;
if (tag->found_caps == NULL)
@ -1155,23 +1162,29 @@ gst_id3_tag_chain (GstPad * pad, GstData * data)
gst_element_set_eos (GST_ELEMENT (tag));
gst_pad_push (tag->srcpad, GST_DATA (gst_event_new (GST_EVENT_EOS)));
} else {
if (buffer->offset >= tag->v1tag_offset) {
gst_data_unref (GST_DATA (buffer));
return;
} else if (buffer->offset + buffer->size > tag->v1tag_offset) {
GstBuffer *sub = gst_buffer_create_sub (buffer, 0,
buffer->size - 128);
if (GST_BUFFER_OFFSET_IS_VALID (buffer)) {
if (buffer->offset >= tag->v1tag_offset) {
gst_data_unref (GST_DATA (buffer));
return;
} else if (buffer->offset + buffer->size > tag->v1tag_offset) {
GstBuffer *sub = gst_buffer_create_sub (buffer, 0,
buffer->size - 128);
gst_data_unref (GST_DATA (buffer));
buffer = sub;
gst_data_unref (GST_DATA (buffer));
buffer = sub;
}
}
if (tag->v2tag_size) {
GstBuffer *sub =
gst_buffer_create_sub (buffer, 0, GST_BUFFER_SIZE (buffer));
GST_BUFFER_OFFSET (sub) =
GST_BUFFER_OFFSET (buffer) - tag->v2tag_size;
GST_BUFFER_OFFSET_END (sub) =
GST_BUFFER_OFFSET_END (buffer) - tag->v2tag_size;
if (GST_BUFFER_OFFSET_IS_VALID (buffer))
GST_BUFFER_OFFSET (sub) =
GST_BUFFER_OFFSET (buffer) - tag->v2tag_size +
tag->v2tag_size_new;
if (GST_BUFFER_OFFSET_END_IS_VALID (buffer))
GST_BUFFER_OFFSET_END (sub) =
GST_BUFFER_OFFSET_END (buffer) - tag->v2tag_size +
tag->v2tag_size_new;
gst_data_unref (GST_DATA (buffer));
buffer = sub;
}