summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2018-08-19 15:44:16 +0100
committerTim-Philipp Müller <tim@centricular.com>2018-08-19 15:44:34 +0100
commit70dd56d04536ee6cf8e15d2bd0385e9e4609f485 (patch)
treecf7b24f4db6d4b1e72848bfaf1a11fc57170f8c6
parent90625953f27668bde29983e2ad3afe2f49d4133f (diff)
musepack: remove support for the 'old' API
-rw-r--r--configure.ac7
-rw-r--r--ext/musepack/gstmusepackdec.c55
-rw-r--r--ext/musepack/gstmusepackdec.h9
-rw-r--r--ext/musepack/gstmusepackreader.c51
-rw-r--r--ext/musepack/gstmusepackreader.h5
5 files changed, 1 insertions, 126 deletions
diff --git a/configure.ac b/configure.ac
index 36b3a548b..9de9d0834 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1838,12 +1838,7 @@ AG_GST_CHECK_FEATURE(MUSEPACK, [musepackdec], musepack, [
HAVE_MUSEPACK="yes"
MUSEPACK_LIBS="-lmpcdec"
AC_SUBST(MUSEPACK_LIBS)
- ], [AC_CHECK_HEADER([mpcdec/mpcdec.h], [
- HAVE_MUSEPACK="yes"
- MUSEPACK_LIBS="-lmpcdec"
- AC_DEFINE(MPC_IS_OLD_API, 1, [Define if the old MusePack API is used])
- AC_SUBST(MUSEPACK_LIBS)
- ], [HAVE_MUSEPACK="no"])])
+ ], [HAVE_MUSEPACK="no"])
])
dnl *** neon ***
diff --git a/ext/musepack/gstmusepackdec.c b/ext/musepack/gstmusepackdec.c
index 5b68200e9..8a0da18aa 100644
--- a/ext/musepack/gstmusepackdec.c
+++ b/ext/musepack/gstmusepackdec.c
@@ -32,11 +32,7 @@ GST_DEBUG_CATEGORY (musepackdec_debug);
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
-#ifdef MPC_IS_OLD_API
- GST_STATIC_CAPS ("audio/x-musepack, streamversion = (int) 7")
-#else
GST_STATIC_CAPS ("audio/x-musepack, streamversion = (int) { 7, 8 }")
-#endif
);
#ifdef MPC_FIXED_POINT
@@ -107,9 +103,6 @@ gst_musepackdec_init (GstMusepackDec * musepackdec)
musepackdec->bps = 0;
musepackdec->r = g_new (mpc_reader, 1);
-#ifdef MPC_IS_OLD_API
- musepackdec->d = g_new (mpc_decoder, 1);
-#endif
musepackdec->sinkpad =
gst_pad_new_from_static_template (&sink_template, "sink");
@@ -136,15 +129,10 @@ gst_musepackdec_dispose (GObject * obj)
g_free (musepackdec->r);
musepackdec->r = NULL;
-#ifdef MPC_IS_OLD_API
- g_free (musepackdec->d);
- musepackdec->d = NULL;
-#else
if (musepackdec->d) {
mpc_demux_exit (musepackdec->d);
musepackdec->d = NULL;
}
-#endif
G_OBJECT_CLASS (parent_class)->dispose (obj);
}
@@ -226,13 +214,8 @@ gst_musepackdec_handle_seek_event (GstMusepackDec * dec, GstEvent * event)
GST_WARNING_OBJECT (dec, "seek out of bounds");
goto failed;
}
-#ifdef MPC_IS_OLD_API
- if (!mpc_decoder_seek_sample (dec->d, segment.start))
- goto failed;
-#else
if (mpc_demux_seek_sample (dec->d, segment.start) != MPC_STATUS_OK)
goto failed;
-#endif
if ((flags & GST_SEEK_FLAG_SEGMENT) == GST_SEEK_FLAG_SEGMENT) {
GST_DEBUG_OBJECT (dec, "posting SEGMENT_START message");
@@ -382,22 +365,6 @@ gst_musepack_stream_init (GstMusepackDec * musepackdec)
/* set up reading */
gst_musepack_init_reader (musepackdec->r, musepackdec);
-#ifdef MPC_IS_OLD_API
- /* streaminfo */
- mpc_streaminfo_init (&i);
- if (mpc_streaminfo_read (&i, musepackdec->r) < 0) {
- GST_ELEMENT_ERROR (musepackdec, STREAM, WRONG_TYPE, (NULL), (NULL));
- return FALSE;
- }
-
- /* decoding */
- mpc_decoder_setup (musepackdec->d, musepackdec->r);
- mpc_decoder_scale_output (musepackdec->d, 1.0);
- if (!mpc_decoder_initialize (musepackdec->d, &i)) {
- GST_ELEMENT_ERROR (musepackdec, STREAM, WRONG_TYPE, (NULL), (NULL));
- return FALSE;
- }
-#else
musepackdec->d = mpc_demux_init (musepackdec->r);
if (!musepackdec->d) {
GST_ELEMENT_ERROR (musepackdec, STREAM, WRONG_TYPE, (NULL), (NULL));
@@ -405,7 +372,6 @@ gst_musepack_stream_init (GstMusepackDec * musepackdec)
}
mpc_demux_get_info (musepackdec->d, &i);
-#endif
stream_id = gst_pad_create_stream_id (musepackdec->srcpad,
GST_ELEMENT_CAST (musepackdec), NULL);
@@ -527,13 +493,8 @@ gst_musepackdec_loop (GstPad * sinkpad)
GstFlowReturn flow;
GstBuffer *out;
GstMapInfo info;
-
-#ifdef MPC_IS_OLD_API
- guint32 update_acc, update_bits;
-#else
mpc_frame_info frame;
mpc_status err;
-#endif
gint num_samples, samplerate, bitspersample;
musepackdec = GST_MUSEPACK_DEC (GST_PAD_PARENT (sinkpad));
@@ -552,21 +513,6 @@ gst_musepackdec_loop (GstPad * sinkpad)
out = gst_buffer_new_allocate (NULL, MPC_DECODER_BUFFER_LENGTH * 4, NULL);
-#ifdef MPC_IS_OLD_API
-
- gst_buffer_map (out, &info, GST_MAP_READWRITE);
- num_samples = mpc_decoder_decode (musepackdec->d,
- (MPC_SAMPLE_FORMAT *) info.data, &update_acc, &update_bits);
- gst_buffer_unmap (out, &info);
-
- if (num_samples < 0) {
- GST_ERROR_OBJECT (musepackdec, "Failed to decode sample");
- GST_ELEMENT_ERROR (musepackdec, STREAM, DECODE, (NULL), (NULL));
- goto pause_task;
- } else if (num_samples == 0) {
- goto eos_and_pause;
- }
-#else
gst_buffer_map (out, &info, GST_MAP_READWRITE);
frame.buffer = (MPC_SAMPLE_FORMAT *) info.data;
err = mpc_demux_decode (musepackdec->d, &frame);
@@ -581,7 +527,6 @@ gst_musepackdec_loop (GstPad * sinkpad)
}
num_samples = frame.samples;
-#endif
gst_buffer_set_size (out, num_samples * bitspersample);
diff --git a/ext/musepack/gstmusepackdec.h b/ext/musepack/gstmusepackdec.h
index fcc4a04d0..eaee5d958 100644
--- a/ext/musepack/gstmusepackdec.h
+++ b/ext/musepack/gstmusepackdec.h
@@ -20,12 +20,7 @@
#ifndef __GST_MUSEPACK_DEC_H__
#define __GST_MUSEPACK_DEC_H__
-#ifdef MPC_IS_OLD_API
-#include <mpcdec/mpcdec.h>
-#else
#include <mpc/mpcdec.h>
-#endif
-
#include <gst/gst.h>
G_BEGIN_DECLS
@@ -51,11 +46,7 @@ typedef struct _GstMusepackDec {
guint64 offset;
/* MUSEPACK_DEC object */
-#ifdef MPC_IS_OLD_API
- mpc_decoder *d;
-#else
mpc_demux *d;
-#endif
mpc_reader *r;
gint bps; /* bytes per sample */ /* ATOMIC */
diff --git a/ext/musepack/gstmusepackreader.c b/ext/musepack/gstmusepackreader.c
index 2c5bb141e..715893b50 100644
--- a/ext/musepack/gstmusepackreader.c
+++ b/ext/musepack/gstmusepackreader.c
@@ -29,16 +29,6 @@
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,
- mpc_int32_t size);
-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,
@@ -48,19 +38,11 @@ static mpc_bool_t gst_musepack_reader_seek (mpc_reader * this,
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;
@@ -91,17 +73,10 @@ gst_musepack_reader_peek (mpc_reader * 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 */
@@ -112,17 +87,10 @@ gst_musepack_reader_read (mpc_reader * 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);
@@ -136,31 +104,17 @@ gst_musepack_reader_seek (mpc_reader * 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
GstQuery *query;
GstFormat format;
gint64 length;
@@ -174,13 +128,8 @@ gst_musepack_reader_get_size (mpc_reader * this)
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;
}
diff --git a/ext/musepack/gstmusepackreader.h b/ext/musepack/gstmusepackreader.h
index 864e281f7..ddaaa4ad6 100644
--- a/ext/musepack/gstmusepackreader.h
+++ b/ext/musepack/gstmusepackreader.h
@@ -20,12 +20,7 @@
#ifndef __GST_MUSEPACK_READER_H__
#define __GST_MUSEPACK_READER_H__
-#ifdef MPC_IS_OLD_API
-#include <mpcdec/mpcdec.h>
-#else
#include <mpc/mpcdec.h>
-#endif
-
#include "gstmusepackdec.h"
void gst_musepack_init_reader (mpc_reader * r, GstMusepackDec * musepackdec);