Commit 72bc1ba4 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵 Committed by Tim-Philipp Müller

configure.ac: Check for wavpack version and define WAVPACK_OLD_API if necessary.

Original commit message from CVS:
Patch by: Sebastian Dröge <slomo at circular-chaos.org>
* configure.ac:
Check for wavpack version and define WAVPACK_OLD_API if
necessary.
* ext/wavpack/Makefile.am:
* ext/wavpack/gstwavpackcommon.c: (gst_wavpack_read_header),
(gst_wavpack_read_metadata):
* ext/wavpack/gstwavpackcommon.h:
* ext/wavpack/gstwavpackdec.c: (gst_wavpack_dec_base_init),
(gst_wavpack_dec_class_init), (gst_wavpack_dec_init),
(gst_wavpack_dec_finalize), (gst_wavpack_dec_format_samples),
(gst_wavpack_dec_clip_outgoing_buffer), (gst_wavpack_dec_chain),
(gst_wavpack_dec_sink_event), (gst_wavpack_dec_change_state),
(gst_wavpack_dec_request_new_pad), (gst_wavpack_dec_plugin_init):
* ext/wavpack/gstwavpackdec.h:
* ext/wavpack/gstwavpackenc.c: (gst_wavpack_enc_class_init),
(gst_wavpack_enc_init), (gst_wavpack_enc_finalize),
(gst_wavpack_enc_set_wp_config):
* ext/wavpack/gstwavpackparse.c: (gst_wavpack_parse_base_init),
(gst_wavpack_parse_finalize), (gst_wavpack_parse_class_init),
(gst_wavpack_parse_index_get_entry_from_sample),
(gst_wavpack_parse_scan_to_find_sample),
(gst_wavpack_parse_handle_seek_event),
(gst_wavpack_parse_create_src_pad):
* ext/wavpack/gstwavpackstreamreader.c:
* ext/wavpack/gstwavpackstreamreader.h:
Port to new/official wavpack API, don't use API that was exported
in wavpack header files and in the lib but meant to be private, at
least not for recent wavpack versions; misc. 'cleanups' (#347443).
parent ae5b1206
......@@ -7,10 +7,11 @@ libgstwavpack_la_SOURCES = \
gstwavpackparse.c \
gstwavpackdec.c \
gstwavpackenc.c \
gstwavpackstreamreader.c \
md5.c
libgstwavpack_la_CFLAGS = $(GST_CFLAGS) $(WAVPACK_CFLAGS)
libgstwavpack_la_LIBADD = $(GST_LIBS) $(WAVPACK_LIBS)
libgstwavpack_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(WAVPACK_CFLAGS)
libgstwavpack_la_LIBADD = $(GST_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(WAVPACK_LIBS)
libgstwavpack_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = \
......@@ -18,5 +19,6 @@ noinst_HEADERS = \
gstwavpackdec.h \
gstwavpackenc.h \
gstwavpackcommon.h \
gstwavpackstreamreader.h \
md5.h
/* GStreamer Wavpack plugin
* Copyright (c) 2005 Arwed v. Merkatz <v.merkatz@gmx.net>
* Copyright (c) 1998 - 2005 Conifer Software
* Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
*
* gstwavpackcommon.c: common helper functions
*
* 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 "gstwavpackcommon.h"
#include <string.h>
......@@ -5,10 +32,64 @@ gboolean
gst_wavpack_read_header (WavpackHeader * header, guint8 * buf)
{
g_memmove (header, buf, sizeof (WavpackHeader));
#ifndef WAVPACK_OLD_API
WavpackLittleEndianToNative (header, WavpackHeaderFormat);
#else
little_endian_to_native (header, WavpackHeaderFormat);
#endif
return (memcmp (header->ckID, "wvpk", 4) == 0);
}
if (strncmp (header->ckID, "wvpk", 4))
/* inspired by the original one in wavpack */
gboolean
gst_wavpack_read_metadata (GstWavpackMetadata * wpmd, guint8 * header_data,
guint8 ** p_data)
{
WavpackHeader hdr;
guint8 *end;
gst_wavpack_read_header (&hdr, header_data);
end = header_data + hdr.ckSize + 8;
if (end - *p_data < 2)
return FALSE;
else
return TRUE;
wpmd->id = GST_READ_UINT8 (*p_data);
wpmd->byte_length = 2 * (guint) GST_READ_UINT8 (*p_data + 1);
*p_data += 2;
if ((wpmd->id & ID_LARGE) == ID_LARGE) {
guint extra;
wpmd->id &= ~ID_LARGE;
if (end - *p_data < 2)
return FALSE;
extra = GST_READ_UINT16_LE (*p_data);
wpmd->byte_length += (extra << 9);
*p_data += 2;
}
if ((wpmd->id & ID_ODD_SIZE) == ID_ODD_SIZE) {
wpmd->id &= ~ID_ODD_SIZE;
--wpmd->byte_length;
}
if (wpmd->byte_length > 0) {
if (end - *p_data < wpmd->byte_length + (wpmd->byte_length & 1)) {
wpmd->data = NULL;
return FALSE;
}
wpmd->data = *p_data;
*p_data += wpmd->byte_length + (wpmd->byte_length & 1);
} else {
wpmd->data = NULL;
}
return TRUE;
}
/* GStreamer Wavpack plugin
* Copyright (c) 2005 Arwed v. Merkatz <v.merkatz@gmx.net>
* Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
*
* gstwavpackcommon.h: common helper functions
*
* 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.
*/
#ifndef __GST_WAVPACK_COMMON_H__
#define __GST_WAVPACK_COMMON_H__
#include <gst/gst.h>
#include <wavpack/wavpack.h>
typedef struct
{
guint32 byte_length;
guint8 *data;
guint8 id;
} GstWavpackMetadata;
#define ID_UNIQUE 0x3f
#define ID_OPTIONAL_DATA 0x20
#define ID_ODD_SIZE 0x40
#define ID_LARGE 0x80
#define ID_DUMMY 0x0
#define ID_ENCODER_INFO 0x1
#define ID_DECORR_TERMS 0x2
#define ID_DECORR_WEIGHTS 0x3
#define ID_DECORR_SAMPLES 0x4
#define ID_ENTROPY_VARS 0x5
#define ID_HYBRID_PROFILE 0x6
#define ID_SHAPING_WEIGHTS 0x7
#define ID_FLOAT_INFO 0x8
#define ID_INT32_INFO 0x9
#define ID_WV_BITSTREAM 0xa
#define ID_WVC_BITSTREAM 0xb
#define ID_WVX_BITSTREAM 0xc
#define ID_CHANNEL_INFO 0xd
#define ID_RIFF_HEADER (ID_OPTIONAL_DATA | 0x1)
#define ID_RIFF_TRAILER (ID_OPTIONAL_DATA | 0x2)
#define ID_REPLAY_GAIN (ID_OPTIONAL_DATA | 0x3)
#define ID_CUESHEET (ID_OPTIONAL_DATA | 0x4)
#define ID_CONFIG_BLOCK (ID_OPTIONAL_DATA | 0x5)
#define ID_MD5_CHECKSUM (ID_OPTIONAL_DATA | 0x6)
#define ID_SAMPLE_RATE (ID_OPTIONAL_DATA | 0x7)
gboolean gst_wavpack_read_header (WavpackHeader * header, guint8 * buf);
gboolean gst_wavpack_read_metadata (GstWavpackMetadata * meta,
guint8 * header_data, guint8 ** p_data);
#endif
/* GStreamer Wavpack plugin
* (c) 2005 Arwed v. Merkatz <v.merkatz@gmx.net>
* Copyright (c) 2005 Arwed v. Merkatz <v.merkatz@gmx.net>
* Copyright (c) 2006 Edward Hervey <bilboed@gmail.com>
* Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
*
* gstwavpackdec.c: raw Wavpack bitstream decoder
*
......@@ -20,6 +22,7 @@
*/
#include <gst/gst.h>
#include <gst/audio/audio.h>
#include <math.h>
#include <string.h>
......@@ -27,6 +30,10 @@
#include <wavpack/wavpack.h>
#include "gstwavpackdec.h"
#include "gstwavpackcommon.h"
#include "gstwavpackstreamreader.h"
#define WAVPACK_DEC_MAX_ERRORS 16
GST_DEBUG_CATEGORY_STATIC (gst_wavpack_dec_debug);
#define GST_CAT_DEFAULT gst_wavpack_dec_debug
......@@ -36,16 +43,18 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-wavpack, "
"width = (int) { 8, 16, 24, 32 }, "
"channels = (int) { 1, 2 }, "
"channels = (int) [ 1, 2 ], "
"rate = (int) [ 6000, 192000 ], " "framed = (boolean) true")
);
#if 0
static GstStaticPadTemplate wvc_sink_factory =
GST_STATIC_PAD_TEMPLATE ("wvcsink",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS ("audio/x-wavpack-correction, " "framed = (boolean) true")
);
#endif
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
......@@ -53,66 +62,24 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS ("audio/x-raw-int, "
"width = (int) { 8, 16, 24, 32 }, "
"depth = (int) { 8, 16, 24, 32 }, "
"channels = (int) { 1, 2 }, "
"channels = (int) [ 1, 2 ], "
"rate = (int) [ 6000, 192000 ], "
"endianness = (int) LITTLE_ENDIAN, " "signed = (boolean) true")
/*
"audio/x-raw-float, "
"width = (int) 32, "
"channels = (int) { 1, 2 }, "
"rate = (int) [ 6000, 192000 ], " "endianness = (int) LITTLE_ENDIAN"
*/
);
static GstFlowReturn gst_wavpack_dec_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_wavpack_dec_sink_event (GstPad * pad, GstEvent * event);
static void gst_wavpack_dec_finalize (GObject * object);
static GstStateChangeReturn gst_wavpack_dec_change_state (GstElement * element,
GstStateChange transition);
static gboolean gst_wavpack_dec_sink_event (GstPad * pad, GstEvent * event);
GST_BOILERPLATE (GstWavpackDec, gst_wavpack_dec, GstElement, GST_TYPE_ELEMENT);
static gboolean
gst_wavpack_dec_setcaps (GstPad * pad, GstCaps * caps)
{
GstWavpackDec *wavpackdec = GST_WAVPACK_DEC (gst_pad_get_parent (pad));
GstStructure *structure;
GstCaps *srccaps;
gint bits, rate, channels;
structure = gst_caps_get_structure (caps, 0);
if (!gst_structure_get_int (structure, "rate", &rate) ||
!gst_structure_get_int (structure, "channels", &channels) ||
!gst_structure_get_int (structure, "width", &bits)) {
return FALSE;
}
wavpackdec->samplerate = rate;
wavpackdec->channels = channels;
wavpackdec->width = bits;
/* 32-bit output seems to be in fact 32 bit int (e.g. Prod_Girls.wv) */
/* if (bits != 32) { */
srccaps = gst_caps_new_simple ("audio/x-raw-int",
"rate", G_TYPE_INT, wavpackdec->samplerate,
"channels", G_TYPE_INT, wavpackdec->channels,
"depth", G_TYPE_INT, bits,
"width", G_TYPE_INT, bits,
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
"signed", G_TYPE_BOOLEAN, TRUE, NULL);
/*
} else {
srccaps = gst_caps_new_simple ("audio/x-raw-float",
"rate", G_TYPE_INT, wavpackdec->samplerate,
"channels", G_TYPE_INT, wavpackdec->channels,
"width", G_TYPE_INT, 32,
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL);
}
*/
/* gst_pad_set_caps (wavpackdec->sinkpad, caps); */
gst_pad_set_caps (wavpackdec->srcpad, srccaps);
gst_pad_use_fixed_caps (wavpackdec->srcpad);
#if 0
static GstPad *gst_wavpack_dec_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * name);
#endif
return TRUE;
}
GST_BOILERPLATE (GstWavpackDec, gst_wavpack_dec, GstElement, GST_TYPE_ELEMENT);
#if 0
static GstPadLinkReturn
......@@ -132,70 +99,34 @@ gst_wavpack_dec_base_init (gpointer klass)
GST_ELEMENT_DETAILS ("WavePack audio decoder",
"Codec/Decoder/Audio",
"Decode Wavpack audio data",
"Arwed v. Merkatz <v.merkatz@gmx.net>");
"Arwed v. Merkatz <v.merkatz@gmx.net>, "
"Sebastian Dröge <slomo@circular-chaos.org>");
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
#if 0
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&wvc_sink_factory));
#endif
gst_element_class_set_details (element_class, &plugin_details);
}
static void
gst_wavpack_dec_dispose (GObject * object)
{
GstWavpackDec *wavpackdec = GST_WAVPACK_DEC (object);
g_free (wavpackdec->decodebuf);
wavpackdec->decodebuf = NULL;
/* FIXME: what about wavpackdec->stream and wavpackdec->context? (tpm) */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_wavpack_dec_class_init (GstWavpackDecClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->dispose = gst_wavpack_dec_dispose;
}
static gboolean
gst_wavpack_dec_src_query (GstPad * pad, GstQuery * query)
{
return gst_pad_query_default (pad, query);
}
static gboolean
gst_wavpack_dec_sink_event (GstPad * pad, GstEvent * event)
{
GstWavpackDec *dec;
dec = GST_WAVPACK_DEC (gst_pad_get_parent (pad));
GST_LOG_OBJECT (dec, "Received %s event", GST_EVENT_TYPE_NAME (event));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NEWSEGMENT:{
/* TODO: save current segment so we can do clipping, for now
* we'll just leave the clipping to the audio sink */
break;
}
default:
break;
}
gst_object_unref (dec);
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
return gst_pad_event_default (pad, event);
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_wavpack_dec_change_state);
#if 0
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_wavpack_dec_request_new_pad);
#endif
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_wavpack_dec_finalize);
}
static void
......@@ -206,98 +137,62 @@ gst_wavpack_dec_init (GstWavpackDec * wavpackdec, GstWavpackDecClass * gklass)
wavpackdec->sinkpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"sink"), "sink");
gst_element_add_pad (GST_ELEMENT (wavpackdec), wavpackdec->sinkpad);
gst_pad_set_chain_function (wavpackdec->sinkpad,
GST_DEBUG_FUNCPTR (gst_wavpack_dec_chain));
gst_pad_set_setcaps_function (wavpackdec->sinkpad,
GST_DEBUG_FUNCPTR (gst_wavpack_dec_setcaps));
gst_pad_set_event_function (wavpackdec->sinkpad,
GST_DEBUG_FUNCPTR (gst_wavpack_dec_sink_event));
#if 0
wavpackdec->wvcsinkpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"wvcsink"), "wvcsink");
gst_pad_set_link_function (wavpackdec->wvcsinkpad, gst_wavpack_dec_wvclink);
gst_element_add_pad (GST_ELEMENT (wavpackdec), wavpackdec->wvcsinkpad);
#endif
gst_element_add_pad (GST_ELEMENT (wavpackdec), wavpackdec->sinkpad);
wavpackdec->srcpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"src"), "src");
gst_pad_use_fixed_caps (wavpackdec->srcpad);
gst_pad_set_query_function (wavpackdec->srcpad,
GST_DEBUG_FUNCPTR (gst_wavpack_dec_src_query));
gst_element_add_pad (GST_ELEMENT (wavpackdec), wavpackdec->srcpad);
wavpackdec->decodebuf = NULL;
wavpackdec->decodebuf_size = 0;
wavpackdec->stream = (WavpackStream *) g_malloc0 (sizeof (WavpackStream));
wavpackdec->context = (WavpackContext *) g_malloc0 (sizeof (WavpackContext));
}
wavpackdec->context = NULL;
wavpackdec->stream_reader = gst_wavpack_stream_reader_new ();
static void
gst_wavpack_dec_setup_context (GstWavpackDec * wavpackdec, guchar * data,
guchar * cdata)
{
WavpackContext *context = wavpackdec->context;
WavpackStream *stream = wavpackdec->stream;
guint buffer_size;
wavpackdec->wv_id.buffer = NULL;
wavpackdec->wv_id.position = wavpackdec->wv_id.length = 0;
memset (context, 0, sizeof (context));
/*
wavpackdec->wvc_id.buffer = NULL;
wavpackdec->wvc_id.position = wavpackdec->wvc_id.length = 0;
wavpackdec->wvcsinkpad = NULL;
*/
context->open_flags = 0;
context->current_stream = 0;
context->num_streams = 1;
wavpackdec->error_count = 0;
memset (stream, 0, sizeof (stream));
context->streams[0] = stream;
gst_wavpack_read_header (&stream->wphdr, data);
stream->blockbuff = data;
wavpackdec->channels = 0;
wavpackdec->sample_rate = 0;
wavpackdec->width = 0;
if (cdata) {
context->wvc_flag = TRUE;
gst_wavpack_read_header (&stream->wphdr, cdata);
stream->block2buff = cdata;
} else {
context->wvc_flag = FALSE;
}
gst_segment_init (&wavpackdec->segment, GST_FORMAT_UNDEFINED);
}
buffer_size =
stream->wphdr.block_samples * wavpackdec->channels * sizeof (int32_t);
if (wavpackdec->decodebuf_size < buffer_size) {
wavpackdec->decodebuf =
(int32_t *) g_realloc (wavpackdec->decodebuf, buffer_size);
wavpackdec->decodebuf_size = buffer_size;
}
static void
gst_wavpack_dec_finalize (GObject * object)
{
GstWavpackDec *wavpackdec = GST_WAVPACK_DEC (object);
g_free (wavpackdec->stream_reader);
wavpackdec->stream_reader = NULL;
unpack_init (context);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GstBuffer *
gst_wavpack_dec_format_samples (GstWavpackDec * wavpackdec, int32_t * samples,
guint num_samples)
static void
gst_wavpack_dec_format_samples (GstWavpackDec * wavpackdec, guint8 * dst,
int32_t * samples, guint num_samples)
{
GstBuffer *buf;
gint i;
guint8 *dst;
int32_t temp;
buf =
gst_buffer_new_and_alloc (num_samples * wavpackdec->width / 8 *
wavpackdec->channels);
dst = (guint8 *) GST_BUFFER_DATA (buf);
switch (wavpackdec->width) {
case 8:
for (i = 0; i < num_samples * wavpackdec->channels; ++i)
*dst++ = *samples++ + 128;
*dst++ = (guint8) (*samples++);
break;
case 16:
for (i = 0; i < num_samples * wavpackdec->channels; ++i) {
......@@ -323,67 +218,353 @@ gst_wavpack_dec_format_samples (GstWavpackDec * wavpackdec, int32_t * samples,
default:
break;
}
}
static gboolean
gst_wavpack_dec_clip_outgoing_buffer (GstWavpackDec * wavpackdec,
GstBuffer * buf)
{
gint64 start, stop, cstart, cstop, diff;
return buf;
if (wavpackdec->segment.format != GST_FORMAT_TIME)
return TRUE;
start = GST_BUFFER_TIMESTAMP (buf);
stop = start + GST_BUFFER_DURATION (buf);
if (gst_segment_clip (&wavpackdec->segment, GST_FORMAT_TIME,
start, stop, &cstart, &cstop)) {
diff = cstart - start;
if (diff > 0) {
GST_BUFFER_TIMESTAMP (buf) = cstart;
GST_BUFFER_DURATION (buf) -= diff;
diff = ((wavpackdec->width + 7) >> 3) * wavpackdec->channels
* GST_CLOCK_TIME_TO_FRAMES (diff, wavpackdec->sample_rate);
GST_BUFFER_DATA (buf) += diff;
GST_BUFFER_SIZE (buf) -= diff;
}
diff = cstop - stop;
if (diff > 0) {
GST_BUFFER_DURATION (buf) -= diff;
diff = ((wavpackdec->width + 7) >> 3) * wavpackdec->channels
* GST_CLOCK_TIME_TO_FRAMES (diff, wavpackdec->sample_rate);
GST_BUFFER_SIZE (buf) -= diff;
}
} else {
GST_DEBUG_OBJECT (wavpackdec, "buffer is outside configured segment");
return FALSE;
}
return TRUE;
}
static GstFlowReturn
gst_wavpack_dec_chain (GstPad * pad, GstBuffer * buf)
{
GstWavpackDec *wavpackdec = GST_WAVPACK_DEC (gst_pad_get_parent (pad));
GstBuffer *outbuf, *cbuf = NULL;
GstWavpackDec *wavpackdec;
GstBuffer *outbuf;
GstBuffer *cbuf = NULL;
GstFlowReturn ret = GST_FLOW_OK;
WavpackHeader wph;
int32_t *unpack_buf;
int32_t unpacked_sample_count;
wavpackdec = GST_WAVPACK_DEC (GST_PAD_PARENT (pad));
/* we only accept framed input with complete chunks */
g_assert (GST_BUFFER_SIZE (buf) >= sizeof (WavpackHeader));
gst_wavpack_read_header (&wph, GST_BUFFER_DATA (buf));
g_assert (GST_BUFFER_SIZE (buf) ==
wph.ckSize + 4 * sizeof (char) + sizeof (uint32_t));
wavpackdec->wv_id.buffer = GST_BUFFER_DATA (buf);
wavpackdec->wv_id.length = GST_BUFFER_SIZE (buf);
wavpackdec->wv_id.position = 0;
#if 0
/* check whether the correction pad is linked and we can get
* the correction chunk that corresponds to our current data */
if (gst_pad_is_linked (wavpackdec->wvcsinkpad)) {
if (GST_FLOW_OK != gst_pad_pull_range (wavpackdec->wvcsinkpad,
wavpackdec->wvcflushed_bytes, -1, &cbuf)) {
GST_BUFFER_OFFSET (buf), -1, &cbuf)) {
cbuf = NULL;
} else {
wavpackdec->wvcflushed_bytes += GST_BUFFER_SIZE (cbuf);
/* this won't work (tpm) */
if (!(GST_BUFFER_TIMESTAMP (cbuf) == GST_BUFFER_TIMESTAMP (buf)) ||
!(GST_BUFFER_DURATION (cbuf) == GST_BUFFER_DURATION (buf)) ||
!(GST_BUFFER_OFFSET (cbuf) == GST_BUFFER_OFFSET (buf)) ||
!(GST_BUFFER_OFFSET_END (cbuf) == GST_BUFFER_OFFSET (buf))) {
gst_buffer_unref (cbuf);
cbuf = NULL;
} else {
wavpackdec->wvc_id.buffer = GST_BUFFER_DATA (cbuf);
wavpackdec->wvc_id.length = GST_BUFFER_SIZE (cbuf);
wavpackdec->wvc_id.position = 0;
}
}
}
#endif
gst_wavpack_dec_setup_context (wavpackdec, GST_BUFFER_DATA (buf),
cbuf ? GST_BUFFER_DATA (cbuf) : NULL);
unpack_samples (wavpackdec->context, wavpackdec->decodebuf,
wavpackdec->context->streams[0]->wphdr.block_samples);
outbuf =
gst_wavpack_dec_format_samples (wavpackdec, wavpackdec->decodebuf,
wavpackdec->context->streams[0]->wphdr.block_samples);
/* create a new wavpack context if there is none yet but if there
* was already one (i.e. caps were set on the srcpad) check whether
* the new one has the same caps */
if (!wavpackdec->context) {
gchar error_msg[80];
gst_buffer_stamp (outbuf, buf);
/*
wavpackdec->context =
WavpackOpenFileInputEx (wavpackdec->stream_reader, &wavpackdec->wv_id,
(cbuf) ? &wavpackdec->wvc_id : NULL, error_msg, OPEN_STREAMING, 0);
*/
wavpackdec-><