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.
This commit is contained in:
Sebastian Dröge 2007-05-02 18:31:16 +00:00
parent 6991907036
commit 13ae0cde51
4 changed files with 30 additions and 2 deletions

View file

@ -23,6 +23,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <gst/gst-i18n-plugin.h>
#include "gstwavpackparse.h" #include "gstwavpackparse.h"
#include "gstwavpackdec.h" #include "gstwavpackdec.h"
#include "gstwavpackenc.h" #include "gstwavpackenc.h"
@ -34,6 +36,13 @@ static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
{ {
GST_DEBUG_CATEGORY_INIT (wavpack_debug, "wavpack", 0, "Wavpack elements"); 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) return (gst_wavpack_parse_plugin_init (plugin)
&& gst_wavpack_dec_plugin_init (plugin) && gst_wavpack_dec_plugin_init (plugin)
&& gst_wavpack_enc_plugin_init (plugin)); && gst_wavpack_enc_plugin_init (plugin));

View file

@ -359,6 +359,11 @@ gst_wavpack_dec_chain (GstPad * pad, GstBuffer * buf)
goto out; goto out;
gst_buffer_stamp (outbuf, buf); 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 */ /* decode */
decoded = WavpackUnpackSamples (dec->context, decoded = WavpackUnpackSamples (dec->context,

View file

@ -221,6 +221,7 @@ gst_wavpack_parse_reset (GstWavpackParse * parse)
parse->current_offset = 0; parse->current_offset = 0;
parse->need_newsegment = TRUE; parse->need_newsegment = TRUE;
parse->discont = TRUE;
parse->upstream_length = -1; parse->upstream_length = -1;
if (parse->entries) { 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 byte_offset; /* byte offset the chunk we seek to starts at */
gint64 chunk_start; /* first sample in chunk we seek to */ gint64 chunk_start; /* first sample in chunk we seek to */
guint rate; guint rate;
gint64 last_stop;
if (wvparse->adapter) { if (wvparse->adapter) {
GST_DEBUG_OBJECT (wvparse, "seeking in streaming mode not implemented yet"); 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); 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 ()); gst_pad_push_event (wvparse->sinkpad, gst_event_new_flush_stop ());
if (flush) { if (flush) {
@ -594,7 +599,8 @@ gst_wavpack_parse_handle_seek_event (GstWavpackParse * wvparse,
* the output buffers accordingly */ * the output buffers accordingly */
wvparse->segment = segment; wvparse->segment = segment;
wvparse->segment.last_stop = chunk_start; 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 we're doing a segment seek, post a SEGMENT_START message */
if (wvparse->segment.flags & GST_SEEK_FLAG_SEGMENT) { 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_SECOND, wvparse->samplerate);
GST_BUFFER_OFFSET (buf) = header->block_index; GST_BUFFER_OFFSET (buf) = header->block_index;
GST_BUFFER_OFFSET_END (buf) = header->block_index + header->block_samples; 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_buffer_set_caps (buf, GST_PAD_CAPS (wvparse->srcpad));
GST_LOG_OBJECT (wvparse, "Pushing buffer with time %" GST_TIME_FORMAT, 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 (); 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); gst_adapter_clear (wvparse->adapter);
wvparse->discont = TRUE;
} }
gst_adapter_push (wvparse->adapter, buf); gst_adapter_push (wvparse->adapter, buf);

View file

@ -60,6 +60,7 @@ struct _GstWavpackParse
guint total_samples; guint total_samples;
gboolean need_newsegment; gboolean need_newsegment;
gboolean discont;
gint64 current_offset; /* byte offset on sink pad */ gint64 current_offset; /* byte offset on sink pad */
gint64 upstream_length; /* length of file in bytes */ gint64 upstream_length; /* length of file in bytes */