From: <sl...@ke...> - 2007-03-22 00:17:59
|
CVS Root: /cvs/gstreamer Module: gst-plugins-bad Changes by: slomo Date: Thu Mar 22 2007 00:17:53 UTC Log message: * 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. Modified files: . : ChangeLog ext/wavpack : gstwavpackenc.c gstwavpackenc.h gstwavpackparse.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.2468&r2=1.2469 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/wavpack/gstwavpackenc.c.diff?r1=1.14&r2=1.15 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/wavpack/gstwavpackenc.h.diff?r1=1.6&r2=1.7 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/wavpack/gstwavpackparse.c.diff?r1=1.22&r2=1.23 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v retrieving revision 1.2468 retrieving revision 1.2469 diff -u -d -r1.2468 -r1.2469 --- ChangeLog 21 Mar 2007 23:50:09 -0000 1.2468 +++ ChangeLog 22 Mar 2007 00:17:41 -0000 1.2469 @@ -1,5 +1,18 @@ 2007-03-22 Sebastian Dröge <sl...@ci...> + * 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 <sl...@ci...> * 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 Index: gstwavpackenc.c RCS file: /cvs/gstreamer/gst-plugins-bad/ext/wavpack/gstwavpackenc.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- gstwavpackenc.c 7 Mar 2007 12:07:07 -0000 1.14 +++ gstwavpackenc.c 22 Mar 2007 00:17:41 -0000 1.15 @@ -83,7 +83,6 @@ 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 @@ /* 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 @@ 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 @@ 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 @@ 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 @@ 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. " Index: gstwavpackenc.h RCS file: /cvs/gstreamer/gst-plugins-bad/ext/wavpack/gstwavpackenc.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- gstwavpackenc.h 18 Dec 2006 10:02:56 -0000 1.6 +++ gstwavpackenc.h 22 Mar 2007 00:17:41 -0000 1.7 @@ -68,8 +68,8 @@ gint channels; gint width; - GstWavpackEncWriteID *wv_id; - GstWavpackEncWriteID *wvc_id; + GstWavpackEncWriteID wv_id; + GstWavpackEncWriteID wvc_id; guint mode; gdouble bitrate; Index: gstwavpackparse.c RCS file: /cvs/gstreamer/gst-plugins-bad/ext/wavpack/gstwavpackparse.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- gstwavpackparse.c 7 Mar 2007 12:07:07 -0000 1.22 +++ gstwavpackparse.c 22 Mar 2007 00:17:41 -0000 1.23 @@ -870,6 +870,7 @@ 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, |