summaryrefslogtreecommitdiffstats
path: root/ext/wavpack
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2007-05-02 18:31:16 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2007-05-02 18:31:16 +0000
commit13ae0cde514f3531c5c39722ca05f96377a4d3d5 (patch)
tree810999f96d472d2babc8a839b2317e7a4095e5e4 /ext/wavpack
parent6991907036b3688b7d4537cdefafbc48baecce58 (diff)
ext/wavpack/gstwavpack.c: Call bindtextdomain() to get localized strings.
Original commit message from CVS: * ext/wavpack/gstwavpack.c: (plugin_init): Call bindtextdomain() to get localized strings. * ext/wavpack/gstwavpackdec.c: (gst_wavpack_dec_chain): * ext/wavpack/gstwavpackparse.c: (gst_wavpack_parse_reset), (gst_wavpack_parse_handle_seek_event), (gst_wavpack_parse_push_buffer), (gst_wavpack_parse_chain): * ext/wavpack/gstwavpackparse.h: Handle DISCONT buffers by correctly setting the DISCONT flag on outgoing buffers when necessary. * ext/wavpack/gstwavpackparse.c: (gst_wavpack_parse_handle_seek_event) Send newsegment from the streaming thread.
Diffstat (limited to 'ext/wavpack')
-rw-r--r--ext/wavpack/gstwavpack.c9
-rw-r--r--ext/wavpack/gstwavpackdec.c5
-rw-r--r--ext/wavpack/gstwavpackparse.c17
-rw-r--r--ext/wavpack/gstwavpackparse.h1
4 files changed, 30 insertions, 2 deletions
diff --git a/ext/wavpack/gstwavpack.c b/ext/wavpack/gstwavpack.c
index ddd3f2a2..580d658e 100644
--- a/ext/wavpack/gstwavpack.c
+++ b/ext/wavpack/gstwavpack.c
@@ -23,6 +23,8 @@
#include "config.h"
#endif
+#include <gst/gst-i18n-plugin.h>
+
#include "gstwavpackparse.h"
#include "gstwavpackdec.h"
#include "gstwavpackenc.h"
@@ -34,6 +36,13 @@ static gboolean
plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (wavpack_debug, "wavpack", 0, "Wavpack elements");
+
+#if ENABLE_NLS
+ GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
+ LOCALEDIR);
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+#endif
+
return (gst_wavpack_parse_plugin_init (plugin)
&& gst_wavpack_dec_plugin_init (plugin)
&& gst_wavpack_enc_plugin_init (plugin));
diff --git a/ext/wavpack/gstwavpackdec.c b/ext/wavpack/gstwavpackdec.c
index 8e46e61f..5adaf1be 100644
--- a/ext/wavpack/gstwavpackdec.c
+++ b/ext/wavpack/gstwavpackdec.c
@@ -359,6 +359,11 @@ gst_wavpack_dec_chain (GstPad * pad, GstBuffer * buf)
goto out;
gst_buffer_stamp (outbuf, buf);
+ /* If we got a DISCONT buffer forward the flag. Nothing else
+ * has to be done as libwavpack doesn't store state between
+ * Wavpack blocks */
+ if (GST_BUFFER_IS_DISCONT (buf))
+ GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
/* decode */
decoded = WavpackUnpackSamples (dec->context,
diff --git a/ext/wavpack/gstwavpackparse.c b/ext/wavpack/gstwavpackparse.c
index 91eb7cf0..61c94f1e 100644
--- a/ext/wavpack/gstwavpackparse.c
+++ b/ext/wavpack/gstwavpackparse.c
@@ -221,6 +221,7 @@ gst_wavpack_parse_reset (GstWavpackParse * parse)
parse->current_offset = 0;
parse->need_newsegment = TRUE;
+ parse->discont = TRUE;
parse->upstream_length = -1;
if (parse->entries) {
@@ -499,6 +500,7 @@ gst_wavpack_parse_handle_seek_event (GstWavpackParse * wvparse,
gint64 byte_offset; /* byte offset the chunk we seek to starts at */
gint64 chunk_start; /* first sample in chunk we seek to */
guint rate;
+ gint64 last_stop;
if (wvparse->adapter) {
GST_DEBUG_OBJECT (wvparse, "seeking in streaming mode not implemented yet");
@@ -572,6 +574,9 @@ gst_wavpack_parse_handle_seek_event (GstWavpackParse * wvparse,
GST_PAD_STREAM_LOCK (wvparse->sinkpad);
+ /* Save current position */
+ last_stop = wvparse->segment.last_stop;
+
gst_pad_push_event (wvparse->sinkpad, gst_event_new_flush_stop ());
if (flush) {
@@ -594,7 +599,8 @@ gst_wavpack_parse_handle_seek_event (GstWavpackParse * wvparse,
* the output buffers accordingly */
wvparse->segment = segment;
wvparse->segment.last_stop = chunk_start;
- gst_wavpack_parse_send_newsegment (wvparse, FALSE);
+ wvparse->need_newsegment = TRUE;
+ wvparse->discont = (last_stop != chunk_start) ? TRUE : FALSE;
/* if we're doing a segment seek, post a SEGMENT_START message */
if (wvparse->segment.flags & GST_SEEK_FLAG_SEGMENT) {
@@ -883,6 +889,12 @@ gst_wavpack_parse_push_buffer (GstWavpackParse * wvparse, GstBuffer * buf,
GST_SECOND, wvparse->samplerate);
GST_BUFFER_OFFSET (buf) = header->block_index;
GST_BUFFER_OFFSET_END (buf) = header->block_index + header->block_samples;
+
+ if (wvparse->discont) {
+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
+ wvparse->discont = FALSE;
+ }
+
gst_buffer_set_caps (buf, GST_PAD_CAPS (wvparse->srcpad));
GST_LOG_OBJECT (wvparse, "Pushing buffer with time %" GST_TIME_FORMAT,
@@ -1092,8 +1104,9 @@ gst_wavpack_parse_chain (GstPad * pad, GstBuffer * buf)
wvparse->adapter = gst_adapter_new ();
}
- if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT)) {
+ if (GST_BUFFER_IS_DISCONT (buf)) {
gst_adapter_clear (wvparse->adapter);
+ wvparse->discont = TRUE;
}
gst_adapter_push (wvparse->adapter, buf);
diff --git a/ext/wavpack/gstwavpackparse.h b/ext/wavpack/gstwavpackparse.h
index 7729c0f4..c1d6feea 100644
--- a/ext/wavpack/gstwavpackparse.h
+++ b/ext/wavpack/gstwavpackparse.h
@@ -60,6 +60,7 @@ struct _GstWavpackParse
guint total_samples;
gboolean need_newsegment;
+ gboolean discont;
gint64 current_offset; /* byte offset on sink pad */
gint64 upstream_length; /* length of file in bytes */