diff options
author | Benjamin Otte <otte@gnome.org> | 2003-11-03 19:18:36 +0000 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2003-11-03 19:18:36 +0000 |
commit | 577f43dacf60a497ba1c5a3b341b3b377553cad5 (patch) | |
tree | d2b8c3c8db213464d39f4a3b8f37b8d413a01b32 | |
parent | dd3d4e08ae8d9d1fdf0bc063f29a1000a2cdbd96 (diff) | |
download | gst-plugins-bad-577f43dacf60a497ba1c5a3b341b3b377553cad5.tar.gz gst-plugins-bad-577f43dacf60a497ba1c5a3b341b3b377553cad5.tar.bz2 gst-plugins-bad-577f43dacf60a497ba1c5a3b341b3b377553cad5.zip |
remove audiofile typefinding because it is buggy and we support all of its formats anyway.
Original commit message from CVS:
remove audiofile typefinding because it is buggy and we support all of its formats anyway.
If you need it back, please fix it before you put it back in :)
-rw-r--r-- | ext/audiofile/Makefile.am | 2 | ||||
-rw-r--r-- | ext/audiofile/gstaf.c | 1 | ||||
-rw-r--r-- | ext/audiofile/gstaftypes.c | 196 |
3 files changed, 1 insertions, 198 deletions
diff --git a/ext/audiofile/Makefile.am b/ext/audiofile/Makefile.am index 821f0e0d..cdca46d1 100644 --- a/ext/audiofile/Makefile.am +++ b/ext/audiofile/Makefile.am @@ -1,7 +1,7 @@ plugin_LTLIBRARIES = libgstaudiofile.la -libgstaudiofile_la_SOURCES = gstaf.c gstafsink.c gstafsrc.c gstafparse.c gstaftypes.c +libgstaudiofile_la_SOURCES = gstaf.c gstafsink.c gstafsrc.c gstafparse.c libgstaudiofile_la_CFLAGS = $(GST_CFLAGS) $(AUDIOFILE_CFLAGS) libgstaudiofile_la_LIBADD = $(AUDIOFILE_LIBS) libgstaudiofile_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) diff --git a/ext/audiofile/gstaf.c b/ext/audiofile/gstaf.c index 691788ea..7014dad3 100644 --- a/ext/audiofile/gstaf.c +++ b/ext/audiofile/gstaf.c @@ -33,7 +33,6 @@ plugin_init (GstPlugin *plugin) gst_afsink_plugin_init (plugin); gst_afsrc_plugin_init (plugin); gst_afparse_plugin_init (plugin); - gst_aftypes_plugin_init (plugin); return TRUE; } diff --git a/ext/audiofile/gstaftypes.c b/ext/audiofile/gstaftypes.c deleted file mode 100644 index 09e68d32..00000000 --- a/ext/audiofile/gstaftypes.c +++ /dev/null @@ -1,196 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> - * 2000 Wim Taymans <wtay@chello.be> - * - * gstaftypes.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#include <gst/gst.h> -#include <string.h> -#include <audiofile.h> -#include <af_vfs.h> - -static ssize_t gst_aftypes_vf_read (AFvirtualfile *vfile, void *data, size_t nbytes); -static long gst_aftypes_vf_length (AFvirtualfile *vfile); -static ssize_t gst_aftypes_vf_write (AFvirtualfile *vfile, const void *data, size_t nbytes); -static void gst_aftypes_vf_destroy(AFvirtualfile *vfile); -static long gst_aftypes_vf_seek (AFvirtualfile *vfile, long offset, int is_relative); -static long gst_aftypes_vf_tell (AFvirtualfile *vfile); - -static void gst_aftypes_type_find(GstTypeFind *tf, gpointer private); - -typedef struct _GstAFTypesBuffer GstAFTypesBuffer; -struct _GstAFTypesBuffer { - guint8 *data; - int length; - long offset; -}; - -#define GST_AUDIOFILE_TYPE_FIND_SIZE 4096 -#define AF_CAPS(type) gst_caps_new ("audiofile_type_find", type, NULL) -static void -gst_aftypes_type_find(GstTypeFind *tf, gpointer private) -{ - GstAFTypesBuffer *buffer_wrap; - guint8 *data; - AFvirtualfile *vfile; - AFfilehandle file; - int file_format, format_version; - gchar *type; - - data = gst_type_find_peek (tf, 0, GST_AUDIOFILE_TYPE_FIND_SIZE); - if (data == NULL) return; - - buffer_wrap = g_new0(GstAFTypesBuffer, 1); - buffer_wrap->data = data; - buffer_wrap->length = GST_AUDIOFILE_TYPE_FIND_SIZE; - buffer_wrap->offset = 0; - - vfile = af_virtual_file_new(); - vfile->closure = buffer_wrap; - vfile->read = gst_aftypes_vf_read; - vfile->length = gst_aftypes_vf_length; - vfile->write = gst_aftypes_vf_write; - vfile->destroy = gst_aftypes_vf_destroy; - vfile->seek = gst_aftypes_vf_seek; - vfile->tell = gst_aftypes_vf_tell; - - file = afOpenVirtualFile (vfile, "r", AF_NULL_FILESETUP); - file_format = afGetFileFormat (file, &format_version); - afCloseFile (file); - - //GST_DEBUG("file format: %d", file_format); - - /* reject raw data, just in case it is some other format */ - if (file_format == AF_FILE_UNKNOWN || - file_format == AF_FILE_RAWDATA){ - g_free (buffer_wrap); - return; - } - switch (file_format){ - case AF_FILE_AIFF: - case AF_FILE_AIFFC: - type = "audio/x-aiff"; - break; - case AF_FILE_WAVE: - type = "audio/x-wav"; - break; - case AF_FILE_NEXTSND: - type = "audio/basic"; - break; - case AF_FILE_BICSF: - default: - type=NULL; - break; - } - - if (type != NULL){ - gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, AF_CAPS(type)); - } -} - -gboolean -gst_aftypes_plugin_init (GstPlugin *plugin) -{ - static gchar * af_exts[] = { "aiff", "aif", "aifc", "wav", "au", "snd", NULL }; - - gst_type_find_register (plugin, "audio/x-mod", - GST_RANK_MARGINAL, - gst_aftypes_type_find, af_exts, - GST_CAPS_ANY, NULL); - - return TRUE; -} - - -static ssize_t -gst_aftypes_vf_read (AFvirtualfile *vfile, void *data, size_t nbytes) -{ - GstAFTypesBuffer *bwrap = (GstAFTypesBuffer*)vfile->closure; - long bufsize = bwrap->length; - guint8 *bytes = bwrap->data; - - if (bwrap->offset + nbytes > bufsize){ - nbytes = bufsize; - } - - bytes += bwrap->offset; - memcpy(data, bytes, nbytes); - bwrap->offset += nbytes; - - g_print("read %d bytes\n", nbytes); - - return nbytes; -} - -static long -gst_aftypes_vf_seek (AFvirtualfile *vfile, long offset, int is_relative) -{ - GstAFTypesBuffer *bwrap = (GstAFTypesBuffer*)vfile->closure; - long bufsize = bwrap->length; - - g_print("request seek to: %ld\n", offset); - if (!is_relative){ - if (offset > bufsize || offset < 0){ - return -1; - } - bwrap->offset = offset; - } - else { - if (bwrap->offset + offset > bufsize || - bwrap->offset + offset < 0){ - return -1; - } - bwrap->offset += offset; - } - - g_print("seek to: %ld\n", bwrap->offset); - return bwrap->offset; -} - -static long -gst_aftypes_vf_length (AFvirtualfile *vfile) -{ - GstAFTypesBuffer *bwrap = (GstAFTypesBuffer*)vfile->closure; - return bwrap->length; -} - -static ssize_t -gst_aftypes_vf_write (AFvirtualfile *vfile, const void *data, size_t nbytes) -{ - g_warning("shouldn't write to a readonly pad"); - return 0; -} - -static void -gst_aftypes_vf_destroy(AFvirtualfile *vfile) -{ - -} - -static long -gst_aftypes_vf_tell (AFvirtualfile *vfile) -{ - GstAFTypesBuffer *bwrap = (GstAFTypesBuffer*)vfile->closure; - g_print("doing tell: %ld\n", bwrap->offset); - return bwrap->offset; -} - - - |