summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--ext/wavpack/gstwavpackenc.c30
-rw-r--r--ext/wavpack/gstwavpackenc.h4
-rw-r--r--ext/wavpack/gstwavpackparse.c1
4 files changed, 23 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index fc00917d..1c23c90c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2007-03-22 Sebastian Dröge <slomo@circular-chaos.org>
+ * ext/wavpack/gstwavpackenc.c: (gst_wavpack_enc_class_init),
+ (gst_wavpack_enc_init), (gst_wavpack_enc_chain),
+ (gst_wavpack_enc_rewrite_first_block):
+ * ext/wavpack/gstwavpackenc.h:
+ Put the write helpers into the GstWavpackEnc struct directly and not
+ as a pointer to save two small, but useless mallocs. This also makes
+ it possible to drop the finalize method.
+ * ext/wavpack/gstwavpackparse.c: (gst_wavpack_parse_push_buffer):
+ For consistency reasons also set GST_BUFFER_OFFSET_END on the outgoing
+ buffers the same way wavpackenc does it.
+
+2007-03-22 Sebastian Dröge <slomo@circular-chaos.org>
+
* ext/wavpack/gstwavpackdec.c: (gst_wavpack_dec_chain):
Don't use gst_pad_alloc_buffer() as we might clip the buffer later and
BaseTransform-based elements will likely break because of wrong
diff --git a/ext/wavpack/gstwavpackenc.c b/ext/wavpack/gstwavpackenc.c
index 8992d0c1..fbeb2c7f 100644
--- a/ext/wavpack/gstwavpackenc.c
+++ b/ext/wavpack/gstwavpackenc.c
@@ -83,7 +83,6 @@ static int gst_wavpack_enc_push_block (void *id, void *data, int32_t count);
static gboolean gst_wavpack_enc_sink_event (GstPad * pad, GstEvent * event);
static GstStateChangeReturn gst_wavpack_enc_change_state (GstElement * element,
GstStateChange transition);
-static void gst_wavpack_enc_finalize (GObject * object);
static void gst_wavpack_enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_wavpack_enc_get_property (GObject * object, guint prop_id,
@@ -274,7 +273,6 @@ gst_wavpack_enc_class_init (GstWavpackEncClass * klass)
/* set state change handler */
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_wavpack_enc_change_state);
- gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_wavpack_enc_finalize);
/* set property handlers */
gobject_class->set_property =
@@ -372,12 +370,10 @@ gst_wavpack_enc_init (GstWavpackEnc * enc, GstWavpackEncClass * gclass)
enc->md5_context = NULL;
gst_wavpack_enc_reset (enc);
- enc->wv_id = g_new0 (GstWavpackEncWriteID, 1);
- enc->wv_id->correction = FALSE;
- enc->wv_id->wavpack_enc = enc;
- enc->wvc_id = g_new0 (GstWavpackEncWriteID, 1);
- enc->wvc_id->correction = TRUE;
- enc->wvc_id->wavpack_enc = enc;
+ enc->wv_id.correction = FALSE;
+ enc->wv_id.wavpack_enc = enc;
+ enc->wvc_id.correction = TRUE;
+ enc->wvc_id.wavpack_enc = enc;
/* set default values of params */
enc->mode = GST_WAVPACK_ENC_MODE_DEFAULT;
@@ -388,18 +384,6 @@ gst_wavpack_enc_init (GstWavpackEnc * enc, GstWavpackEncClass * gclass)
enc->joint_stereo_mode = GST_WAVPACK_JS_MODE_AUTO;
}
-static void
-gst_wavpack_enc_finalize (GObject * object)
-{
- GstWavpackEnc *enc = GST_WAVPACK_ENC (object);
-
- /* free the blockout helpers */
- g_free (enc->wv_id);
- g_free (enc->wvc_id);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
static gboolean
gst_wavpack_enc_sink_set_caps (GstPad * pad, GstCaps * caps)
{
@@ -694,8 +678,8 @@ gst_wavpack_enc_chain (GstPad * pad, GstBuffer * buf)
if (!enc->wp_context) {
/* create raw context */
enc->wp_context =
- WavpackOpenFileOutput (gst_wavpack_enc_push_block, enc->wv_id,
- (enc->correction_mode > 0) ? enc->wvc_id : NULL);
+ WavpackOpenFileOutput (gst_wavpack_enc_push_block, &enc->wv_id,
+ (enc->correction_mode > 0) ? &enc->wvc_id : NULL);
if (!enc->wp_context) {
GST_ELEMENT_ERROR (enc, LIBRARY, INIT, (NULL),
("error creating Wavpack context"));
@@ -784,7 +768,7 @@ gst_wavpack_enc_rewrite_first_block (GstWavpackEnc * enc)
if (ret) {
/* try to rewrite the first block */
GST_DEBUG_OBJECT (enc, "rewriting first block ...");
- ret = gst_wavpack_enc_push_block (enc->wv_id,
+ ret = gst_wavpack_enc_push_block (&enc->wv_id,
enc->first_block, enc->first_block_size);
} else {
GST_WARNING_OBJECT (enc, "rewriting of first block failed. "
diff --git a/ext/wavpack/gstwavpackenc.h b/ext/wavpack/gstwavpackenc.h
index 7a7c156f..35d796f8 100644
--- a/ext/wavpack/gstwavpackenc.h
+++ b/ext/wavpack/gstwavpackenc.h
@@ -68,8 +68,8 @@ struct _GstWavpackEnc
gint channels;
gint width;
- GstWavpackEncWriteID *wv_id;
- GstWavpackEncWriteID *wvc_id;
+ GstWavpackEncWriteID wv_id;
+ GstWavpackEncWriteID wvc_id;
guint mode;
gdouble bitrate;
diff --git a/ext/wavpack/gstwavpackparse.c b/ext/wavpack/gstwavpackparse.c
index 923f3d65..c484a10d 100644
--- a/ext/wavpack/gstwavpackparse.c
+++ b/ext/wavpack/gstwavpackparse.c
@@ -870,6 +870,7 @@ gst_wavpack_parse_push_buffer (GstWavpackParse * wvparse, GstBuffer * buf,
GST_BUFFER_DURATION (buf) = gst_util_uint64_scale_int (header->block_samples,
GST_SECOND, wvparse->samplerate);
GST_BUFFER_OFFSET (buf) = header->block_index;
+ GST_BUFFER_OFFSET_END (buf) = header->block_index + header->block_samples;
gst_buffer_set_caps (buf, GST_PAD_CAPS (wvparse->srcpad));
GST_LOG_OBJECT (wvparse, "Pushing buffer with time %" GST_TIME_FORMAT,