diff options
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; } |