mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-08 15:32:32 +00:00
musepack: remove support for the 'old' API
This commit is contained in:
parent
90625953f2
commit
70dd56d045
5 changed files with 1 additions and 126 deletions
|
@ -1838,12 +1838,7 @@ AG_GST_CHECK_FEATURE(MUSEPACK, [musepackdec], musepack, [
|
||||||
HAVE_MUSEPACK="yes"
|
HAVE_MUSEPACK="yes"
|
||||||
MUSEPACK_LIBS="-lmpcdec"
|
MUSEPACK_LIBS="-lmpcdec"
|
||||||
AC_SUBST(MUSEPACK_LIBS)
|
AC_SUBST(MUSEPACK_LIBS)
|
||||||
], [AC_CHECK_HEADER([mpcdec/mpcdec.h], [
|
], [HAVE_MUSEPACK="no"])
|
||||||
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"])])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl *** neon ***
|
dnl *** neon ***
|
||||||
|
|
|
@ -32,11 +32,7 @@ GST_DEBUG_CATEGORY (musepackdec_debug);
|
||||||
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
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 }")
|
GST_STATIC_CAPS ("audio/x-musepack, streamversion = (int) { 7, 8 }")
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef MPC_FIXED_POINT
|
#ifdef MPC_FIXED_POINT
|
||||||
|
@ -107,9 +103,6 @@ gst_musepackdec_init (GstMusepackDec * musepackdec)
|
||||||
musepackdec->bps = 0;
|
musepackdec->bps = 0;
|
||||||
|
|
||||||
musepackdec->r = g_new (mpc_reader, 1);
|
musepackdec->r = g_new (mpc_reader, 1);
|
||||||
#ifdef MPC_IS_OLD_API
|
|
||||||
musepackdec->d = g_new (mpc_decoder, 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
musepackdec->sinkpad =
|
musepackdec->sinkpad =
|
||||||
gst_pad_new_from_static_template (&sink_template, "sink");
|
gst_pad_new_from_static_template (&sink_template, "sink");
|
||||||
|
@ -136,15 +129,10 @@ gst_musepackdec_dispose (GObject * obj)
|
||||||
g_free (musepackdec->r);
|
g_free (musepackdec->r);
|
||||||
musepackdec->r = NULL;
|
musepackdec->r = NULL;
|
||||||
|
|
||||||
#ifdef MPC_IS_OLD_API
|
|
||||||
g_free (musepackdec->d);
|
|
||||||
musepackdec->d = NULL;
|
|
||||||
#else
|
|
||||||
if (musepackdec->d) {
|
if (musepackdec->d) {
|
||||||
mpc_demux_exit (musepackdec->d);
|
mpc_demux_exit (musepackdec->d);
|
||||||
musepackdec->d = NULL;
|
musepackdec->d = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (obj);
|
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");
|
GST_WARNING_OBJECT (dec, "seek out of bounds");
|
||||||
goto failed;
|
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)
|
if (mpc_demux_seek_sample (dec->d, segment.start) != MPC_STATUS_OK)
|
||||||
goto failed;
|
goto failed;
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((flags & GST_SEEK_FLAG_SEGMENT) == GST_SEEK_FLAG_SEGMENT) {
|
if ((flags & GST_SEEK_FLAG_SEGMENT) == GST_SEEK_FLAG_SEGMENT) {
|
||||||
GST_DEBUG_OBJECT (dec, "posting SEGMENT_START message");
|
GST_DEBUG_OBJECT (dec, "posting SEGMENT_START message");
|
||||||
|
@ -382,22 +365,6 @@ gst_musepack_stream_init (GstMusepackDec * musepackdec)
|
||||||
/* set up reading */
|
/* set up reading */
|
||||||
gst_musepack_init_reader (musepackdec->r, musepackdec);
|
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);
|
musepackdec->d = mpc_demux_init (musepackdec->r);
|
||||||
if (!musepackdec->d) {
|
if (!musepackdec->d) {
|
||||||
GST_ELEMENT_ERROR (musepackdec, STREAM, WRONG_TYPE, (NULL), (NULL));
|
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);
|
mpc_demux_get_info (musepackdec->d, &i);
|
||||||
#endif
|
|
||||||
|
|
||||||
stream_id = gst_pad_create_stream_id (musepackdec->srcpad,
|
stream_id = gst_pad_create_stream_id (musepackdec->srcpad,
|
||||||
GST_ELEMENT_CAST (musepackdec), NULL);
|
GST_ELEMENT_CAST (musepackdec), NULL);
|
||||||
|
@ -527,13 +493,8 @@ gst_musepackdec_loop (GstPad * sinkpad)
|
||||||
GstFlowReturn flow;
|
GstFlowReturn flow;
|
||||||
GstBuffer *out;
|
GstBuffer *out;
|
||||||
GstMapInfo info;
|
GstMapInfo info;
|
||||||
|
|
||||||
#ifdef MPC_IS_OLD_API
|
|
||||||
guint32 update_acc, update_bits;
|
|
||||||
#else
|
|
||||||
mpc_frame_info frame;
|
mpc_frame_info frame;
|
||||||
mpc_status err;
|
mpc_status err;
|
||||||
#endif
|
|
||||||
gint num_samples, samplerate, bitspersample;
|
gint num_samples, samplerate, bitspersample;
|
||||||
|
|
||||||
musepackdec = GST_MUSEPACK_DEC (GST_PAD_PARENT (sinkpad));
|
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);
|
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);
|
gst_buffer_map (out, &info, GST_MAP_READWRITE);
|
||||||
frame.buffer = (MPC_SAMPLE_FORMAT *) info.data;
|
frame.buffer = (MPC_SAMPLE_FORMAT *) info.data;
|
||||||
err = mpc_demux_decode (musepackdec->d, &frame);
|
err = mpc_demux_decode (musepackdec->d, &frame);
|
||||||
|
@ -581,7 +527,6 @@ gst_musepackdec_loop (GstPad * sinkpad)
|
||||||
}
|
}
|
||||||
|
|
||||||
num_samples = frame.samples;
|
num_samples = frame.samples;
|
||||||
#endif
|
|
||||||
|
|
||||||
gst_buffer_set_size (out, num_samples * bitspersample);
|
gst_buffer_set_size (out, num_samples * bitspersample);
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,7 @@
|
||||||
#ifndef __GST_MUSEPACK_DEC_H__
|
#ifndef __GST_MUSEPACK_DEC_H__
|
||||||
#define __GST_MUSEPACK_DEC_H__
|
#define __GST_MUSEPACK_DEC_H__
|
||||||
|
|
||||||
#ifdef MPC_IS_OLD_API
|
|
||||||
#include <mpcdec/mpcdec.h>
|
|
||||||
#else
|
|
||||||
#include <mpc/mpcdec.h>
|
#include <mpc/mpcdec.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -51,11 +46,7 @@ typedef struct _GstMusepackDec {
|
||||||
guint64 offset;
|
guint64 offset;
|
||||||
|
|
||||||
/* MUSEPACK_DEC object */
|
/* MUSEPACK_DEC object */
|
||||||
#ifdef MPC_IS_OLD_API
|
|
||||||
mpc_decoder *d;
|
|
||||||
#else
|
|
||||||
mpc_demux *d;
|
mpc_demux *d;
|
||||||
#endif
|
|
||||||
mpc_reader *r;
|
mpc_reader *r;
|
||||||
|
|
||||||
gint bps; /* bytes per sample */ /* ATOMIC */
|
gint bps; /* bytes per sample */ /* ATOMIC */
|
||||||
|
|
|
@ -29,16 +29,6 @@
|
||||||
GST_DEBUG_CATEGORY_EXTERN (musepackdec_debug);
|
GST_DEBUG_CATEGORY_EXTERN (musepackdec_debug);
|
||||||
#define GST_CAT_DEFAULT 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,
|
static mpc_int32_t gst_musepack_reader_peek (mpc_reader * this, void *ptr,
|
||||||
mpc_int32_t size);
|
mpc_int32_t size);
|
||||||
static mpc_int32_t gst_musepack_reader_read (mpc_reader * this, void *ptr,
|
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_tell (mpc_reader * this);
|
||||||
static mpc_int32_t gst_musepack_reader_get_size (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);
|
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
|
static mpc_int32_t
|
||||||
gst_musepack_reader_peek (mpc_reader * this, void *ptr, mpc_int32_t size)
|
gst_musepack_reader_peek (mpc_reader * this, void *ptr, mpc_int32_t size)
|
||||||
{
|
{
|
||||||
GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this->data);
|
GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this->data);
|
||||||
#endif
|
|
||||||
GstFlowReturn flow_ret;
|
GstFlowReturn flow_ret;
|
||||||
GstBuffer *buf = NULL;
|
GstBuffer *buf = NULL;
|
||||||
guint read;
|
guint read;
|
||||||
|
@ -91,17 +73,10 @@ gst_musepack_reader_peek (mpc_reader * this, void *ptr, mpc_int32_t size)
|
||||||
return read;
|
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
|
static mpc_int32_t
|
||||||
gst_musepack_reader_read (mpc_reader * this, void *ptr, mpc_int32_t size)
|
gst_musepack_reader_read (mpc_reader * this, void *ptr, mpc_int32_t size)
|
||||||
{
|
{
|
||||||
GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this->data);
|
GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this->data);
|
||||||
#endif
|
|
||||||
gint read;
|
gint read;
|
||||||
|
|
||||||
/* read = peek + flush */
|
/* read = peek + flush */
|
||||||
|
@ -112,17 +87,10 @@ gst_musepack_reader_read (mpc_reader * this, void *ptr, mpc_int32_t size)
|
||||||
return read;
|
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
|
static mpc_bool_t
|
||||||
gst_musepack_reader_seek (mpc_reader * this, mpc_int32_t offset)
|
gst_musepack_reader_seek (mpc_reader * this, mpc_int32_t offset)
|
||||||
{
|
{
|
||||||
GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this->data);
|
GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this->data);
|
||||||
#endif
|
|
||||||
mpc_int32_t length;
|
mpc_int32_t length;
|
||||||
|
|
||||||
length = gst_musepack_reader_get_size (this);
|
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
|
static mpc_int32_t
|
||||||
gst_musepack_reader_tell (mpc_reader * this)
|
gst_musepack_reader_tell (mpc_reader * this)
|
||||||
{
|
{
|
||||||
GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this->data);
|
GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (this->data);
|
||||||
#endif
|
|
||||||
return musepackdec->offset;
|
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
|
static mpc_int32_t
|
||||||
gst_musepack_reader_get_size (mpc_reader * this)
|
gst_musepack_reader_get_size (mpc_reader * this)
|
||||||
{
|
{
|
||||||
GstMusepackDec *dec = GST_MUSEPACK_DEC (this->data);
|
GstMusepackDec *dec = GST_MUSEPACK_DEC (this->data);
|
||||||
#endif
|
|
||||||
GstQuery *query;
|
GstQuery *query;
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
gint64 length;
|
gint64 length;
|
||||||
|
@ -174,13 +128,8 @@ gst_musepack_reader_get_size (mpc_reader * this)
|
||||||
return (mpc_int32_t) length;
|
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
|
static mpc_bool_t
|
||||||
gst_musepack_reader_canseek (mpc_reader * this)
|
gst_musepack_reader_canseek (mpc_reader * this)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,7 @@
|
||||||
#ifndef __GST_MUSEPACK_READER_H__
|
#ifndef __GST_MUSEPACK_READER_H__
|
||||||
#define __GST_MUSEPACK_READER_H__
|
#define __GST_MUSEPACK_READER_H__
|
||||||
|
|
||||||
#ifdef MPC_IS_OLD_API
|
|
||||||
#include <mpcdec/mpcdec.h>
|
|
||||||
#else
|
|
||||||
#include <mpc/mpcdec.h>
|
#include <mpc/mpcdec.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gstmusepackdec.h"
|
#include "gstmusepackdec.h"
|
||||||
|
|
||||||
void gst_musepack_init_reader (mpc_reader * r, GstMusepackDec * musepackdec);
|
void gst_musepack_init_reader (mpc_reader * r, GstMusepackDec * musepackdec);
|
||||||
|
|
Loading…
Reference in a new issue