ext/gnomevfs/gstgnomevfssrc.c (gst_gnomevfssrc_get): Remove ugly code to pull a bigger buffer in iradio mode. This a...

Original commit message from CVS:
2004-01-26  Colin Walters  <walters@verbum.org>

* ext/gnomevfs/gstgnomevfssrc.c (gst_gnomevfssrc_get): Remove ugly
code to pull a bigger buffer in iradio mode.  This as a side effect
makes typefinding work.
This commit is contained in:
Colin Walters 2004-01-26 22:17:08 +00:00
parent f9e26c83af
commit 260071fc4a
2 changed files with 29 additions and 36 deletions

View file

@ -1,3 +1,9 @@
2004-01-26 Colin Walters <walters@verbum.org>
* ext/gnomevfs/gstgnomevfssrc.c (gst_gnomevfssrc_get): Remove ugly
code to pull a bigger buffer in iradio mode. This as a side effect
makes typefinding work.
2004-01-26 Jeremy Simon <jesimon@libertysurf.fr> 2004-01-26 Jeremy Simon <jesimon@libertysurf.fr>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_to_extradata): * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_to_extradata):

View file

@ -97,7 +97,6 @@ struct _GstGnomeVFSSrc {
GnomeVFSFileOffset curoffset; /* current offset in file */ GnomeVFSFileOffset curoffset; /* current offset in file */
gulong bytes_per_read; /* bytes per read */ gulong bytes_per_read; /* bytes per read */
gboolean new_seek; gboolean new_seek;
gboolean in_first_get;
/* icecast/audiocast metadata extraction handling */ /* icecast/audiocast metadata extraction handling */
gboolean iradio_mode; gboolean iradio_mode;
@ -328,7 +327,6 @@ static void gst_gnomevfssrc_init(GstGnomeVFSSrc *gnomevfssrc)
gnomevfssrc->curoffset = 0; gnomevfssrc->curoffset = 0;
gnomevfssrc->bytes_per_read = 4096; gnomevfssrc->bytes_per_read = 4096;
gnomevfssrc->new_seek = FALSE; gnomevfssrc->new_seek = FALSE;
gnomevfssrc->in_first_get = TRUE;
gnomevfssrc->icy_metaint = 0; gnomevfssrc->icy_metaint = 0;
@ -961,37 +959,28 @@ static GstData *gst_gnomevfssrc_get(GstPad *pad)
g_return_val_if_fail (GST_BUFFER_DATA (buf) != NULL, NULL); g_return_val_if_fail (GST_BUFFER_DATA (buf) != NULL, NULL);
GST_BUFFER_SIZE (buf) = 0; GST_BUFFER_SIZE (buf) = 0;
/* FIXME GROSS HACK: We try to read in at least 8000 GST_DEBUG ("doing read: icy_count: %" G_GINT64_FORMAT, src->icy_count);
* bytes of data so that mp3 typefinding will work. */ result = gnome_vfs_read (src->handle, data,
do src->icy_metaint - src->icy_count,
{ &readbytes);
GST_DEBUG ("doing read: icy_count: %" G_GINT64_FORMAT, src->icy_count);
result = gnome_vfs_read (src->handle, data, /* EOS? */
src->icy_metaint - src->icy_count, if (readbytes == 0) {
&readbytes); gst_buffer_unref (buf);
gst_element_set_eos (GST_ELEMENT (src));
/* EOS? */ return GST_DATA (gst_event_new (GST_EVENT_EOS));
if (readbytes == 0) { }
gst_buffer_unref (buf);
gst_element_set_eos (GST_ELEMENT (src)); src->icy_count += readbytes;
src->in_first_get = FALSE; GST_BUFFER_OFFSET (buf) = src->curoffset;
return GST_DATA (gst_event_new (GST_EVENT_EOS)); GST_BUFFER_SIZE (buf) += readbytes;
} data += readbytes;
src->curoffset += readbytes;
src->icy_count += readbytes;
GST_BUFFER_OFFSET (buf) = src->curoffset; if (src->icy_count == src->icy_metaint) {
GST_BUFFER_SIZE (buf) += readbytes; gst_gnomevfssrc_get_icy_metadata (src);
data += readbytes; src->icy_count = 0;
src->curoffset += readbytes; }
if (src->icy_count == src->icy_metaint) {
gst_gnomevfssrc_get_icy_metadata (src);
src->icy_count = 0;
}
} while (src->in_first_get
&& GST_BUFFER_OFFSET (buf) < 8000 &&
src->icy_metaint - src->icy_count >= 8000);
src->in_first_get = FALSE;
} else { } else {
/* allocate the space for the buffer data */ /* allocate the space for the buffer data */
GST_BUFFER_DATA(buf) = g_malloc(src->bytes_per_read); GST_BUFFER_DATA(buf) = g_malloc(src->bytes_per_read);
@ -1100,10 +1089,8 @@ static gboolean gst_gnomevfssrc_open_file(GstGnomeVFSSrc *src)
GST_DEBUG ("open result: %s", gnome_vfs_result_to_string (result)); GST_DEBUG ("open result: %s", gnome_vfs_result_to_string (result));
src->in_first_get = TRUE;
if(gnome_vfs_seek(src->handle, GNOME_VFS_SEEK_CURRENT, 0) if(gnome_vfs_seek(src->handle, GNOME_VFS_SEEK_CURRENT, 0)
== GNOME_VFS_OK){ == GNOME_VFS_OK) {
src->seekable = TRUE; src->seekable = TRUE;
}else{ }else{
src->seekable = FALSE; src->seekable = FALSE;