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> 2006-02-07 Andy Wingo <wingo@pobox.com>
* configure.ac (GST_MAJORMINOR): Update core version req to * 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, res = gnome_vfs_read (src->handle, data,
src->icy_metaint - src->icy_count, &readbytes); 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) if (res != GNOME_VFS_OK)
goto read_failed; goto read_failed;
if (readbytes == 0)
goto eos;
src->icy_count += readbytes; src->icy_count += readbytes;
GST_BUFFER_OFFSET (buf) = src->curoffset; GST_BUFFER_OFFSET (buf) = src->curoffset;
GST_BUFFER_SIZE (buf) = readbytes; 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); 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; GST_BUFFER_SIZE (buf) = readbytes;
if (res != GNOME_VFS_OK) if (res != GNOME_VFS_OK)
goto read_failed; goto read_failed;
if (readbytes == 0)
goto eos;
src->curoffset += readbytes; src->curoffset += readbytes;
} }
@ -1010,30 +1010,31 @@ gst_gnome_vfs_src_create (GstBaseSrc * basesrc, guint64 offset, guint size,
seek_failed: seek_failed:
{ {
GST_ERROR_OBJECT (src, GST_ELEMENT_ERROR (src, RESOURCE, SEEK, (NULL),
"Failed to seek to requested position %lld: %s", ("Failed to seek to requested position %" G_GINT64_FORMAT ": %s",
offset, gnome_vfs_result_to_string (res)); offset, gnome_vfs_result_to_string (res)));
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
cannot_seek: cannot_seek:
{ {
GST_ERROR_OBJECT (src, GST_ELEMENT_ERROR (src, RESOURCE, SEEK, (NULL),
"Requested seek from %lld to %lld on non-seekable stream", ("Requested seek from %" G_GINT64_FORMAT " to %" G_GINT64_FORMAT
src->curoffset, offset); "on non-seekable stream", src->curoffset, offset));
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
read_failed: read_failed:
{ {
gst_buffer_unref (buf); gst_buffer_unref (buf);
GST_ERROR_OBJECT (src, "Failed to read data: %s", GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
gnome_vfs_result_to_string (res)); ("Failed to read data: %s", gnome_vfs_result_to_string (res)));
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
eos: eos:
{ {
gst_buffer_unref (buf); gst_buffer_unref (buf);
GST_LOG_OBJECT (src, "Reading data gave EOS"); GST_DEBUG_OBJECT (src, "Reading data gave EOS");
return GST_FLOW_WRONG_STATE; gst_pad_push_event (basesrc->srcpad, gst_event_new_eos ());
return GST_FLOW_UNEXPECTED;
} }
} }