mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 00:01:23 +00:00
ext/wavpack/gstwavpackenc.*: Put the write helpers into the GstWavpackEnc struct directly and not as a pointer to sav...
Original commit message from CVS: * 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.
This commit is contained in:
parent
3a12608d1c
commit
4f1ddeddba
4 changed files with 23 additions and 25 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
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):
|
||||
|
|
|
@ -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. "
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue