summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--ext/wavpack/gstwavpackenc.c6
-rw-r--r--ext/wavpack/gstwavpackparse.c37
3 files changed, 51 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index a4dece6e..0209fdcb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
+2006-08-16 Tim-Philipp Müller <tim at centricular dot net>
+
+ Patch by: Sebastian Dröge <slomo at circular-chaos.org>
+
+ * ext/wavpack/gstwavpackenc.c: (gst_wavpack_enc_class_init):
+ * ext/wavpack/gstwavpackparse.c:
+ (gst_wavpack_parse_resync_adapter), (gst_wavpack_parse_chain):
+ In push mode, re-sync to next wavpack header if sync is lost
+ (#351557). Also use hyphens instead of underscores in
+ GObject property names.
+
2006-08-15 Tim-Philipp Müller <tim at centricular dot net>
+ Patch by: Sebastian Dröge <slomo at circular-chaos.org>
+
* ext/wavpack/gstwavpackparse.c: (gst_wavpack_parse_class_init),
(gst_wavpack_parse_reset), (gst_wavpack_parse_get_src_query_types),
(gst_wavpack_parse_src_query),
@@ -10,8 +23,6 @@
(gst_wavpack_parse_chain), (gst_wavpack_parse_sink_activate),
(gst_wavpack_parse_sink_activate_pull):
* ext/wavpack/gstwavpackparse.h:
- Patch by: Sebastian Dröge <slomo at circular-chaos.org>
-
Make wavpackparse also work in push-mode (not seekable yet though);
some small clean-ups along the way; add support for SEEKING query
and query types function. (#351495).
diff --git a/ext/wavpack/gstwavpackenc.c b/ext/wavpack/gstwavpackenc.c
index 60ab40a2..d5cd0191 100644
--- a/ext/wavpack/gstwavpackenc.c
+++ b/ext/wavpack/gstwavpackenc.c
@@ -238,7 +238,7 @@ gst_wavpack_enc_class_init (GstWavpackEncClass * klass)
"This enables lossy encoding! A value smaller than 2.0 disables this.",
0.0, 24.0, 0.0, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_CORRECTION_MODE,
- g_param_spec_enum ("correction_mode", "Correction file mode",
+ g_param_spec_enum ("correction-mode", "Correction file mode",
"Use this mode for correction file creation. Only works in lossy mode!",
GST_TYPE_WAVPACK_ENC_CORRECTION_MODE, DEFAULT_CORRECTION_MODE,
G_PARAM_READWRITE));
@@ -247,10 +247,10 @@ gst_wavpack_enc_class_init (GstWavpackEncClass * klass)
"Store MD5 hash of raw samples within the file.", FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_EXTRA_PROCESSING,
- g_param_spec_boolean ("extra_processing", "Extra processing",
+ g_param_spec_boolean ("extra-processing", "Extra processing",
"Extra encode processing.", FALSE, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_JOINT_STEREO_MODE,
- g_param_spec_enum ("joint_stereo_mode", "Joint-Stereo mode",
+ g_param_spec_enum ("joint-stereo-mode", "Joint-Stereo mode",
"Use this joint-stereo mode.", GST_TYPE_WAVPACK_ENC_JOINT_STEREO_MODE,
DEFAULT_JS_MODE, G_PARAM_READWRITE));
}
diff --git a/ext/wavpack/gstwavpackparse.c b/ext/wavpack/gstwavpackparse.c
index 720b25b0..20b024f3 100644
--- a/ext/wavpack/gstwavpackparse.c
+++ b/ext/wavpack/gstwavpackparse.c
@@ -935,6 +935,34 @@ pause:
}
}
+static gboolean
+gst_wavpack_parse_resync_adapter (GstAdapter * adapter)
+{
+ const guint8 *buf;
+ guint avail = gst_adapter_available (adapter);
+ gchar *marker;
+
+ if (avail < 4)
+ return FALSE;
+
+ /* if the marker is at the beginning don't do the expensive search */
+ buf = gst_adapter_peek (adapter, 4);
+ if (memcmp (buf, "wvpk", 4) == 0)
+ return TRUE;
+
+ if (avail == 4)
+ return FALSE;
+
+ /* search for the marker in the complete content of the adapter */
+ buf = gst_adapter_peek (adapter, avail);
+ if (buf && (marker = g_strstr_len ((gchar *) buf, avail, "wvpk"))) {
+ gst_adapter_flush (adapter, marker - (gchar *) buf);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static GstFlowReturn
gst_wavpack_parse_chain (GstPad * pad, GstBuffer * buf)
{
@@ -956,11 +984,12 @@ gst_wavpack_parse_chain (GstPad * pad, GstBuffer * buf)
if (gst_adapter_available (wvparse->adapter) < sizeof (WavpackHeader))
return ret;
+ if (!gst_wavpack_parse_resync_adapter (wvparse->adapter))
+ return ret;
+
tmp_buf = gst_adapter_peek (wvparse->adapter, sizeof (WavpackHeader));
gst_wavpack_read_header (&wph, (guint8 *) tmp_buf);
- /* FIXME: should check for wavpack marker here and re-sync if not */
-
while (gst_adapter_available (wvparse->adapter) >= wph.ckSize + 4 * 1 + 4) {
GstBuffer *outbuf =
gst_adapter_take_buffer (wvparse->adapter, wph.ckSize + 4 * 1 + 4);
@@ -983,6 +1012,10 @@ gst_wavpack_parse_chain (GstPad * pad, GstBuffer * buf)
if (gst_adapter_available (wvparse->adapter) >= sizeof (WavpackHeader)) {
tmp_buf = gst_adapter_peek (wvparse->adapter, sizeof (WavpackHeader));
+
+ if (!gst_wavpack_parse_resync_adapter (wvparse->adapter))
+ break;
+
gst_wavpack_read_header (&wph, (guint8 *) tmp_buf);
}
}