2001-12-23 14:15:30 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2005-11-25 22:14:47 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-flacdec
|
|
|
|
* @seealso: flacenc
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <para>
|
|
|
|
* flacdec decodes FLAC streams.
|
|
|
|
* <ulink url="http://flac.sourceforge.net/">FLAC</ulink>
|
|
|
|
* is a Free Lossless Audio Codec.
|
|
|
|
* </para>
|
|
|
|
* <title>Example launch line</title>
|
|
|
|
* <para>
|
|
|
|
* <programlisting>
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
* gst-launch filesrc location=media/small/dark.441-16-s.flac ! flacdec ! audioconvert ! audioresample ! autoaudiosink
|
2005-11-25 22:14:47 +00:00
|
|
|
* </programlisting>
|
|
|
|
* </para>
|
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FIXME: this pipeline doesn't work, but we want to use it as example
|
|
|
|
* gst-launch gnomevfssrc location=http://gstreamer.freedesktop.org/media/small/dark.441-16-s.flac ! flacdec ! autoaudiosink
|
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2001-12-23 14:15:30 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "gstflacdec.h"
|
2005-09-07 13:49:37 +00:00
|
|
|
#include <gst/gsttagsetter.h>
|
2003-11-28 13:04:21 +00:00
|
|
|
|
2005-10-02 15:33:14 +00:00
|
|
|
#include <gst/tag/tag.h>
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2002-09-18 20:56:42 +00:00
|
|
|
#include "flac_compat.h"
|
2001-12-23 14:15:30 +00:00
|
|
|
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (flacdec_debug);
|
|
|
|
#define GST_CAT_DEFAULT flacdec_debug
|
|
|
|
|
2003-11-01 15:46:35 +00:00
|
|
|
static GstPadTemplate *src_template, *sink_template;
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2006-03-30 15:37:05 +00:00
|
|
|
static GstElementDetails flacdec_details =
|
|
|
|
GST_ELEMENT_DETAILS ("FLAC audio decoder",
|
|
|
|
"Codec/Decoder/Audio",
|
|
|
|
"Decodes FLAC lossless audio streams",
|
|
|
|
"Wim Taymans <wim.taymans@chello.be>");
|
2001-12-23 14:15:30 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
static void gst_flac_dec_finalize (GObject * object);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
static void gst_flac_dec_loop (GstPad * pad);
|
|
|
|
static GstStateChangeReturn gst_flac_dec_change_state (GstElement * element,
|
2005-09-02 15:44:50 +00:00
|
|
|
GstStateChange transition);
|
2005-12-09 19:51:03 +00:00
|
|
|
static const GstQueryType *gst_flac_dec_get_src_query_types (GstPad * pad);
|
|
|
|
static gboolean gst_flac_dec_src_query (GstPad * pad, GstQuery * query);
|
|
|
|
static gboolean gst_flac_dec_convert_src (GstPad * pad, GstFormat src_format,
|
2004-03-14 22:34:33 +00:00
|
|
|
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
|
2005-12-09 19:51:03 +00:00
|
|
|
static gboolean gst_flac_dec_src_event (GstPad * pad, GstEvent * event);
|
|
|
|
static gboolean gst_flac_dec_sink_activate (GstPad * sinkpad);
|
|
|
|
static gboolean gst_flac_dec_sink_activate_pull (GstPad * sinkpad,
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
gboolean active);
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
static void gst_flac_dec_send_newsegment (GstFlacDec * flacdec,
|
|
|
|
gboolean update);
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static FLAC__SeekableStreamDecoderReadStatus
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_read (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__byte buffer[], unsigned *bytes, void *client_data);
|
|
|
|
static FLAC__SeekableStreamDecoderSeekStatus
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_seek (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__uint64 position, void *client_data);
|
|
|
|
static FLAC__SeekableStreamDecoderTellStatus
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_tell (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__uint64 * position, void *client_data);
|
|
|
|
static FLAC__SeekableStreamDecoderLengthStatus
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_length (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__uint64 * length, void *client_data);
|
2005-12-09 19:51:03 +00:00
|
|
|
static FLAC__bool gst_flac_dec_eof (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
void *client_data);
|
|
|
|
static FLAC__StreamDecoderWriteStatus
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_write (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
const FLAC__Frame * frame,
|
|
|
|
const FLAC__int32 * const buffer[], void *client_data);
|
2005-12-09 19:51:03 +00:00
|
|
|
static void gst_flac_dec_metadata_callback (const FLAC__SeekableStreamDecoder *
|
2004-03-14 22:34:33 +00:00
|
|
|
decoder, const FLAC__StreamMetadata * metadata, void *client_data);
|
2005-12-09 19:51:03 +00:00
|
|
|
static void gst_flac_dec_error_callback (const FLAC__SeekableStreamDecoder *
|
2004-03-14 22:34:33 +00:00
|
|
|
decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
2001-12-23 14:15:30 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GST_BOILERPLATE (GstFlacDec, gst_flac_dec, GstElement, GST_TYPE_ELEMENT)
|
|
|
|
#define GST_FLAC_DEC_SRC_CAPS \
|
|
|
|
"audio/x-raw-int, " \
|
|
|
|
"endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", " \
|
|
|
|
"signed = (boolean) true, " \
|
|
|
|
"width = (int) { 8, 16, 32 }, " \
|
|
|
|
"depth = (int) { 8, 12, 16, 20, 24, 32 }, " \
|
|
|
|
"rate = (int) [ 8000, 96000 ], " \
|
|
|
|
"channels = (int) [ 1, 8 ]"
|
|
|
|
static void gst_flac_dec_base_init (gpointer g_class)
|
2003-11-01 15:46:35 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
GstCaps *raw_caps, *flac_caps;
|
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
raw_caps = gst_caps_from_string (GST_FLAC_DEC_SRC_CAPS);
|
|
|
|
flac_caps = gst_caps_new_simple ("audio/x-flac", NULL);
|
2003-11-01 15:46:35 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS, flac_caps);
|
2004-03-14 22:34:33 +00:00
|
|
|
src_template = gst_pad_template_new ("src", GST_PAD_SRC,
|
2003-12-22 01:47:09 +00:00
|
|
|
GST_PAD_ALWAYS, raw_caps);
|
2003-11-01 15:46:35 +00:00
|
|
|
gst_element_class_add_pad_template (element_class, sink_template);
|
|
|
|
gst_element_class_add_pad_template (element_class, src_template);
|
|
|
|
gst_element_class_set_details (element_class, &flacdec_details);
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (flacdec_debug, "flacdec", 0, "flac decoder");
|
2003-11-01 15:46:35 +00:00
|
|
|
}
|
|
|
|
|
2001-12-23 14:15:30 +00:00
|
|
|
static void
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_class_init (GstFlacDecClass * klass)
|
2001-12-23 14:15:30 +00:00
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class;
|
2004-01-31 10:25:05 +00:00
|
|
|
GObjectClass *gobject_class;
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gstelement_class = (GstElementClass *) klass;
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
gobject_class->finalize = gst_flac_dec_finalize;
|
2004-07-03 04:21:39 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_flac_dec_change_state);
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gst_flac_dec_init (GstFlacDec * flacdec, GstFlacDecClass * klass)
|
2001-12-23 14:15:30 +00:00
|
|
|
{
|
2003-11-01 15:46:35 +00:00
|
|
|
flacdec->sinkpad = gst_pad_new_from_template (sink_template, "sink");
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gst_pad_set_activate_function (flacdec->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_flac_dec_sink_activate));
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
gst_pad_set_activatepull_function (flacdec->sinkpad,
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_flac_dec_sink_activate_pull));
|
2001-12-23 14:15:30 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (flacdec), flacdec->sinkpad);
|
|
|
|
|
2003-11-01 15:46:35 +00:00
|
|
|
flacdec->srcpad = gst_pad_new_from_template (src_template, "src");
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_pad_set_query_type_function (flacdec->srcpad,
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_flac_dec_get_src_query_types));
|
|
|
|
gst_pad_set_query_function (flacdec->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_flac_dec_src_query));
|
|
|
|
gst_pad_set_event_function (flacdec->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_flac_dec_src_event));
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
gst_pad_use_fixed_caps (flacdec->srcpad);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (flacdec), flacdec->srcpad);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
|
|
|
flacdec->decoder = FLAC__seekable_stream_decoder_new ();
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
flacdec->segment.last_stop = 0;
|
2002-06-07 20:09:05 +00:00
|
|
|
flacdec->init = TRUE;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__seekable_stream_decoder_set_read_callback (flacdec->decoder,
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_read);
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__seekable_stream_decoder_set_seek_callback (flacdec->decoder,
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_seek);
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__seekable_stream_decoder_set_tell_callback (flacdec->decoder,
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_tell);
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__seekable_stream_decoder_set_length_callback (flacdec->decoder,
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_length);
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__seekable_stream_decoder_set_eof_callback (flacdec->decoder,
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_eof);
|
2002-09-18 20:56:42 +00:00
|
|
|
#if FLAC_VERSION >= 0x010003
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__seekable_stream_decoder_set_write_callback (flacdec->decoder,
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_write);
|
2002-09-18 20:56:42 +00:00
|
|
|
#else
|
|
|
|
FLAC__seekable_stream_decoder_set_write_callback (flacdec->decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
(FLAC__StreamDecoderWriteStatus (*)
|
2004-03-15 19:32:27 +00:00
|
|
|
(const FLAC__SeekableStreamDecoder * decoder,
|
|
|
|
const FLAC__Frame * frame,
|
|
|
|
const FLAC__int32 * buffer[], void *client_data))
|
2005-12-09 19:51:03 +00:00
|
|
|
(gst_flac_dec_write));
|
2002-09-18 20:56:42 +00:00
|
|
|
#endif
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__seekable_stream_decoder_set_metadata_respond (flacdec->decoder,
|
|
|
|
FLAC__METADATA_TYPE_VORBIS_COMMENT);
|
|
|
|
FLAC__seekable_stream_decoder_set_metadata_callback (flacdec->decoder,
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_metadata_callback);
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__seekable_stream_decoder_set_error_callback (flacdec->decoder,
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_error_callback);
|
2002-06-07 20:09:05 +00:00
|
|
|
FLAC__seekable_stream_decoder_set_client_data (flacdec->decoder, flacdec);
|
|
|
|
}
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2004-05-07 20:26:46 +00:00
|
|
|
static void
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_finalize (GObject * object)
|
2004-05-07 20:26:46 +00:00
|
|
|
{
|
2005-12-09 19:51:03 +00:00
|
|
|
GstFlacDec *flacdec;
|
2004-05-07 20:26:46 +00:00
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
flacdec = GST_FLAC_DEC (object);
|
2004-05-07 20:26:46 +00:00
|
|
|
|
|
|
|
if (flacdec->decoder)
|
|
|
|
FLAC__seekable_stream_decoder_delete (flacdec->decoder);
|
|
|
|
flacdec->decoder = NULL;
|
|
|
|
|
Fixes a bunch of problems with finalize and dispose functions, either assumptions that dispose is only called once, o...
Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_class_init), (gst_alsa_dispose),
(gst_alsa_finalize):
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init),
(gst_cdaudio_finalize):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_finalize):
* ext/divx/gstdivxdec.c: (gst_divxdec_dispose):
* ext/divx/gstdivxenc.c: (gst_divxenc_dispose):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_finalize):
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
(gst_flacdec_finalize):
* ext/flac/gstflacenc.c: (gst_flacenc_class_init),
(gst_flacenc_finalize):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_class_init),
(gst_gnomevfssink_finalize):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_class_init),
(gst_gnomevfssrc_finalize):
* ext/libfame/gstlibfame.c: (gst_fameenc_class_init),
(gst_fameenc_finalize):
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_finalize):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_class_init):
* ext/sndfile/gstsf.c: (gst_sf_dispose):
* gst-libs/gst/mixer/mixertrack.c: (gst_mixer_track_dispose):
* gst-libs/gst/tuner/tunerchannel.c: (gst_tuner_channel_dispose):
* gst-libs/gst/tuner/tunernorm.c: (gst_tuner_norm_dispose):
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
(gst_x_window_listener_dispose):
* gst/audioscale/gstaudioscale.c:
* gst/playondemand/gstplayondemand.c: (play_on_demand_class_init),
(play_on_demand_finalize):
* gst/videofilter/gstvideobalance.c: (gst_videobalance_dispose):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
* sys/cdrom/gstcdplayer.c: (cdplayer_class_init),
(cdplayer_finalize):
* sys/glsink/glimagesink.c: (gst_glimagesink_finalize),
(gst_glimagesink_class_init):
* sys/oss/gstosselement.c: (gst_osselement_class_init),
(gst_osselement_finalize):
* sys/oss/gstosssink.c: (gst_osssink_dispose):
* sys/oss/gstosssrc.c: (gst_osssrc_dispose):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_dispose):
Fixes a bunch of problems with finalize and dispose functions,
either assumptions that dispose is only called once, or not calling
the parent class dispose/finalize function
2004-11-01 14:43:38 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2004-05-07 20:26:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-04-27 12:00:41 +00:00
|
|
|
static gboolean
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_update_metadata (GstFlacDec * flacdec,
|
2004-03-14 22:34:33 +00:00
|
|
|
const FLAC__StreamMetadata * metadata)
|
2003-04-27 12:00:41 +00:00
|
|
|
{
|
2003-11-28 13:04:21 +00:00
|
|
|
GstTagList *list;
|
2003-04-27 12:00:41 +00:00
|
|
|
guint32 number_of_comments, cursor, str_len;
|
|
|
|
gchar *p_value, *value, *name, *str_ptr;
|
2003-11-28 13:04:21 +00:00
|
|
|
|
|
|
|
list = gst_tag_list_new ();
|
|
|
|
if (list == NULL) {
|
|
|
|
return FALSE;
|
2003-04-27 12:00:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
number_of_comments = metadata->data.vorbis_comment.num_comments;
|
|
|
|
value = NULL;
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_DEBUG ("%d tag(s) found", number_of_comments);
|
|
|
|
for (cursor = 0; cursor < number_of_comments; cursor++) {
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
str_ptr = (gchar *) metadata->data.vorbis_comment.comments[cursor].entry;
|
2004-01-13 23:59:51 +00:00
|
|
|
str_len = metadata->data.vorbis_comment.comments[cursor].length;
|
2004-03-14 22:34:33 +00:00
|
|
|
p_value = g_strstr_len (str_ptr, str_len, "=");
|
|
|
|
if (p_value) {
|
2003-04-27 12:00:41 +00:00
|
|
|
name = g_strndup (str_ptr, p_value - str_ptr);
|
2003-11-28 13:04:21 +00:00
|
|
|
value = g_strndup (p_value + 1, str_ptr + str_len - p_value - 1);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG ("%s : %s", name, value);
|
2005-10-02 15:33:14 +00:00
|
|
|
gst_vorbis_tag_add (list, name, value);
|
2003-04-27 12:00:41 +00:00
|
|
|
g_free (name);
|
|
|
|
g_free (value);
|
|
|
|
}
|
|
|
|
}
|
2004-10-25 16:10:58 +00:00
|
|
|
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_AUDIO_CODEC, "FLAC", NULL);
|
2003-11-28 13:04:21 +00:00
|
|
|
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
gst_element_found_tags_for_pad (GST_ELEMENT (flacdec), flacdec->srcpad, list);
|
|
|
|
|
2003-04-27 12:00:41 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_metadata_callback (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
const FLAC__StreamMetadata * metadata, void *client_data)
|
2002-06-07 20:09:05 +00:00
|
|
|
{
|
2005-12-09 19:51:03 +00:00
|
|
|
GstFlacDec *flacdec;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
flacdec = GST_FLAC_DEC (client_data);
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
switch (metadata->type) {
|
2003-04-27 12:00:41 +00:00
|
|
|
case FLAC__METADATA_TYPE_STREAMINFO:
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gst_segment_set_duration (&flacdec->segment, GST_FORMAT_DEFAULT,
|
|
|
|
metadata->data.stream_info.total_samples);
|
|
|
|
if (flacdec->segment.stop == -1)
|
|
|
|
flacdec->segment.stop = metadata->data.stream_info.total_samples;
|
2004-03-14 22:34:33 +00:00
|
|
|
break;
|
2003-04-27 12:00:41 +00:00
|
|
|
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_update_metadata (flacdec, metadata);
|
2004-03-14 22:34:33 +00:00
|
|
|
break;
|
2003-04-27 12:00:41 +00:00
|
|
|
default:
|
2004-03-14 22:34:33 +00:00
|
|
|
break;
|
2003-04-27 12:00:41 +00:00
|
|
|
}
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_error_callback (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__StreamDecoderErrorStatus status, void *client_data)
|
2001-12-23 14:15:30 +00:00
|
|
|
{
|
2005-12-09 19:51:03 +00:00
|
|
|
GstFlacDec *flacdec;
|
2002-06-07 20:09:05 +00:00
|
|
|
gchar *error;
|
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
flacdec = GST_FLAC_DEC (client_data);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
|
|
|
switch (status) {
|
2002-07-08 19:31:49 +00:00
|
|
|
case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC:
|
2002-06-07 20:09:05 +00:00
|
|
|
error = "lost sync";
|
|
|
|
break;
|
2002-07-08 19:31:49 +00:00
|
|
|
case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER:
|
2002-06-07 20:09:05 +00:00
|
|
|
error = "bad header";
|
|
|
|
break;
|
2002-07-08 19:31:49 +00:00
|
|
|
case FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH:
|
2002-06-07 20:09:05 +00:00
|
|
|
error = "CRC mismatch";
|
|
|
|
break;
|
|
|
|
default:
|
2004-02-16 17:09:18 +00:00
|
|
|
error = "unknown error";
|
2002-06-07 20:09:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-02-02 17:23:33 +00:00
|
|
|
GST_ELEMENT_ERROR (flacdec, STREAM, DECODE, (NULL), (error));
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
flacdec->last_flow = GST_FLOW_ERROR;
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static FLAC__SeekableStreamDecoderSeekStatus
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_seek (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__uint64 position, void *client_data)
|
2001-12-23 14:15:30 +00:00
|
|
|
{
|
2005-12-09 19:51:03 +00:00
|
|
|
GstFlacDec *flacdec;
|
2002-06-07 20:09:05 +00:00
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
flacdec = GST_FLAC_DEC (client_data);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG ("seek %" G_GINT64_FORMAT, position);
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
flacdec->offset = position;
|
|
|
|
|
2002-06-07 20:09:05 +00:00
|
|
|
return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK;
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static FLAC__SeekableStreamDecoderTellStatus
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_tell (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__uint64 * position, void *client_data)
|
2001-12-23 14:15:30 +00:00
|
|
|
{
|
2005-12-09 19:51:03 +00:00
|
|
|
GstFlacDec *flacdec;
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
flacdec = GST_FLAC_DEC (client_data);
|
2001-12-23 14:15:30 +00:00
|
|
|
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
*position = flacdec->offset;
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG ("tell %" G_GINT64_FORMAT, *position);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
|
|
|
return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static FLAC__SeekableStreamDecoderLengthStatus
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_length (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__uint64 * length, void *client_data)
|
2002-06-07 20:09:05 +00:00
|
|
|
{
|
2005-12-09 19:51:03 +00:00
|
|
|
GstFlacDec *flacdec;
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
GstFormat fmt = GST_FORMAT_BYTES;
|
|
|
|
gint64 len;
|
|
|
|
GstPad *peer;
|
2002-06-07 20:09:05 +00:00
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
flacdec = GST_FLAC_DEC (client_data);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
if (!(peer = gst_pad_get_peer (flacdec->sinkpad)))
|
2002-06-07 20:09:05 +00:00
|
|
|
return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;
|
2005-10-19 15:57:04 +00:00
|
|
|
gst_pad_query_duration (peer, &fmt, &len);
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
gst_object_unref (peer);
|
|
|
|
if (fmt != GST_FORMAT_BYTES || len == -1)
|
|
|
|
return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;
|
|
|
|
|
|
|
|
*length = len;
|
2002-06-07 20:09:05 +00:00
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG ("length %" G_GINT64_FORMAT, *length);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
|
|
|
return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static FLAC__bool
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_eof (const FLAC__SeekableStreamDecoder * decoder,
|
|
|
|
void *client_data)
|
2002-06-07 20:09:05 +00:00
|
|
|
{
|
2005-12-09 19:51:03 +00:00
|
|
|
GstFlacDec *flacdec;
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GstFormat fmt;
|
|
|
|
GstPad *peer;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
gint64 len;
|
2002-06-07 20:09:05 +00:00
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
flacdec = GST_FLAC_DEC (client_data);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
if (!(peer = gst_pad_get_peer (flacdec->sinkpad))) {
|
|
|
|
GST_WARNING_OBJECT (flacdec, "no peer pad, returning EOF");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt = GST_FORMAT_BYTES;
|
|
|
|
if (gst_pad_query_duration (peer, &fmt, &len) && fmt == GST_FORMAT_BYTES &&
|
|
|
|
len != -1 && flacdec->offset >= len) {
|
|
|
|
GST_DEBUG ("offset=%" G_GINT64_FORMAT ", len=%" G_GINT64_FORMAT
|
|
|
|
", returning EOF", flacdec->offset, len);
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (peer);
|
|
|
|
|
|
|
|
return ret;
|
2002-06-07 20:09:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static FLAC__SeekableStreamDecoderReadStatus
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_read (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
FLAC__byte buffer[], unsigned *bytes, void *client_data)
|
2002-06-07 20:09:05 +00:00
|
|
|
{
|
2005-12-09 19:51:03 +00:00
|
|
|
GstFlacDec *flacdec;
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
GstBuffer *buf;
|
2002-06-07 20:09:05 +00:00
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
flacdec = GST_FLAC_DEC (client_data);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
if (gst_pad_pull_range (flacdec->sinkpad, flacdec->offset, *bytes,
|
|
|
|
&buf) != GST_FLOW_OK)
|
|
|
|
return FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
GST_DEBUG ("Read %d bytes at %" G_GUINT64_FORMAT,
|
|
|
|
GST_BUFFER_SIZE (buf), flacdec->offset);
|
|
|
|
memcpy (buffer, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
|
|
|
*bytes = GST_BUFFER_SIZE (buf);
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
flacdec->offset += *bytes;
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2002-06-07 20:09:05 +00:00
|
|
|
return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK;
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static FLAC__StreamDecoderWriteStatus
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_write (const FLAC__SeekableStreamDecoder * decoder,
|
2004-03-14 22:34:33 +00:00
|
|
|
const FLAC__Frame * frame,
|
|
|
|
const FLAC__int32 * const buffer[], void *client_data)
|
2001-12-23 14:15:30 +00:00
|
|
|
{
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2005-12-09 19:51:03 +00:00
|
|
|
GstFlacDec *flacdec;
|
2001-12-23 14:15:30 +00:00
|
|
|
GstBuffer *outbuf;
|
|
|
|
guint depth = frame->header.bits_per_sample;
|
2005-12-09 11:12:48 +00:00
|
|
|
guint width;
|
2001-12-23 14:15:30 +00:00
|
|
|
guint channels = frame->header.channels;
|
|
|
|
guint samples = frame->header.blocksize;
|
|
|
|
guint j, i;
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
|
|
|
flacdec = GST_FLAC_DEC (client_data);
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2005-12-09 11:12:48 +00:00
|
|
|
switch (depth) {
|
|
|
|
case 8:
|
|
|
|
width = 8;
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
case 16:
|
|
|
|
width = 16;
|
|
|
|
break;
|
|
|
|
case 20:
|
|
|
|
case 24:
|
|
|
|
case 32:
|
|
|
|
width = 32;
|
|
|
|
break;
|
|
|
|
default:
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
g_assert_not_reached ();
|
2002-06-07 20:09:05 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2001-12-23 14:15:30 +00:00
|
|
|
if (!GST_PAD_CAPS (flacdec->srcpad)) {
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
GST_DEBUG ("Negotiating %d Hz @ %d channels",
|
|
|
|
frame->header.sample_rate, channels);
|
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
caps = gst_caps_new_simple ("audio/x-raw-int",
|
|
|
|
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
|
|
|
"signed", G_TYPE_BOOLEAN, TRUE,
|
|
|
|
"width", G_TYPE_INT, width,
|
|
|
|
"depth", G_TYPE_INT, depth,
|
|
|
|
"rate", G_TYPE_INT, frame->header.sample_rate,
|
|
|
|
"channels", G_TYPE_INT, channels, NULL);
|
|
|
|
|
|
|
|
if (!gst_pad_set_caps (flacdec->srcpad, caps)) {
|
|
|
|
GST_ELEMENT_ERROR (flacdec, CORE, NEGOTIATION, (NULL),
|
|
|
|
("Failed to negotiate caps %" GST_PTR_FORMAT, caps));
|
|
|
|
flacdec->last_flow = GST_FLOW_ERROR;
|
|
|
|
gst_caps_unref (caps);
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_unref (caps);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
|
|
|
flacdec->depth = depth;
|
2005-09-06 21:31:25 +00:00
|
|
|
flacdec->width = width;
|
2002-06-07 20:09:05 +00:00
|
|
|
flacdec->channels = channels;
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
flacdec->sample_rate = frame->header.sample_rate;
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
if (flacdec->need_newsegment) {
|
|
|
|
gst_flac_dec_send_newsegment (flacdec, FALSE);
|
|
|
|
flacdec->need_newsegment = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = gst_pad_alloc_buffer_and_set_caps (flacdec->srcpad,
|
|
|
|
flacdec->segment.last_stop, samples * channels * (width / 8),
|
2005-12-05 13:03:00 +00:00
|
|
|
GST_PAD_CAPS (flacdec->srcpad), &outbuf);
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
GST_DEBUG ("gst_pad_alloc_buffer() returned %s", gst_flow_get_name (ret));
|
|
|
|
goto done;
|
2005-10-02 23:08:35 +00:00
|
|
|
}
|
|
|
|
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) =
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gst_util_uint64_scale_int (flacdec->segment.last_stop, GST_SECOND,
|
|
|
|
frame->header.sample_rate);
|
|
|
|
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
GST_BUFFER_DURATION (outbuf) =
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gst_util_uint64_scale_int (samples, GST_SECOND,
|
|
|
|
frame->header.sample_rate);
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
|
|
|
|
if (depth == 8) {
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gint8 *outbuffer = (gint8 *) GST_BUFFER_DATA (outbuf);
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
|
|
|
|
for (i = 0; i < samples; i++) {
|
|
|
|
for (j = 0; j < channels; j++) {
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
*outbuffer++ = (gint8) buffer[j][i];
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
}
|
2005-12-09 11:12:48 +00:00
|
|
|
} else if (depth == 12 || depth == 16) {
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gint16 *outbuffer = (gint16 *) GST_BUFFER_DATA (outbuf);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
for (i = 0; i < samples; i++) {
|
|
|
|
for (j = 0; j < channels; j++) {
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
*outbuffer++ = (gint16) buffer[j][i];
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
2003-06-28 14:21:47 +00:00
|
|
|
}
|
2005-12-09 11:12:48 +00:00
|
|
|
} else if (depth == 20 || depth == 24 || depth == 32) {
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gint32 *outbuffer = (gint32 *) GST_BUFFER_DATA (outbuf);
|
2005-09-06 21:31:25 +00:00
|
|
|
|
|
|
|
for (i = 0; i < samples; i++) {
|
|
|
|
for (j = 0; j < channels; j++) {
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
*outbuffer++ = (gint32) buffer[j][i];
|
2005-09-06 21:31:25 +00:00
|
|
|
}
|
|
|
|
}
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
} else {
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
g_assert_not_reached ();
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
}
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
|
|
|
if (!flacdec->seeking) {
|
|
|
|
GST_DEBUG ("pushing %d samples at offset %" G_GINT64_FORMAT
|
|
|
|
"(%" GST_TIME_FORMAT " + %" GST_TIME_FORMAT ")",
|
|
|
|
samples, GST_BUFFER_OFFSET (outbuf),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
|
|
|
|
|
|
|
|
ret = gst_pad_push (flacdec->srcpad, outbuf);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG ("not pushing %d samples at offset %" G_GINT64_FORMAT
|
|
|
|
" (in seek)", samples, GST_BUFFER_OFFSET (outbuf));
|
|
|
|
gst_buffer_unref (outbuf);
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
GST_DEBUG ("gst_pad_push() returned %s", gst_flow_get_name (ret));
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
|
|
|
done:
|
|
|
|
|
|
|
|
flacdec->segment.last_stop += samples;
|
|
|
|
|
|
|
|
/* we act on the flow return value later in the loop function, as we don't
|
|
|
|
* want to mess up the internal decoder state by returning ABORT when the
|
|
|
|
* error is in fact non-fatal (like a pad in flushing mode) and we want
|
|
|
|
* to continue later. So just pretend everything's dandy and act later. */
|
|
|
|
flacdec->last_flow = ret;
|
2002-06-07 20:09:05 +00:00
|
|
|
|
2002-07-08 19:31:49 +00:00
|
|
|
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_loop (GstPad * sinkpad)
|
2001-12-23 14:15:30 +00:00
|
|
|
{
|
2005-12-09 19:51:03 +00:00
|
|
|
GstFlacDec *flacdec;
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
FLAC__SeekableStreamDecoderState s;
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
flacdec = GST_FLAC_DEC (GST_OBJECT_PARENT (sinkpad));
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "entering loop");
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (flacdec->init) {
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "initializing decoder");
|
2005-10-02 15:33:14 +00:00
|
|
|
s = FLAC__seekable_stream_decoder_init (flacdec->decoder);
|
|
|
|
if (s != FLAC__SEEKABLE_STREAM_DECODER_OK)
|
|
|
|
goto analyze_state;
|
2004-03-14 22:34:33 +00:00
|
|
|
/* FLAC__seekable_stream_decoder_process_metadata (flacdec->decoder); */
|
2002-06-07 20:09:05 +00:00
|
|
|
flacdec->init = FALSE;
|
|
|
|
}
|
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
flacdec->last_flow = GST_FLOW_OK;
|
2002-06-07 20:09:05 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "processing single");
|
2005-10-02 15:33:14 +00:00
|
|
|
FLAC__seekable_stream_decoder_process_single (flacdec->decoder);
|
|
|
|
|
|
|
|
analyze_state:
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "done processing, checking encoder state");
|
2005-10-02 15:33:14 +00:00
|
|
|
s = FLAC__seekable_stream_decoder_get_state (flacdec->decoder);
|
|
|
|
switch (s) {
|
|
|
|
case FLAC__SEEKABLE_STREAM_DECODER_OK:
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
case FLAC__SEEKABLE_STREAM_DECODER_SEEKING:{
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "everything ok");
|
|
|
|
|
|
|
|
if (flacdec->last_flow != GST_FLOW_OK &&
|
|
|
|
flacdec->last_flow != GST_FLOW_NOT_LINKED) {
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "last_flow return was %s, pausing",
|
|
|
|
gst_flow_get_name (flacdec->last_flow));
|
|
|
|
gst_pad_pause_task (sinkpad);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: support segment seeks
|
|
|
|
if (((flacdec->segment.flags & GST_SEEK_FLAG_SEGMENT) != 0) &&
|
|
|
|
flacdec->segment.last_stop > 0 && flacdec->segment.stop != -1 &&
|
|
|
|
flacdec->segment.last_stop >= flacdec->segment.stop) {
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "reached the end of the configured"
|
|
|
|
" segment, posting SEGMENT_DONE message and pausing");
|
|
|
|
gst_pad_pause_task (sinkpad);
|
|
|
|
gst_element_post_message (GST_ELEMENT (flacdec),
|
|
|
|
gst_message_new_segment_done (GST_OBJECT (flacdec),
|
|
|
|
GST_FORMAT_DEFAULT, flacdec->segment.stop));
|
|
|
|
}
|
|
|
|
*/
|
2005-10-02 15:33:14 +00:00
|
|
|
return;
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
}
|
2005-10-02 15:33:14 +00:00
|
|
|
|
|
|
|
case FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM:{
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "EOS, pushing downstream");
|
2005-10-02 15:33:14 +00:00
|
|
|
FLAC__seekable_stream_decoder_reset (flacdec->decoder);
|
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gst_pad_push_event (flacdec->srcpad, gst_event_new_eos ());
|
2005-10-02 15:33:14 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "pausing");
|
2005-10-02 15:33:14 +00:00
|
|
|
gst_pad_pause_task (sinkpad);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
|
|
|
|
case FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR:
|
|
|
|
case FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR:
|
|
|
|
case FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR:
|
|
|
|
case FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED:
|
|
|
|
case FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK:
|
|
|
|
case FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED:
|
|
|
|
default:{
|
|
|
|
/* fixme: this error sucks -- should try to figure out when/if an more
|
|
|
|
specific error was already sent via the callback */
|
|
|
|
GST_ELEMENT_ERROR (flacdec, STREAM, DECODE, (NULL),
|
|
|
|
("%s", FLAC__SeekableStreamDecoderStateString[s]));
|
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gst_pad_push_event (flacdec->srcpad, gst_event_new_eos ());
|
2005-10-02 15:33:14 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "pausing");
|
2005-10-02 15:33:14 +00:00
|
|
|
gst_pad_pause_task (sinkpad);
|
|
|
|
return;
|
|
|
|
}
|
2002-06-07 20:09:05 +00:00
|
|
|
}
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
}
|
2004-02-04 19:28:51 +00:00
|
|
|
|
2002-06-07 20:09:05 +00:00
|
|
|
static gboolean
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value,
|
2004-03-14 22:34:33 +00:00
|
|
|
GstFormat * dest_format, gint64 * dest_value)
|
2002-06-07 20:09:05 +00:00
|
|
|
{
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GstFlacDec *flacdec = GST_FLAC_DEC (GST_PAD_PARENT (pad));
|
2002-06-07 20:09:05 +00:00
|
|
|
gboolean res = TRUE;
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
guint bytes_per_sample;
|
2002-06-07 20:09:05 +00:00
|
|
|
guint scale = 1;
|
|
|
|
|
2006-01-02 19:38:32 +00:00
|
|
|
if (flacdec->width == 0 || flacdec->channels == 0 ||
|
|
|
|
flacdec->sample_rate == 0) {
|
|
|
|
/* no frame decoded yet */
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "cannot convert: not set up yet");
|
|
|
|
return FALSE;
|
|
|
|
}
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
|
|
|
bytes_per_sample = flacdec->channels * (flacdec->width / 8);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
|
|
|
switch (src_format) {
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
case GST_FORMAT_BYTES:{
|
2002-06-07 20:09:05 +00:00
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case GST_FORMAT_DEFAULT:
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
*dest_value =
|
|
|
|
gst_util_uint64_scale_int (src_value, 1, bytes_per_sample);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
{
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gint byterate = bytes_per_sample * flacdec->sample_rate;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
*dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
|
|
|
|
byterate);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
2002-06-07 20:09:05 +00:00
|
|
|
}
|
|
|
|
break;
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
}
|
2003-05-24 10:41:21 +00:00
|
|
|
case GST_FORMAT_DEFAULT:
|
2002-06-07 20:09:05 +00:00
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
*dest_value = src_value * bytes_per_sample;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
*dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
|
|
|
|
flacdec->sample_rate);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
2002-06-07 20:09:05 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
scale = bytes_per_sample;
|
|
|
|
case GST_FORMAT_DEFAULT:
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
*dest_value = gst_util_uint64_scale_int (src_value,
|
|
|
|
scale * flacdec->sample_rate, GST_SECOND);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
2002-06-07 20:09:05 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2004-02-04 19:28:51 +00:00
|
|
|
static const GstQueryType *
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_get_src_query_types (GstPad * pad)
|
2004-03-14 22:34:33 +00:00
|
|
|
{
|
2004-02-04 19:28:51 +00:00
|
|
|
static const GstQueryType types[] = {
|
|
|
|
GST_QUERY_POSITION,
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GST_QUERY_DURATION,
|
2004-02-04 19:28:51 +00:00
|
|
|
0,
|
|
|
|
};
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2004-02-04 19:28:51 +00:00
|
|
|
return types;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2002-07-25 18:12:46 +00:00
|
|
|
|
2002-06-07 20:09:05 +00:00
|
|
|
static gboolean
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_src_query (GstPad * pad, GstQuery * query)
|
2002-06-07 20:09:05 +00:00
|
|
|
{
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GstFlacDec *flacdec;
|
2002-06-07 20:09:05 +00:00
|
|
|
gboolean res = TRUE;
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GstPad *peer;
|
|
|
|
|
|
|
|
flacdec = GST_FLAC_DEC (gst_pad_get_parent (pad));
|
|
|
|
peer = gst_pad_get_peer (flacdec->sinkpad);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_POSITION:{
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GstFormat fmt;
|
2005-10-19 15:57:04 +00:00
|
|
|
gint64 pos;
|
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gst_query_parse_position (query, &fmt, NULL);
|
2005-10-19 15:57:04 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
if (fmt != GST_FORMAT_DEFAULT) {
|
|
|
|
if (!gst_flac_dec_convert_src (flacdec->srcpad, GST_FORMAT_DEFAULT,
|
|
|
|
flacdec->segment.last_stop, &fmt, &pos)) {
|
2006-01-02 19:38:32 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "failed to convert position into %s "
|
|
|
|
"format", gst_format_get_name (fmt));
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
res = FALSE;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
pos = flacdec->segment.last_stop;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_query_set_position (query, fmt, pos);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "returning position %" G_GUINT64_FORMAT
|
|
|
|
" (format: %s)", pos, gst_format_get_name (fmt));
|
|
|
|
|
|
|
|
res = TRUE;
|
2005-10-19 15:57:04 +00:00
|
|
|
break;
|
|
|
|
}
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
2005-10-19 15:57:04 +00:00
|
|
|
case GST_QUERY_DURATION:{
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GstFormat fmt;
|
2005-10-19 15:57:04 +00:00
|
|
|
gint64 len;
|
2002-06-07 20:09:05 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gst_query_parse_duration (query, &fmt, NULL);
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
/* try any demuxers before us first */
|
|
|
|
if (fmt == GST_FORMAT_TIME && peer && gst_pad_query (peer, query)) {
|
|
|
|
gst_query_parse_duration (query, NULL, &len);
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "peer returned duration %" GST_TIME_FORMAT,
|
|
|
|
len);
|
|
|
|
res = TRUE;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flacdec->segment.duration == 0 || flacdec->segment.duration == -1) {
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "duration not known yet");
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
res = FALSE;
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* convert total number of samples to request format */
|
|
|
|
if (fmt != GST_FORMAT_DEFAULT) {
|
|
|
|
if (!gst_flac_dec_convert_src (flacdec->srcpad, GST_FORMAT_DEFAULT,
|
|
|
|
flacdec->segment.duration, &fmt, &len)) {
|
2006-01-02 19:38:32 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "failed to convert duration into %s "
|
|
|
|
"format", gst_format_get_name (fmt));
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
res = FALSE;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
len = flacdec->segment.duration;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_query_set_duration (query, fmt, len);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "returning duration %" G_GUINT64_FORMAT
|
|
|
|
" (format: %s)", len, gst_format_get_name (fmt));
|
|
|
|
|
|
|
|
res = TRUE;
|
2002-06-07 20:09:05 +00:00
|
|
|
break;
|
|
|
|
}
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
|
|
|
case GST_QUERY_CONVERT:{
|
|
|
|
GstFormat src_fmt, dest_fmt;
|
|
|
|
gint64 src_val, dest_val;
|
|
|
|
|
|
|
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
|
|
|
|
|
|
|
|
res = gst_flac_dec_convert_src (pad, src_fmt, src_val, &dest_fmt,
|
|
|
|
&dest_val);
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:{
|
2006-02-06 12:18:45 +00:00
|
|
|
res = gst_pad_query_default (pad, query);
|
2002-06-07 20:09:05 +00:00
|
|
|
break;
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
}
|
2002-06-07 20:09:05 +00:00
|
|
|
}
|
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
done:
|
|
|
|
|
|
|
|
if (peer)
|
|
|
|
gst_object_unref (peer);
|
|
|
|
|
|
|
|
gst_object_unref (flacdec);
|
|
|
|
|
2002-06-07 20:09:05 +00:00
|
|
|
return res;
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
static void
|
|
|
|
gst_flac_dec_send_newsegment (GstFlacDec * flacdec, gboolean update)
|
|
|
|
{
|
|
|
|
GstSegment *s = &flacdec->segment;
|
|
|
|
GstFormat target_format = GST_FORMAT_TIME;
|
|
|
|
gint64 stop_time = GST_CLOCK_TIME_NONE;
|
|
|
|
gint64 start_time = 0;
|
|
|
|
|
|
|
|
/* segment is in DEFAULT format, but we want to send a TIME newsegment */
|
|
|
|
if (!gst_flac_dec_convert_src (flacdec->srcpad, GST_FORMAT_DEFAULT,
|
|
|
|
s->start, &target_format, &start_time)) {
|
|
|
|
GST_WARNING_OBJECT (flacdec, "failed to convert segment start %lld to TIME",
|
|
|
|
s->start);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->stop != -1 && !gst_flac_dec_convert_src (flacdec->srcpad,
|
|
|
|
GST_FORMAT_DEFAULT, s->stop, &target_format, &stop_time)) {
|
|
|
|
GST_WARNING_OBJECT (flacdec, "failed to convert segment stop to TIME");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "sending newsegment from %" GST_TIME_FORMAT
|
|
|
|
" to %" GST_TIME_FORMAT, GST_TIME_ARGS (start_time),
|
|
|
|
GST_TIME_ARGS (stop_time));
|
|
|
|
|
|
|
|
gst_pad_push_event (flacdec->srcpad,
|
|
|
|
gst_event_new_new_segment (update, s->rate, GST_FORMAT_TIME,
|
|
|
|
start_time, stop_time, start_time));
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_flac_dec_handle_seek_event (GstFlacDec * flacdec, GstEvent * event)
|
|
|
|
{
|
|
|
|
FLAC__bool seek_ok;
|
|
|
|
GstSeekFlags seek_flags;
|
|
|
|
GstSeekType start_type;
|
|
|
|
GstSeekType stop_type;
|
|
|
|
GstSegment segment;
|
|
|
|
GstFormat seek_format;
|
|
|
|
gboolean only_update = FALSE;
|
|
|
|
gboolean flush;
|
|
|
|
gdouble rate;
|
|
|
|
gint64 start;
|
|
|
|
gint64 stop;
|
|
|
|
|
|
|
|
gst_event_parse_seek (event, &rate, &seek_format, &seek_flags, &start_type,
|
|
|
|
&start, &stop_type, &stop);
|
|
|
|
|
|
|
|
if (seek_format != GST_FORMAT_DEFAULT && seek_format != GST_FORMAT_TIME) {
|
|
|
|
GST_DEBUG ("seeking is only supported in TIME or DEFAULT format");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rate < 0.0) {
|
|
|
|
GST_DEBUG ("only forward playback supported, rate %f not allowed", rate);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (seek_format != GST_FORMAT_DEFAULT) {
|
|
|
|
GstFormat target_format = GST_FORMAT_DEFAULT;
|
|
|
|
|
|
|
|
if (start_type != GST_SEEK_TYPE_NONE &&
|
|
|
|
!gst_flac_dec_convert_src (flacdec->srcpad, seek_format, start,
|
|
|
|
&target_format, &start)) {
|
|
|
|
GST_DEBUG ("failed to convert start to DEFAULT format");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stop_type != GST_SEEK_TYPE_NONE &&
|
|
|
|
!gst_flac_dec_convert_src (flacdec->srcpad, seek_format, stop,
|
|
|
|
&target_format, &stop)) {
|
|
|
|
GST_DEBUG ("failed to convert stop to DEFAULT format");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
flush = ((seek_flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH);
|
|
|
|
|
|
|
|
if (flush) {
|
|
|
|
gst_pad_push_event (flacdec->srcpad, gst_event_new_flush_start ());
|
|
|
|
} else {
|
|
|
|
gst_pad_stop_task (flacdec->sinkpad);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_PAD_STREAM_LOCK (flacdec->sinkpad);
|
|
|
|
|
2006-03-24 19:41:03 +00:00
|
|
|
/* operate on segment copy until we know the seek worked */
|
|
|
|
segment = flacdec->segment;
|
|
|
|
|
|
|
|
gst_segment_set_seek (&segment, rate, GST_FORMAT_DEFAULT,
|
|
|
|
seek_flags, start_type, start, stop_type, stop, &only_update);
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("configured segment: [%" G_GINT64_FORMAT "-%" G_GINT64_FORMAT
|
|
|
|
"] = [%" GST_TIME_FORMAT "-%" GST_TIME_FORMAT "]",
|
|
|
|
segment.start, segment.stop,
|
|
|
|
GST_TIME_ARGS (segment.start * GST_SECOND / flacdec->sample_rate),
|
|
|
|
GST_TIME_ARGS (segment.stop * GST_SECOND / flacdec->sample_rate));
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "performing seek to sample %" G_GINT64_FORMAT,
|
|
|
|
segment.start);
|
|
|
|
|
|
|
|
flacdec->seeking = TRUE;
|
|
|
|
|
|
|
|
seek_ok = FLAC__seekable_stream_decoder_seek_absolute (flacdec->decoder,
|
|
|
|
segment.start);
|
|
|
|
|
|
|
|
flacdec->seeking = FALSE;
|
|
|
|
|
2006-03-24 19:41:03 +00:00
|
|
|
/* FIXME: support segment seeks */
|
|
|
|
if (flush) {
|
|
|
|
gst_pad_push_event (flacdec->srcpad, gst_event_new_flush_stop ());
|
|
|
|
}
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
|
|
|
if (seek_ok) {
|
|
|
|
flacdec->segment = segment;
|
|
|
|
gst_flac_dec_send_newsegment (flacdec, FALSE);
|
|
|
|
flacdec->segment.last_stop = segment.start;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "seek successful");
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (flacdec, "seek failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_pad_start_task (flacdec->sinkpad,
|
|
|
|
(GstTaskFunction) gst_flac_dec_loop, flacdec->sinkpad);
|
|
|
|
|
2006-03-24 19:41:03 +00:00
|
|
|
GST_PAD_STREAM_UNLOCK (flacdec->sinkpad);
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2002-06-07 20:09:05 +00:00
|
|
|
static gboolean
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_src_event (GstPad * pad, GstEvent * event)
|
2004-03-14 22:34:33 +00:00
|
|
|
{
|
2002-06-07 20:09:05 +00:00
|
|
|
gboolean res = TRUE;
|
2005-12-09 19:51:03 +00:00
|
|
|
GstFlacDec *flacdec = GST_FLAC_DEC (gst_pad_get_parent (pad));
|
2002-06-07 20:09:05 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
case GST_EVENT_SEEK:{
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
/* first, see if we're before a demuxer that
|
|
|
|
* might handle the seek for us */
|
|
|
|
gst_event_ref (event);
|
|
|
|
res = gst_pad_event_default (pad, event);
|
|
|
|
/* if not, try to handle it ourselves */
|
|
|
|
if (!res) {
|
|
|
|
res = gst_flac_dec_handle_seek_event (flacdec, event);
|
|
|
|
}
|
|
|
|
gst_event_unref (event);
|
2002-06-07 20:09:05 +00:00
|
|
|
break;
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
}
|
2002-06-07 20:09:05 +00:00
|
|
|
default:
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
res = gst_pad_event_default (pad, event);
|
2002-06-07 20:09:05 +00:00
|
|
|
break;
|
|
|
|
}
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
|
|
|
|
gst_object_unref (flacdec);
|
|
|
|
|
2002-06-07 20:09:05 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
static gboolean
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_sink_activate (GstPad * sinkpad)
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
{
|
|
|
|
if (gst_pad_check_pull_range (sinkpad))
|
|
|
|
return gst_pad_activate_pull (sinkpad, TRUE);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_sink_activate_pull (GstPad * sinkpad, gboolean active)
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
{
|
|
|
|
if (active) {
|
|
|
|
/* if we have a scheduler we can start the task */
|
2005-12-09 19:51:03 +00:00
|
|
|
GST_FLAC_DEC (GST_OBJECT_PARENT (sinkpad))->offset = 0;
|
|
|
|
return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_flac_dec_loop,
|
2005-10-02 23:08:35 +00:00
|
|
|
sinkpad);
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
} else {
|
2005-10-02 23:08:35 +00:00
|
|
|
return gst_pad_stop_task (sinkpad);
|
Port flacdec (seeking is still slow'ish).
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/flac/Makefile.am:
* ext/flac/gstflac.c: (plugin_init):
* ext/flac/gstflacdec.c: (flacdec_get_type), (gst_flacdec_init),
(gst_flacdec_update_metadata), (gst_flacdec_seek),
(gst_flacdec_tell), (gst_flacdec_length), (gst_flacdec_read),
(gst_flacdec_write), (gst_flacdec_loop),
(gst_flacdec_get_src_query_types), (gst_flacdec_src_query),
(gst_flacdec_src_event), (gst_flacdec_sink_activate),
(gst_flacdec_sink_activate_pull), (gst_flacdec_change_state):
* ext/flac/gstflacdec.h:
Port flacdec (seeking is still slow'ish).
2005-08-22 11:20:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
static GstStateChangeReturn
|
2005-12-09 19:51:03 +00:00
|
|
|
gst_flac_dec_change_state (GstElement * element, GstStateChange transition)
|
2002-06-07 20:09:05 +00:00
|
|
|
{
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
2005-12-09 19:51:03 +00:00
|
|
|
GstFlacDec *flacdec = GST_FLAC_DEC (element);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
flacdec->segment.last_stop = 0;
|
|
|
|
flacdec->need_newsegment = TRUE;
|
|
|
|
flacdec->seeking = FALSE;
|
2006-01-02 19:38:32 +00:00
|
|
|
flacdec->channels = 0;
|
|
|
|
flacdec->depth = 0;
|
|
|
|
flacdec->width = 0;
|
|
|
|
flacdec->sample_rate = 0;
|
2003-11-22 13:17:51 +00:00
|
|
|
if (flacdec->init == FALSE) {
|
2004-03-15 19:32:27 +00:00
|
|
|
FLAC__seekable_stream_decoder_reset (flacdec->decoder);
|
2003-11-22 13:17:51 +00:00
|
|
|
}
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
gst_segment_init (&flacdec->segment, GST_FORMAT_DEFAULT);
|
2002-06-07 20:09:05 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
|
|
|
gst_segment_init (&flacdec->segment, GST_FORMAT_UNDEFINED);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2002-06-07 20:09:05 +00:00
|
|
|
|
ext/flac/gstflacdec.*: Rewrite flacdec a bit, so that even seeking might work now. Most importantly, don't act upon a...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_base_init),
(gst_flac_dec_class_init), (gst_flac_dec_init),
(gst_flac_dec_metadata_callback), (gst_flac_dec_error_callback),
(gst_flac_dec_eof), (gst_flac_dec_write), (gst_flac_dec_loop),
(gst_flac_dec_convert_src), (gst_flac_dec_get_src_query_types),
(gst_flac_dec_src_query), (gst_flac_dec_send_newsegment),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_src_event),
(gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Rewrite flacdec a bit, so that even seeking might work now. Most
importantly, don't act upon any flow return values we get, just tell
the decoder everything's dandy and act on the flow return values
later on in the loop function. We don't want to mess up the internal
decoder state for non-fatal things like flushing pads etc. Other
than that, use GstSegment (segment seeks don't work yet though, but
should be easy to add), use boilerplate macros, drop the superfluous
'flacdec:' from debug messages, use gst_util_uint64_scale_int, and
lots of other things.
2005-12-10 20:26:33 +00:00
|
|
|
return ret;
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|