2005-08-23 19:29:38 +00:00
|
|
|
/* GStreamer
|
2005-08-24 14:08:58 +00:00
|
|
|
* Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
|
2005-08-23 19:29:38 +00:00
|
|
|
* Copyright (C) 2003,2004 David A. Schleef <ds@schleef.org>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
/* Element-Checklist-Version: 5 */
|
|
|
|
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
/**
|
2008-11-28 09:49:56 +00:00
|
|
|
* SECTION:element-legacyresample
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
*
|
2008-11-28 09:49:56 +00:00
|
|
|
* legacyresample resamples raw audio buffers to different sample rates using
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
* a configurable windowing function to enhance quality.
|
2008-07-10 21:06:03 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
* <title>Example launch line</title>
|
2008-07-10 21:06:03 +00:00
|
|
|
* |[
|
2008-11-28 09:49:56 +00:00
|
|
|
* gst-launch -v filesrc location=sine.ogg ! oggdemux ! vorbisdec ! audioconvert ! legacyresample ! audio/x-raw-int, rate=8000 ! alsasink
|
2008-07-10 21:06:03 +00:00
|
|
|
* ]| Decode an Ogg/Vorbis downsample to 8Khz and play sound through alsa.
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
* To create the Ogg/Vorbis file refer to the documentation of vorbisenc.
|
|
|
|
* </refsect2>
|
|
|
|
*
|
|
|
|
* Last reviewed on 2006-03-02 (0.10.4)
|
|
|
|
*/
|
|
|
|
|
2005-08-23 19:29:38 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2005-08-24 14:08:58 +00:00
|
|
|
|
2005-08-23 19:29:38 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
/*#define DEBUG_ENABLED */
|
2009-01-23 11:46:28 +00:00
|
|
|
#include "gstlegacyresample.h"
|
2005-08-23 19:29:38 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2005-08-24 14:08:58 +00:00
|
|
|
#include <gst/base/gstbasetransform.h>
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (legacyresample_debug);
|
|
|
|
#define GST_CAT_DEFAULT legacyresample_debug
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-12-06 19:42:02 +00:00
|
|
|
#define DEFAULT_FILTERLEN 16
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
2005-08-23 19:29:38 +00:00
|
|
|
enum
|
|
|
|
{
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_FILTERLEN
|
2005-08-23 19:29:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define SUPPORTED_CAPS \
|
2005-08-25 12:31:31 +00:00
|
|
|
GST_STATIC_CAPS ( \
|
2005-08-23 19:29:38 +00:00
|
|
|
"audio/x-raw-int, " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
|
|
|
"channels = (int) [ 1, MAX ], " \
|
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
|
|
|
"width = (int) 16, " \
|
|
|
|
"depth = (int) 16, " \
|
2006-04-28 14:17:00 +00:00
|
|
|
"signed = (boolean) true;" \
|
|
|
|
"audio/x-raw-int, " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
|
|
|
"channels = (int) [ 1, MAX ], " \
|
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
|
|
|
"width = (int) 32, " \
|
|
|
|
"depth = (int) 32, " \
|
|
|
|
"signed = (boolean) true;" \
|
|
|
|
"audio/x-raw-float, " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
|
|
|
"channels = (int) [ 1, MAX ], " \
|
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
|
|
|
"width = (int) 32; " \
|
|
|
|
"audio/x-raw-float, " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
|
|
|
"channels = (int) [ 1, MAX ], " \
|
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
|
|
|
"width = (int) 64" \
|
2005-08-25 12:31:31 +00:00
|
|
|
)
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
static GstStaticPadTemplate gst_legacyresample_sink_template =
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK, GST_PAD_ALWAYS, SUPPORTED_CAPS);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
static GstStaticPadTemplate gst_legacyresample_src_template =
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC, GST_PAD_ALWAYS, SUPPORTED_CAPS);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
static void gst_legacyresample_set_property (GObject * object,
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
2009-01-23 11:46:28 +00:00
|
|
|
static void gst_legacyresample_get_property (GObject * object,
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
/* vmethods */
|
2009-01-23 11:46:28 +00:00
|
|
|
static gboolean legacyresample_get_unit_size (GstBaseTransform * base,
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
GstCaps * caps, guint * size);
|
2009-01-23 11:46:28 +00:00
|
|
|
static GstCaps *legacyresample_transform_caps (GstBaseTransform * base,
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
GstPadDirection direction, GstCaps * caps);
|
2009-01-23 11:46:28 +00:00
|
|
|
static void legacyresample_fixate_caps (GstBaseTransform * base,
|
2008-10-28 16:25:00 +00:00
|
|
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
|
2009-01-23 11:46:28 +00:00
|
|
|
static gboolean legacyresample_transform_size (GstBaseTransform * trans,
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
GstPadDirection direction, GstCaps * incaps, guint insize,
|
|
|
|
GstCaps * outcaps, guint * outsize);
|
2009-01-23 11:46:28 +00:00
|
|
|
static gboolean legacyresample_set_caps (GstBaseTransform * base,
|
2007-04-21 14:14:24 +00:00
|
|
|
GstCaps * incaps, GstCaps * outcaps);
|
2009-01-23 11:46:28 +00:00
|
|
|
static GstFlowReturn legacyresample_pushthrough (GstLegacyresample *
|
|
|
|
legacyresample);
|
|
|
|
static GstFlowReturn legacyresample_transform (GstBaseTransform * base,
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
GstBuffer * inbuf, GstBuffer * outbuf);
|
2009-01-23 11:46:28 +00:00
|
|
|
static gboolean legacyresample_event (GstBaseTransform * base,
|
|
|
|
GstEvent * event);
|
|
|
|
static gboolean legacyresample_start (GstBaseTransform * base);
|
|
|
|
static gboolean legacyresample_stop (GstBaseTransform * base);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
static gboolean legacyresample_query (GstPad * pad, GstQuery * query);
|
|
|
|
static const GstQueryType *legacyresample_query_type (GstPad * pad);
|
2007-11-23 10:21:11 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
#define DEBUG_INIT(bla) \
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (legacyresample_debug, "legacyresample", 0, "audio resampling element");
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_BOILERPLATE_FULL (GstLegacyresample, gst_legacyresample, GstBaseTransform,
|
2005-08-24 14:08:58 +00:00
|
|
|
GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
static void
|
2009-01-23 11:46:28 +00:00
|
|
|
gst_legacyresample_base_init (gpointer g_class)
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
2009-01-23 11:46:28 +00:00
|
|
|
gst_static_pad_template_get (&gst_legacyresample_src_template));
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
2009-01-23 11:46:28 +00:00
|
|
|
gst_static_pad_template_get (&gst_legacyresample_sink_template));
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2010-03-18 16:30:26 +00:00
|
|
|
gst_element_class_set_details_simple (gstelement_class, "Audio scaler",
|
|
|
|
"Filter/Converter/Audio",
|
|
|
|
"Resample audio", "David Schleef <ds@schleef.org>");
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
}
|
2005-08-24 14:08:58 +00:00
|
|
|
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
static void
|
2009-01-23 11:46:28 +00:00
|
|
|
gst_legacyresample_class_init (GstLegacyresampleClass * klass)
|
2005-08-23 19:29:38 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
gobject_class->set_property = gst_legacyresample_set_property;
|
|
|
|
gobject_class->get_property = gst_legacyresample_get_property;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2006-06-22 10:10:51 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_FILTERLEN,
|
2008-03-22 15:00:47 +00:00
|
|
|
g_param_spec_int ("filter-length", "filter length",
|
|
|
|
"Length of the resample filter", 0, G_MAXINT, DEFAULT_FILTERLEN,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2006-06-16 15:17:44 +00:00
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->start =
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_FUNCPTR (legacyresample_start);
|
2006-06-16 15:17:44 +00:00
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->stop =
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_FUNCPTR (legacyresample_stop);
|
2005-08-24 14:08:58 +00:00
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->transform_size =
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_FUNCPTR (legacyresample_transform_size);
|
2005-08-24 14:08:58 +00:00
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->get_unit_size =
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_FUNCPTR (legacyresample_get_unit_size);
|
2005-08-24 14:08:58 +00:00
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->transform_caps =
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_FUNCPTR (legacyresample_transform_caps);
|
2008-10-28 16:25:00 +00:00
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->fixate_caps =
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_FUNCPTR (legacyresample_fixate_caps);
|
2005-08-24 14:08:58 +00:00
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->set_caps =
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_FUNCPTR (legacyresample_set_caps);
|
2005-08-24 14:08:58 +00:00
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->transform =
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_FUNCPTR (legacyresample_transform);
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->event =
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_FUNCPTR (legacyresample_event);
|
check/: Add extra tests for basetransform based components.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (GST_START_TEST), (simple_launch_lines_suite):
Add extra tests for basetransform based components.
Comment out the test_element_negotiation test until we decide
if it's testing correct behaviour.
* ext/libvisual/visual.c: (gst_visual_init), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Slightly more correct but still bogus timestamping.
Fix state change function.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init):
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_class_init):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_class_init),
(gst_videoscale_prepare_size), (gst_videoscale_set_caps),
(gst_videoscale_prepare_image):
* gst/volume/gstvolume.c: (gst_volume_class_init),
(volume_transform_ip):
Basetransform updates. Enable passthrough modes.
* sys/ximage/ximagesink.c: (gst_ximage_buffer_init),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
Negotiation fix that allows the window to return to the original
size and renegotiate passthrough upstream. Extra debug output.
2005-09-09 17:53:47 +00:00
|
|
|
|
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->passthrough_on_same_caps = TRUE;
|
2005-08-23 19:29:38 +00:00
|
|
|
}
|
|
|
|
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
static void
|
2009-01-23 11:46:28 +00:00
|
|
|
gst_legacyresample_init (GstLegacyresample * legacyresample,
|
|
|
|
GstLegacyresampleClass * klass)
|
2005-08-23 19:29:38 +00:00
|
|
|
{
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
GstBaseTransform *trans;
|
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
trans = GST_BASE_TRANSFORM (legacyresample);
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
2008-05-14 13:57:41 +00:00
|
|
|
/* buffer alloc passthrough is too impossible. FIXME, it
|
|
|
|
* is trivial in the passthrough case. */
|
|
|
|
gst_pad_set_bufferalloc_function (trans->sinkpad, NULL);
|
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->filter_length = DEFAULT_FILTERLEN;
|
2007-03-14 17:16:30 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->need_discont = FALSE;
|
2007-11-23 10:21:11 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
gst_pad_set_query_function (trans->srcpad, legacyresample_query);
|
|
|
|
gst_pad_set_query_type_function (trans->srcpad, legacyresample_query_type);
|
2006-06-16 15:17:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* vmethods */
|
|
|
|
static gboolean
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_start (GstBaseTransform * base)
|
2006-06-16 15:17:44 +00:00
|
|
|
{
|
2009-01-23 11:46:28 +00:00
|
|
|
GstLegacyresample *legacyresample = GST_LEGACYRESAMPLE (base);
|
2006-06-16 15:17:44 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->resample = resample_new ();
|
|
|
|
legacyresample->ts_offset = -1;
|
|
|
|
legacyresample->offset = -1;
|
|
|
|
legacyresample->next_ts = -1;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
resample_set_filter_length (legacyresample->resample,
|
|
|
|
legacyresample->filter_length);
|
2006-06-16 15:17:44 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2005-08-24 14:08:58 +00:00
|
|
|
}
|
|
|
|
|
2006-06-16 15:17:44 +00:00
|
|
|
static gboolean
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_stop (GstBaseTransform * base)
|
2005-08-24 14:08:58 +00:00
|
|
|
{
|
2009-01-23 11:46:28 +00:00
|
|
|
GstLegacyresample *legacyresample = GST_LEGACYRESAMPLE (base);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
if (legacyresample->resample) {
|
|
|
|
resample_free (legacyresample->resample);
|
|
|
|
legacyresample->resample = NULL;
|
2005-08-23 19:29:38 +00:00
|
|
|
}
|
2005-08-24 14:08:58 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
gst_caps_replace (&legacyresample->sinkcaps, NULL);
|
|
|
|
gst_caps_replace (&legacyresample->srccaps, NULL);
|
2006-07-28 17:17:24 +00:00
|
|
|
|
2006-06-16 15:17:44 +00:00
|
|
|
return TRUE;
|
2005-08-23 19:29:38 +00:00
|
|
|
}
|
|
|
|
|
2007-04-21 14:14:24 +00:00
|
|
|
static gboolean
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_get_unit_size (GstBaseTransform * base, GstCaps * caps,
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
guint * size)
|
|
|
|
{
|
2005-08-24 14:08:58 +00:00
|
|
|
gint width, channels;
|
|
|
|
GstStructure *structure;
|
|
|
|
gboolean ret;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2006-08-20 13:05:43 +00:00
|
|
|
g_assert (size);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
/* this works for both float and int */
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
ret = gst_structure_get_int (structure, "width", &width);
|
|
|
|
ret &= gst_structure_get_int (structure, "channels", &channels);
|
|
|
|
g_return_val_if_fail (ret, FALSE);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
*size = width * channels / 8;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
return TRUE;
|
2005-08-23 19:29:38 +00:00
|
|
|
}
|
|
|
|
|
2007-04-21 14:14:24 +00:00
|
|
|
static GstCaps *
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_transform_caps (GstBaseTransform * base,
|
2005-08-24 14:08:58 +00:00
|
|
|
GstPadDirection direction, GstCaps * caps)
|
2005-08-23 19:29:38 +00:00
|
|
|
{
|
2009-04-01 14:45:22 +00:00
|
|
|
const GValue *val;
|
|
|
|
GstStructure *s;
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
GstCaps *res;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-04-01 14:45:22 +00:00
|
|
|
/* transform single caps into input_caps + input_caps with the rate
|
|
|
|
* field set to our supported range. This ensures that upstream knows
|
|
|
|
* about downstream's prefered rate(s) and can negotiate accordingly. */
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
res = gst_caps_copy (caps);
|
2009-04-01 14:45:22 +00:00
|
|
|
|
|
|
|
/* first, however, check if the caps contain a range for the rate field, in
|
|
|
|
* which case that side isn't going to care much about the exact sample rate
|
|
|
|
* chosen and we should just assume things will get fixated to something sane
|
|
|
|
* and we may just as well offer our full range instead of the range in the
|
|
|
|
* caps. If the rate is not an int range value, it's likely to express a
|
|
|
|
* real preference or limitation and we should maintain that structure as
|
|
|
|
* preference by putting it first into the transformed caps, and only add
|
|
|
|
* our full rate range as second option */
|
|
|
|
s = gst_caps_get_structure (res, 0);
|
|
|
|
val = gst_structure_get_value (s, "rate");
|
|
|
|
if (val == NULL || GST_VALUE_HOLDS_INT_RANGE (val)) {
|
|
|
|
/* overwrite existing range, or add field if it doesn't exist yet */
|
|
|
|
gst_structure_set (s, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
|
|
|
} else {
|
|
|
|
/* append caps with full range to existing caps with non-range rate field */
|
|
|
|
s = gst_structure_copy (s);
|
|
|
|
gst_structure_set (s, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
|
|
|
gst_caps_append_structure (res, s);
|
|
|
|
}
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
return res;
|
2005-08-23 19:29:38 +00:00
|
|
|
}
|
|
|
|
|
2008-10-28 16:25:00 +00:00
|
|
|
/* Fixate rate to the allowed rate that has the smallest difference */
|
|
|
|
static void
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_fixate_caps (GstBaseTransform * base,
|
2008-10-28 16:25:00 +00:00
|
|
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
|
|
|
gint rate;
|
|
|
|
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
if (!gst_structure_get_int (s, "rate", &rate))
|
|
|
|
return;
|
|
|
|
|
|
|
|
s = gst_caps_get_structure (othercaps, 0);
|
|
|
|
gst_structure_fixate_field_nearest_int (s, "rate", rate);
|
|
|
|
}
|
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
static gboolean
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
resample_set_state_from_caps (ResampleState * state, GstCaps * incaps,
|
2005-08-24 14:08:58 +00:00
|
|
|
GstCaps * outcaps, gint * channels, gint * inrate, gint * outrate)
|
2005-08-23 19:29:38 +00:00
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
gboolean ret;
|
2005-08-24 14:08:58 +00:00
|
|
|
gint myinrate, myoutrate;
|
|
|
|
int mychannels;
|
2006-04-28 14:17:00 +00:00
|
|
|
gint width, depth;
|
|
|
|
ResampleFormat format;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
GST_DEBUG ("incaps %" GST_PTR_FORMAT ", outcaps %"
|
|
|
|
GST_PTR_FORMAT, incaps, outcaps);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
structure = gst_caps_get_structure (incaps, 0);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2006-04-28 14:17:00 +00:00
|
|
|
/* get width */
|
|
|
|
ret = gst_structure_get_int (structure, "width", &width);
|
|
|
|
if (!ret)
|
|
|
|
goto no_width;
|
|
|
|
|
|
|
|
/* figure out the format */
|
2005-08-24 14:08:58 +00:00
|
|
|
if (g_str_equal (gst_structure_get_name (structure), "audio/x-raw-float")) {
|
2006-04-28 14:17:00 +00:00
|
|
|
if (width == 32)
|
|
|
|
format = RESAMPLE_FORMAT_F32;
|
|
|
|
else if (width == 64)
|
|
|
|
format = RESAMPLE_FORMAT_F64;
|
|
|
|
else
|
|
|
|
goto wrong_depth;
|
2005-08-24 14:08:58 +00:00
|
|
|
} else {
|
2006-04-28 14:17:00 +00:00
|
|
|
/* for int, depth and width must be the same */
|
|
|
|
ret = gst_structure_get_int (structure, "depth", &depth);
|
|
|
|
if (!ret || width != depth)
|
|
|
|
goto not_equal;
|
|
|
|
|
|
|
|
if (width == 16)
|
|
|
|
format = RESAMPLE_FORMAT_S16;
|
|
|
|
else if (width == 32)
|
|
|
|
format = RESAMPLE_FORMAT_S32;
|
|
|
|
else
|
|
|
|
goto wrong_depth;
|
2005-08-23 19:29:38 +00:00
|
|
|
}
|
2005-08-24 14:08:58 +00:00
|
|
|
ret = gst_structure_get_int (structure, "rate", &myinrate);
|
|
|
|
ret &= gst_structure_get_int (structure, "channels", &mychannels);
|
2006-04-28 14:17:00 +00:00
|
|
|
if (!ret)
|
|
|
|
goto no_in_rate_channels;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
structure = gst_caps_get_structure (outcaps, 0);
|
|
|
|
ret = gst_structure_get_int (structure, "rate", &myoutrate);
|
2006-04-28 14:17:00 +00:00
|
|
|
if (!ret)
|
|
|
|
goto no_out_rate;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
if (channels)
|
|
|
|
*channels = mychannels;
|
|
|
|
if (inrate)
|
|
|
|
*inrate = myinrate;
|
|
|
|
if (outrate)
|
|
|
|
*outrate = myoutrate;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2006-04-28 14:17:00 +00:00
|
|
|
resample_set_format (state, format);
|
2005-08-24 14:08:58 +00:00
|
|
|
resample_set_n_channels (state, mychannels);
|
|
|
|
resample_set_input_rate (state, myinrate);
|
|
|
|
resample_set_output_rate (state, myoutrate);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
return TRUE;
|
2006-04-28 14:17:00 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_width:
|
|
|
|
{
|
|
|
|
GST_DEBUG ("failed to get width from caps");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
not_equal:
|
|
|
|
{
|
|
|
|
GST_DEBUG ("width %d and depth %d must be the same", width, depth);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
wrong_depth:
|
|
|
|
{
|
|
|
|
GST_DEBUG ("unknown depth %d found", depth);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
no_in_rate_channels:
|
|
|
|
{
|
|
|
|
GST_DEBUG ("could not get input rate and channels");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
no_out_rate:
|
|
|
|
{
|
|
|
|
GST_DEBUG ("could not get output rate");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-08-23 19:29:38 +00:00
|
|
|
}
|
|
|
|
|
2007-04-21 14:14:24 +00:00
|
|
|
static gboolean
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_transform_size (GstBaseTransform * base,
|
2005-08-24 14:08:58 +00:00
|
|
|
GstPadDirection direction, GstCaps * caps, guint size, GstCaps * othercaps,
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
guint * othersize)
|
|
|
|
{
|
2009-01-23 11:46:28 +00:00
|
|
|
GstLegacyresample *legacyresample = GST_LEGACYRESAMPLE (base);
|
2005-08-24 14:08:58 +00:00
|
|
|
ResampleState *state;
|
|
|
|
GstCaps *srccaps, *sinkcaps;
|
|
|
|
gboolean use_internal = FALSE; /* whether we use the internal state */
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
|
2007-03-14 17:16:30 +00:00
|
|
|
GST_LOG_OBJECT (base, "asked to transform size %d in direction %s",
|
2005-08-25 12:31:31 +00:00
|
|
|
size, direction == GST_PAD_SINK ? "SINK" : "SRC");
|
2005-08-24 14:08:58 +00:00
|
|
|
if (direction == GST_PAD_SINK) {
|
|
|
|
sinkcaps = caps;
|
|
|
|
srccaps = othercaps;
|
|
|
|
} else {
|
|
|
|
sinkcaps = othercaps;
|
|
|
|
srccaps = caps;
|
|
|
|
}
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
/* if the caps are the ones that _set_caps got called with; we can use
|
|
|
|
* our own state; otherwise we'll have to create a state */
|
2009-01-23 11:46:28 +00:00
|
|
|
if (gst_caps_is_equal (sinkcaps, legacyresample->sinkcaps) &&
|
|
|
|
gst_caps_is_equal (srccaps, legacyresample->srccaps)) {
|
2005-08-24 14:08:58 +00:00
|
|
|
use_internal = TRUE;
|
2009-01-23 11:46:28 +00:00
|
|
|
state = legacyresample->resample;
|
2005-08-24 14:08:58 +00:00
|
|
|
} else {
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_OBJECT (legacyresample,
|
2005-08-25 12:31:31 +00:00
|
|
|
"caps are not the set caps, creating state");
|
2005-08-24 14:08:58 +00:00
|
|
|
state = resample_new ();
|
2009-01-23 11:46:28 +00:00
|
|
|
resample_set_filter_length (state, legacyresample->filter_length);
|
2005-08-24 14:08:58 +00:00
|
|
|
resample_set_state_from_caps (state, sinkcaps, srccaps, NULL, NULL, NULL);
|
|
|
|
}
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
if (direction == GST_PAD_SINK) {
|
|
|
|
/* asked to convert size of an incoming buffer */
|
|
|
|
*othersize = resample_get_output_size_for_input (state, size);
|
|
|
|
} else {
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
/* asked to convert size of an outgoing buffer */
|
|
|
|
*othersize = resample_get_input_size_for_output (state, size);
|
2005-08-24 14:08:58 +00:00
|
|
|
}
|
2005-08-26 17:35:28 +00:00
|
|
|
g_assert (*othersize % state->sample_size == 0);
|
|
|
|
|
2005-08-25 12:31:31 +00:00
|
|
|
/* we make room for one extra sample, given that the resampling filter
|
|
|
|
* can output an extra one for non-integral i_rate/o_rate */
|
2007-03-14 17:16:30 +00:00
|
|
|
GST_LOG_OBJECT (base, "transformed size %d to %d", size, *othersize);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
if (!use_internal) {
|
|
|
|
resample_free (state);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2005-08-23 19:29:38 +00:00
|
|
|
}
|
|
|
|
|
2007-04-21 14:14:24 +00:00
|
|
|
static gboolean
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_set_caps (GstBaseTransform * base, GstCaps * incaps,
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
GstCaps * outcaps)
|
|
|
|
{
|
2005-08-24 14:08:58 +00:00
|
|
|
gboolean ret;
|
|
|
|
gint inrate, outrate;
|
|
|
|
int channels;
|
2009-01-23 11:46:28 +00:00
|
|
|
GstLegacyresample *legacyresample = GST_LEGACYRESAMPLE (base);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
GST_DEBUG_OBJECT (base, "incaps %" GST_PTR_FORMAT ", outcaps %"
|
|
|
|
GST_PTR_FORMAT, incaps, outcaps);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
ret = resample_set_state_from_caps (legacyresample->resample, incaps, outcaps,
|
2005-08-24 14:08:58 +00:00
|
|
|
&channels, &inrate, &outrate);
|
|
|
|
|
|
|
|
g_return_val_if_fail (ret, FALSE);
|
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->channels = channels;
|
|
|
|
GST_DEBUG_OBJECT (legacyresample, "set channels to %d", channels);
|
|
|
|
legacyresample->i_rate = inrate;
|
|
|
|
GST_DEBUG_OBJECT (legacyresample, "set i_rate to %d", inrate);
|
|
|
|
legacyresample->o_rate = outrate;
|
|
|
|
GST_DEBUG_OBJECT (legacyresample, "set o_rate to %d", outrate);
|
2005-08-24 14:08:58 +00:00
|
|
|
|
|
|
|
/* save caps so we can short-circuit in the size_transform if the caps
|
|
|
|
* are the same */
|
2009-01-23 11:46:28 +00:00
|
|
|
gst_caps_replace (&legacyresample->sinkcaps, incaps);
|
|
|
|
gst_caps_replace (&legacyresample->srccaps, outcaps);
|
2005-08-24 14:08:58 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2005-08-23 19:29:38 +00:00
|
|
|
}
|
|
|
|
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
static gboolean
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_event (GstBaseTransform * base, GstEvent * event)
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
{
|
2009-01-23 11:46:28 +00:00
|
|
|
GstLegacyresample *legacyresample;
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample = GST_LEGACYRESAMPLE (base);
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_FLUSH_START:
|
|
|
|
break;
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
2009-01-23 11:46:28 +00:00
|
|
|
if (legacyresample->resample)
|
|
|
|
resample_input_flush (legacyresample->resample);
|
|
|
|
legacyresample->ts_offset = -1;
|
|
|
|
legacyresample->next_ts = -1;
|
|
|
|
legacyresample->offset = -1;
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
break;
|
|
|
|
case GST_EVENT_NEWSEGMENT:
|
2009-01-23 11:46:28 +00:00
|
|
|
resample_input_pushthrough (legacyresample->resample);
|
|
|
|
legacyresample_pushthrough (legacyresample);
|
|
|
|
legacyresample->ts_offset = -1;
|
|
|
|
legacyresample->next_ts = -1;
|
|
|
|
legacyresample->offset = -1;
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
break;
|
|
|
|
case GST_EVENT_EOS:
|
2009-01-23 11:46:28 +00:00
|
|
|
resample_input_eos (legacyresample->resample);
|
|
|
|
legacyresample_pushthrough (legacyresample);
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2008-10-30 11:43:12 +00:00
|
|
|
return parent_class->event (base, event);
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
}
|
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
static GstFlowReturn
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_do_output (GstLegacyresample * legacyresample,
|
|
|
|
GstBuffer * outbuf)
|
2005-08-23 19:29:38 +00:00
|
|
|
{
|
|
|
|
int outsize;
|
2005-08-25 15:44:58 +00:00
|
|
|
int outsamples;
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
ResampleState *r;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
r = legacyresample->resample;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
|
|
|
outsize = resample_get_output_size (r);
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_LOG_OBJECT (legacyresample, "legacyresample can give me %d bytes",
|
|
|
|
outsize);
|
2005-08-25 12:31:31 +00:00
|
|
|
|
|
|
|
/* protect against mem corruption */
|
|
|
|
if (outsize > GST_BUFFER_SIZE (outbuf)) {
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_WARNING_OBJECT (legacyresample,
|
|
|
|
"overriding legacyresample's outsize %d with outbuffer's size %d",
|
2005-08-24 14:08:58 +00:00
|
|
|
outsize, GST_BUFFER_SIZE (outbuf));
|
|
|
|
outsize = GST_BUFFER_SIZE (outbuf);
|
2005-08-23 19:29:38 +00:00
|
|
|
}
|
2005-08-25 12:31:31 +00:00
|
|
|
/* catch possibly wrong size differences */
|
|
|
|
if (GST_BUFFER_SIZE (outbuf) - outsize > r->sample_size) {
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_WARNING_OBJECT (legacyresample,
|
|
|
|
"legacyresample's outsize %d too far from outbuffer's size %d",
|
2005-08-25 12:31:31 +00:00
|
|
|
outsize, GST_BUFFER_SIZE (outbuf));
|
|
|
|
}
|
2005-08-23 19:29:38 +00:00
|
|
|
|
|
|
|
outsize = resample_get_output_data (r, GST_BUFFER_DATA (outbuf), outsize);
|
2005-08-25 15:44:58 +00:00
|
|
|
outsamples = outsize / r->sample_size;
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_LOG_OBJECT (legacyresample, "resample gave me %d bytes or %d samples",
|
2005-08-25 15:44:58 +00:00
|
|
|
outsize, outsamples);
|
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_BUFFER_OFFSET (outbuf) = legacyresample->offset;
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = legacyresample->next_ts;
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
if (legacyresample->ts_offset != -1) {
|
|
|
|
legacyresample->offset += outsamples;
|
|
|
|
legacyresample->ts_offset += outsamples;
|
|
|
|
legacyresample->next_ts =
|
|
|
|
gst_util_uint64_scale_int (legacyresample->ts_offset, GST_SECOND,
|
|
|
|
legacyresample->o_rate);
|
|
|
|
GST_BUFFER_OFFSET_END (outbuf) = legacyresample->offset;
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
|
|
|
/* we calculate DURATION as the difference between "next" timestamp
|
|
|
|
* and current timestamp so we ensure a contiguous stream, instead of
|
|
|
|
* having rounding errors. */
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_BUFFER_DURATION (outbuf) = legacyresample->next_ts -
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (outbuf);
|
|
|
|
} else {
|
|
|
|
/* no valid offset know, we can still sortof calculate the duration though */
|
|
|
|
GST_BUFFER_DURATION (outbuf) =
|
|
|
|
gst_util_uint64_scale_int (outsamples, GST_SECOND,
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->o_rate);
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
}
|
2005-08-25 17:20:02 +00:00
|
|
|
|
2005-08-25 12:31:31 +00:00
|
|
|
/* check for possible mem corruption */
|
|
|
|
if (outsize > GST_BUFFER_SIZE (outbuf)) {
|
|
|
|
/* this is an error that when it happens, would need fixing in the
|
2007-03-14 14:09:21 +00:00
|
|
|
* resample library; we told it we wanted only GST_BUFFER_SIZE (outbuf),
|
|
|
|
* and it gave us more ! */
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_WARNING_OBJECT (legacyresample,
|
|
|
|
"legacyresample, you memory corrupting bastard. "
|
2005-08-25 12:31:31 +00:00
|
|
|
"you gave me outsize %d while my buffer was size %d",
|
|
|
|
outsize, GST_BUFFER_SIZE (outbuf));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
/* catch possibly wrong size differences */
|
|
|
|
if (GST_BUFFER_SIZE (outbuf) - outsize > r->sample_size) {
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_WARNING_OBJECT (legacyresample,
|
|
|
|
"legacyresample's written outsize %d too far from outbuffer's size %d",
|
2005-08-24 14:08:58 +00:00
|
|
|
outsize, GST_BUFFER_SIZE (outbuf));
|
|
|
|
}
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
GST_BUFFER_SIZE (outbuf) = outsize;
|
2005-08-24 14:08:58 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
if (G_UNLIKELY (legacyresample->need_discont)) {
|
|
|
|
GST_DEBUG_OBJECT (legacyresample,
|
2007-03-14 17:16:30 +00:00
|
|
|
"marking this buffer with the DISCONT flag");
|
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->need_discont = FALSE;
|
2007-03-14 17:16:30 +00:00
|
|
|
}
|
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_LOG_OBJECT (legacyresample, "transformed to buffer of %d bytes, ts %"
|
2007-03-14 14:09:21 +00:00
|
|
|
GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT ", offset %"
|
|
|
|
G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT,
|
|
|
|
outsize, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)),
|
|
|
|
GST_BUFFER_OFFSET (outbuf), GST_BUFFER_OFFSET_END (outbuf));
|
|
|
|
|
|
|
|
|
2005-08-24 14:08:58 +00:00
|
|
|
return GST_FLOW_OK;
|
2005-08-23 19:29:38 +00:00
|
|
|
}
|
|
|
|
|
2007-03-15 10:52:21 +00:00
|
|
|
static gboolean
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_check_discont (GstLegacyresample * legacyresample,
|
2007-03-15 10:52:21 +00:00
|
|
|
GstClockTime timestamp)
|
|
|
|
{
|
|
|
|
if (timestamp != GST_CLOCK_TIME_NONE &&
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->prev_ts != GST_CLOCK_TIME_NONE &&
|
|
|
|
legacyresample->prev_duration != GST_CLOCK_TIME_NONE &&
|
|
|
|
timestamp != legacyresample->prev_ts + legacyresample->prev_duration) {
|
2007-03-15 10:52:21 +00:00
|
|
|
/* Potentially a discontinuous buffer. However, it turns out that many
|
|
|
|
* elements generate imperfect streams due to rounding errors, so we permit
|
|
|
|
* a small error (up to one sample) without triggering a filter
|
|
|
|
* flush/restart (if triggered incorrectly, this will be audible) */
|
|
|
|
GstClockTimeDiff diff = timestamp -
|
2009-01-23 11:46:28 +00:00
|
|
|
(legacyresample->prev_ts + legacyresample->prev_duration);
|
2007-03-15 10:52:21 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
if (ABS (diff) > GST_SECOND / legacyresample->i_rate) {
|
|
|
|
GST_WARNING_OBJECT (legacyresample,
|
2007-03-15 10:52:21 +00:00
|
|
|
"encountered timestamp discontinuity of %" G_GINT64_FORMAT, diff);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
static GstFlowReturn
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_transform (GstBaseTransform * base, GstBuffer * inbuf,
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
GstBuffer * outbuf)
|
|
|
|
{
|
2009-01-23 11:46:28 +00:00
|
|
|
GstLegacyresample *legacyresample;
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
ResampleState *r;
|
2005-12-15 10:30:14 +00:00
|
|
|
guchar *data, *datacopy;
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
gulong size;
|
|
|
|
GstClockTime timestamp;
|
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample = GST_LEGACYRESAMPLE (base);
|
|
|
|
r = legacyresample->resample;
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
|
|
|
data = GST_BUFFER_DATA (inbuf);
|
|
|
|
size = GST_BUFFER_SIZE (inbuf);
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (inbuf);
|
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_LOG_OBJECT (legacyresample, "transforming buffer of %ld bytes, ts %"
|
2007-03-14 14:09:21 +00:00
|
|
|
GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT ", offset %"
|
|
|
|
G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT,
|
|
|
|
size, GST_TIME_ARGS (timestamp),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (inbuf)),
|
|
|
|
GST_BUFFER_OFFSET (inbuf), GST_BUFFER_OFFSET_END (inbuf));
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
2007-03-14 17:16:30 +00:00
|
|
|
/* check for timestamp discontinuities and flush/reset if needed */
|
2009-01-23 11:46:28 +00:00
|
|
|
if (G_UNLIKELY (legacyresample_check_discont (legacyresample, timestamp))) {
|
2007-03-15 10:52:21 +00:00
|
|
|
/* Flush internal samples */
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_pushthrough (legacyresample);
|
2007-03-15 10:52:21 +00:00
|
|
|
/* Inform downstream element about discontinuity */
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->need_discont = TRUE;
|
2007-03-15 10:52:21 +00:00
|
|
|
/* We want to recalculate the offset */
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->ts_offset = -1;
|
2007-03-14 17:16:30 +00:00
|
|
|
}
|
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
if (legacyresample->ts_offset == -1) {
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
/* if we don't know the initial offset yet, calculate it based on the
|
|
|
|
* input timestamp. */
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
|
|
|
GstClockTime stime;
|
|
|
|
|
2007-03-14 14:09:21 +00:00
|
|
|
/* offset used to calculate the timestamps. We use the sample offset for
|
|
|
|
* this to make it more accurate. We want the first buffer to have the
|
|
|
|
* same timestamp as the incoming timestamp. */
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->next_ts = timestamp;
|
|
|
|
legacyresample->ts_offset =
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
gst_util_uint64_scale_int (timestamp, r->o_rate, GST_SECOND);
|
2007-03-14 14:09:21 +00:00
|
|
|
/* offset used to set as the buffer offset, this offset is always
|
|
|
|
* relative to the stream time, note that timestamp is not... */
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
stime = (timestamp - base->segment.start) + base->segment.time;
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->offset =
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
gst_util_uint64_scale_int (stime, r->o_rate, GST_SECOND);
|
|
|
|
}
|
|
|
|
}
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->prev_ts = timestamp;
|
|
|
|
legacyresample->prev_duration = GST_BUFFER_DURATION (inbuf);
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
|
|
|
/* need to memdup, resample takes ownership. */
|
2005-12-15 10:30:14 +00:00
|
|
|
datacopy = g_memdup (data, size);
|
|
|
|
resample_add_input_data (r, datacopy, size, g_free, datacopy);
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
return legacyresample_do_output (legacyresample, outbuf);
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* push remaining data in the buffers out */
|
|
|
|
static GstFlowReturn
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_pushthrough (GstLegacyresample * legacyresample)
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
{
|
|
|
|
int outsize;
|
|
|
|
ResampleState *r;
|
|
|
|
GstBuffer *outbuf;
|
|
|
|
GstFlowReturn res = GST_FLOW_OK;
|
|
|
|
GstBaseTransform *trans;
|
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
r = legacyresample->resample;
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
|
|
|
outsize = resample_get_output_size (r);
|
2007-03-14 17:16:30 +00:00
|
|
|
if (outsize == 0) {
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_DEBUG_OBJECT (legacyresample, "no internal buffers needing flush");
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
goto done;
|
2007-03-14 17:16:30 +00:00
|
|
|
}
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
trans = GST_BASE_TRANSFORM (legacyresample);
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
2007-03-14 17:16:30 +00:00
|
|
|
res = gst_pad_alloc_buffer (trans->srcpad, GST_BUFFER_OFFSET_NONE, outsize,
|
|
|
|
GST_PAD_CAPS (trans->srcpad), &outbuf);
|
|
|
|
if (G_UNLIKELY (res != GST_FLOW_OK)) {
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_WARNING_OBJECT (legacyresample, "failed allocating buffer of %d bytes",
|
2007-03-14 17:16:30 +00:00
|
|
|
outsize);
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
goto done;
|
2007-03-14 17:16:30 +00:00
|
|
|
}
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
res = legacyresample_do_output (legacyresample, outbuf);
|
2007-03-14 17:16:30 +00:00
|
|
|
if (G_UNLIKELY (res != GST_FLOW_OK))
|
|
|
|
goto done;
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
|
|
|
res = gst_pad_push (trans->srcpad, outbuf);
|
|
|
|
|
|
|
|
done:
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2007-11-23 10:21:11 +00:00
|
|
|
static gboolean
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_query (GstPad * pad, GstQuery * query)
|
2007-11-23 10:21:11 +00:00
|
|
|
{
|
2009-01-23 11:46:28 +00:00
|
|
|
GstLegacyresample *legacyresample =
|
|
|
|
GST_LEGACYRESAMPLE (gst_pad_get_parent (pad));
|
|
|
|
GstBaseTransform *trans = GST_BASE_TRANSFORM (legacyresample);
|
2007-11-23 10:21:11 +00:00
|
|
|
gboolean res = TRUE;
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_LATENCY:
|
|
|
|
{
|
|
|
|
GstClockTime min, max;
|
|
|
|
gboolean live;
|
|
|
|
guint64 latency;
|
|
|
|
GstPad *peer;
|
2009-01-23 11:46:28 +00:00
|
|
|
gint rate = legacyresample->i_rate;
|
|
|
|
gint resampler_latency = legacyresample->filter_length / 2;
|
2007-11-23 10:21:11 +00:00
|
|
|
|
|
|
|
if (gst_base_transform_is_passthrough (trans))
|
|
|
|
resampler_latency = 0;
|
|
|
|
|
|
|
|
if ((peer = gst_pad_get_peer (trans->sinkpad))) {
|
|
|
|
if ((res = gst_pad_query (peer, query))) {
|
|
|
|
gst_query_parse_latency (query, &live, &min, &max);
|
|
|
|
|
|
|
|
GST_DEBUG ("Peer latency: min %"
|
|
|
|
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (min), GST_TIME_ARGS (max));
|
|
|
|
|
|
|
|
/* add our own latency */
|
|
|
|
if (rate != 0 && resampler_latency != 0)
|
|
|
|
latency =
|
|
|
|
gst_util_uint64_scale (resampler_latency, GST_SECOND, rate);
|
|
|
|
else
|
|
|
|
latency = 0;
|
|
|
|
|
|
|
|
GST_DEBUG ("Our latency: %" GST_TIME_FORMAT, GST_TIME_ARGS (latency));
|
|
|
|
|
|
|
|
min += latency;
|
|
|
|
if (max != GST_CLOCK_TIME_NONE)
|
|
|
|
max += latency;
|
|
|
|
|
|
|
|
GST_DEBUG ("Calculated total latency : min %"
|
|
|
|
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (min), GST_TIME_ARGS (max));
|
|
|
|
|
|
|
|
gst_query_set_latency (query, live, min, max);
|
|
|
|
}
|
|
|
|
gst_object_unref (peer);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = gst_pad_query_default (pad, query);
|
|
|
|
break;
|
|
|
|
}
|
2009-01-23 11:46:28 +00:00
|
|
|
gst_object_unref (legacyresample);
|
2007-11-23 10:21:11 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GstQueryType *
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample_query_type (GstPad * pad)
|
2007-11-23 10:21:11 +00:00
|
|
|
{
|
|
|
|
static const GstQueryType types[] = {
|
|
|
|
GST_QUERY_LATENCY,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
return types;
|
|
|
|
}
|
gst/audioresample/: Fix audioresample, seek torture, new segments, reverse negotiation etc.. work fine.
Original commit message from CVS:
* gst/audioresample/buffer.c: (audioresample_buffer_queue_flush):
* gst/audioresample/buffer.h:
* gst/audioresample/gstaudioresample.c:
* gst/audioresample/gstaudioresample.h:
* gst/audioresample/resample.c: (resample_input_flush),
(resample_input_pushthrough), (resample_input_eos),
(resample_get_output_size_for_input),
(resample_get_input_size_for_output), (resample_get_output_size),
(resample_get_output_data):
* gst/audioresample/resample.h:
* gst/audioresample/resample_ref.c: (resample_scale_ref):
Fix audioresample, seek torture, new segments, reverse negotiation
etc.. work fine.
2005-12-02 11:34:50 +00:00
|
|
|
|
2005-08-23 19:29:38 +00:00
|
|
|
static void
|
2009-01-23 11:46:28 +00:00
|
|
|
gst_legacyresample_set_property (GObject * object, guint prop_id,
|
2005-08-23 19:29:38 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2009-01-23 11:46:28 +00:00
|
|
|
GstLegacyresample *legacyresample;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample = GST_LEGACYRESAMPLE (object);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
case PROP_FILTERLEN:
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample->filter_length = g_value_get_int (value);
|
|
|
|
GST_DEBUG_OBJECT (GST_ELEMENT (legacyresample), "new filter length %d",
|
|
|
|
legacyresample->filter_length);
|
|
|
|
if (legacyresample->resample) {
|
|
|
|
resample_set_filter_length (legacyresample->resample,
|
|
|
|
legacyresample->filter_length);
|
|
|
|
gst_element_post_message (GST_ELEMENT (legacyresample),
|
|
|
|
gst_message_new_latency (GST_OBJECT (legacyresample)));
|
2006-06-16 15:17:44 +00:00
|
|
|
}
|
2005-08-23 19:29:38 +00:00
|
|
|
break;
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2005-08-23 19:29:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-01-23 11:46:28 +00:00
|
|
|
gst_legacyresample_get_property (GObject * object, guint prop_id,
|
2005-08-23 19:29:38 +00:00
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2009-01-23 11:46:28 +00:00
|
|
|
GstLegacyresample *legacyresample;
|
2005-08-23 19:29:38 +00:00
|
|
|
|
2009-01-23 11:46:28 +00:00
|
|
|
legacyresample = GST_LEGACYRESAMPLE (object);
|
2005-08-23 19:29:38 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
case PROP_FILTERLEN:
|
2009-01-23 11:46:28 +00:00
|
|
|
g_value_set_int (value, legacyresample->filter_length);
|
2005-08-23 19:29:38 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
docs/plugins/: Add audioresample to docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
Add audioresample to docs.
* gst/audioconvert/gstaudioconvert.c:
Add revision date.
* gst/audioresample/gstaudioresample.c:
(gst_audioresample_base_init), (gst_audioresample_class_init),
(gst_audioresample_init), (gst_audioresample_dispose),
(audioresample_get_unit_size), (audioresample_transform_caps),
(resample_set_state_from_caps), (audioresample_transform_size),
(audioresample_set_caps), (audioresample_event),
(audioresample_do_output), (audioresample_transform),
(audioresample_pushthrough), (gst_audioresample_set_property),
(gst_audioresample_get_property), (plugin_init):
* gst/audioresample/gstaudioresample.h:
Added docs.
Small code cleanups.
2006-03-02 18:23:55 +00:00
|
|
|
static gboolean
|
|
|
|
plugin_init (GstPlugin * plugin)
|
2005-08-23 19:29:38 +00:00
|
|
|
{
|
|
|
|
resample_init ();
|
|
|
|
|
2008-11-27 16:58:31 +00:00
|
|
|
if (!gst_element_register (plugin, "legacyresample", GST_RANK_MARGINAL,
|
2009-01-23 11:46:28 +00:00
|
|
|
GST_TYPE_LEGACYRESAMPLE)) {
|
2005-08-23 19:29:38 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
2008-11-27 16:58:31 +00:00
|
|
|
"legacyresample",
|
2005-10-16 13:54:38 +00:00
|
|
|
"Resamples audio", plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME,
|
|
|
|
GST_PACKAGE_ORIGIN);
|