2001-12-23 14:15:30 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
* Copyright (C) <2006> Tim-Philipp Müller <tim centricular net>
|
|
|
|
* Copyright (C) <2006> Jan Schmidt <thaytan at mad scientist com>
|
2001-12-23 14:15:30 +00:00
|
|
|
*
|
|
|
|
* 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
|
2009-01-28 15:46:06 +00:00
|
|
|
* @see_also: #GstFlacEnc
|
2005-11-25 22:14:47 +00:00
|
|
|
*
|
|
|
|
* flacdec decodes FLAC streams.
|
|
|
|
* <ulink url="http://flac.sourceforge.net/">FLAC</ulink>
|
|
|
|
* is a Free Lossless Audio Codec.
|
2009-01-28 15:46:06 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
2005-11-25 22:14:47 +00:00
|
|
|
* <title>Example launch line</title>
|
2009-01-28 15:46:06 +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-launch filesrc location=media/small/dark.441-16-s.flac ! flacdec ! audioconvert ! audioresample ! autoaudiosink
|
2009-01-28 15:46:06 +00:00
|
|
|
* ]|
|
|
|
|
* |[
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
* gst-launch gnomevfssrc location=http://gstreamer.freedesktop.org/media/small/dark.441-16-s.flac ! flacdec ! audioconvert ! audioresample ! queue min-threshold-buffers=10 ! autoaudiosink
|
2009-01-28 15:46:06 +00:00
|
|
|
* ]|
|
2005-11-25 22:14:47 +00:00
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
/* TODO: add seeking when operating chain-based with unframed input */
|
2010-01-06 13:06:14 +00:00
|
|
|
/* FIXME: demote/remove granulepos handling and make more time-centric */
|
2005-11-25 22:14:47 +00:00
|
|
|
|
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"
|
2007-05-02 17:08:09 +00:00
|
|
|
#include <gst/gst-i18n-plugin.h>
|
2005-09-07 13:49:37 +00:00
|
|
|
#include <gst/gsttagsetter.h>
|
2008-01-03 12:26:03 +00:00
|
|
|
#include <gst/base/gsttypefindhelper.h>
|
2008-05-25 16:09:39 +00:00
|
|
|
#include <gst/audio/multichannel.h>
|
2005-10-02 15:33:14 +00:00
|
|
|
#include <gst/tag/tag.h>
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2008-05-25 16:09:39 +00:00
|
|
|
/* Taken from http://flac.sourceforge.net/format.html#frame_header */
|
|
|
|
static const GstAudioChannelPosition channel_positions[8][8] = {
|
|
|
|
{GST_AUDIO_CHANNEL_POSITION_FRONT_MONO},
|
|
|
|
{GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, {
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}, {
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, {
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, {
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT},
|
|
|
|
/* FIXME: 7/8 channel layouts are not defined in the FLAC specs */
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, {
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
static void gst_flac_dec_finalize (GObject * object);
|
|
|
|
static void gst_flac_dec_loop (GstPad * pad);
|
2008-06-04 08:54:09 +00:00
|
|
|
|
2005-12-09 19:51:03 +00:00
|
|
|
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);
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
static const GstQueryType *gst_flac_dec_get_sink_query_types (GstPad * pad);
|
|
|
|
static gboolean gst_flac_dec_sink_query (GstPad * pad, GstQuery * query);
|
2005-12-09 19:51:03 +00:00
|
|
|
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/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
static gboolean gst_flac_dec_sink_activate_push (GstPad * sinkpad,
|
|
|
|
gboolean active);
|
|
|
|
static gboolean gst_flac_dec_sink_event (GstPad * pad, GstEvent * event);
|
|
|
|
static GstFlowReturn gst_flac_dec_chain (GstPad * pad, GstBuffer * buf);
|
2008-06-04 08:54:09 +00:00
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
static void gst_flac_dec_reset_decoders (GstFlacDec * flacdec);
|
2009-12-23 16:50:34 +00:00
|
|
|
static void gst_flac_dec_setup_decoder (GstFlacDec * flacdec);
|
|
|
|
static void gst_flac_dec_setup_decoder (GstFlacDec * flacdec);
|
2001-12-23 14:15:30 +00:00
|
|
|
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
static FLAC__StreamDecoderReadStatus
|
|
|
|
gst_flac_dec_read_seekable (const FLAC__StreamDecoder * decoder,
|
|
|
|
FLAC__byte buffer[], size_t * bytes, void *client_data);
|
|
|
|
static FLAC__StreamDecoderReadStatus
|
|
|
|
gst_flac_dec_read_stream (const FLAC__StreamDecoder * decoder,
|
|
|
|
FLAC__byte buffer[], size_t * bytes, void *client_data);
|
|
|
|
static FLAC__StreamDecoderSeekStatus
|
|
|
|
gst_flac_dec_seek (const FLAC__StreamDecoder * decoder,
|
|
|
|
FLAC__uint64 position, void *client_data);
|
|
|
|
static FLAC__StreamDecoderTellStatus
|
|
|
|
gst_flac_dec_tell (const FLAC__StreamDecoder * decoder,
|
|
|
|
FLAC__uint64 * position, void *client_data);
|
|
|
|
static FLAC__StreamDecoderLengthStatus
|
|
|
|
gst_flac_dec_length (const FLAC__StreamDecoder * decoder,
|
|
|
|
FLAC__uint64 * length, void *client_data);
|
|
|
|
static FLAC__bool gst_flac_dec_eof (const FLAC__StreamDecoder * decoder,
|
|
|
|
void *client_data);
|
|
|
|
static FLAC__StreamDecoderWriteStatus
|
|
|
|
gst_flac_dec_write_stream (const FLAC__StreamDecoder * decoder,
|
|
|
|
const FLAC__Frame * frame,
|
|
|
|
const FLAC__int32 * const buffer[], void *client_data);
|
2009-08-01 15:48:36 +00:00
|
|
|
static void gst_flac_dec_metadata_cb (const FLAC__StreamDecoder *
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
decoder, const FLAC__StreamMetadata * metadata, void *client_data);
|
2009-08-01 15:48:36 +00:00
|
|
|
static void gst_flac_dec_error_cb (const FLAC__StreamDecoder *
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
2001-12-23 14:15:30 +00:00
|
|
|
|
2006-05-06 00:14:09 +00:00
|
|
|
GST_BOILERPLATE (GstFlacDec, gst_flac_dec, GstElement, GST_TYPE_ELEMENT);
|
2008-08-07 14:40:13 +00:00
|
|
|
|
|
|
|
/* FIXME 0.11: Use width=32 for all depths and let audioconvert
|
|
|
|
* handle the conversions instead of doing it ourself.
|
|
|
|
*/
|
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
|
|
|
#define GST_FLAC_DEC_SRC_CAPS \
|
|
|
|
"audio/x-raw-int, " \
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
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
|
|
|
"signed = (boolean) true, " \
|
|
|
|
"width = (int) { 8, 16, 32 }, " \
|
2008-08-03 11:38:22 +00:00
|
|
|
"depth = (int) [ 4, 32 ], " \
|
|
|
|
"rate = (int) [ 1, 655350 ], " \
|
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
|
|
|
"channels = (int) [ 1, 8 ]"
|
2008-12-13 15:34:01 +00:00
|
|
|
|
|
|
|
static GstStaticPadTemplate flac_dec_src_factory =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS (GST_FLAC_DEC_SRC_CAPS));
|
|
|
|
static GstStaticPadTemplate flac_dec_sink_factory =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-flac")
|
|
|
|
);
|
|
|
|
|
2006-05-06 00:14:09 +00:00
|
|
|
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);
|
2008-06-04 08:54:09 +00:00
|
|
|
|
2008-12-13 15:34:01 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&flac_dec_src_factory));
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&flac_dec_sink_factory));
|
2008-08-06 15:34:55 +00:00
|
|
|
gst_element_class_set_details_simple (element_class, "FLAC audio decoder",
|
|
|
|
"Codec/Decoder/Audio",
|
|
|
|
"Decodes FLAC lossless audio streams", "Wim Taymans <wim@fluendo.com>");
|
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
|
|
|
{
|
2008-12-13 15:34:01 +00:00
|
|
|
flacdec->sinkpad =
|
|
|
|
gst_pad_new_from_static_template (&flac_dec_sink_factory, "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));
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
gst_pad_set_activatepush_function (flacdec->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_flac_dec_sink_activate_push));
|
|
|
|
gst_pad_set_query_type_function (flacdec->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_flac_dec_get_sink_query_types));
|
|
|
|
gst_pad_set_query_function (flacdec->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_flac_dec_sink_query));
|
|
|
|
gst_pad_set_event_function (flacdec->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_flac_dec_sink_event));
|
|
|
|
gst_pad_set_chain_function (flacdec->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_flac_dec_chain));
|
2001-12-23 14:15:30 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (flacdec), flacdec->sinkpad);
|
|
|
|
|
2008-12-13 15:34:01 +00:00
|
|
|
flacdec->srcpad =
|
|
|
|
gst_pad_new_from_static_template (&flac_dec_src_factory, "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
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
gst_flac_dec_reset_decoders (flacdec);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_flac_dec_reset_decoders (GstFlacDec * flacdec)
|
|
|
|
{
|
2009-12-23 16:50:34 +00:00
|
|
|
/* Clean up the decoder */
|
|
|
|
if (flacdec->decoder) {
|
|
|
|
FLAC__stream_decoder_delete (flacdec->decoder);
|
|
|
|
flacdec->decoder = NULL;
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flacdec->adapter) {
|
|
|
|
gst_adapter_clear (flacdec->adapter);
|
|
|
|
g_object_unref (flacdec->adapter);
|
|
|
|
flacdec->adapter = NULL;
|
|
|
|
}
|
|
|
|
|
2007-12-18 17:40:34 +00:00
|
|
|
if (flacdec->close_segment) {
|
|
|
|
gst_event_unref (flacdec->close_segment);
|
|
|
|
flacdec->close_segment = NULL;
|
|
|
|
}
|
|
|
|
if (flacdec->start_segment) {
|
|
|
|
gst_event_unref (flacdec->start_segment);
|
|
|
|
flacdec->start_segment = NULL;
|
|
|
|
}
|
|
|
|
if (flacdec->tags) {
|
|
|
|
gst_tag_list_free (flacdec->tags);
|
|
|
|
flacdec->tags = NULL;
|
|
|
|
}
|
2009-03-09 16:14:12 +00:00
|
|
|
if (flacdec->pending) {
|
|
|
|
gst_buffer_unref (flacdec->pending);
|
|
|
|
flacdec->pending = NULL;
|
|
|
|
}
|
2007-12-18 17:40:34 +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
|
|
|
flacdec->segment.last_stop = 0;
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
flacdec->offset = 0;
|
2002-06-07 20:09:05 +00:00
|
|
|
flacdec->init = TRUE;
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-12-23 16:50:34 +00:00
|
|
|
gst_flac_dec_setup_decoder (GstFlacDec * dec)
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
{
|
|
|
|
gst_flac_dec_reset_decoders (dec);
|
|
|
|
|
2008-08-02 17:18:47 +00:00
|
|
|
dec->tags = gst_tag_list_new ();
|
|
|
|
gst_tag_list_add (dec->tags, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_AUDIO_CODEC, "FLAC", NULL);
|
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
dec->adapter = gst_adapter_new ();
|
|
|
|
|
2009-12-23 16:50:34 +00:00
|
|
|
dec->decoder = FLAC__stream_decoder_new ();
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
|
2009-12-23 16:50:34 +00:00
|
|
|
/* no point calculating since it's never checked here */
|
|
|
|
FLAC__stream_decoder_set_md5_checking (dec->decoder, false);
|
|
|
|
FLAC__stream_decoder_set_metadata_respond (dec->decoder,
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
FLAC__METADATA_TYPE_VORBIS_COMMENT);
|
2009-12-23 16:50:34 +00:00
|
|
|
FLAC__stream_decoder_set_metadata_respond (dec->decoder,
|
2008-01-03 12:26:03 +00:00
|
|
|
FLAC__METADATA_TYPE_PICTURE);
|
2002-06-07 20:09:05 +00:00
|
|
|
}
|
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
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
gst_flac_dec_reset_decoders (flacdec);
|
2004-05-07 20:26:46 +00:00
|
|
|
|
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;
|
2006-08-24 10:03:03 +00:00
|
|
|
guint num, i;
|
2003-11-28 13:04:21 +00:00
|
|
|
|
2008-08-02 17:18:47 +00:00
|
|
|
if (flacdec->tags)
|
|
|
|
list = flacdec->tags;
|
|
|
|
else
|
|
|
|
flacdec->tags = list = gst_tag_list_new ();
|
2003-04-27 12:00:41 +00:00
|
|
|
|
2006-08-24 10:03:03 +00:00
|
|
|
num = metadata->data.vorbis_comment.num_comments;
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "%u tag(s) found", num);
|
2006-08-24 10:03:03 +00:00
|
|
|
|
|
|
|
for (i = 0; i < num; ++i) {
|
|
|
|
gchar *vc, *name, *value;
|
|
|
|
|
|
|
|
vc = g_strndup ((gchar *) metadata->data.vorbis_comment.comments[i].entry,
|
|
|
|
metadata->data.vorbis_comment.comments[i].length);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2006-08-24 10:03:03 +00:00
|
|
|
if (gst_tag_parse_extended_comment (vc, &name, NULL, &value, TRUE)) {
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "%s : %s", name, value);
|
2009-07-01 06:40:40 +00:00
|
|
|
if (value && strlen (value))
|
|
|
|
gst_vorbis_tag_add (list, name, value);
|
2003-04-27 12:00:41 +00:00
|
|
|
g_free (name);
|
|
|
|
g_free (value);
|
|
|
|
}
|
2006-08-24 10:03:03 +00:00
|
|
|
|
|
|
|
g_free (vc);
|
2003-04-27 12:00:41 +00:00
|
|
|
}
|
2006-08-24 10:03:03 +00:00
|
|
|
|
2003-04-27 12:00:41 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2006-04-07 18:15:08 +00:00
|
|
|
/* CRC-8, poly = x^8 + x^2 + x^1 + x^0, init = 0 */
|
|
|
|
static const guint8 crc8_table[256] = {
|
|
|
|
0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15,
|
|
|
|
0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D,
|
|
|
|
0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65,
|
|
|
|
0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D,
|
|
|
|
0xE0, 0xE7, 0xEE, 0xE9, 0xFC, 0xFB, 0xF2, 0xF5,
|
|
|
|
0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD,
|
|
|
|
0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85,
|
|
|
|
0xA8, 0xAF, 0xA6, 0xA1, 0xB4, 0xB3, 0xBA, 0xBD,
|
|
|
|
0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2,
|
|
|
|
0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA,
|
|
|
|
0xB7, 0xB0, 0xB9, 0xBE, 0xAB, 0xAC, 0xA5, 0xA2,
|
|
|
|
0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A,
|
|
|
|
0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32,
|
|
|
|
0x1F, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0D, 0x0A,
|
|
|
|
0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42,
|
|
|
|
0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A,
|
|
|
|
0x89, 0x8E, 0x87, 0x80, 0x95, 0x92, 0x9B, 0x9C,
|
|
|
|
0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4,
|
|
|
|
0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC,
|
|
|
|
0xC1, 0xC6, 0xCF, 0xC8, 0xDD, 0xDA, 0xD3, 0xD4,
|
|
|
|
0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C,
|
|
|
|
0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44,
|
|
|
|
0x19, 0x1E, 0x17, 0x10, 0x05, 0x02, 0x0B, 0x0C,
|
|
|
|
0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34,
|
|
|
|
0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B,
|
|
|
|
0x76, 0x71, 0x78, 0x7F, 0x6A, 0x6D, 0x64, 0x63,
|
|
|
|
0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B,
|
|
|
|
0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13,
|
|
|
|
0xAE, 0xA9, 0xA0, 0xA7, 0xB2, 0xB5, 0xBC, 0xBB,
|
|
|
|
0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83,
|
|
|
|
0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB,
|
|
|
|
0xE6, 0xE1, 0xE8, 0xEF, 0xFA, 0xFD, 0xF4, 0xF3
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint8
|
|
|
|
gst_flac_calculate_crc8 (guint8 * data, guint length)
|
|
|
|
{
|
|
|
|
guint8 crc = 0;
|
|
|
|
|
|
|
|
while (length--) {
|
|
|
|
crc = crc8_table[crc ^ *data];
|
|
|
|
++data;
|
|
|
|
}
|
|
|
|
|
|
|
|
return crc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_flac_dec_scan_got_frame (GstFlacDec * flacdec, guint8 * data, guint size,
|
|
|
|
gint64 * last_sample_num)
|
|
|
|
{
|
|
|
|
guint headerlen;
|
|
|
|
guint sr_from_end = 0; /* can be 0, 8 or 16 */
|
|
|
|
guint bs_from_end = 0; /* can be 0, 8 or 16 */
|
|
|
|
guint32 val = 0;
|
|
|
|
guint8 bs, sr, ca, ss, pb;
|
|
|
|
|
|
|
|
if (size < 10)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* sync */
|
|
|
|
if (data[0] != 0xFF || data[1] != 0xF8)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
bs = (data[2] & 0xF0) >> 8; /* blocksize marker */
|
|
|
|
sr = (data[2] & 0x0F); /* samplerate marker */
|
|
|
|
ca = (data[3] & 0xF0) >> 8; /* channel assignment */
|
|
|
|
ss = (data[3] & 0x0F) >> 1; /* sample size marker */
|
|
|
|
pb = (data[3] & 0x01); /* padding bit */
|
|
|
|
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_LOG_OBJECT (flacdec,
|
|
|
|
"got sync, bs=%x,sr=%x,ca=%x,ss=%x,pb=%x", bs, sr, ca, ss, pb);
|
2006-04-07 18:15:08 +00:00
|
|
|
|
|
|
|
if (sr == 0x0F || sr == 0x01 || sr == 0x02 || sr == 0x03 ||
|
|
|
|
ca >= 0x0B || ss == 0x03 || ss == 0x07) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read block size from end of header? */
|
|
|
|
if (bs == 6)
|
|
|
|
bs_from_end = 8;
|
|
|
|
else if (bs == 7)
|
|
|
|
bs_from_end = 16;
|
|
|
|
|
|
|
|
/* read sample rate from end of header? */
|
|
|
|
if (sr == 0x0C)
|
|
|
|
sr_from_end = 8;
|
|
|
|
else if (sr == 0x0D || sr == 0x0E)
|
|
|
|
sr_from_end = 16;
|
|
|
|
|
|
|
|
val = (guint32) g_utf8_get_char_validated ((gchar *) data + 4, -1);
|
|
|
|
|
|
|
|
if (val == (guint32) - 1 || val == (guint32) - 2) {
|
|
|
|
GST_LOG_OBJECT (flacdec, "failed to read sample/frame");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
headerlen = 4 + g_unichar_to_utf8 ((gunichar) val, NULL) +
|
|
|
|
(bs_from_end / 8) + (sr_from_end / 8);
|
|
|
|
|
|
|
|
if (gst_flac_calculate_crc8 (data, headerlen) != data[headerlen])
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (flacdec->min_blocksize == flacdec->max_blocksize) {
|
|
|
|
*last_sample_num = (val + 1) * flacdec->min_blocksize;
|
|
|
|
} else {
|
|
|
|
*last_sample_num = val; /* FIXME: + length of last block in samples */
|
|
|
|
}
|
|
|
|
|
2006-08-22 12:28:24 +00:00
|
|
|
if (flacdec->sample_rate > 0) {
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "last sample %" G_GINT64_FORMAT " = %"
|
|
|
|
GST_TIME_FORMAT, *last_sample_num,
|
|
|
|
GST_TIME_ARGS (*last_sample_num * GST_SECOND / flacdec->sample_rate));
|
|
|
|
}
|
2006-04-07 18:15:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define SCANBLOCK_SIZE (64*1024)
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_flac_dec_scan_for_last_block (GstFlacDec * flacdec, gint64 * samples)
|
|
|
|
{
|
|
|
|
GstFormat format = GST_FORMAT_BYTES;
|
2008-06-04 08:54:09 +00:00
|
|
|
|
2006-04-07 18:15:08 +00:00
|
|
|
gint64 file_size, offset;
|
|
|
|
|
|
|
|
GST_INFO_OBJECT (flacdec, "total number of samples unknown, scanning file");
|
|
|
|
|
|
|
|
if (!gst_pad_query_peer_duration (flacdec->sinkpad, &format, &file_size)) {
|
|
|
|
GST_WARNING_OBJECT (flacdec, "failed to query upstream size!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "upstream size: %" G_GINT64_FORMAT, file_size);
|
|
|
|
|
|
|
|
offset = file_size - 1;
|
|
|
|
while (offset >= MAX (SCANBLOCK_SIZE / 2, file_size / 2)) {
|
|
|
|
GstFlowReturn flow;
|
|
|
|
GstBuffer *buf = NULL;
|
|
|
|
guint8 *data;
|
|
|
|
guint size;
|
|
|
|
|
|
|
|
/* divide by 2 = not very sophisticated way to deal with overlapping */
|
|
|
|
offset -= SCANBLOCK_SIZE / 2;
|
|
|
|
GST_LOG_OBJECT (flacdec, "looking for frame at %" G_GINT64_FORMAT
|
|
|
|
"-%" G_GINT64_FORMAT, offset, offset + SCANBLOCK_SIZE);
|
|
|
|
|
|
|
|
flow = gst_pad_pull_range (flacdec->sinkpad, offset, SCANBLOCK_SIZE, &buf);
|
|
|
|
if (flow != GST_FLOW_OK) {
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "flow = %s", gst_flow_get_name (flow));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
size = GST_BUFFER_SIZE (buf);
|
|
|
|
data = GST_BUFFER_DATA (buf);
|
|
|
|
|
|
|
|
while (size > 16) {
|
|
|
|
if (gst_flac_dec_scan_got_frame (flacdec, data, size, samples)) {
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "frame sync at offset %" G_GINT64_FORMAT,
|
|
|
|
offset + GST_BUFFER_SIZE (buf) - size);
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
++data;
|
|
|
|
--size;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
}
|
2003-04-27 12:00:41 +00:00
|
|
|
|
2008-01-03 12:26:03 +00:00
|
|
|
static void
|
2008-06-04 10:42:46 +00:00
|
|
|
gst_flac_extract_picture_buffer (GstFlacDec * dec,
|
2008-01-03 12:26:03 +00:00
|
|
|
const FLAC__StreamMetadata * metadata)
|
|
|
|
{
|
|
|
|
FLAC__StreamMetadata_Picture picture;
|
2008-06-04 10:42:46 +00:00
|
|
|
GstTagList *tags;
|
2008-01-03 12:26:03 +00:00
|
|
|
|
|
|
|
g_return_if_fail (metadata->type == FLAC__METADATA_TYPE_PICTURE);
|
|
|
|
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_LOG_OBJECT (dec, "Got PICTURE block");
|
2008-01-03 12:26:03 +00:00
|
|
|
picture = metadata->data.picture;
|
|
|
|
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (dec, "declared MIME type is: '%s'",
|
|
|
|
GST_STR_NULL (picture.mime_type));
|
|
|
|
GST_DEBUG_OBJECT (dec, "image data is %u bytes", picture.data_length);
|
2008-01-03 12:26:03 +00:00
|
|
|
|
2008-06-04 10:42:46 +00:00
|
|
|
tags = gst_tag_list_new ();
|
2008-01-03 12:26:03 +00:00
|
|
|
|
2008-06-04 10:42:46 +00:00
|
|
|
gst_tag_list_add_id3_image (tags, (guint8 *) picture.data,
|
|
|
|
picture.data_length, picture.type);
|
2008-01-03 12:26:03 +00:00
|
|
|
|
2008-06-04 10:42:46 +00:00
|
|
|
if (!gst_tag_list_is_empty (tags)) {
|
|
|
|
gst_element_found_tags_for_pad (GST_ELEMENT (dec), dec->srcpad, tags);
|
2008-01-03 12:26:03 +00:00
|
|
|
} else {
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (dec, "problem parsing PICTURE block, skipping");
|
2008-06-04 10:42:46 +00:00
|
|
|
gst_tag_list_free (tags);
|
2008-01-03 12:26:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
2009-08-01 15:48:36 +00:00
|
|
|
gst_flac_dec_metadata_cb (const FLAC__StreamDecoder * decoder,
|
|
|
|
const FLAC__StreamMetadata * metadata, void *client_data)
|
2002-06-07 20:09:05 +00:00
|
|
|
{
|
2009-08-01 15:48:36 +00:00
|
|
|
GstFlacDec *flacdec = GST_FLAC_DEC (client_data);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (flacdec, "metadata type: %d", metadata->type);
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
switch (metadata->type) {
|
2006-04-07 18:15:08 +00:00
|
|
|
case FLAC__METADATA_TYPE_STREAMINFO:{
|
|
|
|
gint64 samples;
|
|
|
|
|
|
|
|
samples = metadata->data.stream_info.total_samples;
|
|
|
|
|
|
|
|
flacdec->min_blocksize = metadata->data.stream_info.min_blocksize;
|
|
|
|
flacdec->max_blocksize = metadata->data.stream_info.max_blocksize;
|
|
|
|
flacdec->sample_rate = metadata->data.stream_info.sample_rate;
|
2008-08-03 11:38:22 +00:00
|
|
|
flacdec->depth = metadata->data.stream_info.bits_per_sample;
|
2006-04-07 18:15:08 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "blocksize: min=%u, max=%u",
|
|
|
|
flacdec->min_blocksize, flacdec->max_blocksize);
|
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
/* Only scan for last block in pull-mode, since it uses pull_range() */
|
2009-12-23 16:50:34 +00:00
|
|
|
if (samples == 0 && !flacdec->streaming) {
|
2006-04-07 18:15:08 +00:00
|
|
|
gst_flac_dec_scan_for_last_block (flacdec, &samples);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "total samples = %" G_GINT64_FORMAT, samples);
|
|
|
|
|
|
|
|
if (samples > 0) {
|
2007-12-14 18:49:34 +00:00
|
|
|
gint64 duration;
|
|
|
|
|
2006-04-07 18:15:08 +00:00
|
|
|
gst_segment_set_duration (&flacdec->segment, GST_FORMAT_DEFAULT,
|
|
|
|
samples);
|
2007-12-14 18:49:34 +00:00
|
|
|
|
|
|
|
/* convert duration to time */
|
|
|
|
duration = gst_util_uint64_scale_int (samples, GST_SECOND,
|
|
|
|
flacdec->sample_rate);
|
|
|
|
|
|
|
|
/* fixme, at this time we could seek to the queued seek event if we have
|
|
|
|
* any */
|
|
|
|
if (flacdec->start_segment)
|
|
|
|
gst_event_unref (flacdec->start_segment);
|
|
|
|
flacdec->start_segment =
|
|
|
|
gst_event_new_new_segment_full (FALSE,
|
|
|
|
flacdec->segment.rate, flacdec->segment.applied_rate,
|
|
|
|
GST_FORMAT_TIME, 0, duration, 0);
|
2006-04-07 18:15:08 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
break;
|
2006-04-07 18:15:08 +00:00
|
|
|
}
|
2008-01-03 12:26:03 +00:00
|
|
|
case FLAC__METADATA_TYPE_PICTURE:{
|
|
|
|
gst_flac_extract_picture_buffer (flacdec, metadata);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
static void
|
2009-08-01 15:48:36 +00:00
|
|
|
gst_flac_dec_error_cb (const FLAC__StreamDecoder * d,
|
|
|
|
FLAC__StreamDecoderErrorStatus status, void *client_data)
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
{
|
|
|
|
const gchar *error;
|
2009-08-01 15:48:36 +00:00
|
|
|
GstFlacDec *dec;
|
|
|
|
|
|
|
|
dec = 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:
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
/* Ignore this error and keep processing */
|
|
|
|
return;
|
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;
|
|
|
|
}
|
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
GST_ELEMENT_ERROR (dec, STREAM, DECODE, (NULL), ("%s (%d)", error, status));
|
|
|
|
dec->last_flow = GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
static FLAC__StreamDecoderSeekStatus
|
|
|
|
gst_flac_dec_seek (const FLAC__StreamDecoder * decoder,
|
|
|
|
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
|
|
|
|
2009-10-09 11:37:32 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "seek %" G_GUINT64_FORMAT, (guint64) 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;
|
|
|
|
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
|
|
|
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
static FLAC__StreamDecoderTellStatus
|
|
|
|
gst_flac_dec_tell (const FLAC__StreamDecoder * decoder,
|
|
|
|
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
|
|
|
|
2009-10-09 10:25:19 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "tell %" G_GINT64_FORMAT, (gint64) * position);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
return FLAC__STREAM_DECODER_TELL_STATUS_OK;
|
2002-06-07 20:09:05 +00:00
|
|
|
}
|
|
|
|
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
static FLAC__StreamDecoderLengthStatus
|
|
|
|
gst_flac_dec_length (const FLAC__StreamDecoder * decoder,
|
|
|
|
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)))
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
|
2009-03-27 21:17:05 +00:00
|
|
|
|
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)
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
|
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
|
|
|
|
|
|
|
*length = len;
|
2002-06-07 20:09:05 +00:00
|
|
|
|
2009-10-09 10:25:19 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "encoded byte length %" G_GINT64_FORMAT,
|
|
|
|
(gint64) * length);
|
2002-06-07 20:09:05 +00:00
|
|
|
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
|
2002-06-07 20:09:05 +00:00
|
|
|
}
|
|
|
|
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
static FLAC__bool
|
|
|
|
gst_flac_dec_eof (const FLAC__StreamDecoder * 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) {
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec,
|
|
|
|
"offset=%" G_GINT64_FORMAT ", len=%" G_GINT64_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
|
|
|
", returning EOF", flacdec->offset, len);
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (peer);
|
|
|
|
|
|
|
|
return ret;
|
2002-06-07 20:09:05 +00:00
|
|
|
}
|
|
|
|
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
static FLAC__StreamDecoderReadStatus
|
|
|
|
gst_flac_dec_read_seekable (const FLAC__StreamDecoder * decoder,
|
|
|
|
FLAC__byte buffer[], size_t * bytes, void *client_data)
|
2002-06-07 20:09:05 +00:00
|
|
|
{
|
2009-07-21 18:46:55 +00:00
|
|
|
GstFlowReturn flow;
|
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
|
|
|
|
2009-07-21 18:46:55 +00:00
|
|
|
flow = gst_pad_pull_range (flacdec->sinkpad, flacdec->offset, *bytes, &buf);
|
|
|
|
|
|
|
|
GST_PAD_STREAM_LOCK (flacdec->sinkpad);
|
|
|
|
flacdec->pull_flow = flow;
|
|
|
|
GST_PAD_STREAM_UNLOCK (flacdec->sinkpad);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (flow != GST_FLOW_OK)) {
|
|
|
|
GST_INFO_OBJECT (flacdec, "pull_range flow: %s", gst_flow_get_name (flow));
|
|
|
|
if (flow == GST_FLOW_UNEXPECTED)
|
|
|
|
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
|
|
|
|
else
|
|
|
|
return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "Read %d bytes at %" G_GUINT64_FORMAT,
|
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_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
|
|
|
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
|
|
|
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
static FLAC__StreamDecoderReadStatus
|
|
|
|
gst_flac_dec_read_stream (const FLAC__StreamDecoder * decoder,
|
|
|
|
FLAC__byte buffer[], size_t * bytes, void *client_data)
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
{
|
|
|
|
GstFlacDec *dec = GST_FLAC_DEC (client_data);
|
|
|
|
guint len;
|
|
|
|
|
|
|
|
len = MIN (gst_adapter_available (dec->adapter), *bytes);
|
|
|
|
|
|
|
|
if (len == 0) {
|
|
|
|
GST_LOG_OBJECT (dec, "0 bytes available at the moment");
|
|
|
|
return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (dec, "feeding %u bytes to decoder (available=%u, bytes=%u)",
|
2008-10-10 12:28:34 +00:00
|
|
|
len, gst_adapter_available (dec->adapter), (guint) * bytes);
|
2009-08-01 14:22:49 +00:00
|
|
|
gst_adapter_copy (dec->adapter, buffer, 0, len);
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
*bytes = len;
|
|
|
|
|
|
|
|
gst_adapter_flush (dec->adapter, len);
|
|
|
|
|
|
|
|
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
|
|
|
|
}
|
|
|
|
|
2001-12-23 14:15:30 +00:00
|
|
|
static FLAC__StreamDecoderWriteStatus
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame,
|
|
|
|
const FLAC__int32 * const buffer[])
|
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;
|
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;
|
2007-12-14 18:49:34 +00:00
|
|
|
GstClockTime next;
|
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
|
|
|
|
2009-03-02 07:41:15 +00:00
|
|
|
GST_LOG_OBJECT (flacdec, "samples in frame header: %d", samples);
|
|
|
|
|
2009-02-21 11:47:00 +00:00
|
|
|
/* if a DEFAULT segment is configured, don't send samples past the end
|
|
|
|
* of the segment */
|
|
|
|
if (flacdec->segment.format == GST_FORMAT_DEFAULT &&
|
|
|
|
flacdec->segment.stop != -1 &&
|
2009-03-03 09:06:52 +00:00
|
|
|
flacdec->segment.last_stop >= 0 &&
|
2009-02-21 11:47:00 +00:00
|
|
|
flacdec->segment.last_stop + samples > flacdec->segment.stop) {
|
|
|
|
samples = flacdec->segment.stop - flacdec->segment.last_stop;
|
|
|
|
GST_DEBUG_OBJECT (flacdec,
|
|
|
|
"clipping last buffer to %d samples because of segment", samples);
|
|
|
|
}
|
|
|
|
|
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;
|
2008-08-03 11:38:22 +00:00
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
if (flacdec->depth < 4 || flacdec->depth > 32) {
|
|
|
|
GST_ERROR_OBJECT (flacdec, "unsupported depth %d from STREAMINFO",
|
|
|
|
flacdec->depth);
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
depth = flacdec->depth;
|
|
|
|
if (depth < 9)
|
|
|
|
width = 8;
|
|
|
|
else if (depth < 17)
|
|
|
|
width = 16;
|
|
|
|
else
|
|
|
|
width = 32;
|
|
|
|
|
2005-12-09 11:12:48 +00:00
|
|
|
break;
|
|
|
|
default:
|
2007-12-29 16:48:33 +00:00
|
|
|
GST_ERROR_OBJECT (flacdec, "unsupported depth %d", depth);
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto done;
|
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;
|
|
|
|
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "Negotiating %d Hz @ %d channels",
|
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
|
|
|
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);
|
|
|
|
|
2008-05-25 16:09:39 +00:00
|
|
|
if (channels > 2) {
|
|
|
|
GstStructure *s = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
gst_audio_set_channel_positions (s, channel_positions[channels - 1]);
|
|
|
|
}
|
|
|
|
|
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;
|
2007-12-18 17:40:34 +00:00
|
|
|
|
|
|
|
gst_pad_set_caps (flacdec->srcpad, caps);
|
|
|
|
gst_caps_unref (caps);
|
2001-12-23 14:15:30 +00:00
|
|
|
}
|
|
|
|
|
2007-12-14 18:49:34 +00:00
|
|
|
if (flacdec->close_segment) {
|
2009-04-18 16:00:54 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "pushing close segment");
|
2007-12-14 18:49:34 +00:00
|
|
|
gst_pad_push_event (flacdec->srcpad, flacdec->close_segment);
|
|
|
|
flacdec->close_segment = NULL;
|
|
|
|
}
|
|
|
|
if (flacdec->start_segment) {
|
2009-04-18 16:00:54 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "pushing start segment");
|
2007-12-14 18:49:34 +00:00
|
|
|
gst_pad_push_event (flacdec->srcpad, flacdec->start_segment);
|
|
|
|
flacdec->start_segment = NULL;
|
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
|
|
|
}
|
|
|
|
|
2007-12-18 17:40:34 +00:00
|
|
|
if (flacdec->tags) {
|
|
|
|
gst_element_found_tags_for_pad (GST_ELEMENT (flacdec), flacdec->srcpad,
|
|
|
|
flacdec->tags);
|
|
|
|
flacdec->tags = NULL;
|
|
|
|
}
|
|
|
|
|
2009-03-09 16:14:12 +00:00
|
|
|
if (flacdec->pending) {
|
|
|
|
GST_DEBUG_OBJECT (flacdec,
|
|
|
|
"pushing pending samples at offset %" G_GINT64_FORMAT " (%"
|
|
|
|
GST_TIME_FORMAT " + %" GST_TIME_FORMAT ")",
|
|
|
|
GST_BUFFER_OFFSET (flacdec->pending),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (flacdec->pending)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (flacdec->pending)));
|
2009-04-20 17:33:09 +00:00
|
|
|
/* Pending buffer was always allocated from the seeking thread,
|
|
|
|
* which means it wasn't gst_buffer_alloc'd. Do so now to let
|
|
|
|
* downstream negotiation work on older basetransform */
|
|
|
|
ret = gst_pad_alloc_buffer_and_set_caps (flacdec->srcpad,
|
|
|
|
GST_BUFFER_OFFSET (flacdec->pending),
|
|
|
|
GST_BUFFER_SIZE (flacdec->pending),
|
|
|
|
GST_BUFFER_CAPS (flacdec->pending), &outbuf);
|
2009-05-08 14:40:57 +00:00
|
|
|
if (ret == GST_FLOW_OK) {
|
|
|
|
gst_pad_push (flacdec->srcpad, flacdec->pending);
|
|
|
|
gst_buffer_unref (outbuf);
|
|
|
|
}
|
2009-04-20 17:33:09 +00:00
|
|
|
|
|
|
|
outbuf = flacdec->pending = NULL;
|
2009-03-31 23:15:31 +00:00
|
|
|
flacdec->segment.last_stop += flacdec->pending_samples;
|
|
|
|
flacdec->pending_samples = 0;
|
2009-03-09 16:14:12 +00:00
|
|
|
}
|
|
|
|
|
2009-04-18 16:00:54 +00:00
|
|
|
if (flacdec->seeking) {
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "a pad_alloc would block here, do normal alloc");
|
|
|
|
outbuf = gst_buffer_new_and_alloc (samples * channels * (width / 8));
|
2009-04-20 17:33:09 +00:00
|
|
|
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (flacdec->srcpad));
|
|
|
|
GST_BUFFER_OFFSET (outbuf) = flacdec->segment.last_stop;
|
2009-04-18 16:00:54 +00:00
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (flacdec, "alloc_buffer_and_set_caps");
|
|
|
|
ret = gst_pad_alloc_buffer_and_set_caps (flacdec->srcpad,
|
|
|
|
flacdec->segment.last_stop, samples * channels * (width / 8),
|
|
|
|
GST_PAD_CAPS (flacdec->srcpad), &outbuf);
|
|
|
|
|
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "gst_pad_alloc_buffer() returned %s",
|
|
|
|
gst_flow_get_name (ret));
|
|
|
|
goto done;
|
|
|
|
}
|
2005-10-02 23:08:35 +00:00
|
|
|
}
|
|
|
|
|
2006-08-22 12:28:24 +00:00
|
|
|
if (flacdec->cur_granulepos != GST_BUFFER_OFFSET_NONE) {
|
|
|
|
/* this should be fine since it should be one flac frame per ogg packet */
|
|
|
|
flacdec->segment.last_stop = flacdec->cur_granulepos - samples;
|
|
|
|
GST_LOG_OBJECT (flacdec, "granulepos = %" G_GINT64_FORMAT ", samples = %u",
|
|
|
|
flacdec->cur_granulepos, samples);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
2007-12-14 18:49:34 +00:00
|
|
|
/* get next timestamp to calculate the duration */
|
|
|
|
next = gst_util_uint64_scale_int (flacdec->segment.last_stop + samples,
|
|
|
|
GST_SECOND, frame->header.sample_rate);
|
|
|
|
|
|
|
|
GST_BUFFER_DURATION (outbuf) = next - GST_BUFFER_TIMESTAMP (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
|
|
|
|
2008-08-03 11:38:22 +00:00
|
|
|
if (width == 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
|
|
|
}
|
2008-08-03 11:38:22 +00:00
|
|
|
} else if (width == 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
|
|
|
}
|
2008-08-03 11:38:22 +00:00
|
|
|
} else if (width == 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) {
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "pushing %d samples at offset %" G_GINT64_FORMAT
|
2006-08-22 12:28:24 +00:00
|
|
|
" (%" GST_TIME_FORMAT " + %" GST_TIME_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
|
|
|
samples, GST_BUFFER_OFFSET (outbuf),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
|
|
|
|
|
2007-12-14 18:49:34 +00:00
|
|
|
if (flacdec->discont) {
|
2009-03-09 16:14:12 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "marking discont");
|
2007-12-14 18:49:34 +00:00
|
|
|
outbuf = gst_buffer_make_metadata_writable (outbuf);
|
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
|
|
|
flacdec->discont = 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
|
|
|
ret = gst_pad_push (flacdec->srcpad, outbuf);
|
2009-03-09 16:14:12 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "returned %s", gst_flow_get_name (ret));
|
2009-03-31 23:15:31 +00:00
|
|
|
flacdec->segment.last_stop += samples;
|
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
|
|
|
} else {
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec,
|
|
|
|
"not pushing %d samples at offset %" G_GINT64_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
|
|
|
" (in seek)", samples, GST_BUFFER_OFFSET (outbuf));
|
2009-03-09 16:14:12 +00:00
|
|
|
gst_buffer_replace (&flacdec->pending, outbuf);
|
2009-05-13 08:18:07 +00:00
|
|
|
gst_buffer_unref (outbuf);
|
2009-03-31 23:15:31 +00:00
|
|
|
flacdec->pending_samples = samples;
|
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_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret != GST_FLOW_OK) {
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "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:
|
|
|
|
|
|
|
|
|
|
|
|
/* 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
|
|
|
}
|
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
static FLAC__StreamDecoderWriteStatus
|
|
|
|
gst_flac_dec_write_stream (const FLAC__StreamDecoder * decoder,
|
|
|
|
const FLAC__Frame * frame,
|
|
|
|
const FLAC__int32 * const buffer[], void *client_data)
|
|
|
|
{
|
|
|
|
return gst_flac_dec_write (GST_FLAC_DEC (client_data), frame, buffer);
|
|
|
|
}
|
|
|
|
|
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;
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
FLAC__StreamDecoderState s;
|
|
|
|
FLAC__StreamDecoderInitStatus is;
|
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
|
|
|
|
2006-04-20 14:21:42 +00:00
|
|
|
GST_LOG_OBJECT (flacdec, "entering loop");
|
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
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (flacdec->init) {
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "initializing new decoder");
|
2009-12-23 16:50:34 +00:00
|
|
|
is = FLAC__stream_decoder_init_stream (flacdec->decoder,
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
gst_flac_dec_read_seekable, gst_flac_dec_seek, gst_flac_dec_tell,
|
|
|
|
gst_flac_dec_length, gst_flac_dec_eof, gst_flac_dec_write_stream,
|
2009-08-01 15:48:36 +00:00
|
|
|
gst_flac_dec_metadata_cb, gst_flac_dec_error_cb, flacdec);
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
if (is != FLAC__STREAM_DECODER_INIT_STATUS_OK)
|
|
|
|
goto analyze_state;
|
2009-03-27 21:17:05 +00:00
|
|
|
|
2009-12-23 16:50:34 +00:00
|
|
|
/* FLAC__seekable_decoder_process_metadata (flacdec->decoder); */
|
2002-06-07 20:09:05 +00:00
|
|
|
flacdec->init = FALSE;
|
|
|
|
}
|
|
|
|
|
2006-08-22 12:28:24 +00:00
|
|
|
flacdec->cur_granulepos = GST_BUFFER_OFFSET_NONE;
|
|
|
|
|
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
|
|
|
|
2006-04-20 14:21:42 +00:00
|
|
|
GST_LOG_OBJECT (flacdec, "processing single");
|
2009-12-23 16:50:34 +00:00
|
|
|
FLAC__stream_decoder_process_single (flacdec->decoder);
|
2009-03-27 21:17:05 +00:00
|
|
|
|
2005-10-02 15:33:14 +00:00
|
|
|
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
|
|
|
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_LOG_OBJECT (flacdec, "done processing, checking encoder state");
|
2009-12-23 16:50:34 +00:00
|
|
|
s = FLAC__stream_decoder_get_state (flacdec->decoder);
|
2005-10-02 15:33:14 +00:00
|
|
|
switch (s) {
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
|
|
|
|
case FLAC__STREAM_DECODER_READ_METADATA:
|
|
|
|
case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
|
|
|
|
case FLAC__STREAM_DECODER_READ_FRAME:
|
|
|
|
{
|
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, "everything ok");
|
|
|
|
|
2007-05-02 17:08:09 +00:00
|
|
|
if (GST_FLOW_IS_FATAL (flacdec->last_flow) ||
|
|
|
|
flacdec->last_flow == GST_FLOW_NOT_LINKED) {
|
|
|
|
GST_ELEMENT_ERROR (flacdec, STREAM, FAILED,
|
|
|
|
(_("Internal data stream error.")),
|
|
|
|
("stream stopped, reason %s",
|
|
|
|
gst_flow_get_name (flacdec->last_flow)));
|
|
|
|
goto eos_and_pause;
|
|
|
|
} else if (flacdec->last_flow != GST_FLOW_OK) {
|
2006-04-20 14:21:42 +00:00
|
|
|
goto pause;
|
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
|
|
|
}
|
|
|
|
|
2006-04-20 14:21:42 +00:00
|
|
|
/* check if we're at the end of a configured segment */
|
|
|
|
if (flacdec->segment.stop != -1 &&
|
|
|
|
flacdec->segment.last_stop > 0 &&
|
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 >= flacdec->segment.stop) {
|
2006-04-20 14:21:42 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "reached end of the configured segment");
|
|
|
|
|
2006-05-06 09:01:34 +00:00
|
|
|
if ((flacdec->segment.flags & GST_SEEK_FLAG_SEGMENT) == 0) {
|
2006-04-20 14:21:42 +00:00
|
|
|
goto eos_and_pause;
|
2006-05-06 09:01:34 +00:00
|
|
|
} else {
|
|
|
|
goto segment_done_and_pause;
|
|
|
|
}
|
2006-04-20 14:21:42 +00:00
|
|
|
|
2006-05-06 09:01:34 +00:00
|
|
|
g_assert_not_reached ();
|
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
|
|
|
}
|
2006-04-20 14:21:42 +00:00
|
|
|
|
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
|
|
|
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
case FLAC__STREAM_DECODER_END_OF_STREAM:{
|
2006-04-20 14:21:42 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "EOS");
|
2009-12-23 16:50:34 +00:00
|
|
|
FLAC__stream_decoder_reset (flacdec->decoder);
|
2006-05-06 09:01:34 +00:00
|
|
|
|
|
|
|
if ((flacdec->segment.flags & GST_SEEK_FLAG_SEGMENT) != 0) {
|
|
|
|
if (flacdec->segment.duration > 0) {
|
|
|
|
flacdec->segment.stop = flacdec->segment.duration;
|
|
|
|
} else {
|
|
|
|
flacdec->segment.stop = flacdec->segment.last_stop;
|
|
|
|
}
|
|
|
|
goto segment_done_and_pause;
|
|
|
|
}
|
|
|
|
|
2006-04-20 14:21:42 +00:00
|
|
|
goto eos_and_pause;
|
2005-10-02 15:33:14 +00:00
|
|
|
}
|
|
|
|
|
2009-07-21 18:46:55 +00:00
|
|
|
/* gst_flac_dec_read_seekable() returned ABORTED */
|
|
|
|
case FLAC__STREAM_DECODER_ABORTED:
|
|
|
|
{
|
|
|
|
GST_INFO_OBJECT (flacdec, "read aborted: last pull_range flow = %s",
|
|
|
|
gst_flow_get_name (flacdec->pull_flow));
|
|
|
|
if (!GST_FLOW_IS_FATAL (flacdec->pull_flow)) {
|
|
|
|
/* it seems we need to flush the decoder here to reset the decoder
|
|
|
|
* state after the abort for FLAC__stream_decoder_seek_absolute()
|
|
|
|
* to work properly */
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "flushing decoder to reset decoder state");
|
2009-12-23 16:50:34 +00:00
|
|
|
FLAC__stream_decoder_flush (flacdec->decoder);
|
2009-07-21 18:46:55 +00:00
|
|
|
goto pause;
|
|
|
|
}
|
|
|
|
/* fall through */
|
|
|
|
}
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
case FLAC__STREAM_DECODER_OGG_ERROR:
|
|
|
|
case FLAC__STREAM_DECODER_SEEK_ERROR:
|
|
|
|
case FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
|
|
|
|
case FLAC__STREAM_DECODER_UNINITIALIZED:
|
2005-10-02 15:33:14 +00:00
|
|
|
default:{
|
|
|
|
/* fixme: this error sucks -- should try to figure out when/if an more
|
|
|
|
specific error was already sent via the callback */
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
GST_ELEMENT_ERROR (flacdec, STREAM, DECODE, (NULL),
|
|
|
|
("%s", FLAC__StreamDecoderStateString[s]));
|
2006-04-20 14:21:42 +00:00
|
|
|
goto eos_and_pause;
|
|
|
|
}
|
|
|
|
}
|
2005-10-02 15:33:14 +00:00
|
|
|
|
2006-04-20 14:21:42 +00:00
|
|
|
return;
|
2005-10-02 15:33:14 +00:00
|
|
|
|
2006-05-06 09:01:34 +00:00
|
|
|
segment_done_and_pause:
|
|
|
|
{
|
|
|
|
gint64 stop_time;
|
|
|
|
|
|
|
|
stop_time = gst_util_uint64_scale_int (flacdec->segment.stop,
|
|
|
|
GST_SECOND, flacdec->sample_rate);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "posting SEGMENT_DONE message, stop time %"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (stop_time));
|
|
|
|
|
|
|
|
gst_element_post_message (GST_ELEMENT (flacdec),
|
|
|
|
gst_message_new_segment_done (GST_OBJECT (flacdec),
|
|
|
|
GST_FORMAT_TIME, stop_time));
|
|
|
|
|
|
|
|
goto pause;
|
|
|
|
}
|
2006-04-20 14:21:42 +00:00
|
|
|
eos_and_pause:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "sending EOS event");
|
2007-12-14 18:49:34 +00:00
|
|
|
flacdec->running = FALSE;
|
2006-04-20 14:21:42 +00:00
|
|
|
gst_pad_push_event (flacdec->srcpad, gst_event_new_eos ());
|
|
|
|
/* fall through to pause */
|
|
|
|
}
|
|
|
|
pause:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "pausing");
|
|
|
|
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
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
static gboolean
|
|
|
|
gst_flac_dec_sink_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstFlacDec *dec;
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
dec = GST_FLAC_DEC (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_FLUSH_STOP:{
|
2009-03-12 15:10:25 +00:00
|
|
|
if (dec->init == FALSE) {
|
2009-12-23 16:50:34 +00:00
|
|
|
FLAC__stream_decoder_flush (dec->decoder);
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
gst_adapter_clear (dec->adapter);
|
|
|
|
}
|
|
|
|
res = gst_pad_push_event (dec->srcpad, event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_EVENT_NEWSEGMENT:{
|
|
|
|
GstFormat fmt;
|
2006-08-22 12:28:24 +00:00
|
|
|
gboolean update;
|
|
|
|
gdouble rate, applied_rate;
|
|
|
|
gint64 cur, stop, time;
|
|
|
|
|
|
|
|
gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
|
|
|
|
&fmt, &cur, &stop, &time);
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
|
|
|
|
if (fmt == GST_FORMAT_TIME) {
|
2006-08-22 12:28:24 +00:00
|
|
|
GstFormat dformat = GST_FORMAT_DEFAULT;
|
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
GST_DEBUG_OBJECT (dec, "newsegment event in TIME format => framed");
|
|
|
|
dec->framed = TRUE;
|
|
|
|
res = gst_pad_push_event (dec->srcpad, event);
|
2006-08-22 12:28:24 +00:00
|
|
|
|
|
|
|
/* this won't work for the first newsegment event though ... */
|
|
|
|
if (gst_flac_dec_convert_src (dec->srcpad, GST_FORMAT_TIME, cur,
|
|
|
|
&dformat, &cur) && cur != -1 &&
|
|
|
|
gst_flac_dec_convert_src (dec->srcpad, GST_FORMAT_TIME, stop,
|
|
|
|
&dformat, &stop) && stop != -1) {
|
|
|
|
gst_segment_set_newsegment_full (&dec->segment, update, rate,
|
|
|
|
applied_rate, dformat, cur, stop, time);
|
|
|
|
GST_DEBUG_OBJECT (dec, "segment %" GST_SEGMENT_FORMAT, &dec->segment);
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (dec, "couldn't convert time => samples");
|
|
|
|
}
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
} else if (fmt == GST_FORMAT_BYTES || TRUE) {
|
|
|
|
GST_DEBUG_OBJECT (dec, "newsegment event in %s format => not framed",
|
|
|
|
gst_format_get_name (fmt));
|
|
|
|
dec->framed = FALSE;
|
2009-08-01 16:07:42 +00:00
|
|
|
|
|
|
|
/* prepare generic newsegment event, for some reason our metadata
|
|
|
|
* callback where we usually set this up is not being called in
|
|
|
|
* push mode */
|
|
|
|
dec->start_segment = gst_event_new_new_segment (FALSE, 1.0,
|
|
|
|
GST_FORMAT_TIME, 0, -1, 0);
|
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
gst_event_unref (event);
|
|
|
|
res = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_EVENT_EOS:{
|
|
|
|
GST_LOG_OBJECT (dec, "EOS, with %u bytes available in adapter",
|
|
|
|
gst_adapter_available (dec->adapter));
|
2009-03-12 15:10:25 +00:00
|
|
|
if (dec->init == FALSE) {
|
|
|
|
if (gst_adapter_available (dec->adapter) > 0) {
|
2009-12-23 16:50:34 +00:00
|
|
|
FLAC__stream_decoder_process_until_end_of_stream (dec->decoder);
|
2009-03-12 15:10:25 +00:00
|
|
|
}
|
2009-12-23 16:50:34 +00:00
|
|
|
FLAC__stream_decoder_flush (dec->decoder);
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
}
|
|
|
|
gst_adapter_clear (dec->adapter);
|
|
|
|
res = gst_pad_push_event (dec->srcpad, event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = gst_pad_event_default (pad, event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (dec);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_flac_dec_chain (GstPad * pad, GstBuffer * buf)
|
|
|
|
{
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
FLAC__StreamDecoderInitStatus s;
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
GstFlacDec *dec;
|
2006-08-22 12:28:24 +00:00
|
|
|
gboolean got_audio_frame;
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
|
|
|
|
dec = GST_FLAC_DEC (GST_PAD_PARENT (pad));
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (dec, "buffer with ts=%" GST_TIME_FORMAT ", end_offset=%"
|
|
|
|
G_GINT64_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
|
|
|
|
GST_BUFFER_OFFSET_END (buf));
|
|
|
|
|
|
|
|
if (dec->init) {
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (dec, "initializing decoder");
|
2009-12-23 16:50:34 +00:00
|
|
|
s = FLAC__stream_decoder_init_stream (dec->decoder,
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
gst_flac_dec_read_stream, NULL, NULL, NULL, NULL,
|
2009-08-01 15:48:36 +00:00
|
|
|
gst_flac_dec_write_stream, gst_flac_dec_metadata_cb,
|
|
|
|
gst_flac_dec_error_cb, dec);
|
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
Original commit message from CVS:
Patch by: Josh Coalson <xflac at yahoo dot com>,
updated by Alexis Ballier <aballier at gentoo dot org>:
* configure.ac:
* ext/flac/gstflacdec.c: (gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_seek),
(gst_flac_dec_tell), (gst_flac_dec_length), (gst_flac_dec_eof),
(gst_flac_dec_read_seekable), (gst_flac_dec_read_stream):
* ext/flac/gstflacdec.h:
* ext/flac/gstflacenc.c: (gst_flac_enc_init),
(gst_flac_enc_finalize), (gst_flac_enc_set_metadata),
(gst_flac_enc_sink_setcaps), (gst_flac_enc_update_quality),
(gst_flac_enc_seek_callback), (gst_flac_enc_write_callback),
(gst_flac_enc_tell_callback), (gst_flac_enc_sink_event),
(gst_flac_enc_chain), (gst_flac_enc_set_property),
(gst_flac_enc_get_property), (gst_flac_enc_change_state):
* ext/flac/gstflacenc.h:
Add support for flac >= 1.1.3 which changed the API. Fixes bug #385887.
2007-06-10 10:53:26 +00:00
|
|
|
if (s != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (dec), LIBRARY, INIT, (NULL), (NULL));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
GST_DEBUG_OBJECT (dec, "initialized (framed=%d)", dec->framed);
|
|
|
|
dec->init = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT)) {
|
|
|
|
/* Clear the adapter and the decoder */
|
|
|
|
gst_adapter_clear (dec->adapter);
|
2009-12-23 16:50:34 +00:00
|
|
|
FLAC__stream_decoder_flush (dec->decoder);
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
}
|
|
|
|
|
2006-08-22 12:28:24 +00:00
|
|
|
if (dec->framed) {
|
|
|
|
gint64 unused;
|
|
|
|
|
|
|
|
/* check if this is a flac audio frame (rather than a header or junk) */
|
|
|
|
got_audio_frame = gst_flac_dec_scan_got_frame (dec, GST_BUFFER_DATA (buf),
|
|
|
|
GST_BUFFER_SIZE (buf), &unused);
|
|
|
|
|
|
|
|
/* oggdemux will set granulepos in OFFSET_END instead of timestamp */
|
2010-01-06 13:06:14 +00:00
|
|
|
if (G_LIKELY (got_audio_frame)) {
|
|
|
|
/* old oggdemux for now */
|
|
|
|
if (!GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
|
|
|
|
dec->cur_granulepos = GST_BUFFER_OFFSET_END (buf);
|
|
|
|
} else {
|
|
|
|
GstFormat dformat = GST_FORMAT_DEFAULT;
|
|
|
|
|
|
|
|
/* upstream (e.g. demuxer) presents us time,
|
|
|
|
* convert to default samples */
|
|
|
|
gst_flac_dec_convert_src (dec->srcpad, GST_FORMAT_TIME,
|
|
|
|
GST_BUFFER_TIMESTAMP (buf), &dformat, &dec->segment.last_stop);
|
|
|
|
dec->cur_granulepos = GST_BUFFER_OFFSET_NONE;
|
|
|
|
}
|
2006-08-22 12:28:24 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
dec->cur_granulepos = GST_BUFFER_OFFSET_NONE;
|
|
|
|
got_audio_frame = TRUE;
|
|
|
|
}
|
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
gst_adapter_push (dec->adapter, buf);
|
|
|
|
buf = NULL;
|
|
|
|
|
|
|
|
dec->last_flow = GST_FLOW_OK;
|
|
|
|
|
|
|
|
if (!dec->framed) {
|
|
|
|
/* wait until we have at least 64kB because libflac's StreamDecoder
|
|
|
|
* interface is a bit dumb it seems (if we don't have as much data as
|
|
|
|
* it wants it will call our read callback repeatedly and the only
|
|
|
|
* way to stop that is to error out or EOS, which will affect the
|
2006-08-22 12:28:24 +00:00
|
|
|
* decoder state). And the decoder seems to always ask for MAX_BLOCK_SIZE
|
|
|
|
* bytes rather than the max. block size from the header). Requiring
|
|
|
|
* MAX_BLOCK_SIZE bytes here should make sure it always gets enough data
|
|
|
|
* to decode at least one block */
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
while (gst_adapter_available (dec->adapter) >= FLAC__MAX_BLOCK_SIZE &&
|
|
|
|
dec->last_flow == GST_FLOW_OK) {
|
|
|
|
GST_LOG_OBJECT (dec, "%u bytes available",
|
|
|
|
gst_adapter_available (dec->adapter));
|
2009-12-23 16:50:34 +00:00
|
|
|
if (!FLAC__stream_decoder_process_single (dec->decoder)) {
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
GST_DEBUG_OBJECT (dec, "process_single failed");
|
|
|
|
break;
|
|
|
|
}
|
2009-02-05 23:51:42 +00:00
|
|
|
|
2009-12-23 16:50:34 +00:00
|
|
|
if (FLAC__stream_decoder_get_state (dec->decoder) ==
|
2009-02-05 23:51:42 +00:00
|
|
|
FLAC__STREAM_DECODER_ABORTED) {
|
|
|
|
GST_WARNING_OBJECT (dec, "Read callback caused internal abort");
|
|
|
|
dec->last_flow = GST_FLOW_ERROR;
|
|
|
|
break;
|
|
|
|
}
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
}
|
2006-08-22 12:28:24 +00:00
|
|
|
} else if (dec->framed && got_audio_frame) {
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
/* framed - there should always be enough data to decode something */
|
|
|
|
GST_LOG_OBJECT (dec, "%u bytes available",
|
|
|
|
gst_adapter_available (dec->adapter));
|
2009-12-23 16:50:34 +00:00
|
|
|
if (!FLAC__stream_decoder_process_single (dec->decoder)) {
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
GST_DEBUG_OBJECT (dec, "process_single failed");
|
|
|
|
}
|
2006-08-22 12:28:24 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (dec, "don't have all headers yet");
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return dec->last_flow;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_flac_dec_convert_sink (GstFlacDec * dec, GstFormat src_format,
|
|
|
|
gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
|
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
|
|
|
|
if (dec->width == 0 || dec->channels == 0 || dec->sample_rate == 0) {
|
|
|
|
/* no frame decoded yet */
|
|
|
|
GST_DEBUG_OBJECT (dec, "cannot convert: not set up yet");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (src_format) {
|
|
|
|
case GST_FORMAT_BYTES:{
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
switch (*dest_format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
/* granulepos = sample */
|
|
|
|
*dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
|
|
|
|
dec->sample_rate);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
switch (*dest_format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
*dest_value = gst_util_uint64_scale_int (src_value,
|
|
|
|
dec->sample_rate, GST_SECOND);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GstQueryType *
|
|
|
|
gst_flac_dec_get_sink_query_types (GstPad * pad)
|
|
|
|
{
|
|
|
|
static const GstQueryType types[] = {
|
|
|
|
GST_QUERY_CONVERT,
|
|
|
|
0,
|
|
|
|
};
|
|
|
|
|
|
|
|
return types;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_flac_dec_sink_query (GstPad * pad, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstFlacDec *dec;
|
|
|
|
gboolean res = FALSE;
|
|
|
|
|
|
|
|
dec = GST_FLAC_DEC (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (dec, "%s query", GST_QUERY_TYPE_NAME (query));
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_CONVERT:{
|
|
|
|
GstFormat src_fmt, dest_fmt;
|
2008-06-04 08:54:09 +00:00
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
gint64 src_val, dest_val;
|
|
|
|
|
|
|
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, NULL);
|
|
|
|
|
|
|
|
res = gst_flac_dec_convert_sink (dec, src_fmt, src_val, &dest_fmt,
|
|
|
|
&dest_val);
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
|
|
|
}
|
|
|
|
GST_LOG_OBJECT (dec, "conversion %s", (res) ? "ok" : "FAILED");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:{
|
|
|
|
res = gst_pad_query_default (pad, query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (dec);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
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,
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
GST_QUERY_CONVERT,
|
2009-07-23 10:06:27 +00:00
|
|
|
GST_QUERY_SEEKING,
|
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/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
/* there might be a demuxer in front of us who can handle this */
|
|
|
|
if (fmt == GST_FORMAT_TIME && (res = gst_pad_query (peer, query)))
|
|
|
|
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
|
|
|
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,
|
2006-08-22 12:28:24 +00:00
|
|
|
GST_TIME_ARGS (len));
|
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 = 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;
|
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, NULL);
|
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_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;
|
|
|
|
}
|
2009-07-23 10:06:27 +00:00
|
|
|
case GST_QUERY_SEEKING:{
|
|
|
|
GstFormat fmt;
|
|
|
|
gboolean seekable = FALSE;
|
|
|
|
|
|
|
|
res = TRUE;
|
|
|
|
/* If upstream can handle the query we're done */
|
|
|
|
seekable = gst_pad_peer_query (flacdec->sinkpad, query);
|
|
|
|
if (seekable)
|
|
|
|
gst_query_parse_seeking (query, NULL, &seekable, NULL, NULL);
|
|
|
|
if (seekable)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
|
|
|
|
if ((fmt != GST_FORMAT_TIME && fmt != GST_FORMAT_DEFAULT) ||
|
2009-12-23 16:50:34 +00:00
|
|
|
flacdec->streaming) {
|
2009-07-23 10:06:27 +00:00
|
|
|
gst_query_set_seeking (query, fmt, FALSE, -1, -1);
|
|
|
|
} else {
|
|
|
|
gst_query_set_seeking (query, GST_FORMAT_TIME, TRUE, 0, -1);
|
|
|
|
}
|
|
|
|
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
|
|
|
|
|
|
|
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 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;
|
2007-12-14 18:49:34 +00:00
|
|
|
gint64 start, last_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
|
|
|
gint64 stop;
|
|
|
|
|
2009-12-23 16:50:34 +00:00
|
|
|
if (flacdec->streaming) {
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "seeking in streaming mode not implemented 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
|
|
|
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) {
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec,
|
|
|
|
"seeking is only supported in TIME or DEFAULT 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
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rate < 0.0) {
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec,
|
|
|
|
"only forward playback supported, rate %f not allowed", rate);
|
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 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)) {
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "failed to convert start to DEFAULT 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
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stop_type != GST_SEEK_TYPE_NONE &&
|
|
|
|
!gst_flac_dec_convert_src (flacdec->srcpad, seek_format, stop,
|
|
|
|
&target_format, &stop)) {
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "failed to convert stop to DEFAULT 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
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
flush = ((seek_flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH);
|
|
|
|
|
|
|
|
if (flush) {
|
2007-12-14 18:49:34 +00:00
|
|
|
/* flushing seek, clear the pipeline of stuff, we need a newsegment after
|
|
|
|
* this. */
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "flushing");
|
2009-03-09 16:14:12 +00:00
|
|
|
gst_pad_push_event (flacdec->sinkpad, gst_event_new_flush_start ());
|
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_flush_start ());
|
|
|
|
} else {
|
2007-12-14 18:49:34 +00:00
|
|
|
/* non flushing seek, pause the task */
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "stopping task");
|
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_stop_task (flacdec->sinkpad);
|
|
|
|
}
|
|
|
|
|
2007-12-14 18:49:34 +00:00
|
|
|
/* acquire the stream lock, this either happens when the streaming thread
|
|
|
|
* stopped because of the flush or when the task is paused after the loop
|
|
|
|
* function finished an iteration, which can never happen when it's blocked
|
|
|
|
* downstream in PAUSED, for example */
|
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_STREAM_LOCK (flacdec->sinkpad);
|
|
|
|
|
2009-12-23 16:03:32 +00:00
|
|
|
/* start seek with clear state to avoid seeking thread pushing segments/data.
|
|
|
|
* Note current state may have some pending,
|
|
|
|
* e.g. multi-sink seek leads to immediate subsequent seek events */
|
|
|
|
if (flacdec->start_segment) {
|
|
|
|
gst_event_unref (flacdec->start_segment);
|
|
|
|
flacdec->start_segment = NULL;
|
|
|
|
}
|
|
|
|
gst_buffer_replace (&flacdec->pending, NULL);
|
|
|
|
flacdec->pending_samples = 0;
|
|
|
|
|
2009-03-09 16:14:12 +00:00
|
|
|
/* save a segment copy until we know the seek worked. The idea is that
|
|
|
|
* when the seek fails, we want to restore with what we were doing. */
|
2006-03-24 19:41:03 +00:00
|
|
|
segment = flacdec->segment;
|
|
|
|
|
2007-12-14 18:49:34 +00:00
|
|
|
/* update the segment with the seek values, last_stop will contain the new
|
|
|
|
* position we should seek to */
|
2009-03-09 16:14:12 +00:00
|
|
|
gst_segment_set_seek (&flacdec->segment, rate, GST_FORMAT_DEFAULT,
|
2006-03-24 19:41:03 +00:00
|
|
|
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
|
|
|
|
2009-02-05 19:02:01 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec,
|
|
|
|
"configured segment: [%" G_GINT64_FORMAT "-%" G_GINT64_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
|
|
|
"] = [%" GST_TIME_FORMAT "-%" GST_TIME_FORMAT "]",
|
2009-03-09 16:14:12 +00:00
|
|
|
flacdec->segment.start, flacdec->segment.stop,
|
|
|
|
GST_TIME_ARGS (flacdec->segment.start * GST_SECOND /
|
|
|
|
flacdec->sample_rate),
|
|
|
|
GST_TIME_ARGS (flacdec->segment.stop * GST_SECOND /
|
|
|
|
flacdec->sample_rate));
|
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, "performing seek to sample %" G_GINT64_FORMAT,
|
2009-03-09 16:14:12 +00:00
|
|
|
flacdec->segment.last_stop);
|
|
|
|
|
|
|
|
/* flush sinkpad again because we need to pull and push buffers while doing
|
|
|
|
* the seek */
|
|
|
|
if (flush) {
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "flushing stop");
|
|
|
|
gst_pad_push_event (flacdec->sinkpad, gst_event_new_flush_stop ());
|
|
|
|
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
|
|
|
|
2007-12-14 18:49:34 +00:00
|
|
|
/* mark ourselves as seeking because the above lines will trigger some
|
|
|
|
* callbacks that need to behave differently when seeking */
|
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->seeking = TRUE;
|
|
|
|
|
2009-07-21 18:46:55 +00:00
|
|
|
GST_LOG_OBJECT (flacdec, "calling seek_absolute");
|
2009-12-23 16:50:34 +00:00
|
|
|
seek_ok = FLAC__stream_decoder_seek_absolute (flacdec->decoder,
|
2009-03-09 16:14:12 +00:00
|
|
|
flacdec->segment.last_stop);
|
2009-07-21 18:46:55 +00:00
|
|
|
GST_LOG_OBJECT (flacdec, "done with seek_absolute, seek_ok=%d", seek_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
|
|
|
|
|
|
|
flacdec->seeking = FALSE;
|
|
|
|
|
2009-03-31 23:15:31 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "performed seek to sample %" G_GINT64_FORMAT,
|
|
|
|
flacdec->segment.last_stop);
|
|
|
|
|
|
|
|
|
2007-12-14 18:49:34 +00:00
|
|
|
if (!seek_ok) {
|
|
|
|
GST_WARNING_OBJECT (flacdec, "seek failed");
|
2009-03-09 16:14:12 +00:00
|
|
|
/* seek failed, restore the segment and start streaming again with
|
|
|
|
* the previous segment values */
|
|
|
|
flacdec->segment = segment;
|
2007-12-14 18:49:34 +00:00
|
|
|
} else if (!flush && flacdec->running) {
|
|
|
|
/* we are running the current segment and doing a non-flushing seek,
|
|
|
|
* close the segment first based on the last_stop. */
|
|
|
|
GST_DEBUG_OBJECT (flacdec, "closing running segment %" G_GINT64_FORMAT
|
|
|
|
" to %" G_GINT64_FORMAT, segment.start, segment.last_stop);
|
|
|
|
|
|
|
|
/* convert the old segment values to time to close the old segment */
|
2009-03-09 16:14:12 +00:00
|
|
|
start = gst_util_uint64_scale_int (segment.start, GST_SECOND,
|
2007-12-14 18:49:34 +00:00
|
|
|
flacdec->sample_rate);
|
|
|
|
last_stop =
|
2009-03-09 16:14:12 +00:00
|
|
|
gst_util_uint64_scale_int (segment.last_stop, GST_SECOND,
|
2007-12-14 18:49:34 +00:00
|
|
|
flacdec->sample_rate);
|
|
|
|
|
|
|
|
/* queue the segment for sending in the stream thread, start and time are
|
|
|
|
* always the same. */
|
|
|
|
if (flacdec->close_segment)
|
|
|
|
gst_event_unref (flacdec->close_segment);
|
|
|
|
flacdec->close_segment =
|
|
|
|
gst_event_new_new_segment_full (TRUE,
|
2009-03-09 16:14:12 +00:00
|
|
|
segment.rate, segment.applied_rate, GST_FORMAT_TIME,
|
2007-12-14 18:49:34 +00:00
|
|
|
start, last_stop, start);
|
2006-03-24 19:41:03 +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 (seek_ok) {
|
2009-03-09 16:14:12 +00:00
|
|
|
/* seek succeeded, flacdec->segment contains the new positions */
|
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, "seek successful");
|
2007-12-14 18:49:34 +00:00
|
|
|
}
|
2006-04-20 14:21:42 +00:00
|
|
|
|
2007-12-14 18:49:34 +00:00
|
|
|
/* convert the (new) segment values to time, we will need them to generate the
|
|
|
|
* new segment events. */
|
|
|
|
start = gst_util_uint64_scale_int (flacdec->segment.start, GST_SECOND,
|
|
|
|
flacdec->sample_rate);
|
|
|
|
last_stop = gst_util_uint64_scale_int (flacdec->segment.last_stop, GST_SECOND,
|
|
|
|
flacdec->sample_rate);
|
|
|
|
|
|
|
|
/* for deriving a stop position for the playback segment from the seek
|
|
|
|
* segment, we must take the duration when the stop is not set */
|
|
|
|
if (flacdec->segment.stop != -1)
|
|
|
|
stop = gst_util_uint64_scale_int (flacdec->segment.stop, GST_SECOND,
|
|
|
|
flacdec->sample_rate);
|
|
|
|
else
|
|
|
|
stop = gst_util_uint64_scale_int (flacdec->segment.duration, GST_SECOND,
|
|
|
|
flacdec->sample_rate);
|
|
|
|
|
|
|
|
/* notify start of new segment when we were asked to do so. */
|
2009-03-09 16:14:12 +00:00
|
|
|
if (flacdec->segment.flags & GST_SEEK_FLAG_SEGMENT) {
|
2007-12-14 18:49:34 +00:00
|
|
|
/* last_stop contains the position we start from */
|
|
|
|
gst_element_post_message (GST_ELEMENT (flacdec),
|
|
|
|
gst_message_new_segment_start (GST_OBJECT (flacdec),
|
|
|
|
GST_FORMAT_TIME, last_stop));
|
|
|
|
}
|
2006-04-20 14:21:42 +00:00
|
|
|
|
2007-12-14 18:49:34 +00:00
|
|
|
/* if the seek was ok or (when it failed) we are flushing, we need to send out
|
|
|
|
* a new segment. If we did not flush and the seek failed, we simply do
|
|
|
|
* nothing here and continue where we were. */
|
|
|
|
if (seek_ok || flush) {
|
2009-03-02 07:41:15 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "Creating newsegment from %" GST_TIME_FORMAT
|
|
|
|
" to %" GST_TIME_FORMAT, GST_TIME_ARGS (last_stop),
|
|
|
|
GST_TIME_ARGS (stop));
|
2007-12-14 18:49:34 +00:00
|
|
|
/* now replace the old segment so that we send it in the stream thread the
|
|
|
|
* next time it is scheduled. */
|
|
|
|
if (flacdec->start_segment)
|
|
|
|
gst_event_unref (flacdec->start_segment);
|
|
|
|
flacdec->start_segment =
|
|
|
|
gst_event_new_new_segment_full (FALSE,
|
2009-03-09 16:14:12 +00:00
|
|
|
flacdec->segment.rate, flacdec->segment.applied_rate, GST_FORMAT_TIME,
|
2007-12-14 18:49:34 +00:00
|
|
|
last_stop, stop, last_stop);
|
|
|
|
}
|
2006-04-20 14:21:42 +00:00
|
|
|
|
2007-12-14 18:49:34 +00:00
|
|
|
/* we'll generate a discont on the next buffer */
|
|
|
|
flacdec->discont = TRUE;
|
|
|
|
/* the task is running again now */
|
|
|
|
flacdec->running = 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
|
|
|
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
|
|
|
|
2007-12-14 18:49:34 +00:00
|
|
|
return seek_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
|
|
|
}
|
|
|
|
|
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;
|
2009-07-31 23:00:41 +00:00
|
|
|
GstFlacDec *flacdec;
|
2008-06-04 08:54:09 +00:00
|
|
|
|
2009-07-31 23:00:41 +00:00
|
|
|
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:{
|
2009-03-15 20:30:32 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "received seek event %p", event);
|
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) {
|
2009-03-15 20:30:32 +00:00
|
|
|
GST_DEBUG_OBJECT (flacdec, "default failed, handling ourselves");
|
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_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);
|
|
|
|
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
return gst_pad_activate_push (sinkpad, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_flac_dec_sink_activate_push (GstPad * sinkpad, gboolean active)
|
|
|
|
{
|
|
|
|
GstFlacDec *dec = GST_FLAC_DEC (GST_OBJECT_PARENT (sinkpad));
|
|
|
|
|
2009-12-23 16:50:34 +00:00
|
|
|
if (active) {
|
|
|
|
gst_flac_dec_setup_decoder (dec);
|
|
|
|
dec->streaming = TRUE;
|
|
|
|
}
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
return TRUE;
|
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_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
|
|
|
{
|
2007-12-14 18:49:34 +00:00
|
|
|
gboolean 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
|
|
|
if (active) {
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
GstFlacDec *flacdec;
|
|
|
|
|
|
|
|
flacdec = GST_FLAC_DEC (GST_PAD_PARENT (sinkpad));
|
|
|
|
|
|
|
|
flacdec->offset = 0;
|
2009-12-23 16:50:34 +00:00
|
|
|
gst_flac_dec_setup_decoder (flacdec);
|
2007-12-14 18:49:34 +00:00
|
|
|
flacdec->running = TRUE;
|
2009-12-23 16:50:34 +00:00
|
|
|
flacdec->streaming = FALSE;
|
2007-12-14 18:49:34 +00:00
|
|
|
|
|
|
|
res = 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 {
|
2007-12-14 18:49:34 +00:00
|
|
|
res = 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
|
|
|
}
|
2007-12-14 18:49:34 +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
|
|
|
}
|
|
|
|
|
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->seeking = FALSE;
|
2006-01-02 19:38:32 +00:00
|
|
|
flacdec->channels = 0;
|
|
|
|
flacdec->depth = 0;
|
|
|
|
flacdec->width = 0;
|
|
|
|
flacdec->sample_rate = 0;
|
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);
|
ext/flac/: Support chain-based operation, should make flac-over-DAAP work (#340492).
Original commit message from CVS:
* ext/flac/Makefile.am:
* ext/flac/gstflacdec.c: (gst_flac_dec_init),
(gst_flac_dec_reset_decoders),
(gst_flac_dec_setup_seekable_decoder),
(gst_flac_dec_setup_stream_decoder), (gst_flac_dec_finalize),
(gst_flac_dec_metadata_callback),
(gst_flac_dec_metadata_callback_seekable),
(gst_flac_dec_metadata_callback_stream),
(gst_flac_dec_error_callback),
(gst_flac_dec_error_callback_seekable),
(gst_flac_dec_error_callback_stream), (gst_flac_dec_read_seekable),
(gst_flac_dec_read_stream), (gst_flac_dec_write),
(gst_flac_dec_write_seekable), (gst_flac_dec_write_stream),
(gst_flac_dec_loop), (gst_flac_dec_sink_event),
(gst_flac_dec_chain), (gst_flac_dec_convert_sink),
(gst_flac_dec_get_sink_query_types), (gst_flac_dec_sink_query),
(gst_flac_dec_get_src_query_types), (gst_flac_dec_src_query),
(gst_flac_dec_handle_seek_event), (gst_flac_dec_sink_activate),
(gst_flac_dec_sink_activate_push),
(gst_flac_dec_sink_activate_pull), (gst_flac_dec_change_state):
* ext/flac/gstflacdec.h:
Support chain-based operation, should make flac-over-DAAP
work (#340492).
2006-06-20 19:40:29 +00:00
|
|
|
gst_flac_dec_reset_decoders (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
|
|
|
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
|
|
|
}
|