ext/gnomevfs/gstgnomevfssrc.c: Treat GNOME_VFS_RESULT_EOF as EOS, not as error (#329194).

Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_create):
Treat GNOME_VFS_RESULT_EOF as EOS, not as error (#329194).
Post an error message on the bus when we encounter an
error, which will hopefully be more meaningful than the
'Internal Flow Error' message users get to see if we
just return GST_FLOW_ERROR.
This commit is contained in:
Tim-Philipp Müller 2006-02-07 11:44:39 +00:00
parent c48e901ac3
commit b14f57785e
2 changed files with 26 additions and 16 deletions

View file

@ -1,3 +1,12 @@
2006-02-07 Tim-Philipp Müller <tim at centricular dot net>
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_create):
Treat GNOME_VFS_RESULT_EOF as EOS, not as error (#329194).
Post an error message on the bus when we encounter an
error, which will hopefully be more meaningful than the
'Internal Flow Error' message users get to see if we
just return GST_FLOW_ERROR.
2006-02-07 Andy Wingo <wingo@pobox.com>
* configure.ac (GST_MAJORMINOR): Update core version req to

View file

@ -969,12 +969,12 @@ gst_gnome_vfs_src_create (GstBaseSrc * basesrc, guint64 offset, guint size,
res = gnome_vfs_read (src->handle, data,
src->icy_metaint - src->icy_count, &readbytes);
if (res == GNOME_VFS_ERROR_EOF || (res == GNOME_VFS_OK && readbytes == 0))
goto eos;
if (res != GNOME_VFS_OK)
goto read_failed;
if (readbytes == 0)
goto eos;
src->icy_count += readbytes;
GST_BUFFER_OFFSET (buf) = src->curoffset;
GST_BUFFER_SIZE (buf) = readbytes;
@ -992,14 +992,14 @@ gst_gnome_vfs_src_create (GstBaseSrc * basesrc, guint64 offset, guint size,
res = gnome_vfs_read (src->handle, data, size, &readbytes);
if (res == GNOME_VFS_ERROR_EOF || (res == GNOME_VFS_OK && readbytes == 0))
goto eos;
GST_BUFFER_SIZE (buf) = readbytes;
if (res != GNOME_VFS_OK)
goto read_failed;
if (readbytes == 0)
goto eos;
src->curoffset += readbytes;
}
@ -1010,30 +1010,31 @@ gst_gnome_vfs_src_create (GstBaseSrc * basesrc, guint64 offset, guint size,
seek_failed:
{
GST_ERROR_OBJECT (src,
"Failed to seek to requested position %lld: %s",
offset, gnome_vfs_result_to_string (res));
GST_ELEMENT_ERROR (src, RESOURCE, SEEK, (NULL),
("Failed to seek to requested position %" G_GINT64_FORMAT ": %s",
offset, gnome_vfs_result_to_string (res)));
return GST_FLOW_ERROR;
}
cannot_seek:
{
GST_ERROR_OBJECT (src,
"Requested seek from %lld to %lld on non-seekable stream",
src->curoffset, offset);
GST_ELEMENT_ERROR (src, RESOURCE, SEEK, (NULL),
("Requested seek from %" G_GINT64_FORMAT " to %" G_GINT64_FORMAT
"on non-seekable stream", src->curoffset, offset));
return GST_FLOW_ERROR;
}
read_failed:
{
gst_buffer_unref (buf);
GST_ERROR_OBJECT (src, "Failed to read data: %s",
gnome_vfs_result_to_string (res));
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
("Failed to read data: %s", gnome_vfs_result_to_string (res)));
return GST_FLOW_ERROR;
}
eos:
{
gst_buffer_unref (buf);
GST_LOG_OBJECT (src, "Reading data gave EOS");
return GST_FLOW_WRONG_STATE;
GST_DEBUG_OBJECT (src, "Reading data gave EOS");
gst_pad_push_event (basesrc->srcpad, gst_event_new_eos ());
return GST_FLOW_UNEXPECTED;
}
}