diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2008-04-24 22:19:48 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-04-24 22:19:48 +0000 |
commit | 01bcb096c75d8f4264390b8afb6f307ca97e23f0 (patch) | |
tree | 13bd3fd207bbeca69c3186ffc991510cbc0cbf1e /ext/musepack/gstmusepackreader.c | |
parent | 36d15d78686e14036677ccb1e6c4a98f287b6073 (diff) | |
download | gst-plugins-bad-01bcb096c75d8f4264390b8afb6f307ca97e23f0.tar.gz gst-plugins-bad-01bcb096c75d8f4264390b8afb6f307ca97e23f0.tar.bz2 gst-plugins-bad-01bcb096c75d8f4264390b8afb6f307ca97e23f0.zip |
Add support for the new libmpcdec API which magically gets us support for SV8 files. Also do some random cleanup. Fix...
Original commit message from CVS:
* configure.ac:
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_base_init),
(gst_musepackdec_init), (gst_musepackdec_dispose),
(gst_musepackdec_handle_seek_event), (gst_musepack_stream_init),
(gst_musepackdec_loop), (plugin_init):
* ext/musepack/gstmusepackdec.h:
* ext/musepack/gstmusepackreader.c:
* ext/musepack/gstmusepackreader.h:
Add support for the new libmpcdec API which magically gets us support
for SV8 files. Also do some random cleanup. Fixes bug #526905.
Diffstat (limited to 'ext/musepack/gstmusepackreader.c')
-rw-r--r-- | ext/musepack/gstmusepackreader.c | 65 |
1 files changed, 55 insertions, 10 deletions
diff --git a/ext/musepack/gstmusepackreader.c b/ext/musepack/gstmusepackreader.c index 10de6b0d..8a43f760 100644 --- a/ext/musepack/gstmusepackreader.c +++ b/ext/musepack/gstmusepackreader.c @@ -29,6 +29,7 @@ GST_DEBUG_CATEGORY_EXTERN (musepackdec_debug); #define GST_CAT_DEFAULT musepackdec_debug +#ifdef MPC_IS_OLD_API static mpc_int32_t gst_musepack_reader_peek (void *this, void *ptr, mpc_int32_t size); static mpc_int32_t gst_musepack_reader_read (void *this, void *ptr, @@ -37,11 +38,29 @@ static mpc_bool_t gst_musepack_reader_seek (void *this, mpc_int32_t offset); static mpc_int32_t gst_musepack_reader_tell (void *this); static mpc_int32_t gst_musepack_reader_get_size (void *this); static mpc_bool_t gst_musepack_reader_canseek (void *this); +#else +static mpc_int32_t gst_musepack_reader_peek (mpc_reader * this, void *ptr, + mpc_int32_t size); +static mpc_int32_t gst_musepack_reader_read (mpc_reader * this, void *ptr, + mpc_int32_t size); +static mpc_bool_t gst_musepack_reader_seek (mpc_reader * this, + mpc_int32_t offset); +static mpc_int32_t gst_musepack_reader_tell (mpc_reader * this); +static mpc_int32_t gst_musepack_reader_get_size (mpc_reader * this); +static mpc_bool_t gst_musepack_reader_canseek (mpc_reader * this); +#endif +#ifdef MPC_IS_OLD_API static mpc_int32_t gst_musepack_reader_peek (void *this, void *ptr, mpc_int32_t size) { GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this); +#else +static mpc_int32_t +gst_musepack_reader_peek (mpc_reader * this, void *ptr, mpc_int32_t size) +{ + GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this->data); +#endif GstFlowReturn flow_ret; GstBuffer *buf = NULL; guint read; @@ -72,10 +91,17 @@ gst_musepack_reader_peek (void *this, void *ptr, mpc_int32_t size) return read; } +#ifdef MPC_IS_OLD_API static mpc_int32_t gst_musepack_reader_read (void *this, void *ptr, mpc_int32_t size) { GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this); +#else +static mpc_int32_t +gst_musepack_reader_read (mpc_reader * this, void *ptr, mpc_int32_t size) +{ + GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this->data); +#endif gint read; /* read = peek + flush */ @@ -86,10 +112,17 @@ gst_musepack_reader_read (void *this, void *ptr, mpc_int32_t size) return read; } +#ifdef MPC_IS_OLD_API static mpc_bool_t gst_musepack_reader_seek (void *this, mpc_int32_t offset) { GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this); +#else +static mpc_bool_t +gst_musepack_reader_seek (mpc_reader * this, mpc_int32_t offset) +{ + GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this->data); +#endif mpc_int32_t length; length = gst_musepack_reader_get_size (this); @@ -103,35 +136,47 @@ gst_musepack_reader_seek (void *this, mpc_int32_t offset) } } +#ifdef MPC_IS_OLD_API static mpc_int32_t gst_musepack_reader_tell (void *this) { GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this); - +#else +static mpc_int32_t +gst_musepack_reader_tell (mpc_reader * this) +{ + GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this->data); +#endif return musepackdec->offset; } +#ifdef MPC_IS_OLD_API static mpc_int32_t gst_musepack_reader_get_size (void *this) { GstMusepackDec *dec = GST_MUSEPACK_DEC (this); +#else +static mpc_int32_t +gst_musepack_reader_get_size (mpc_reader * this) +{ + GstMusepackDec *dec = GST_MUSEPACK_DEC (this->data); +#endif GstFormat format = GST_FORMAT_BYTES; gint64 length = -1; - GstPad *peer; - - peer = gst_pad_get_peer (dec->sinkpad); - if (peer) { - if (!gst_pad_query_duration (peer, &format, &length) || length <= 0) { - length = -1; - } - gst_object_unref (peer); - } + + if (!gst_pad_query_peer_duration (dec->sinkpad, &format, &length)) + length = -1; return (mpc_int32_t) length; } +#ifdef MPC_IS_OLD_API static mpc_bool_t gst_musepack_reader_canseek (void *this) +#else +static mpc_bool_t +gst_musepack_reader_canseek (mpc_reader * this) +#endif { return TRUE; } |