diff options
author | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2005-01-29 01:28:34 +0000 |
---|---|---|
committer | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2005-01-29 01:28:34 +0000 |
commit | f6b6f72c1c30de3334306e73000ebeb4a054a2b2 (patch) | |
tree | 8cab91cf09927cb278504c1636fb9f9e0e45654a /ext/musepack/gstmusepackreader.cpp | |
parent | 6af0bb76f1dcc0beb019c7bd4fd63dba33fb47e0 (diff) | |
download | gst-plugins-bad-f6b6f72c1c30de3334306e73000ebeb4a054a2b2.tar.gz gst-plugins-bad-f6b6f72c1c30de3334306e73000ebeb4a054a2b2.tar.bz2 gst-plugins-bad-f6b6f72c1c30de3334306e73000ebeb4a054a2b2.zip |
Update to 1.1 API (#165446).
Original commit message from CVS:
* configure.ac:
* ext/musepack/Makefile.am:
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_class_init),
(gst_musepackdec_init), (gst_musepackdec_dispose),
(gst_musepackdec_src_query), (gst_musepackdec_src_convert),
(gst_musepack_stream_init), (gst_musepackdec_loop),
(gst_musepackdec_change_state):
* ext/musepack/gstmusepackdec.cpp:
* ext/musepack/gstmusepackdec.h:
* ext/musepack/gstmusepackreader.c: (gst_musepack_reader_peek),
(gst_musepack_reader_read), (gst_musepack_reader_seek),
(gst_musepack_reader_tell), (gst_musepack_reader_get_size),
(gst_musepack_reader_canseek), (gst_musepack_init_reader):
* ext/musepack/gstmusepackreader.cpp:
* ext/musepack/gstmusepackreader.h:
Update to 1.1 API (#165446).
Diffstat (limited to 'ext/musepack/gstmusepackreader.cpp')
-rw-r--r-- | ext/musepack/gstmusepackreader.cpp | 151 |
1 files changed, 0 insertions, 151 deletions
diff --git a/ext/musepack/gstmusepackreader.cpp b/ext/musepack/gstmusepackreader.cpp deleted file mode 100644 index 07fbcf3d..00000000 --- a/ext/musepack/gstmusepackreader.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* GStreamer Musepack decoder plugin - * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net> - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> -#include <string.h> - -#include "gstmusepackreader.h" - -GstMusepackReader::GstMusepackReader (GstByteStream *bs) -{ - this->bs = bs; - this->eos = false; -} - -GstMusepackReader::~GstMusepackReader (void) -{ -} - -mpc_int32_t -GstMusepackReader::read (void * ptr, mpc_int32_t size) -{ - guint8 *data; - gint read; - - do { - read = gst_bytestream_peek_bytes (this->bs, &data, size); - - if (read != size) { - GstEvent *event; - guint32 remaining; - - gst_bytestream_get_status (this->bs, &remaining, &event); - if (!event) { - GST_ELEMENT_ERROR (gst_pad_get_parent (this->bs->pad), - RESOURCE, READ, (NULL), (NULL)); - goto done; - } - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_INTERRUPT: - gst_event_unref (event); - goto done; - case GST_EVENT_EOS: - this->eos = true; - gst_event_unref (event); - goto done; - case GST_EVENT_FLUSH: - gst_event_unref (event); - break; - default: - gst_pad_event_default (this->bs->pad, event); - break; - } - } - } while (read != size); - -done: - if (read != 0) { - memcpy (ptr, data, read); - gst_bytestream_flush_fast (this->bs, read); - } - - return read; -} - -bool -GstMusepackReader::seek (mpc_int32_t offset) -{ - guint8 *dummy; - - /* hacky hack - if we're after typefind, we'll fail because - * typefind is still typefinding (heh :) ). So read first. */ - if (this->tell () != this->get_size ()) { - guint8 dummy2[1]; - this->read (dummy2, 1); - } - - if (!gst_bytestream_seek (this->bs, offset, GST_SEEK_METHOD_SET)) - return FALSE; - - /* get discont */ - while (gst_bytestream_peek_bytes (this->bs, &dummy, 1) != 1) { - GstEvent *event; - guint32 remaining; - - gst_bytestream_get_status (this->bs, &remaining, &event); - if (!event) { - GST_ELEMENT_ERROR (gst_pad_get_parent (this->bs->pad), - RESOURCE, SEEK, (NULL), (NULL)); - return false; - } - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_EOS: - g_warning ("EOS!"); - gst_event_unref (event); - return false; - case GST_EVENT_DISCONTINUOUS: - gst_event_unref (event); - return true; - case GST_EVENT_INTERRUPT: - g_warning ("interrupt!"); - return false; - case GST_EVENT_FLUSH: - gst_event_unref (event); - break; - default: - gst_pad_event_default (this->bs->pad, event); - break; - } - } - - return false; -} - -mpc_int32_t -GstMusepackReader::tell (void) -{ - return gst_bytestream_tell (this->bs); -} - -mpc_int32_t -GstMusepackReader::get_size (void) -{ - return gst_bytestream_length (this->bs); -} - -bool -GstMusepackReader::canseek (void) -{ - return true; -} |