CLEANFILES = $(BUILT_SOURCES)
+# FIXME 0.11: rename GstBaseAudioSink to GstAudioBaseSink or merge with GstAudioSink
libgstaudio_@GST_MAJORMINOR@_la_SOURCES = \
audio.c \
gstringbuffer.c \
gstaudioclock.c \
mixerutils.c \
multichannel.c \
- gstbaseaudiodecoder.c \
- gstbaseaudioencoder.c \
+ gstaudiodecoder.c \
+ gstaudioencoder.c \
gstbaseaudiosink.c \
gstbaseaudiosrc.c \
gstaudiofilter.c \
gstringbuffer.h \
gstaudioclock.h \
gstaudiofilter.h \
- gstbaseaudiodecoder.h \
- gstbaseaudioencoder.h \
+ gstaudiodecoder.h \
+ gstaudioencoder.h \
gstbaseaudiosink.h \
gstbaseaudiosrc.h \
gstaudiosink.h \
*/
/**
- * SECTION:gstbaseaudiodecoder
+ * SECTION:gstaudiodecoder
* @short_description: Base class for audio decoders
* @see_also: #GstBaseTransform
* @since: 0.10.36
* This base class is for audio decoders turning encoded data into
* raw audio samples.
*
- * GstBaseAudioDecoder and subclass should cooperate as follows.
+ * GstAudioDecoder and subclass should cooperate as follows.
* <orderedlist>
* <listitem>
* <itemizedlist><title>Configuration</title>
* <listitem><para>
- * Initially, GstBaseAudioDecoder calls @start when the decoder element
+ * Initially, GstAudioDecoder calls @start when the decoder element
* is activated, which allows subclass to perform any global setup.
* Base class (context) parameters can already be set according to subclass
* capabilities (or possibly upon receive more information in subsequent
* @set_format).
* </para></listitem>
* <listitem><para>
- * GstBaseAudioDecoder calls @set_format to inform subclass of the format
+ * GstAudioDecoder calls @set_format to inform subclass of the format
* of input audio data that it is about to receive.
* While unlikely, it might be called more than once, if changing input
* parameters require reconfiguration.
* </para></listitem>
* <listitem><para>
- * GstBaseAudioDecoder calls @stop at end of all processing.
+ * GstAudioDecoder calls @stop at end of all processing.
* </para></listitem>
* </itemizedlist>
* </listitem>
- * As of configuration stage, and throughout processing, GstBaseAudioDecoder
+ * As of configuration stage, and throughout processing, GstAudioDecoder
* provides various (context) parameters, e.g. describing the format of
* output audio data (valid when output caps have been caps) or current parsing state.
* Conversely, subclass can and should configure context to inform
* </para></listitem>
* <listitem><para>
* If codec processing results in decoded data, subclass should call
- * @gst_base_audio_decoder_finish_frame to have decoded data pushed
+ * @gst_audio_decoder_finish_frame to have decoded data pushed
* downstream.
* </para></listitem>
* <listitem><para>
* setting src pad caps.
* </para></listitem>
* <listitem><para>
- * During the parsing process GstBaseAudioDecoderClass will handle both
+ * During the parsing process GstAudioDecoderClass will handle both
* srcpad and sinkpad events. Sink events will be passed to subclass
* if @event callback has been provided.
* </para></listitem>
* <listitem>
* <itemizedlist><title>Shutdown phase</title>
* <listitem><para>
- * GstBaseAudioDecoder class calls @stop to inform the subclass that data
+ * GstAudioDecoder class calls @stop to inform the subclass that data
* parsing will be stopped.
* </para></listitem>
* </itemizedlist>
* source and sink pads. The pads need to be named "sink" and "src". It also
* needs to set the fixed caps on srcpad, when the format is ensured. This
* is typically when base class calls subclass' @set_format function, though
- * it might be delayed until calling @gst_base_audio_decoder_finish_frame.
+ * it might be delayed until calling @gst_audio_decoder_finish_frame.
*
* In summary, above process should have subclass concentrating on
* codec data processing while leaving other matters to base class,
* In particular, base class will try to arrange for perfect output timestamps
* as much as possible while tracking upstream timestamps.
* To this end, if deviation between the next ideal expected perfect timestamp
- * and upstream exceeds #GstBaseAudioDecoder:tolerance, then resync to upstream
+ * and upstream exceeds #GstAudioDecoder:tolerance, then resync to upstream
* occurs (which would happen always if the tolerance mechanism is disabled).
*
* In non-live pipelines, baseclass can also (configurably) arrange for
* </para></listitem>
* <listitem><para>
* Accept data in @handle_frame and provide encoded results to
- * @gst_base_audio_decoder_finish_frame. If it is prepared to perform
+ * @gst_audio_decoder_finish_frame. If it is prepared to perform
* PLC, it should also accept NULL data in @handle_frame and provide for
* data for indicated duration.
* </para></listitem>
#endif
#define GST_USE_UNSTABLE_API
-#include "gstbaseaudiodecoder.h"
+#include "gstaudiodecoder.h"
#include <gst/pbutils/descriptions.h>
#include <string.h>
-GST_DEBUG_CATEGORY (baseaudiodecoder_debug);
-#define GST_CAT_DEFAULT baseaudiodecoder_debug
+GST_DEBUG_CATEGORY (audiodecoder_debug);
+#define GST_CAT_DEFAULT audiodecoder_debug
-#define GST_BASE_AUDIO_DECODER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_AUDIO_DECODER, \
- GstBaseAudioDecoderPrivate))
+#define GST_AUDIO_DECODER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_AUDIO_DECODER, \
+ GstAudioDecoderPrivate))
enum
{
#define DEFAULT_TOLERANCE 0
#define DEFAULT_PLC FALSE
-typedef struct _GstBaseAudioDecoderContext
+typedef struct _GstAudioDecoderContext
{
/* input */
/* (output) audio format */
/* MT-protected (with LOCK) */
GstClockTime min_latency;
GstClockTime max_latency;
-} GstBaseAudioDecoderContext;
+} GstAudioDecoderContext;
-struct _GstBaseAudioDecoderPrivate
+struct _GstAudioDecoderPrivate
{
/* activation status */
gboolean active;
GList *queued;
/* context storage */
- GstBaseAudioDecoderContext ctx;
+ GstAudioDecoderContext ctx;
/* properties */
GstClockTime latency;
};
-static void gst_base_audio_decoder_finalize (GObject * object);
-static void gst_base_audio_decoder_set_property (GObject * object,
+static void gst_audio_decoder_finalize (GObject * object);
+static void gst_audio_decoder_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_base_audio_decoder_get_property (GObject * object,
+static void gst_audio_decoder_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
-static void gst_base_audio_decoder_clear_queues (GstBaseAudioDecoder * dec);
-static GstFlowReturn gst_base_audio_decoder_chain_reverse (GstBaseAudioDecoder *
+static void gst_audio_decoder_clear_queues (GstAudioDecoder * dec);
+static GstFlowReturn gst_audio_decoder_chain_reverse (GstAudioDecoder *
dec, GstBuffer * buf);
-static GstStateChangeReturn gst_base_audio_decoder_change_state (GstElement *
+static GstStateChangeReturn gst_audio_decoder_change_state (GstElement *
element, GstStateChange transition);
-static gboolean gst_base_audio_decoder_sink_event (GstPad * pad,
- GstEvent * event);
-static gboolean gst_base_audio_decoder_src_event (GstPad * pad,
- GstEvent * event);
-static gboolean gst_base_audio_decoder_sink_setcaps (GstPad * pad,
- GstCaps * caps);
-static gboolean gst_base_audio_decoder_src_setcaps (GstPad * pad,
- GstCaps * caps);
-static GstFlowReturn gst_base_audio_decoder_chain (GstPad * pad,
- GstBuffer * buf);
-static gboolean gst_base_audio_decoder_src_query (GstPad * pad,
- GstQuery * query);
-static gboolean gst_base_audio_decoder_sink_query (GstPad * pad,
- GstQuery * query);
-static const GstQueryType *gst_base_audio_decoder_get_query_types (GstPad *
- pad);
-static void gst_base_audio_decoder_reset (GstBaseAudioDecoder * dec,
- gboolean full);
-
-
-GST_BOILERPLATE (GstBaseAudioDecoder, gst_base_audio_decoder, GstElement,
+static gboolean gst_audio_decoder_sink_event (GstPad * pad, GstEvent * event);
+static gboolean gst_audio_decoder_src_event (GstPad * pad, GstEvent * event);
+static gboolean gst_audio_decoder_sink_setcaps (GstPad * pad, GstCaps * caps);
+static gboolean gst_audio_decoder_src_setcaps (GstPad * pad, GstCaps * caps);
+static GstFlowReturn gst_audio_decoder_chain (GstPad * pad, GstBuffer * buf);
+static gboolean gst_audio_decoder_src_query (GstPad * pad, GstQuery * query);
+static gboolean gst_audio_decoder_sink_query (GstPad * pad, GstQuery * query);
+static const GstQueryType *gst_audio_decoder_get_query_types (GstPad * pad);
+static void gst_audio_decoder_reset (GstAudioDecoder * dec, gboolean full);
+
+
+GST_BOILERPLATE (GstAudioDecoder, gst_audio_decoder, GstElement,
GST_TYPE_ELEMENT);
static void
-gst_base_audio_decoder_base_init (gpointer g_class)
+gst_audio_decoder_base_init (gpointer g_class)
{
}
static void
-gst_base_audio_decoder_class_init (GstBaseAudioDecoderClass * klass)
+gst_audio_decoder_class_init (GstAudioDecoderClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (GstBaseAudioDecoderPrivate));
+ g_type_class_add_private (klass, sizeof (GstAudioDecoderPrivate));
- GST_DEBUG_CATEGORY_INIT (baseaudiodecoder_debug, "baseaudiodecoder", 0,
- "baseaudiodecoder element");
+ GST_DEBUG_CATEGORY_INIT (audiodecoder_debug, "audiodecoder", 0,
+ "audio decoder base class");
- gobject_class->set_property = gst_base_audio_decoder_set_property;
- gobject_class->get_property = gst_base_audio_decoder_get_property;
- gobject_class->finalize = gst_base_audio_decoder_finalize;
+ gobject_class->set_property = gst_audio_decoder_set_property;
+ gobject_class->get_property = gst_audio_decoder_get_property;
+ gobject_class->finalize = gst_audio_decoder_finalize;
- element_class->change_state = gst_base_audio_decoder_change_state;
+ element_class->change_state = gst_audio_decoder_change_state;
/* Properties */
g_object_class_install_property (gobject_class, PROP_LATENCY,
}
static void
-gst_base_audio_decoder_init (GstBaseAudioDecoder * dec,
- GstBaseAudioDecoderClass * klass)
+gst_audio_decoder_init (GstAudioDecoder * dec, GstAudioDecoderClass * klass)
{
GstPadTemplate *pad_template;
- GST_DEBUG_OBJECT (dec, "gst_base_audio_decoder_init");
+ GST_DEBUG_OBJECT (dec, "gst_audio_decoder_init");
- dec->priv = GST_BASE_AUDIO_DECODER_GET_PRIVATE (dec);
+ dec->priv = GST_AUDIO_DECODER_GET_PRIVATE (dec);
/* Setup sink pad */
pad_template =
dec->sinkpad = gst_pad_new_from_template (pad_template, "sink");
gst_pad_set_event_function (dec->sinkpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_decoder_sink_event));
+ GST_DEBUG_FUNCPTR (gst_audio_decoder_sink_event));
gst_pad_set_setcaps_function (dec->sinkpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_decoder_sink_setcaps));
+ GST_DEBUG_FUNCPTR (gst_audio_decoder_sink_setcaps));
gst_pad_set_chain_function (dec->sinkpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_decoder_chain));
+ GST_DEBUG_FUNCPTR (gst_audio_decoder_chain));
gst_pad_set_query_function (dec->sinkpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_decoder_sink_query));
+ GST_DEBUG_FUNCPTR (gst_audio_decoder_sink_query));
gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
GST_DEBUG_OBJECT (dec, "sinkpad created");
dec->srcpad = gst_pad_new_from_template (pad_template, "src");
gst_pad_set_setcaps_function (dec->srcpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_decoder_src_setcaps));
+ GST_DEBUG_FUNCPTR (gst_audio_decoder_src_setcaps));
gst_pad_set_event_function (dec->srcpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_decoder_src_event));
+ GST_DEBUG_FUNCPTR (gst_audio_decoder_src_event));
gst_pad_set_query_function (dec->srcpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_decoder_src_query));
+ GST_DEBUG_FUNCPTR (gst_audio_decoder_src_query));
gst_pad_set_query_type_function (dec->srcpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_decoder_get_query_types));
+ GST_DEBUG_FUNCPTR (gst_audio_decoder_get_query_types));
gst_pad_use_fixed_caps (dec->srcpad);
gst_element_add_pad (GST_ELEMENT (dec), dec->srcpad);
GST_DEBUG_OBJECT (dec, "srcpad created");
dec->priv->plc = DEFAULT_PLC;
/* init state */
- gst_base_audio_decoder_reset (dec, TRUE);
+ gst_audio_decoder_reset (dec, TRUE);
GST_DEBUG_OBJECT (dec, "init ok");
}
static void
-gst_base_audio_decoder_reset (GstBaseAudioDecoder * dec, gboolean full)
+gst_audio_decoder_reset (GstAudioDecoder * dec, gboolean full)
{
- GST_DEBUG_OBJECT (dec, "gst_base_audio_decoder_reset");
+ GST_DEBUG_OBJECT (dec, "gst_audio_decoder_reset");
GST_OBJECT_LOCK (dec);
dec->priv->samples_out = 0;
dec->priv->agg = -1;
dec->priv->error_count = 0;
- gst_base_audio_decoder_clear_queues (dec);
+ gst_audio_decoder_clear_queues (dec);
gst_audio_info_clear (&dec->priv->ctx.info);
memset (&dec->priv->ctx, 0, sizeof (dec->priv->ctx));
}
static void
-gst_base_audio_decoder_finalize (GObject * object)
+gst_audio_decoder_finalize (GObject * object)
{
- GstBaseAudioDecoder *dec;
+ GstAudioDecoder *dec;
- g_return_if_fail (GST_IS_BASE_AUDIO_DECODER (object));
- dec = GST_BASE_AUDIO_DECODER (object);
+ g_return_if_fail (GST_IS_AUDIO_DECODER (object));
+ dec = GST_AUDIO_DECODER (object);
if (dec->priv->adapter) {
g_object_unref (dec->priv->adapter);
/* automagically perform sanity checking of src caps;
* also extracts output data format */
static gboolean
-gst_base_audio_decoder_src_setcaps (GstPad * pad, GstCaps * caps)
+gst_audio_decoder_src_setcaps (GstPad * pad, GstCaps * caps)
{
- GstBaseAudioDecoder *dec;
+ GstAudioDecoder *dec;
gboolean res = TRUE;
guint old_rate;
- dec = GST_BASE_AUDIO_DECODER (gst_pad_get_parent (pad));
+ dec = GST_AUDIO_DECODER (gst_pad_get_parent (pad));
GST_DEBUG_OBJECT (dec, "setting src caps %" GST_PTR_FORMAT, caps);
}
static gboolean
-gst_base_audio_decoder_sink_setcaps (GstPad * pad, GstCaps * caps)
+gst_audio_decoder_sink_setcaps (GstPad * pad, GstCaps * caps)
{
- GstBaseAudioDecoder *dec;
- GstBaseAudioDecoderClass *klass;
+ GstAudioDecoder *dec;
+ GstAudioDecoderClass *klass;
gboolean res = TRUE;
- dec = GST_BASE_AUDIO_DECODER (gst_pad_get_parent (pad));
- klass = GST_BASE_AUDIO_DECODER_GET_CLASS (dec);
+ dec = GST_AUDIO_DECODER (gst_pad_get_parent (pad));
+ klass = GST_AUDIO_DECODER_GET_CLASS (dec);
GST_DEBUG_OBJECT (dec, "caps: %" GST_PTR_FORMAT, caps);
}
static void
-gst_base_audio_decoder_setup (GstBaseAudioDecoder * dec)
+gst_audio_decoder_setup (GstAudioDecoder * dec)
{
GstQuery *query;
gboolean res;
/* mini aggregator combining output buffers into fewer larger ones,
* if so allowed/configured */
static GstFlowReturn
-gst_base_audio_decoder_output (GstBaseAudioDecoder * dec, GstBuffer * buf)
+gst_audio_decoder_output (GstAudioDecoder * dec, GstBuffer * buf)
{
- GstBaseAudioDecoderClass *klass;
- GstBaseAudioDecoderPrivate *priv;
- GstBaseAudioDecoderContext *ctx;
+ GstAudioDecoderClass *klass;
+ GstAudioDecoderPrivate *priv;
+ GstAudioDecoderContext *ctx;
GstFlowReturn ret = GST_FLOW_OK;
GstBuffer *inbuf = NULL;
- klass = GST_BASE_AUDIO_DECODER_GET_CLASS (dec);
+ klass = GST_AUDIO_DECODER_GET_CLASS (dec);
priv = dec->priv;
ctx = &dec->priv->ctx;
if (G_UNLIKELY (priv->agg < 0))
- gst_base_audio_decoder_setup (dec);
+ gst_audio_decoder_setup (dec);
if (G_LIKELY (buf)) {
g_return_val_if_fail (ctx->info.bpf != 0, GST_FLOW_ERROR);
}
GstFlowReturn
-gst_base_audio_decoder_finish_frame (GstBaseAudioDecoder * dec, GstBuffer * buf,
+gst_audio_decoder_finish_frame (GstAudioDecoder * dec, GstBuffer * buf,
gint frames)
{
- GstBaseAudioDecoderPrivate *priv;
- GstBaseAudioDecoderContext *ctx;
+ GstAudioDecoderPrivate *priv;
+ GstAudioDecoderContext *ctx;
gint samples = 0;
GstClockTime ts, next_ts;
dec->priv->error_count--;
exit:
- return gst_base_audio_decoder_output (dec, buf);
+ return gst_audio_decoder_output (dec, buf);
/* ERRORS */
wrong_buffer:
}
static GstFlowReturn
-gst_base_audio_decoder_handle_frame (GstBaseAudioDecoder * dec,
- GstBaseAudioDecoderClass * klass, GstBuffer * buffer)
+gst_audio_decoder_handle_frame (GstAudioDecoder * dec,
+ GstAudioDecoderClass * klass, GstBuffer * buffer)
{
if (G_LIKELY (buffer)) {
/* keep around for admin */
/* maybe subclass configurable instead, but this allows for a whole lot of
* raw samples, so at least quite some encoded ... */
-#define GST_BASE_AUDIO_DECODER_MAX_SYNC 10 * 8 * 2 * 1024
+#define GST_AUDIO_DECODER_MAX_SYNC 10 * 8 * 2 * 1024
static GstFlowReturn
-gst_base_audio_decoder_push_buffers (GstBaseAudioDecoder * dec, gboolean force)
+gst_audio_decoder_push_buffers (GstAudioDecoder * dec, gboolean force)
{
- GstBaseAudioDecoderClass *klass;
- GstBaseAudioDecoderPrivate *priv;
- GstBaseAudioDecoderContext *ctx;
+ GstAudioDecoderClass *klass;
+ GstAudioDecoderPrivate *priv;
+ GstAudioDecoderContext *ctx;
GstFlowReturn ret = GST_FLOW_OK;
GstBuffer *buffer;
gint av, flush;
- klass = GST_BASE_AUDIO_DECODER_GET_CLASS (dec);
+ klass = GST_AUDIO_DECODER_GET_CLASS (dec);
priv = dec->priv;
ctx = &dec->priv->ctx;
flush = offset;
/* avoid parsing indefinitely */
priv->sync_flush += offset;
- if (priv->sync_flush > GST_BASE_AUDIO_DECODER_MAX_SYNC)
+ if (priv->sync_flush > GST_AUDIO_DECODER_MAX_SYNC)
goto parse_failed;
}
buffer = NULL;
}
- ret = gst_base_audio_decoder_handle_frame (dec, klass, buffer);
+ ret = gst_audio_decoder_handle_frame (dec, klass, buffer);
/* do not keep pushing it ... */
if (G_UNLIKELY (!av)) {
}
static GstFlowReturn
-gst_base_audio_decoder_drain (GstBaseAudioDecoder * dec)
+gst_audio_decoder_drain (GstAudioDecoder * dec)
{
GstFlowReturn ret;
/* chain eventually calls upon drain as well, but by that time
* gather list should be clear, so ok ... */
if (dec->segment.rate < 0.0 && dec->priv->gather)
- gst_base_audio_decoder_chain_reverse (dec, NULL);
+ gst_audio_decoder_chain_reverse (dec, NULL);
/* have subclass give all it can */
- ret = gst_base_audio_decoder_push_buffers (dec, TRUE);
+ ret = gst_audio_decoder_push_buffers (dec, TRUE);
/* ensure all output sent */
- ret = gst_base_audio_decoder_output (dec, NULL);
+ ret = gst_audio_decoder_output (dec, NULL);
/* everything should be away now */
if (dec->priv->frames.length) {
/* not fatal/impossible though if subclass/codec eats stuff */
/* hard == FLUSH, otherwise discont */
static GstFlowReturn
-gst_base_audio_decoder_flush (GstBaseAudioDecoder * dec, gboolean hard)
+gst_audio_decoder_flush (GstAudioDecoder * dec, gboolean hard)
{
- GstBaseAudioDecoderClass *klass;
+ GstAudioDecoderClass *klass;
GstFlowReturn ret = GST_FLOW_OK;
- klass = GST_BASE_AUDIO_DECODER_GET_CLASS (dec);
+ klass = GST_AUDIO_DECODER_GET_CLASS (dec);
GST_LOG_OBJECT (dec, "flush hard %d", hard);
if (!hard) {
- ret = gst_base_audio_decoder_drain (dec);
+ ret = gst_audio_decoder_drain (dec);
} else {
- gst_base_audio_decoder_clear_queues (dec);
+ gst_audio_decoder_clear_queues (dec);
gst_segment_init (&dec->segment, GST_FORMAT_TIME);
dec->priv->error_count = 0;
}
if (klass->flush && dec->priv->samples_out > 0)
klass->flush (dec, hard);
/* and get (re)set for the sequel */
- gst_base_audio_decoder_reset (dec, FALSE);
+ gst_audio_decoder_reset (dec, FALSE);
return ret;
}
static GstFlowReturn
-gst_base_audio_decoder_chain_forward (GstBaseAudioDecoder * dec,
- GstBuffer * buffer)
+gst_audio_decoder_chain_forward (GstAudioDecoder * dec, GstBuffer * buffer)
{
GstFlowReturn ret;
dec->priv->drained = FALSE;
/* hand to subclass */
- ret = gst_base_audio_decoder_push_buffers (dec, FALSE);
+ ret = gst_audio_decoder_push_buffers (dec, FALSE);
GST_LOG_OBJECT (dec, "chain-done");
return ret;
}
static void
-gst_base_audio_decoder_clear_queues (GstBaseAudioDecoder * dec)
+gst_audio_decoder_clear_queues (GstAudioDecoder * dec)
{
- GstBaseAudioDecoderPrivate *priv = dec->priv;
+ GstAudioDecoderPrivate *priv = dec->priv;
g_list_foreach (priv->queued, (GFunc) gst_mini_object_unref, NULL);
g_list_free (priv->queued);
* Etc..
*/
static GstFlowReturn
-gst_base_audio_decoder_flush_decode (GstBaseAudioDecoder * dec)
+gst_audio_decoder_flush_decode (GstAudioDecoder * dec)
{
- GstBaseAudioDecoderPrivate *priv = dec->priv;
+ GstAudioDecoderPrivate *priv = dec->priv;
GstFlowReturn res = GST_FLOW_OK;
GList *walk;
GST_DEBUG_OBJECT (dec, "flushing buffers to decoder");
/* clear buffer and decoder state */
- gst_base_audio_decoder_flush (dec, FALSE);
+ gst_audio_decoder_flush (dec, FALSE);
while (walk) {
GList *next;
next = g_list_next (walk);
/* decode buffer, resulting data prepended to output queue */
gst_buffer_ref (buf);
- res = gst_base_audio_decoder_chain_forward (dec, buf);
+ res = gst_audio_decoder_chain_forward (dec, buf);
/* if we generated output, we can discard the buffer, else we
* keep it in the queue */
}
/* drain any aggregation (or otherwise) leftover */
- gst_base_audio_decoder_drain (dec);
+ gst_audio_decoder_drain (dec);
/* now send queued data downstream */
while (priv->queued) {
}
static GstFlowReturn
-gst_base_audio_decoder_chain_reverse (GstBaseAudioDecoder * dec,
- GstBuffer * buf)
+gst_audio_decoder_chain_reverse (GstAudioDecoder * dec, GstBuffer * buf)
{
- GstBaseAudioDecoderPrivate *priv = dec->priv;
+ GstAudioDecoderPrivate *priv = dec->priv;
GstFlowReturn result = GST_FLOW_OK;
/* if we have a discont, move buffers to the decode list */
priv->decode = g_list_prepend (priv->decode, gbuf);
}
/* decode stuff in the decode queue */
- gst_base_audio_decoder_flush_decode (dec);
+ gst_audio_decoder_flush_decode (dec);
}
if (G_LIKELY (buf)) {
}
static GstFlowReturn
-gst_base_audio_decoder_chain (GstPad * pad, GstBuffer * buffer)
+gst_audio_decoder_chain (GstPad * pad, GstBuffer * buffer)
{
- GstBaseAudioDecoder *dec;
+ GstAudioDecoder *dec;
GstFlowReturn ret;
- dec = GST_BASE_AUDIO_DECODER (GST_PAD_PARENT (pad));
+ dec = GST_AUDIO_DECODER (GST_PAD_PARENT (pad));
GST_LOG_OBJECT (dec,
"received buffer of size %d with ts %" GST_TIME_FORMAT
samples = dec->priv->samples;
GST_DEBUG_OBJECT (dec, "handling discont");
- gst_base_audio_decoder_flush (dec, FALSE);
+ gst_audio_decoder_flush (dec, FALSE);
dec->priv->discont = TRUE;
/* buffer may claim DISCONT loudly, if it can't tell us where we are now,
}
if (dec->segment.rate > 0.0)
- ret = gst_base_audio_decoder_chain_forward (dec, buffer);
+ ret = gst_audio_decoder_chain_forward (dec, buffer);
else
- ret = gst_base_audio_decoder_chain_reverse (dec, buffer);
+ ret = gst_audio_decoder_chain_reverse (dec, buffer);
return ret;
}
/* perform upstream byte <-> time conversion (duration, seeking)
* if subclass allows and if enough data for moderately decent conversion */
static inline gboolean
-gst_base_audio_decoder_do_byte (GstBaseAudioDecoder * dec)
+gst_audio_decoder_do_byte (GstAudioDecoder * dec)
{
return dec->priv->ctx.do_byte_time && dec->priv->ctx.info.bpf &&
dec->priv->ctx.info.rate <= dec->priv->samples_out;
}
static gboolean
-gst_base_audio_decoder_sink_eventfunc (GstBaseAudioDecoder * dec,
- GstEvent * event)
+gst_audio_decoder_sink_eventfunc (GstAudioDecoder * dec, GstEvent * event)
{
gboolean handled = FALSE;
}
/* finish current segment */
- gst_base_audio_decoder_drain (dec);
+ gst_audio_decoder_drain (dec);
if (update) {
/* time progressed without data, see if we can fill the gap with
GST_TIME_ARGS (dec->segment.last_stop));
if (dec->priv->plc && dec->priv->ctx.do_plc &&
dec->segment.rate > 0.0 && dec->segment.last_stop < start) {
- GstBaseAudioDecoderClass *klass;
+ GstAudioDecoderClass *klass;
GstBuffer *buf;
- klass = GST_BASE_AUDIO_DECODER_GET_CLASS (dec);
+ klass = GST_AUDIO_DECODER_GET_CLASS (dec);
/* hand subclass empty frame with duration that needs covering */
buf = gst_buffer_new ();
GST_BUFFER_DURATION (buf) = start - dec->segment.last_stop;
/* best effort, not much error handling */
- gst_base_audio_decoder_handle_frame (dec, klass, buf);
+ gst_audio_decoder_handle_frame (dec, klass, buf);
}
} else {
/* prepare for next one */
- gst_base_audio_decoder_flush (dec, FALSE);
+ gst_audio_decoder_flush (dec, FALSE);
/* and that's where we time from,
* in case upstream does not come up with anything better
* (e.g. upstream BYTE) */
case GST_EVENT_FLUSH_STOP:
/* prepare for fresh start */
- gst_base_audio_decoder_flush (dec, TRUE);
+ gst_audio_decoder_flush (dec, TRUE);
break;
case GST_EVENT_EOS:
- gst_base_audio_decoder_drain (dec);
+ gst_audio_decoder_drain (dec);
break;
default:
}
static gboolean
-gst_base_audio_decoder_sink_event (GstPad * pad, GstEvent * event)
+gst_audio_decoder_sink_event (GstPad * pad, GstEvent * event)
{
- GstBaseAudioDecoder *dec;
- GstBaseAudioDecoderClass *klass;
+ GstAudioDecoder *dec;
+ GstAudioDecoderClass *klass;
gboolean handled = FALSE;
gboolean ret = TRUE;
- dec = GST_BASE_AUDIO_DECODER (gst_pad_get_parent (pad));
- klass = GST_BASE_AUDIO_DECODER_GET_CLASS (dec);
+ dec = GST_AUDIO_DECODER (gst_pad_get_parent (pad));
+ klass = GST_AUDIO_DECODER_GET_CLASS (dec);
GST_DEBUG_OBJECT (dec, "received event %d, %s", GST_EVENT_TYPE (event),
GST_EVENT_TYPE_NAME (event));
handled = klass->event (dec, event);
if (!handled)
- handled = gst_base_audio_decoder_sink_eventfunc (dec, event);
+ handled = gst_audio_decoder_sink_eventfunc (dec, event);
if (!handled)
ret = gst_pad_event_default (pad, event);
}
static gboolean
-gst_base_audio_decoder_do_seek (GstBaseAudioDecoder * dec, GstEvent * event)
+gst_audio_decoder_do_seek (GstAudioDecoder * dec, GstEvent * event)
{
GstSeekFlags flags;
GstSeekType start_type, end_type;
}
static gboolean
-gst_base_audio_decoder_src_event (GstPad * pad, GstEvent * event)
+gst_audio_decoder_src_event (GstPad * pad, GstEvent * event)
{
- GstBaseAudioDecoder *dec;
+ GstAudioDecoder *dec;
gboolean res = FALSE;
- dec = GST_BASE_AUDIO_DECODER (gst_pad_get_parent (pad));
+ dec = GST_AUDIO_DECODER (gst_pad_get_parent (pad));
GST_DEBUG_OBJECT (dec, "received event %d, %s", GST_EVENT_TYPE (event),
GST_EVENT_TYPE_NAME (event));
/* if upstream fails for a time seek, maybe we can help if allowed */
if (format == GST_FORMAT_TIME) {
- if (gst_base_audio_decoder_do_byte (dec))
- res = gst_base_audio_decoder_do_seek (dec, event);
+ if (gst_audio_decoder_do_byte (dec))
+ res = gst_audio_decoder_do_seek (dec, event);
break;
}
}
/*
- * gst_base_audio_encoded_audio_convert:
+ * gst_audio_encoded_audio_convert:
* @fmt: audio format of the encoded audio
* @bytes: number of encoded bytes
* @samples: number of encoded samples
* BYTE and TIME format by using estimated bitrate based on
* @samples and @bytes (and @fmt).
*/
-/* FIXME: make gst_base_audio_encoded_audio_convert() public? */
+/* FIXME: make gst_audio_encoded_audio_convert() public? */
static gboolean
-gst_base_audio_encoded_audio_convert (GstAudioInfo * fmt,
+gst_audio_encoded_audio_convert (GstAudioInfo * fmt,
gint64 bytes, gint64 samples, GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
{
}
static gboolean
-gst_base_audio_decoder_sink_query (GstPad * pad, GstQuery * query)
+gst_audio_decoder_sink_query (GstPad * pad, GstQuery * query)
{
gboolean res = TRUE;
- GstBaseAudioDecoder *dec;
+ GstAudioDecoder *dec;
- dec = GST_BASE_AUDIO_DECODER (gst_pad_get_parent (pad));
+ dec = GST_AUDIO_DECODER (gst_pad_get_parent (pad));
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_FORMATS:
gint64 src_val, dest_val;
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if (!(res = gst_base_audio_encoded_audio_convert (&dec->priv->ctx.info,
+ if (!(res = gst_audio_encoded_audio_convert (&dec->priv->ctx.info,
dec->priv->bytes_in, dec->priv->samples_out,
src_fmt, src_val, &dest_fmt, &dest_val)))
goto error;
}
static const GstQueryType *
-gst_base_audio_decoder_get_query_types (GstPad * pad)
+gst_audio_decoder_get_query_types (GstPad * pad)
{
- static const GstQueryType gst_base_audio_decoder_src_query_types[] = {
+ static const GstQueryType gst_audio_decoder_src_query_types[] = {
GST_QUERY_POSITION,
GST_QUERY_DURATION,
GST_QUERY_CONVERT,
0
};
- return gst_base_audio_decoder_src_query_types;
+ return gst_audio_decoder_src_query_types;
}
/* FIXME ? are any of these queries (other than latency) a decoder's business ??
* segment stuff etc at all
* Supposedly that's backward compatibility ... */
static gboolean
-gst_base_audio_decoder_src_query (GstPad * pad, GstQuery * query)
+gst_audio_decoder_src_query (GstPad * pad, GstQuery * query)
{
- GstBaseAudioDecoder *dec;
+ GstAudioDecoder *dec;
GstPad *peerpad;
gboolean res = FALSE;
- dec = GST_BASE_AUDIO_DECODER (GST_PAD_PARENT (pad));
+ dec = GST_AUDIO_DECODER (GST_PAD_PARENT (pad));
peerpad = gst_pad_get_peer (GST_PAD (dec->sinkpad));
GST_LOG_OBJECT (dec, "handling query: %" GST_PTR_FORMAT, query);
gst_query_parse_duration (query, &format, NULL);
/* try answering TIME by converting from BYTE if subclass allows */
- if (format == GST_FORMAT_TIME && gst_base_audio_decoder_do_byte (dec)) {
+ if (format == GST_FORMAT_TIME && gst_audio_decoder_do_byte (dec)) {
gint64 value;
format = GST_FORMAT_BYTES;
}
static gboolean
-gst_base_audio_decoder_stop (GstBaseAudioDecoder * dec)
+gst_audio_decoder_stop (GstAudioDecoder * dec)
{
- GstBaseAudioDecoderClass *klass;
+ GstAudioDecoderClass *klass;
gboolean ret = TRUE;
- GST_DEBUG_OBJECT (dec, "gst_base_audio_decoder_stop");
+ GST_DEBUG_OBJECT (dec, "gst_audio_decoder_stop");
- klass = GST_BASE_AUDIO_DECODER_GET_CLASS (dec);
+ klass = GST_AUDIO_DECODER_GET_CLASS (dec);
if (klass->stop) {
ret = klass->stop (dec);
}
/* clean up */
- gst_base_audio_decoder_reset (dec, TRUE);
+ gst_audio_decoder_reset (dec, TRUE);
if (ret)
dec->priv->active = FALSE;
}
static gboolean
-gst_base_audio_decoder_start (GstBaseAudioDecoder * dec)
+gst_audio_decoder_start (GstAudioDecoder * dec)
{
- GstBaseAudioDecoderClass *klass;
+ GstAudioDecoderClass *klass;
gboolean ret = TRUE;
- GST_DEBUG_OBJECT (dec, "gst_base_audio_decoder_start");
+ GST_DEBUG_OBJECT (dec, "gst_audio_decoder_start");
- klass = GST_BASE_AUDIO_DECODER_GET_CLASS (dec);
+ klass = GST_AUDIO_DECODER_GET_CLASS (dec);
/* arrange clean state */
- gst_base_audio_decoder_reset (dec, TRUE);
+ gst_audio_decoder_reset (dec, TRUE);
if (klass->start) {
ret = klass->start (dec);
}
static void
-gst_base_audio_decoder_get_property (GObject * object, guint prop_id,
+gst_audio_decoder_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
- GstBaseAudioDecoder *dec;
+ GstAudioDecoder *dec;
- dec = GST_BASE_AUDIO_DECODER (object);
+ dec = GST_AUDIO_DECODER (object);
switch (prop_id) {
case PROP_LATENCY:
}
static void
-gst_base_audio_decoder_set_property (GObject * object, guint prop_id,
+gst_audio_decoder_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
- GstBaseAudioDecoder *dec;
+ GstAudioDecoder *dec;
- dec = GST_BASE_AUDIO_DECODER (object);
+ dec = GST_AUDIO_DECODER (object);
switch (prop_id) {
case PROP_LATENCY:
}
static GstStateChangeReturn
-gst_base_audio_decoder_change_state (GstElement * element,
- GstStateChange transition)
+gst_audio_decoder_change_state (GstElement * element, GstStateChange transition)
{
- GstBaseAudioDecoder *codec;
+ GstAudioDecoder *codec;
GstStateChangeReturn ret;
- codec = GST_BASE_AUDIO_DECODER (element);
+ codec = GST_AUDIO_DECODER (element);
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
- if (!gst_base_audio_decoder_start (codec)) {
+ if (!gst_audio_decoder_start (codec)) {
goto start_failed;
}
break;
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
- if (!gst_base_audio_decoder_stop (codec)) {
+ if (!gst_audio_decoder_stop (codec)) {
goto stop_failed;
}
break;
}
GstFlowReturn
-_gst_base_audio_decoder_error (GstBaseAudioDecoder * dec, gint weight,
+_gst_audio_decoder_error (GstAudioDecoder * dec, gint weight,
GQuark domain, gint code, gchar * txt, gchar * dbg, const gchar * file,
const gchar * function, gint line)
{
}
/**
- * gst_base_audio_decoder_get_audio_info:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_get_audio_info:
+ * @dec: a #GstAudioDecoder
*
* Returns: a #GstAudioInfo describing the input audio format
*
* Since: 0.10.36
*/
GstAudioInfo *
-gst_base_audio_decoder_get_audio_info (GstBaseAudioDecoder * dec)
+gst_audio_decoder_get_audio_info (GstAudioDecoder * dec)
{
- g_return_val_if_fail (GST_IS_BASE_AUDIO_DECODER (dec), NULL);
+ g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), NULL);
return &dec->priv->ctx.info;
}
/**
- * gst_base_audio_decoder_set_plc_aware:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_set_plc_aware:
+ * @dec: a #GstAudioDecoder
* @plc: new plc state
*
* Indicates whether or not subclass handles packet loss concealment (plc).
* Since: 0.10.36
*/
void
-gst_base_audio_decoder_set_plc_aware (GstBaseAudioDecoder * dec, gboolean plc)
+gst_audio_decoder_set_plc_aware (GstAudioDecoder * dec, gboolean plc)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_DECODER (dec));
+ g_return_if_fail (GST_IS_AUDIO_DECODER (dec));
dec->priv->ctx.do_plc = plc;
}
/**
- * gst_base_audio_decoder_get_plc_aware:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_get_plc_aware:
+ * @dec: a #GstAudioDecoder
*
* Returns: currently configured plc handling
*
* Since: 0.10.36
*/
gint
-gst_base_audio_decoder_get_plc_aware (GstBaseAudioDecoder * dec)
+gst_audio_decoder_get_plc_aware (GstAudioDecoder * dec)
{
- g_return_val_if_fail (GST_IS_BASE_AUDIO_DECODER (dec), 0);
+ g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), 0);
return dec->priv->ctx.do_plc;
}
/**
- * gst_base_audio_decoder_set_byte_time:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_set_byte_time:
+ * @dec: a #GstAudioDecoder
* @enabled: whether to enable byte to time conversion
*
* Allows baseclass to perform byte to time estimated conversion.
* Since: 0.10.36
*/
void
-gst_base_audio_decoder_set_byte_time (GstBaseAudioDecoder * dec,
- gboolean enabled)
+gst_audio_decoder_set_byte_time (GstAudioDecoder * dec, gboolean enabled)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_DECODER (dec));
+ g_return_if_fail (GST_IS_AUDIO_DECODER (dec));
dec->priv->ctx.do_byte_time = enabled;
}
/**
- * gst_base_audio_decoder_get_byte_time:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_get_byte_time:
+ * @dec: a #GstAudioDecoder
*
* Returns: currently configured byte to time conversion setting
*
* Since: 0.10.36
*/
gint
-gst_base_audio_decoder_get_byte_time (GstBaseAudioDecoder * dec)
+gst_audio_decoder_get_byte_time (GstAudioDecoder * dec)
{
- g_return_val_if_fail (GST_IS_BASE_AUDIO_DECODER (dec), 0);
+ g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), 0);
return dec->priv->ctx.do_byte_time;
}
/**
- * gst_base_audio_decoder_get_delay:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_get_delay:
+ * @dec: a #GstAudioDecoder
*
* Returns: currently configured decoder delay
*
* Since: 0.10.36
*/
gint
-gst_base_audio_decoder_get_delay (GstBaseAudioDecoder * dec)
+gst_audio_decoder_get_delay (GstAudioDecoder * dec)
{
- g_return_val_if_fail (GST_IS_BASE_AUDIO_DECODER (dec), 0);
+ g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), 0);
return dec->priv->ctx.delay;
}
/**
- * gst_base_audio_decoder_set_max_errors:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_set_max_errors:
+ * @dec: a #GstAudioDecoder
* @num: max tolerated errors
*
* Sets numbers of tolerated decoder errors, where a tolerated one is then only
* Since: 0.10.36
*/
void
-gst_base_audio_decoder_set_max_errors (GstBaseAudioDecoder * enc, gint num)
+gst_audio_decoder_set_max_errors (GstAudioDecoder * enc, gint num)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_DECODER (enc));
+ g_return_if_fail (GST_IS_AUDIO_DECODER (enc));
enc->priv->ctx.max_errors = num;
}
/**
- * gst_base_audio_decoder_get_max_errors:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_get_max_errors:
+ * @dec: a #GstAudioDecoder
*
* Returns: currently configured decoder tolerated error count.
*
* Since: 0.10.36
*/
gint
-gst_base_audio_decoder_get_max_errors (GstBaseAudioDecoder * dec)
+gst_audio_decoder_get_max_errors (GstAudioDecoder * dec)
{
- g_return_val_if_fail (GST_IS_BASE_AUDIO_DECODER (dec), 0);
+ g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), 0);
return dec->priv->ctx.max_errors;
}
/**
- * gst_base_audio_decoder_set_latency:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_set_latency:
+ * @dec: a #GstAudioDecoder
* @min: minimum latency
* @max: maximum latency
*
* Since: 0.10.36
*/
void
-gst_base_audio_decoder_set_latency (GstBaseAudioDecoder * dec,
+gst_audio_decoder_set_latency (GstAudioDecoder * dec,
GstClockTime min, GstClockTime max)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_DECODER (dec));
+ g_return_if_fail (GST_IS_AUDIO_DECODER (dec));
GST_OBJECT_LOCK (dec);
dec->priv->ctx.min_latency = min;
}
/**
- * gst_base_audio_decoder_get_latency:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_get_latency:
+ * @dec: a #GstAudioDecoder
* @min: a pointer to storage to hold minimum latency
* @max: a pointer to storage to hold maximum latency
*
* Since: 0.10.36
*/
void
-gst_base_audio_decoder_get_latency (GstBaseAudioDecoder * dec,
+gst_audio_decoder_get_latency (GstAudioDecoder * dec,
GstClockTime * min, GstClockTime * max)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_DECODER (dec));
+ g_return_if_fail (GST_IS_AUDIO_DECODER (dec));
GST_OBJECT_LOCK (dec);
if (min)
}
/**
- * gst_base_audio_decoder_get_parse_state:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_get_parse_state:
+ * @dec: a #GstAudioDecoder
* @min: a pointer to storage to hold current sync state
* @max: a pointer to storage to hold current eos state
*
* Since: 0.10.36
*/
void
-gst_base_audio_decoder_get_parse_state (GstBaseAudioDecoder * dec,
+gst_audio_decoder_get_parse_state (GstAudioDecoder * dec,
gboolean * sync, gboolean * eos)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_DECODER (dec));
+ g_return_if_fail (GST_IS_AUDIO_DECODER (dec));
if (sync)
*sync = dec->priv->ctx.sync;
}
/**
- * gst_base_audio_decoder_set_plc:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_set_plc:
+ * @dec: a #GstAudioDecoder
* @enabled: new state
*
* Enable or disable decoder packet loss concealment, provided subclass
* Since: 0.10.36
*/
void
-gst_base_audio_decoder_set_plc (GstBaseAudioDecoder * dec, gboolean enabled)
+gst_audio_decoder_set_plc (GstAudioDecoder * dec, gboolean enabled)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_DECODER (dec));
+ g_return_if_fail (GST_IS_AUDIO_DECODER (dec));
GST_LOG_OBJECT (dec, "enabled: %d", enabled);
}
/**
- * gst_base_audio_decoder_get_plc:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_get_plc:
+ * @dec: a #GstAudioDecoder
*
* Queries decoder packet loss concealment handling.
*
* Since: 0.10.36
*/
gboolean
-gst_base_audio_decoder_get_plc (GstBaseAudioDecoder * dec)
+gst_audio_decoder_get_plc (GstAudioDecoder * dec)
{
gboolean result;
- g_return_val_if_fail (GST_IS_BASE_AUDIO_DECODER (dec), FALSE);
+ g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), FALSE);
GST_OBJECT_LOCK (dec);
result = dec->priv->plc;
}
/**
- * gst_base_audio_decoder_set_min_latency:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_set_min_latency:
+ * @dec: a #GstAudioDecoder
* @num: new minimum latency
*
* Sets decoder minimum aggregation latency.
* Since: 0.10.36
*/
void
-gst_base_audio_decoder_set_min_latency (GstBaseAudioDecoder * dec, gint64 num)
+gst_audio_decoder_set_min_latency (GstAudioDecoder * dec, gint64 num)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_DECODER (dec));
+ g_return_if_fail (GST_IS_AUDIO_DECODER (dec));
GST_OBJECT_LOCK (dec);
dec->priv->latency = num;
}
/**
- * gst_base_audio_decoder_get_min_latency:
- * @enc: a #GstBaseAudioDecoder
+ * gst_audio_decoder_get_min_latency:
+ * @enc: a #GstAudioDecoder
*
* Queries decoder's latency aggregation.
*
* Since: 0.10.36
*/
gint64
-gst_base_audio_decoder_get_min_latency (GstBaseAudioDecoder * dec)
+gst_audio_decoder_get_min_latency (GstAudioDecoder * dec)
{
gint64 result;
- g_return_val_if_fail (GST_IS_BASE_AUDIO_DECODER (dec), FALSE);
+ g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), FALSE);
GST_OBJECT_LOCK (dec);
result = dec->priv->latency;
}
/**
- * gst_base_audio_decoder_set_tolerance:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_set_tolerance:
+ * @dec: a #GstAudioDecoder
* @tolerance: new tolerance
*
* Configures decoder audio jitter tolerance threshold.
* Since: 0.10.36
*/
void
-gst_base_audio_decoder_set_tolerance (GstBaseAudioDecoder * dec,
- gint64 tolerance)
+gst_audio_decoder_set_tolerance (GstAudioDecoder * dec, gint64 tolerance)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_DECODER (dec));
+ g_return_if_fail (GST_IS_AUDIO_DECODER (dec));
GST_OBJECT_LOCK (dec);
dec->priv->tolerance = tolerance;
}
/**
- * gst_base_audio_decoder_get_tolerance:
- * @dec: a #GstBaseAudioDecoder
+ * gst_audio_decoder_get_tolerance:
+ * @dec: a #GstAudioDecoder
*
* Queries current audio jitter tolerance threshold.
*
* Since: 0.10.36
*/
gint64
-gst_base_audio_decoder_get_tolerance (GstBaseAudioDecoder * dec)
+gst_audio_decoder_get_tolerance (GstAudioDecoder * dec)
{
gint64 result;
- g_return_val_if_fail (GST_IS_BASE_AUDIO_DECODER (dec), 0);
+ g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), 0);
GST_OBJECT_LOCK (dec);
result = dec->priv->tolerance;
* Boston, MA 02111-1307, USA.
*/
-#ifndef _GST_BASE_AUDIO_DECODER_H_
-#define _GST_BASE_AUDIO_DECODER_H_
+#ifndef _GST_AUDIO_DECODER_H_
+#define _GST_AUDIO_DECODER_H_
#ifndef GST_USE_UNSTABLE_API
-#warning "GstBaseAudioDecoder is unstable API and may change in future."
+#warning "GstAudioDecoder is unstable API and may change in future."
#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
#endif
G_BEGIN_DECLS
-#define GST_TYPE_BASE_AUDIO_DECODER \
- (gst_base_audio_decoder_get_type())
-#define GST_BASE_AUDIO_DECODER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_AUDIO_DECODER,GstBaseAudioDecoder))
-#define GST_BASE_AUDIO_DECODER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_AUDIO_DECODER,GstBaseAudioDecoderClass))
-#define GST_BASE_AUDIO_DECODER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_AUDIO_DECODER,GstBaseAudioDecoderClass))
-#define GST_IS_BASE_AUDIO_DECODER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_AUDIO_DECODER))
-#define GST_IS_BASE_AUDIO_DECODER_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_AUDIO_DECODER))
+#define GST_TYPE_AUDIO_DECODER \
+ (gst_audio_decoder_get_type())
+#define GST_AUDIO_DECODER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_DECODER,GstAudioDecoder))
+#define GST_AUDIO_DECODER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_DECODER,GstAudioDecoderClass))
+#define GST_AUDIO_DECODER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AUDIO_DECODER,GstAudioDecoderClass))
+#define GST_IS_AUDIO_DECODER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_DECODER))
+#define GST_IS_AUDIO_DECODER_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_DECODER))
/**
- * GST_BASE_AUDIO_DECODER_SINK_NAME:
+ * GST_AUDIO_DECODER_SINK_NAME:
*
* The name of the templates for the sink pad.
*
* Since: 0.10.36
*/
-#define GST_BASE_AUDIO_DECODER_SINK_NAME "sink"
+#define GST_AUDIO_DECODER_SINK_NAME "sink"
/**
- * GST_BASE_AUDIO_DECODER_SRC_NAME:
+ * GST_AUDIO_DECODER_SRC_NAME:
*
* The name of the templates for the source pad.
*
* Since: 0.10.36
*/
-#define GST_BASE_AUDIO_DECODER_SRC_NAME "src"
+#define GST_AUDIO_DECODER_SRC_NAME "src"
/**
- * GST_BASE_AUDIO_DECODER_SRC_PAD:
+ * GST_AUDIO_DECODER_SRC_PAD:
* @obj: base audio codec instance
*
* Gives the pointer to the source #GstPad object of the element.
*
* Since: 0.10.36
*/
-#define GST_BASE_AUDIO_DECODER_SRC_PAD(obj) (((GstBaseAudioDecoder *) (obj))->srcpad)
+#define GST_AUDIO_DECODER_SRC_PAD(obj) (((GstAudioDecoder *) (obj))->srcpad)
/**
- * GST_BASE_AUDIO_DECODER_SINK_PAD:
+ * GST_AUDIO_DECODER_SINK_PAD:
* @obj: base audio codec instance
*
* Gives the pointer to the sink #GstPad object of the element.
*
* Since: 0.10.36
*/
-#define GST_BASE_AUDIO_DECODER_SINK_PAD(obj) (((GstBaseAudioDecoder *) (obj))->sinkpad)
+#define GST_AUDIO_DECODER_SINK_PAD(obj) (((GstAudioDecoder *) (obj))->sinkpad)
-typedef struct _GstBaseAudioDecoder GstBaseAudioDecoder;
-typedef struct _GstBaseAudioDecoderClass GstBaseAudioDecoderClass;
+typedef struct _GstAudioDecoder GstAudioDecoder;
+typedef struct _GstAudioDecoderClass GstAudioDecoderClass;
-typedef struct _GstBaseAudioDecoderPrivate GstBaseAudioDecoderPrivate;
+typedef struct _GstAudioDecoderPrivate GstAudioDecoderPrivate;
/* do not use this one, use macro below */
-GstFlowReturn _gst_base_audio_decoder_error (GstBaseAudioDecoder *dec, gint weight,
- GQuark domain, gint code,
- gchar *txt, gchar *debug,
- const gchar *file, const gchar *function,
- gint line);
+GstFlowReturn _gst_audio_decoder_error (GstAudioDecoder *dec, gint weight,
+ GQuark domain, gint code,
+ gchar *txt, gchar *debug,
+ const gchar *file, const gchar *function,
+ gint line);
/**
- * GST_BASE_AUDIO_DECODER_ERROR:
+ * GST_AUDIO_DECODER_ERROR:
* @el: the base audio decoder element that generates the error
* @weight: element defined weight of the error, added to error count
* @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError)
*
* Since: 0.10.36
*/
-#define GST_BASE_AUDIO_DECODER_ERROR(el, w, domain, code, text, debug, ret) \
+#define GST_AUDIO_DECODER_ERROR(el, w, domain, code, text, debug, ret) \
G_STMT_START { \
gchar *__txt = _gst_element_error_printf text; \
gchar *__dbg = _gst_element_error_printf debug; \
- GstBaseAudioDecoder *dec = GST_BASE_AUDIO_DECODER (el); \
- ret = _gst_base_audio_decoder_error (dec, w, GST_ ## domain ## _ERROR, \
+ GstAudioDecoder *dec = GST_AUDIO_DECODER (el); \
+ ret = _gst_audio_decoder_error (dec, w, GST_ ## domain ## _ERROR, \
GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__, \
GST_FUNCTION, __LINE__); \
} G_STMT_END
/**
- * GstBaseAudioDecoder:
+ * GstAudioDecoder:
*
- * The opaque #GstBaseAudioDecoder data structure.
+ * The opaque #GstAudioDecoder data structure.
*
* Since: 0.10.36
*/
-struct _GstBaseAudioDecoder
+struct _GstAudioDecoder
{
GstElement element;
GstSegment segment;
/*< private >*/
- GstBaseAudioDecoderPrivate *priv;
+ GstAudioDecoderPrivate *priv;
gpointer _gst_reserved[GST_PADDING_LARGE];
};
/**
- * GstBaseAudioDecoderClass:
+ * GstAudioDecoderClass:
* @start: Optional.
* Called when the element starts processing.
* Allows opening external resources.
*
* Since: 0.10.36
*/
-struct _GstBaseAudioDecoderClass
+struct _GstAudioDecoderClass
{
GstElementClass parent_class;
/*< public >*/
/* virtual methods for subclasses */
- gboolean (*start) (GstBaseAudioDecoder *dec);
+ gboolean (*start) (GstAudioDecoder *dec);
- gboolean (*stop) (GstBaseAudioDecoder *dec);
+ gboolean (*stop) (GstAudioDecoder *dec);
- gboolean (*set_format) (GstBaseAudioDecoder *dec,
+ gboolean (*set_format) (GstAudioDecoder *dec,
GstCaps *caps);
- GstFlowReturn (*parse) (GstBaseAudioDecoder *dec,
+ GstFlowReturn (*parse) (GstAudioDecoder *dec,
GstAdapter *adapter,
gint *offset, gint *length);
- GstFlowReturn (*handle_frame) (GstBaseAudioDecoder *dec,
+ GstFlowReturn (*handle_frame) (GstAudioDecoder *dec,
GstBuffer *buffer);
- void (*flush) (GstBaseAudioDecoder *dec, gboolean hard);
+ void (*flush) (GstAudioDecoder *dec, gboolean hard);
- GstFlowReturn (*pre_push) (GstBaseAudioDecoder *dec,
+ GstFlowReturn (*pre_push) (GstAudioDecoder *dec,
GstBuffer **buffer);
- gboolean (*event) (GstBaseAudioDecoder *dec,
+ gboolean (*event) (GstAudioDecoder *dec,
GstEvent *event);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
};
-GstFlowReturn gst_base_audio_decoder_finish_frame (GstBaseAudioDecoder * dec,
+GType gst_audio_decoder_get_type (void);
+
+GstFlowReturn gst_audio_decoder_finish_frame (GstAudioDecoder * dec,
GstBuffer * buf, gint frames);
/* context parameters */
-GstAudioInfo * gst_base_audio_decoder_get_audio_info (GstBaseAudioDecoder * dec);
+GstAudioInfo * gst_audio_decoder_get_audio_info (GstAudioDecoder * dec);
+
+void gst_audio_decoder_set_plc_aware (GstAudioDecoder * dec,
+ gboolean plc);
+
+gint gst_audio_decoder_get_plc_aware (GstAudioDecoder * dec);
+
+void gst_audio_decoder_set_byte_time (GstAudioDecoder * dec,
+ gboolean enabled);
-void gst_base_audio_decoder_set_plc_aware (GstBaseAudioDecoder * dec,
- gboolean plc);
-gint gst_base_audio_decoder_get_plc_aware (GstBaseAudioDecoder * dec);
+gint gst_audio_decoder_get_byte_time (GstAudioDecoder * dec);
-void gst_base_audio_decoder_set_byte_time (GstBaseAudioDecoder * dec,
- gboolean enabled);
-gint gst_base_audio_decoder_get_byte_time (GstBaseAudioDecoder * dec);
+gint gst_audio_decoder_get_delay (GstAudioDecoder * dec);
-gint gst_base_audio_decoder_get_delay (GstBaseAudioDecoder * dec);
+void gst_audio_decoder_set_max_errors (GstAudioDecoder * enc,
+ gint num);
-void gst_base_audio_decoder_set_max_errors (GstBaseAudioDecoder * enc,
- gint num);
-gint gst_base_audio_decoder_get_max_errors (GstBaseAudioDecoder * dec);
+gint gst_audio_decoder_get_max_errors (GstAudioDecoder * dec);
-void gst_base_audio_decoder_set_latency (GstBaseAudioDecoder * dec,
- GstClockTime min, GstClockTime max);
-void gst_base_audio_decoder_get_latency (GstBaseAudioDecoder * dec,
- GstClockTime * min, GstClockTime * max);
+void gst_audio_decoder_set_latency (GstAudioDecoder * dec,
+ GstClockTime min,
+ GstClockTime max);
-void gst_base_audio_decoder_get_parse_state (GstBaseAudioDecoder * dec,
- gboolean * sync, gboolean * eos);
+void gst_audio_decoder_get_latency (GstAudioDecoder * dec,
+ GstClockTime * min,
+ GstClockTime * max);
+
+void gst_audio_decoder_get_parse_state (GstAudioDecoder * dec,
+ gboolean * sync,
+ gboolean * eos);
/* object properties */
-void gst_base_audio_decoder_set_plc (GstBaseAudioDecoder * dec,
- gboolean enabled);
-gboolean gst_base_audio_decoder_get_plc (GstBaseAudioDecoder * dec);
+void gst_audio_decoder_set_plc (GstAudioDecoder * dec,
+ gboolean enabled);
-void gst_base_audio_decoder_set_min_latency (GstBaseAudioDecoder * dec,
- gint64 num);
-gint64 gst_base_audio_decoder_get_min_latency (GstBaseAudioDecoder * dec);
+gboolean gst_audio_decoder_get_plc (GstAudioDecoder * dec);
-void gst_base_audio_decoder_set_tolerance (GstBaseAudioDecoder * dec,
- gint64 tolerance);
+void gst_audio_decoder_set_min_latency (GstAudioDecoder * dec,
+ gint64 num);
-gint64 gst_base_audio_decoder_get_tolerance (GstBaseAudioDecoder * dec);
+gint64 gst_audio_decoder_get_min_latency (GstAudioDecoder * dec);
-GType gst_base_audio_decoder_get_type (void);
+void gst_audio_decoder_set_tolerance (GstAudioDecoder * dec,
+ gint64 tolerance);
-G_END_DECLS
+gint64 gst_audio_decoder_get_tolerance (GstAudioDecoder * dec);
-#endif
+G_END_DECLS
+#endif /* _GST_AUDIO_DECODER_H_ */
*/
/**
- * SECTION:gstbaseaudioencoder
+ * SECTION:gstaudioencoder
* @short_description: Base class for audio encoders
* @see_also: #GstBaseTransform
* @since: 0.10.36
* This base class is for audio encoders turning raw audio samples into
* encoded audio data.
*
- * GstBaseAudioEncoder and subclass should cooperate as follows.
+ * GstAudioEncoder and subclass should cooperate as follows.
* <orderedlist>
* <listitem>
* <itemizedlist><title>Configuration</title>
* <listitem><para>
- * Initially, GstBaseAudioEncoder calls @start when the encoder element
+ * Initially, GstAudioEncoder calls @start when the encoder element
* is activated, which allows subclass to perform any global setup.
* </para></listitem>
* <listitem><para>
- * GstBaseAudioEncoder calls @set_format to inform subclass of the format
+ * GstAudioEncoder calls @set_format to inform subclass of the format
* of input audio data that it is about to receive. Subclass should
* setup for encoding and configure various base class parameters
* appropriately, notably those directing desired input data handling.
* parameters require reconfiguration.
* </para></listitem>
* <listitem><para>
- * GstBaseAudioEncoder calls @stop at end of all processing.
+ * GstAudioEncoder calls @stop at end of all processing.
* </para></listitem>
* </itemizedlist>
* </listitem>
- * As of configuration stage, and throughout processing, GstBaseAudioEncoder
+ * As of configuration stage, and throughout processing, GstAudioEncoder
* maintains various parameters that provide required context,
* e.g. describing the format of input audio data.
* Conversely, subclass can and should configure these context parameters
* </para></listitem>
* <listitem><para>
* If codec processing results in encoded data, subclass should call
- * @gst_base_audio_encoder_finish_frame to have encoded data pushed
+ * @gst_audio_encoder_finish_frame to have encoded data pushed
* downstream. Alternatively, it might also call to indicate dropped
* (non-encoded) samples.
* </para></listitem>
* it is passed to @pre_push.
* </para></listitem>
* <listitem><para>
- * During the parsing process GstBaseAudioEncoderClass will handle both
+ * During the parsing process GstAudioEncoderClass will handle both
* srcpad and sinkpad events. Sink events will be passed to subclass
* if @event callback has been provided.
* </para></listitem>
* <listitem>
* <itemizedlist><title>Shutdown phase</title>
* <listitem><para>
- * GstBaseAudioEncoder class calls @stop to inform the subclass that data
+ * GstAudioEncoder class calls @stop to inform the subclass that data
* parsing will be stopped.
* </para></listitem>
* </itemizedlist>
* source and sink pads. The pads need to be named "sink" and "src". It also
* needs to set the fixed caps on srcpad, when the format is ensured. This
* is typically when base class calls subclass' @set_format function, though
- * it might be delayed until calling @gst_base_audio_encoder_finish_frame.
+ * it might be delayed until calling @gst_audio_encoder_finish_frame.
*
* In summary, above process should have subclass concentrating on
* codec data processing while leaving other matters to base class,
*
* In particular, base class will either favor tracking upstream timestamps
* (at the possible expense of jitter) or aim to arrange for a perfect stream of
- * output timestamps, depending on #GstBaseAudioEncoder:perfect-ts.
+ * output timestamps, depending on #GstAudioEncoder:perfect-ts.
* However, in the latter case, the input may not be so perfect or ideal, which
* is handled as follows. An input timestamp is compared with the expected
* timestamp as dictated by input sample stream and if the deviation is less
- * than #GstBaseAudioEncoder:tolerance, the deviation is discarded.
+ * than #GstAudioEncoder:tolerance, the deviation is discarded.
* Otherwise, it is considered a discontuinity and subsequent output timestamp
* is resynced to the new position after performing configured discontinuity
* processing. In the non-perfect-ts case, an upstream variation exceeding
* tolerance only leads to marking DISCONT on subsequent outgoing
* (while timestamps are adjusted to upstream regardless of variation).
* While DISCONT is also marked in the perfect-ts case, this one optionally
- * (see #GstBaseAudioEncoder:hard-resync)
+ * (see #GstAudioEncoder:hard-resync)
* performs some additional steps, such as clipping of (early) input samples
* or draining all currently remaining input data, depending on the direction
* of the discontuinity.
* </para></listitem>
* <listitem><para>
* Accept data in @handle_frame and provide encoded results to
- * @gst_base_audio_encoder_finish_frame.
+ * @gst_audio_encoder_finish_frame.
* </para></listitem>
* </itemizedlist>
*
#endif
#define GST_USE_UNSTABLE_API
-#include "gstbaseaudioencoder.h"
+#include "gstaudioencoder.h"
#include <gst/base/gstadapter.h>
#include <gst/audio/audio.h>
#include <string.h>
-GST_DEBUG_CATEGORY_STATIC (gst_base_audio_encoder_debug);
-#define GST_CAT_DEFAULT gst_base_audio_encoder_debug
+GST_DEBUG_CATEGORY_STATIC (gst_audio_encoder_debug);
+#define GST_CAT_DEFAULT gst_audio_encoder_debug
-#define GST_BASE_AUDIO_ENCODER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_AUDIO_ENCODER, \
- GstBaseAudioEncoderPrivate))
+#define GST_AUDIO_ENCODER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_AUDIO_ENCODER, \
+ GstAudioEncoderPrivate))
enum
{
#define DEFAULT_HARD_RESYNC FALSE
#define DEFAULT_TOLERANCE 40000000
-typedef struct _GstBaseAudioEncoderContext
+typedef struct _GstAudioEncoderContext
{
/* input */
GstAudioInfo info;
/* MT-protected (with LOCK) */
GstClockTime min_latency;
GstClockTime max_latency;
-} GstBaseAudioEncoderContext;
+} GstAudioEncoderContext;
-struct _GstBaseAudioEncoderPrivate
+struct _GstAudioEncoderPrivate
{
/* activation status */
gboolean active;
guint64 bytes_out;
/* context storage */
- GstBaseAudioEncoderContext ctx;
+ GstAudioEncoderContext ctx;
/* properties */
gint64 tolerance;
static GstElementClass *parent_class = NULL;
-static void gst_base_audio_encoder_class_init (GstBaseAudioEncoderClass *
- klass);
-static void gst_base_audio_encoder_init (GstBaseAudioEncoder * parse,
- GstBaseAudioEncoderClass * klass);
+static void gst_audio_encoder_class_init (GstAudioEncoderClass * klass);
+static void gst_audio_encoder_init (GstAudioEncoder * parse,
+ GstAudioEncoderClass * klass);
GType
-gst_base_audio_encoder_get_type (void)
+gst_audio_encoder_get_type (void)
{
- static GType base_audio_encoder_type = 0;
+ static GType audio_encoder_type = 0;
- if (!base_audio_encoder_type) {
- static const GTypeInfo base_audio_encoder_info = {
- sizeof (GstBaseAudioEncoderClass),
+ if (!audio_encoder_type) {
+ static const GTypeInfo audio_encoder_info = {
+ sizeof (GstAudioEncoderClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gst_base_audio_encoder_class_init,
+ (GClassInitFunc) gst_audio_encoder_class_init,
NULL,
NULL,
- sizeof (GstBaseAudioEncoder),
+ sizeof (GstAudioEncoder),
0,
- (GInstanceInitFunc) gst_base_audio_encoder_init,
+ (GInstanceInitFunc) gst_audio_encoder_init,
};
const GInterfaceInfo preset_interface_info = {
NULL, /* interface_init */
NULL /* interface_data */
};
- base_audio_encoder_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstBaseAudioEncoder", &base_audio_encoder_info, G_TYPE_FLAG_ABSTRACT);
+ audio_encoder_type = g_type_register_static (GST_TYPE_ELEMENT,
+ "GstAudioEncoder", &audio_encoder_info, G_TYPE_FLAG_ABSTRACT);
- g_type_add_interface_static (base_audio_encoder_type, GST_TYPE_PRESET,
+ g_type_add_interface_static (audio_encoder_type, GST_TYPE_PRESET,
&preset_interface_info);
}
- return base_audio_encoder_type;
+ return audio_encoder_type;
}
-static void gst_base_audio_encoder_finalize (GObject * object);
-static void gst_base_audio_encoder_reset (GstBaseAudioEncoder * enc,
- gboolean full);
+static void gst_audio_encoder_finalize (GObject * object);
+static void gst_audio_encoder_reset (GstAudioEncoder * enc, gboolean full);
-static void gst_base_audio_encoder_set_property (GObject * object,
+static void gst_audio_encoder_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_base_audio_encoder_get_property (GObject * object,
+static void gst_audio_encoder_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
-static gboolean gst_base_audio_encoder_sink_activate_push (GstPad * pad,
+static gboolean gst_audio_encoder_sink_activate_push (GstPad * pad,
gboolean active);
-static gboolean gst_base_audio_encoder_sink_event (GstPad * pad,
- GstEvent * event);
-static gboolean gst_base_audio_encoder_sink_setcaps (GstPad * pad,
- GstCaps * caps);
-static GstFlowReturn gst_base_audio_encoder_chain (GstPad * pad,
- GstBuffer * buffer);
-static gboolean gst_base_audio_encoder_src_query (GstPad * pad,
- GstQuery * query);
-static gboolean gst_base_audio_encoder_sink_query (GstPad * pad,
- GstQuery * query);
-static const GstQueryType *gst_base_audio_encoder_get_query_types (GstPad *
- pad);
-static GstCaps *gst_base_audio_encoder_sink_getcaps (GstPad * pad);
+static gboolean gst_audio_encoder_sink_event (GstPad * pad, GstEvent * event);
+static gboolean gst_audio_encoder_sink_setcaps (GstPad * pad, GstCaps * caps);
+static GstFlowReturn gst_audio_encoder_chain (GstPad * pad, GstBuffer * buffer);
+static gboolean gst_audio_encoder_src_query (GstPad * pad, GstQuery * query);
+static gboolean gst_audio_encoder_sink_query (GstPad * pad, GstQuery * query);
+static const GstQueryType *gst_audio_encoder_get_query_types (GstPad * pad);
+static GstCaps *gst_audio_encoder_sink_getcaps (GstPad * pad);
static void
-gst_base_audio_encoder_class_init (GstBaseAudioEncoderClass * klass)
+gst_audio_encoder_class_init (GstAudioEncoderClass * klass)
{
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
- GST_DEBUG_CATEGORY_INIT (gst_base_audio_encoder_debug, "baseaudioencoder", 0,
- "baseaudioencoder element");
+ GST_DEBUG_CATEGORY_INIT (gst_audio_encoder_debug, "audioencoder", 0,
+ "audio encoder base class");
- g_type_class_add_private (klass, sizeof (GstBaseAudioEncoderPrivate));
+ g_type_class_add_private (klass, sizeof (GstAudioEncoderPrivate));
- gobject_class->set_property = gst_base_audio_encoder_set_property;
- gobject_class->get_property = gst_base_audio_encoder_get_property;
+ gobject_class->set_property = gst_audio_encoder_set_property;
+ gobject_class->get_property = gst_audio_encoder_get_property;
- gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_base_audio_encoder_finalize);
+ gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_audio_encoder_finalize);
/* properties */
g_object_class_install_property (gobject_class, PROP_PERFECT_TS,
}
static void
-gst_base_audio_encoder_init (GstBaseAudioEncoder * enc,
- GstBaseAudioEncoderClass * bclass)
+gst_audio_encoder_init (GstAudioEncoder * enc, GstAudioEncoderClass * bclass)
{
GstPadTemplate *pad_template;
- GST_DEBUG_OBJECT (enc, "gst_base_audio_encoder_init");
+ GST_DEBUG_OBJECT (enc, "gst_audio_encoder_init");
- enc->priv = GST_BASE_AUDIO_ENCODER_GET_PRIVATE (enc);
+ enc->priv = GST_AUDIO_ENCODER_GET_PRIVATE (enc);
/* only push mode supported */
pad_template =
g_return_if_fail (pad_template != NULL);
enc->sinkpad = gst_pad_new_from_template (pad_template, "sink");
gst_pad_set_event_function (enc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_encoder_sink_event));
+ GST_DEBUG_FUNCPTR (gst_audio_encoder_sink_event));
gst_pad_set_setcaps_function (enc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_encoder_sink_setcaps));
+ GST_DEBUG_FUNCPTR (gst_audio_encoder_sink_setcaps));
gst_pad_set_getcaps_function (enc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_encoder_sink_getcaps));
+ GST_DEBUG_FUNCPTR (gst_audio_encoder_sink_getcaps));
gst_pad_set_query_function (enc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_encoder_sink_query));
+ GST_DEBUG_FUNCPTR (gst_audio_encoder_sink_query));
gst_pad_set_chain_function (enc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_encoder_chain));
+ GST_DEBUG_FUNCPTR (gst_audio_encoder_chain));
gst_pad_set_activatepush_function (enc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_encoder_sink_activate_push));
+ GST_DEBUG_FUNCPTR (gst_audio_encoder_sink_activate_push));
gst_element_add_pad (GST_ELEMENT (enc), enc->sinkpad);
GST_DEBUG_OBJECT (enc, "sinkpad created");
g_return_if_fail (pad_template != NULL);
enc->srcpad = gst_pad_new_from_template (pad_template, "src");
gst_pad_set_query_function (enc->srcpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_encoder_src_query));
+ GST_DEBUG_FUNCPTR (gst_audio_encoder_src_query));
gst_pad_set_query_type_function (enc->srcpad,
- GST_DEBUG_FUNCPTR (gst_base_audio_encoder_get_query_types));
+ GST_DEBUG_FUNCPTR (gst_audio_encoder_get_query_types));
gst_pad_use_fixed_caps (enc->srcpad);
gst_element_add_pad (GST_ELEMENT (enc), enc->srcpad);
GST_DEBUG_OBJECT (enc, "src created");
enc->priv->tolerance = DEFAULT_TOLERANCE;
/* init state */
- gst_base_audio_encoder_reset (enc, TRUE);
+ gst_audio_encoder_reset (enc, TRUE);
GST_DEBUG_OBJECT (enc, "init ok");
}
static void
-gst_base_audio_encoder_reset (GstBaseAudioEncoder * enc, gboolean full)
+gst_audio_encoder_reset (GstAudioEncoder * enc, gboolean full)
{
GST_OBJECT_LOCK (enc);
}
static void
-gst_base_audio_encoder_finalize (GObject * object)
+gst_audio_encoder_finalize (GObject * object)
{
- GstBaseAudioEncoder *enc = GST_BASE_AUDIO_ENCODER (object);
+ GstAudioEncoder *enc = GST_AUDIO_ENCODER (object);
g_object_unref (enc->priv->adapter);
}
/**
- * gst_base_audio_encoder_finish_frame:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_finish_frame:
+ * @enc: a #GstAudioEncoder
* @buffer: encoded data
* @samples: number of samples (per channel) represented by encoded data
*
* Since: 0.10.36
*/
GstFlowReturn
-gst_base_audio_encoder_finish_frame (GstBaseAudioEncoder * enc, GstBuffer * buf,
+gst_audio_encoder_finish_frame (GstAudioEncoder * enc, GstBuffer * buf,
gint samples)
{
- GstBaseAudioEncoderClass *klass;
- GstBaseAudioEncoderPrivate *priv;
- GstBaseAudioEncoderContext *ctx;
+ GstAudioEncoderClass *klass;
+ GstAudioEncoderPrivate *priv;
+ GstAudioEncoderContext *ctx;
GstFlowReturn ret = GST_FLOW_OK;
- klass = GST_BASE_AUDIO_ENCODER_GET_CLASS (enc);
+ klass = GST_AUDIO_ENCODER_GET_CLASS (enc);
priv = enc->priv;
ctx = &enc->priv->ctx;
* (i.e. really returned by encoder subclass)
* - start + offset is what needs to be fed to subclass next */
static GstFlowReturn
-gst_base_audio_encoder_push_buffers (GstBaseAudioEncoder * enc, gboolean force)
+gst_audio_encoder_push_buffers (GstAudioEncoder * enc, gboolean force)
{
- GstBaseAudioEncoderClass *klass;
- GstBaseAudioEncoderPrivate *priv;
- GstBaseAudioEncoderContext *ctx;
+ GstAudioEncoderClass *klass;
+ GstAudioEncoderPrivate *priv;
+ GstAudioEncoderContext *ctx;
gint av, need;
GstBuffer *buf;
GstFlowReturn ret = GST_FLOW_OK;
- klass = GST_BASE_AUDIO_ENCODER_GET_CLASS (enc);
+ klass = GST_AUDIO_ENCODER_GET_CLASS (enc);
g_return_val_if_fail (klass->handle_frame != NULL, GST_FLOW_ERROR);
}
static GstFlowReturn
-gst_base_audio_encoder_drain (GstBaseAudioEncoder * enc)
+gst_audio_encoder_drain (GstAudioEncoder * enc)
{
if (enc->priv->drained)
return GST_FLOW_OK;
else
- return gst_base_audio_encoder_push_buffers (enc, TRUE);
+ return gst_audio_encoder_push_buffers (enc, TRUE);
}
static void
-gst_base_audio_encoder_set_base_gp (GstBaseAudioEncoder * enc)
+gst_audio_encoder_set_base_gp (GstAudioEncoder * enc)
{
GstClockTime ts;
}
static GstFlowReturn
-gst_base_audio_encoder_chain (GstPad * pad, GstBuffer * buffer)
+gst_audio_encoder_chain (GstPad * pad, GstBuffer * buffer)
{
- GstBaseAudioEncoder *enc;
- GstBaseAudioEncoderPrivate *priv;
- GstBaseAudioEncoderContext *ctx;
+ GstAudioEncoder *enc;
+ GstAudioEncoderPrivate *priv;
+ GstAudioEncoderContext *ctx;
GstFlowReturn ret = GST_FLOW_OK;
gboolean discont;
- enc = GST_BASE_AUDIO_ENCODER (GST_OBJECT_PARENT (pad));
+ enc = GST_AUDIO_ENCODER (GST_OBJECT_PARENT (pad));
priv = enc->priv;
ctx = &enc->priv->ctx;
priv->base_ts = GST_BUFFER_TIMESTAMP (buffer);
GST_DEBUG_OBJECT (enc, "new base ts %" GST_TIME_FORMAT,
GST_TIME_ARGS (priv->base_ts));
- gst_base_audio_encoder_set_base_gp (enc);
+ gst_audio_encoder_set_base_gp (enc);
}
/* check for continuity;
/* care even less about duration after this */
} else {
/* drain stuff prior to resync */
- gst_base_audio_encoder_drain (enc);
+ gst_audio_encoder_drain (enc);
}
}
/* now re-sync ts */
priv->base_ts += diff;
- gst_base_audio_encoder_set_base_gp (enc);
+ gst_audio_encoder_set_base_gp (enc);
priv->discont |= discont;
}
/* new stuff, so we can push subclass again */
enc->priv->drained = FALSE;
- ret = gst_base_audio_encoder_push_buffers (enc, FALSE);
+ ret = gst_audio_encoder_push_buffers (enc, FALSE);
done:
GST_LOG_OBJECT (enc, "chain leaving");
}
static gboolean
-gst_base_audio_encoder_sink_setcaps (GstPad * pad, GstCaps * caps)
+gst_audio_encoder_sink_setcaps (GstPad * pad, GstCaps * caps)
{
- GstBaseAudioEncoder *enc;
- GstBaseAudioEncoderClass *klass;
- GstBaseAudioEncoderContext *ctx;
+ GstAudioEncoder *enc;
+ GstAudioEncoderClass *klass;
+ GstAudioEncoderContext *ctx;
GstAudioInfo *state, *old_state;
gboolean res = TRUE, changed = FALSE;
guint old_rate;
- enc = GST_BASE_AUDIO_ENCODER (GST_PAD_PARENT (pad));
- klass = GST_BASE_AUDIO_ENCODER_GET_CLASS (enc);
+ enc = GST_AUDIO_ENCODER (GST_PAD_PARENT (pad));
+ klass = GST_AUDIO_ENCODER_GET_CLASS (enc);
/* subclass must do something here ... */
g_return_val_if_fail (klass->set_format != NULL, FALSE);
GstClockTime old_max_latency;
/* drain any pending old data stuff */
- gst_base_audio_encoder_drain (enc);
+ gst_audio_encoder_drain (enc);
/* context defaults */
enc->priv->ctx.frame_samples = 0;
/**
- * gst_base_audio_encoder_proxy_getcaps:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_proxy_getcaps:
+ * @enc: a #GstAudioEncoder
* @caps: initial caps
*
* Returns caps that express @caps (or sink template caps if @caps == NULL)
* Since: 0.10.36
*/
GstCaps *
-gst_base_audio_encoder_proxy_getcaps (GstBaseAudioEncoder * enc, GstCaps * caps)
+gst_audio_encoder_proxy_getcaps (GstAudioEncoder * enc, GstCaps * caps)
{
const GstCaps *templ_caps;
GstCaps *allowed = NULL;
}
static GstCaps *
-gst_base_audio_encoder_sink_getcaps (GstPad * pad)
+gst_audio_encoder_sink_getcaps (GstPad * pad)
{
- GstBaseAudioEncoder *enc;
- GstBaseAudioEncoderClass *klass;
+ GstAudioEncoder *enc;
+ GstAudioEncoderClass *klass;
GstCaps *caps;
- enc = GST_BASE_AUDIO_ENCODER (gst_pad_get_parent (pad));
- klass = GST_BASE_AUDIO_ENCODER_GET_CLASS (enc);
+ enc = GST_AUDIO_ENCODER (gst_pad_get_parent (pad));
+ klass = GST_AUDIO_ENCODER_GET_CLASS (enc);
g_assert (pad == enc->sinkpad);
if (klass->getcaps)
caps = klass->getcaps (enc);
else
- caps = gst_base_audio_encoder_proxy_getcaps (enc, NULL);
+ caps = gst_audio_encoder_proxy_getcaps (enc, NULL);
gst_object_unref (enc);
GST_LOG_OBJECT (enc, "returning caps %" GST_PTR_FORMAT, caps);
}
static gboolean
-gst_base_audio_encoder_sink_eventfunc (GstBaseAudioEncoder * enc,
- GstEvent * event)
+gst_audio_encoder_sink_eventfunc (GstAudioEncoder * enc, GstEvent * event)
{
- GstBaseAudioEncoderClass *klass;
+ GstAudioEncoderClass *klass;
gboolean handled = FALSE;
- klass = GST_BASE_AUDIO_ENCODER_GET_CLASS (enc);
+ klass = GST_AUDIO_ENCODER_GET_CLASS (enc);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NEWSEGMENT:
}
/* finish current segment */
- gst_base_audio_encoder_drain (enc);
+ gst_audio_encoder_drain (enc);
/* reset partially for new segment */
- gst_base_audio_encoder_reset (enc, FALSE);
+ gst_audio_encoder_reset (enc, FALSE);
/* and follow along with segment */
gst_segment_set_newsegment_full (&enc->segment, update, rate, arate,
format, start, stop, time);
if (!enc->priv->drained && klass->flush)
klass->flush (enc);
/* and get (re)set for the sequel */
- gst_base_audio_encoder_reset (enc, FALSE);
+ gst_audio_encoder_reset (enc, FALSE);
break;
case GST_EVENT_EOS:
- gst_base_audio_encoder_drain (enc);
+ gst_audio_encoder_drain (enc);
break;
default:
}
static gboolean
-gst_base_audio_encoder_sink_event (GstPad * pad, GstEvent * event)
+gst_audio_encoder_sink_event (GstPad * pad, GstEvent * event)
{
- GstBaseAudioEncoder *enc;
- GstBaseAudioEncoderClass *klass;
+ GstAudioEncoder *enc;
+ GstAudioEncoderClass *klass;
gboolean handled = FALSE;
gboolean ret = TRUE;
- enc = GST_BASE_AUDIO_ENCODER (gst_pad_get_parent (pad));
- klass = GST_BASE_AUDIO_ENCODER_GET_CLASS (enc);
+ enc = GST_AUDIO_ENCODER (gst_pad_get_parent (pad));
+ klass = GST_AUDIO_ENCODER_GET_CLASS (enc);
GST_DEBUG_OBJECT (enc, "received event %d, %s", GST_EVENT_TYPE (event),
GST_EVENT_TYPE_NAME (event));
handled = klass->event (enc, event);
if (!handled)
- handled = gst_base_audio_encoder_sink_eventfunc (enc, event);
+ handled = gst_audio_encoder_sink_eventfunc (enc, event);
if (!handled)
ret = gst_pad_event_default (pad, event);
}
static gboolean
-gst_base_audio_encoder_sink_query (GstPad * pad, GstQuery * query)
+gst_audio_encoder_sink_query (GstPad * pad, GstQuery * query)
{
gboolean res = TRUE;
- GstBaseAudioEncoder *enc;
+ GstAudioEncoder *enc;
- enc = GST_BASE_AUDIO_ENCODER (gst_pad_get_parent (pad));
+ enc = GST_AUDIO_ENCODER (gst_pad_get_parent (pad));
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_FORMATS:
}
static const GstQueryType *
-gst_base_audio_encoder_get_query_types (GstPad * pad)
+gst_audio_encoder_get_query_types (GstPad * pad)
{
- static const GstQueryType gst_base_audio_encoder_src_query_types[] = {
+ static const GstQueryType gst_audio_encoder_src_query_types[] = {
GST_QUERY_POSITION,
GST_QUERY_DURATION,
GST_QUERY_CONVERT,
0
};
- return gst_base_audio_encoder_src_query_types;
+ return gst_audio_encoder_src_query_types;
}
/*
- * gst_base_audio_encoded_audio_convert:
+ * gst_audio_encoded_audio_convert:
* @fmt: audio format of the encoded audio
* @bytes: number of encoded bytes
* @samples: number of encoded samples
*
* Since: 0.10.36
*/
-/* FIXME: make gst_base_audio_encoded_audio_convert() public? */
+/* FIXME: make gst_audio_encoded_audio_convert() public? */
static gboolean
-gst_base_audio_encoded_audio_convert (GstAudioInfo * fmt,
+gst_audio_encoded_audio_convert (GstAudioInfo * fmt,
gint64 bytes, gint64 samples, GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
{
* segment stuff etc at all
* Supposedly that's backward compatibility ... */
static gboolean
-gst_base_audio_encoder_src_query (GstPad * pad, GstQuery * query)
+gst_audio_encoder_src_query (GstPad * pad, GstQuery * query)
{
- GstBaseAudioEncoder *enc;
+ GstAudioEncoder *enc;
GstPad *peerpad;
gboolean res = FALSE;
- enc = GST_BASE_AUDIO_ENCODER (GST_PAD_PARENT (pad));
+ enc = GST_AUDIO_ENCODER (GST_PAD_PARENT (pad));
peerpad = gst_pad_get_peer (GST_PAD (enc->sinkpad));
GST_LOG_OBJECT (enc, "handling query: %" GST_PTR_FORMAT, query);
gint64 src_val, dest_val;
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if (!(res = gst_base_audio_encoded_audio_convert (&enc->priv->ctx.info,
+ if (!(res = gst_audio_encoded_audio_convert (&enc->priv->ctx.info,
enc->priv->bytes_out, enc->priv->samples_in, src_fmt, src_val,
&dest_fmt, &dest_val)))
break;
}
static void
-gst_base_audio_encoder_set_property (GObject * object, guint prop_id,
+gst_audio_encoder_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
- GstBaseAudioEncoder *enc;
+ GstAudioEncoder *enc;
- enc = GST_BASE_AUDIO_ENCODER (object);
+ enc = GST_AUDIO_ENCODER (object);
switch (prop_id) {
case PROP_PERFECT_TS:
}
static void
-gst_base_audio_encoder_get_property (GObject * object, guint prop_id,
+gst_audio_encoder_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
- GstBaseAudioEncoder *enc;
+ GstAudioEncoder *enc;
- enc = GST_BASE_AUDIO_ENCODER (object);
+ enc = GST_AUDIO_ENCODER (object);
switch (prop_id) {
case PROP_PERFECT_TS:
}
static gboolean
-gst_base_audio_encoder_activate (GstBaseAudioEncoder * enc, gboolean active)
+gst_audio_encoder_activate (GstAudioEncoder * enc, gboolean active)
{
- GstBaseAudioEncoderClass *klass;
+ GstAudioEncoderClass *klass;
gboolean result = FALSE;
- klass = GST_BASE_AUDIO_ENCODER_GET_CLASS (enc);
+ klass = GST_AUDIO_ENCODER_GET_CLASS (enc);
g_return_val_if_fail (!enc->priv->granule || enc->priv->perfect_ts, FALSE);
result = klass->stop (enc);
/* clean up */
- gst_base_audio_encoder_reset (enc, TRUE);
+ gst_audio_encoder_reset (enc, TRUE);
}
GST_DEBUG_OBJECT (enc, "activate return: %d", result);
return result;
static gboolean
-gst_base_audio_encoder_sink_activate_push (GstPad * pad, gboolean active)
+gst_audio_encoder_sink_activate_push (GstPad * pad, gboolean active)
{
gboolean result = TRUE;
- GstBaseAudioEncoder *enc;
+ GstAudioEncoder *enc;
- enc = GST_BASE_AUDIO_ENCODER (gst_pad_get_parent (pad));
+ enc = GST_AUDIO_ENCODER (gst_pad_get_parent (pad));
GST_DEBUG_OBJECT (enc, "sink activate push %d", active);
- result = gst_base_audio_encoder_activate (enc, active);
+ result = gst_audio_encoder_activate (enc, active);
if (result)
enc->priv->active = active;
}
/**
- * gst_base_audio_encoder_get_audio_info:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_get_audio_info:
+ * @enc: a #GstAudioEncoder
*
* Returns: a #GstAudioInfo describing the input audio format
*
* Since: 0.10.36
*/
GstAudioInfo *
-gst_base_audio_encoder_get_audio_info (GstBaseAudioEncoder * enc)
+gst_audio_encoder_get_audio_info (GstAudioEncoder * enc)
{
- g_return_val_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc), NULL);
+ g_return_val_if_fail (GST_IS_AUDIO_ENCODER (enc), NULL);
return &enc->priv->ctx.info;
}
/**
- * gst_base_audio_encoder_set_frame_samples:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_set_frame_samples:
+ * @enc: a #GstAudioEncoder
* @num: number of samples per frame
*
* Sets number of samples (per channel) subclass needs to be handed,
* Since: 0.10.36
*/
void
-gst_base_audio_encoder_set_frame_samples (GstBaseAudioEncoder * enc, gint num)
+gst_audio_encoder_set_frame_samples (GstAudioEncoder * enc, gint num)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc));
+ g_return_if_fail (GST_IS_AUDIO_ENCODER (enc));
enc->priv->ctx.frame_samples = num;
}
/**
- * gst_base_audio_encoder_get_frame_samples:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_get_frame_samples:
+ * @enc: a #GstAudioEncoder
*
* Returns: currently requested samples per frame
*
* Since: 0.10.36
*/
gint
-gst_base_audio_encoder_get_frame_samples (GstBaseAudioEncoder * enc)
+gst_audio_encoder_get_frame_samples (GstAudioEncoder * enc)
{
- g_return_val_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc), 0);
+ g_return_val_if_fail (GST_IS_AUDIO_ENCODER (enc), 0);
return enc->priv->ctx.frame_samples;
}
/**
- * gst_base_audio_encoder_set_frame_max:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_set_frame_max:
+ * @enc: a #GstAudioEncoder
* @num: number of frames
*
* Sets max number of frames accepted at once (assumed minimally 1)
* Since: 0.10.36
*/
void
-gst_base_audio_encoder_set_frame_max (GstBaseAudioEncoder * enc, gint num)
+gst_audio_encoder_set_frame_max (GstAudioEncoder * enc, gint num)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc));
+ g_return_if_fail (GST_IS_AUDIO_ENCODER (enc));
enc->priv->ctx.frame_max = num;
}
/**
- * gst_base_audio_encoder_get_frame_max:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_get_frame_max:
+ * @enc: a #GstAudioEncoder
*
* Returns: currently configured maximum handled frames
*
* Since: 0.10.36
*/
gint
-gst_base_audio_encoder_get_frame_max (GstBaseAudioEncoder * enc)
+gst_audio_encoder_get_frame_max (GstAudioEncoder * enc)
{
- g_return_val_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc), 0);
+ g_return_val_if_fail (GST_IS_AUDIO_ENCODER (enc), 0);
return enc->priv->ctx.frame_max;
}
/**
- * gst_base_audio_encoder_set_lookahead:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_set_lookahead:
+ * @enc: a #GstAudioEncoder
* @num: lookahead
*
* Sets encoder lookahead (in units of input rate samples)
* Since: 0.10.36
*/
void
-gst_base_audio_encoder_set_lookahead (GstBaseAudioEncoder * enc, gint num)
+gst_audio_encoder_set_lookahead (GstAudioEncoder * enc, gint num)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc));
+ g_return_if_fail (GST_IS_AUDIO_ENCODER (enc));
enc->priv->ctx.lookahead = num;
}
/**
- * gst_base_audio_encoder_get_lookahead:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_get_lookahead:
+ * @enc: a #GstAudioEncoder
*
* Returns: currently configured encoder lookahead
*/
gint
-gst_base_audio_encoder_get_lookahead (GstBaseAudioEncoder * enc)
+gst_audio_encoder_get_lookahead (GstAudioEncoder * enc)
{
- g_return_val_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc), 0);
+ g_return_val_if_fail (GST_IS_AUDIO_ENCODER (enc), 0);
return enc->priv->ctx.lookahead;
}
/**
- * gst_base_audio_encoder_set_latency:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_set_latency:
+ * @enc: a #GstAudioEncoder
* @min: minimum latency
* @max: maximum latency
*
* Since: 0.10.36
*/
void
-gst_base_audio_encoder_set_latency (GstBaseAudioEncoder * enc,
+gst_audio_encoder_set_latency (GstAudioEncoder * enc,
GstClockTime min, GstClockTime max)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc));
+ g_return_if_fail (GST_IS_AUDIO_ENCODER (enc));
GST_OBJECT_LOCK (enc);
enc->priv->ctx.min_latency = min;
}
/**
- * gst_base_audio_encoder_get_latency:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_get_latency:
+ * @enc: a #GstAudioEncoder
* @min: a pointer to storage to hold minimum latency
* @max: a pointer to storage to hold maximum latency
*
* Since: 0.10.36
*/
void
-gst_base_audio_encoder_get_latency (GstBaseAudioEncoder * enc,
+gst_audio_encoder_get_latency (GstAudioEncoder * enc,
GstClockTime * min, GstClockTime * max)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc));
+ g_return_if_fail (GST_IS_AUDIO_ENCODER (enc));
GST_OBJECT_LOCK (enc);
if (min)
}
/**
- * gst_base_audio_encoder_set_mark_granule:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_set_mark_granule:
+ * @enc: a #GstAudioEncoder
* @enabled: new state
*
* Enable or disable encoder granule handling.
* Since: 0.10.36
*/
void
-gst_base_audio_encoder_set_mark_granule (GstBaseAudioEncoder * enc,
- gboolean enabled)
+gst_audio_encoder_set_mark_granule (GstAudioEncoder * enc, gboolean enabled)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc));
+ g_return_if_fail (GST_IS_AUDIO_ENCODER (enc));
GST_LOG_OBJECT (enc, "enabled: %d", enabled);
}
/**
- * gst_base_audio_encoder_get_mark_granule:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_get_mark_granule:
+ * @enc: a #GstAudioEncoder
*
* Queries if the encoder will handle granule marking.
*
* Since: 0.10.36
*/
gboolean
-gst_base_audio_encoder_get_mark_granule (GstBaseAudioEncoder * enc)
+gst_audio_encoder_get_mark_granule (GstAudioEncoder * enc)
{
gboolean result;
- g_return_val_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc), FALSE);
+ g_return_val_if_fail (GST_IS_AUDIO_ENCODER (enc), FALSE);
GST_OBJECT_LOCK (enc);
result = enc->priv->granule;
}
/**
- * gst_base_audio_encoder_set_perfect_timestamp:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_set_perfect_timestamp:
+ * @enc: a #GstAudioEncoder
* @enabled: new state
*
* Enable or disable encoder perfect output timestamp preference.
* Since: 0.10.36
*/
void
-gst_base_audio_encoder_set_perfect_timestamp (GstBaseAudioEncoder * enc,
+gst_audio_encoder_set_perfect_timestamp (GstAudioEncoder * enc,
gboolean enabled)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc));
+ g_return_if_fail (GST_IS_AUDIO_ENCODER (enc));
GST_LOG_OBJECT (enc, "enabled: %d", enabled);
}
/**
- * gst_base_audio_encoder_get_perfect_timestamp:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_get_perfect_timestamp:
+ * @enc: a #GstAudioEncoder
*
* Queries encoder perfect timestamp behaviour.
*
* Since: 0.10.36
*/
gboolean
-gst_base_audio_encoder_get_perfect_timestamp (GstBaseAudioEncoder * enc)
+gst_audio_encoder_get_perfect_timestamp (GstAudioEncoder * enc)
{
gboolean result;
- g_return_val_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc), FALSE);
+ g_return_val_if_fail (GST_IS_AUDIO_ENCODER (enc), FALSE);
GST_OBJECT_LOCK (enc);
result = enc->priv->perfect_ts;
}
/**
- * gst_base_audio_encoder_set_hard_sync:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_set_hard_sync:
+ * @enc: a #GstAudioEncoder
* @enabled: new state
*
* Sets encoder hard resync handling.
* Since: 0.10.36
*/
void
-gst_base_audio_encoder_set_hard_resync (GstBaseAudioEncoder * enc,
- gboolean enabled)
+gst_audio_encoder_set_hard_resync (GstAudioEncoder * enc, gboolean enabled)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc));
+ g_return_if_fail (GST_IS_AUDIO_ENCODER (enc));
GST_LOG_OBJECT (enc, "enabled: %d", enabled);
}
/**
- * gst_base_audio_encoder_get_hard_sync:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_get_hard_sync:
+ * @enc: a #GstAudioEncoder
*
* Queries encoder's hard resync setting.
*
* Since: 0.10.36
*/
gboolean
-gst_base_audio_encoder_get_hard_resync (GstBaseAudioEncoder * enc)
+gst_audio_encoder_get_hard_resync (GstAudioEncoder * enc)
{
gboolean result;
- g_return_val_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc), FALSE);
+ g_return_val_if_fail (GST_IS_AUDIO_ENCODER (enc), FALSE);
GST_OBJECT_LOCK (enc);
result = enc->priv->hard_resync;
}
/**
- * gst_base_audio_encoder_set_tolerance:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_set_tolerance:
+ * @enc: a #GstAudioEncoder
* @tolerance: new tolerance
*
* Configures encoder audio jitter tolerance threshold.
* Since: 0.10.36
*/
void
-gst_base_audio_encoder_set_tolerance (GstBaseAudioEncoder * enc,
- gint64 tolerance)
+gst_audio_encoder_set_tolerance (GstAudioEncoder * enc, gint64 tolerance)
{
- g_return_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc));
+ g_return_if_fail (GST_IS_AUDIO_ENCODER (enc));
GST_OBJECT_LOCK (enc);
enc->priv->tolerance = tolerance;
}
/**
- * gst_base_audio_encoder_get_tolerance:
- * @enc: a #GstBaseAudioEncoder
+ * gst_audio_encoder_get_tolerance:
+ * @enc: a #GstAudioEncoder
*
* Queries current audio jitter tolerance threshold.
*
* Since: 0.10.36
*/
gint64
-gst_base_audio_encoder_get_tolerance (GstBaseAudioEncoder * enc)
+gst_audio_encoder_get_tolerance (GstAudioEncoder * enc)
{
gint64 result;
- g_return_val_if_fail (GST_IS_BASE_AUDIO_ENCODER (enc), 0);
+ g_return_val_if_fail (GST_IS_AUDIO_ENCODER (enc), 0);
GST_OBJECT_LOCK (enc);
result = enc->priv->tolerance;
--- /dev/null
+/* GStreamer
+ * Copyright (C) 2011 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>.
+ * Copyright (C) 2011 Nokia Corporation. All rights reserved.
+ * Contact: Stefan Kost <stefan.kost@nokia.com>
+ *
+ * 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.
+ */
+
+#ifndef __GST_AUDIO_ENCODER_H__
+#define __GST_AUDIO_ENCODER_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "GstAudioEncoder is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/audio/audio.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIO_ENCODER (gst_audio_encoder_get_type())
+#define GST_AUDIO_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_ENCODER,GstAudioEncoder))
+#define GST_AUDIO_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_ENCODER,GstAudioEncoderClass))
+#define GST_AUDIO_ENCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AUDIO_ENCODER,GstAudioEncoderClass))
+#define GST_IS_AUDIO_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_ENCODER))
+#define GST_IS_AUDIO_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_ENCODER))
+#define GST_AUDIO_ENCODER_CAST(obj) ((GstAudioEncoder *)(obj))
+
+/**
+ * GST_AUDIO_ENCODER_SINK_NAME:
+ *
+ * the name of the templates for the sink pad
+ *
+ * Since: 0.10.36
+ */
+#define GST_AUDIO_ENCODER_SINK_NAME "sink"
+/**
+ * GST_AUDIO_ENCODER_SRC_NAME:
+ *
+ * the name of the templates for the source pad
+ *
+ * Since: 0.10.36
+ */
+#define GST_AUDIO_ENCODER_SRC_NAME "src"
+
+/**
+ * GST_AUDIO_ENCODER_SRC_PAD:
+ * @obj: base parse instance
+ *
+ * Gives the pointer to the source #GstPad object of the element.
+ *
+ * Since: 0.10.36
+ */
+#define GST_AUDIO_ENCODER_SRC_PAD(obj) (GST_AUDIO_ENCODER_CAST (obj)->srcpad)
+
+/**
+ * GST_AUDIO_ENCODER_SINK_PAD:
+ * @obj: base parse instance
+ *
+ * Gives the pointer to the sink #GstPad object of the element.
+ *
+ * Since: 0.10.36
+ */
+#define GST_AUDIO_ENCODER_SINK_PAD(obj) (GST_AUDIO_ENCODER_CAST (obj)->sinkpad)
+
+/**
+ * GST_AUDIO_ENCODER_SEGMENT:
+ * @obj: base parse instance
+ *
+ * Gives the segment of the element.
+ *
+ * Since: 0.10.36
+ */
+#define GST_AUDIO_ENCODER_SEGMENT(obj) (GST_AUDIO_ENCODER_CAST (obj)->segment)
+
+
+typedef struct _GstAudioEncoder GstAudioEncoder;
+typedef struct _GstAudioEncoderClass GstAudioEncoderClass;
+
+typedef struct _GstAudioEncoderPrivate GstAudioEncoderPrivate;
+
+/**
+ * GstAudioEncoder:
+ * @element: the parent element.
+ *
+ * The opaque #GstAudioEncoder data structure.
+ *
+ * Since: 0.10.36
+ */
+struct _GstAudioEncoder {
+ GstElement element;
+
+ /*< protected >*/
+ /* source and sink pads */
+ GstPad *sinkpad;
+ GstPad *srcpad;
+
+ /* MT-protected (with STREAM_LOCK) */
+ GstSegment segment;
+
+ /*< private >*/
+ GstAudioEncoderPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+/**
+ * GstAudioEncoderClass:
+ * @start: Optional.
+ * Called when the element starts processing.
+ * Allows opening external resources.
+ * @stop: Optional.
+ * Called when the element stops processing.
+ * Allows closing external resources.
+ * @set_format: Notifies subclass of incoming data format.
+ * GstAudioInfo contains the format according to provided caps.
+ * @handle_frame: Provides input samples (or NULL to clear any remaining data)
+ * according to directions as provided by subclass in the
+ * #GstAudioEncoderContext. Input data ref management
+ * is performed by base class, subclass should not care or
+ * intervene.
+ * @flush: Optional.
+ * Instructs subclass to clear any codec caches and discard
+ * any pending samples and not yet returned encoded data.
+ * @event: Optional.
+ * Event handler on the sink pad. This function should return
+ * TRUE if the event was handled and should be discarded
+ * (i.e. not unref'ed).
+ * @pre_push: Optional.
+ * Called just prior to pushing (encoded data) buffer downstream.
+ * Subclass has full discretionary access to buffer,
+ * and a not OK flow return will abort downstream pushing.
+ * @getcaps: Optional.
+ * Allows for a custom sink getcaps implementation (e.g.
+ * for multichannel input specification). If not implemented,
+ * default returns gst_audio_encoder_proxy_getcaps
+ * applied to sink template caps.
+ *
+ * Subclasses can override any of the available virtual methods or not, as
+ * needed. At minimum @set_format and @handle_frame needs to be overridden.
+ *
+ * Since: 0.10.36
+ */
+struct _GstAudioEncoderClass {
+ GstElementClass parent_class;
+
+ /*< public >*/
+ /* virtual methods for subclasses */
+
+ gboolean (*start) (GstAudioEncoder *enc);
+
+ gboolean (*stop) (GstAudioEncoder *enc);
+
+ gboolean (*set_format) (GstAudioEncoder *enc,
+ GstAudioInfo *info);
+
+ GstFlowReturn (*handle_frame) (GstAudioEncoder *enc,
+ GstBuffer *buffer);
+
+ void (*flush) (GstAudioEncoder *enc);
+
+ GstFlowReturn (*pre_push) (GstAudioEncoder *enc,
+ GstBuffer **buffer);
+
+ gboolean (*event) (GstAudioEncoder *enc,
+ GstEvent *event);
+
+ GstCaps * (*getcaps) (GstAudioEncoder *enc);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+GType gst_audio_encoder_get_type (void);
+
+GstFlowReturn gst_audio_encoder_finish_frame (GstAudioEncoder * enc,
+ GstBuffer * buffer,
+ gint samples);
+
+GstCaps * gst_audio_encoder_proxy_getcaps (GstAudioEncoder * enc,
+ GstCaps * caps);
+
+
+/* context parameters */
+GstAudioInfo * gst_audio_encoder_get_audio_info (GstAudioEncoder * enc);
+
+gint gst_audio_encoder_get_frame_samples (GstAudioEncoder * enc);
+
+void gst_audio_encoder_set_frame_samples (GstAudioEncoder * enc, gint num);
+
+gint gst_audio_encoder_get_frame_max (GstAudioEncoder * enc);
+
+void gst_audio_encoder_set_frame_max (GstAudioEncoder * enc, gint num);
+
+gint gst_audio_encoder_get_lookahead (GstAudioEncoder * enc);
+
+void gst_audio_encoder_set_lookahead (GstAudioEncoder * enc, gint num);
+
+void gst_audio_encoder_get_latency (GstAudioEncoder * enc,
+ GstClockTime * min,
+ GstClockTime * max);
+
+void gst_audio_encoder_set_latency (GstAudioEncoder * enc,
+ GstClockTime min,
+ GstClockTime max);
+
+/* object properties */
+
+void gst_audio_encoder_set_mark_granule (GstAudioEncoder * enc,
+ gboolean enabled);
+
+gboolean gst_audio_encoder_get_mark_granule (GstAudioEncoder * enc);
+
+void gst_audio_encoder_set_perfect_timestamp (GstAudioEncoder * enc,
+ gboolean enabled);
+
+gboolean gst_audio_encoder_get_perfect_timestamp (GstAudioEncoder * enc);
+
+void gst_audio_encoder_set_hard_resync (GstAudioEncoder * enc,
+ gboolean enabled);
+
+gboolean gst_audio_encoder_get_hard_resync (GstAudioEncoder * enc);
+
+void gst_audio_encoder_set_tolerance (GstAudioEncoder * enc,
+ gint64 tolerance);
+
+gint64 gst_audio_encoder_get_tolerance (GstAudioEncoder * enc);
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_ENCODER_H__ */
+++ /dev/null
-/* GStreamer
- * Copyright (C) 2011 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>.
- * Copyright (C) 2011 Nokia Corporation. All rights reserved.
- * Contact: Stefan Kost <stefan.kost@nokia.com>
- *
- * 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.
- */
-
-#ifndef __GST_BASE_AUDIO_ENCODER_H__
-#define __GST_BASE_AUDIO_ENCODER_H__
-
-#ifndef GST_USE_UNSTABLE_API
-#warning "GstBaseAudioEncoder is unstable API and may change in future."
-#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
-#endif
-
-#include <gst/gst.h>
-#include <gst/audio/audio.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_BASE_AUDIO_ENCODER (gst_base_audio_encoder_get_type())
-#define GST_BASE_AUDIO_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_AUDIO_ENCODER,GstBaseAudioEncoder))
-#define GST_BASE_AUDIO_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_AUDIO_ENCODER,GstBaseAudioEncoderClass))
-#define GST_BASE_AUDIO_ENCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_AUDIO_ENCODER,GstBaseAudioEncoderClass))
-#define GST_IS_BASE_AUDIO_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_AUDIO_ENCODER))
-#define GST_IS_BASE_AUDIO_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_AUDIO_ENCODER))
-#define GST_BASE_AUDIO_ENCODER_CAST(obj) ((GstBaseAudioEncoder *)(obj))
-
-/**
- * GST_BASE_AUDIO_ENCODER_SINK_NAME:
- *
- * the name of the templates for the sink pad
- *
- * Since: 0.10.36
- */
-#define GST_BASE_AUDIO_ENCODER_SINK_NAME "sink"
-/**
- * GST_BASE_AUDIO_ENCODER_SRC_NAME:
- *
- * the name of the templates for the source pad
- *
- * Since: 0.10.36
- */
-#define GST_BASE_AUDIO_ENCODER_SRC_NAME "src"
-
-/**
- * GST_BASE_AUDIO_ENCODER_SRC_PAD:
- * @obj: base parse instance
- *
- * Gives the pointer to the source #GstPad object of the element.
- *
- * Since: 0.10.36
- */
-#define GST_BASE_AUDIO_ENCODER_SRC_PAD(obj) (GST_BASE_AUDIO_ENCODER_CAST (obj)->srcpad)
-
-/**
- * GST_BASE_AUDIO_ENCODER_SINK_PAD:
- * @obj: base parse instance
- *
- * Gives the pointer to the sink #GstPad object of the element.
- *
- * Since: 0.10.36
- */
-#define GST_BASE_AUDIO_ENCODER_SINK_PAD(obj) (GST_BASE_AUDIO_ENCODER_CAST (obj)->sinkpad)
-
-/**
- * GST_BASE_AUDIO_ENCODER_SEGMENT:
- * @obj: base parse instance
- *
- * Gives the segment of the element.
- *
- * Since: 0.10.36
- */
-#define GST_BASE_AUDIO_ENCODER_SEGMENT(obj) (GST_BASE_AUDIO_ENCODER_CAST (obj)->segment)
-
-
-typedef struct _GstBaseAudioEncoder GstBaseAudioEncoder;
-typedef struct _GstBaseAudioEncoderClass GstBaseAudioEncoderClass;
-
-typedef struct _GstBaseAudioEncoderPrivate GstBaseAudioEncoderPrivate;
-
-/**
- * GstBaseAudioEncoder:
- * @element: the parent element.
- *
- * The opaque #GstBaseAudioEncoder data structure.
- *
- * Since: 0.10.36
- */
-struct _GstBaseAudioEncoder {
- GstElement element;
-
- /*< protected >*/
- /* source and sink pads */
- GstPad *sinkpad;
- GstPad *srcpad;
-
- /* MT-protected (with STREAM_LOCK) */
- GstSegment segment;
-
- /*< private >*/
- GstBaseAudioEncoderPrivate *priv;
- gpointer _gst_reserved[GST_PADDING_LARGE];
-};
-
-/**
- * GstBaseAudioEncoderClass:
- * @start: Optional.
- * Called when the element starts processing.
- * Allows opening external resources.
- * @stop: Optional.
- * Called when the element stops processing.
- * Allows closing external resources.
- * @set_format: Notifies subclass of incoming data format.
- * GstAudioInfo contains the format according to provided caps.
- * @handle_frame: Provides input samples (or NULL to clear any remaining data)
- * according to directions as provided by subclass in the
- * #GstBaseAudioEncoderContext. Input data ref management
- * is performed by base class, subclass should not care or
- * intervene.
- * @flush: Optional.
- * Instructs subclass to clear any codec caches and discard
- * any pending samples and not yet returned encoded data.
- * @event: Optional.
- * Event handler on the sink pad. This function should return
- * TRUE if the event was handled and should be discarded
- * (i.e. not unref'ed).
- * @pre_push: Optional.
- * Called just prior to pushing (encoded data) buffer downstream.
- * Subclass has full discretionary access to buffer,
- * and a not OK flow return will abort downstream pushing.
- * @getcaps: Optional.
- * Allows for a custom sink getcaps implementation (e.g.
- * for multichannel input specification). If not implemented,
- * default returns gst_base_audio_encoder_proxy_getcaps
- * applied to sink template caps.
- *
- * Subclasses can override any of the available virtual methods or not, as
- * needed. At minimum @set_format and @handle_frame needs to be overridden.
- *
- * Since: 0.10.36
- */
-struct _GstBaseAudioEncoderClass {
- GstElementClass parent_class;
-
- /*< public >*/
- /* virtual methods for subclasses */
-
- gboolean (*start) (GstBaseAudioEncoder *enc);
-
- gboolean (*stop) (GstBaseAudioEncoder *enc);
-
- gboolean (*set_format) (GstBaseAudioEncoder *enc,
- GstAudioInfo *info);
-
- GstFlowReturn (*handle_frame) (GstBaseAudioEncoder *enc,
- GstBuffer *buffer);
-
- void (*flush) (GstBaseAudioEncoder *enc);
-
- GstFlowReturn (*pre_push) (GstBaseAudioEncoder *enc,
- GstBuffer **buffer);
-
- gboolean (*event) (GstBaseAudioEncoder *enc,
- GstEvent *event);
-
- GstCaps * (*getcaps) (GstBaseAudioEncoder *enc);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING_LARGE];
-};
-
-GType gst_base_audio_encoder_get_type (void);
-
-GstFlowReturn gst_base_audio_encoder_finish_frame (GstBaseAudioEncoder * enc,
- GstBuffer *buffer, gint samples);
-
-GstCaps * gst_base_audio_encoder_proxy_getcaps (GstBaseAudioEncoder * enc,
- GstCaps * caps);
-
-
-/* context parameters */
-GstAudioInfo * gst_base_audio_encoder_get_audio_info (GstBaseAudioEncoder * enc);
-
-gint gst_base_audio_encoder_get_frame_samples (GstBaseAudioEncoder * enc);
-void gst_base_audio_encoder_set_frame_samples (GstBaseAudioEncoder * enc,
- gint num);
-
-gint gst_base_audio_encoder_get_frame_max (GstBaseAudioEncoder * enc);
-void gst_base_audio_encoder_set_frame_max (GstBaseAudioEncoder * enc,
- gint num);
-
-gint gst_base_audio_encoder_get_lookahead (GstBaseAudioEncoder * enc);
-void gst_base_audio_encoder_set_lookahead (GstBaseAudioEncoder * enc,
- gint num);
-
-void gst_base_audio_encoder_get_latency (GstBaseAudioEncoder * enc,
- GstClockTime * min, GstClockTime * max);
-void gst_base_audio_encoder_set_latency (GstBaseAudioEncoder * enc,
- GstClockTime min, GstClockTime max);
-
-/* object properties */
-void gst_base_audio_encoder_set_mark_granule (GstBaseAudioEncoder * enc,
- gboolean enabled);
-gboolean gst_base_audio_encoder_get_mark_granule (GstBaseAudioEncoder * enc);
-
-void gst_base_audio_encoder_set_perfect_timestamp (GstBaseAudioEncoder * enc,
- gboolean enabled);
-gboolean gst_base_audio_encoder_get_perfect_timestamp (GstBaseAudioEncoder * enc);
-
-void gst_base_audio_encoder_set_hard_resync (GstBaseAudioEncoder * enc,
- gboolean enabled);
-gboolean gst_base_audio_encoder_get_hard_resync (GstBaseAudioEncoder * enc);
-
-void gst_base_audio_encoder_set_tolerance (GstBaseAudioEncoder * enc,
- gint64 tolerance);
-gint64 gst_base_audio_encoder_get_tolerance (GstBaseAudioEncoder * enc);
-
-G_END_DECLS
-
-#endif /* __GST_BASE_AUDIO_ENCODER_H__ */
EXPORTS
- _gst_base_audio_decoder_error
+ _gst_audio_decoder_error
gst_audio_buffer_clip
gst_audio_channel_position_get_type
gst_audio_check_channel_positions
gst_audio_clock_new
gst_audio_clock_new_full
gst_audio_clock_reset
+ gst_audio_decoder_finish_frame
+ gst_audio_decoder_get_audio_info
+ gst_audio_decoder_get_byte_time
+ gst_audio_decoder_get_delay
+ gst_audio_decoder_get_latency
+ gst_audio_decoder_get_max_errors
+ gst_audio_decoder_get_min_latency
+ gst_audio_decoder_get_parse_state
+ gst_audio_decoder_get_plc
+ gst_audio_decoder_get_plc_aware
+ gst_audio_decoder_get_tolerance
+ gst_audio_decoder_get_type
+ gst_audio_decoder_set_byte_time
+ gst_audio_decoder_set_latency
+ gst_audio_decoder_set_max_errors
+ gst_audio_decoder_set_min_latency
+ gst_audio_decoder_set_plc
+ gst_audio_decoder_set_plc_aware
+ gst_audio_decoder_set_tolerance
gst_audio_default_registry_mixer_filter
gst_audio_duration_from_pad_buffer
+ gst_audio_encoder_finish_frame
+ gst_audio_encoder_get_audio_info
+ gst_audio_encoder_get_frame_max
+ gst_audio_encoder_get_frame_samples
+ gst_audio_encoder_get_hard_resync
+ gst_audio_encoder_get_latency
+ gst_audio_encoder_get_lookahead
+ gst_audio_encoder_get_mark_granule
+ gst_audio_encoder_get_perfect_timestamp
+ gst_audio_encoder_get_tolerance
+ gst_audio_encoder_get_type
+ gst_audio_encoder_proxy_getcaps
+ gst_audio_encoder_set_frame_max
+ gst_audio_encoder_set_frame_samples
+ gst_audio_encoder_set_hard_resync
+ gst_audio_encoder_set_latency
+ gst_audio_encoder_set_lookahead
+ gst_audio_encoder_set_mark_granule
+ gst_audio_encoder_set_perfect_timestamp
+ gst_audio_encoder_set_tolerance
gst_audio_filter_class_add_pad_templates
gst_audio_filter_get_type
gst_audio_fixate_channel_positions
gst_audio_sink_get_type
gst_audio_src_get_type
gst_audio_structure_set_int
- gst_base_audio_decoder_finish_frame
- gst_base_audio_decoder_get_audio_info
- gst_base_audio_decoder_get_byte_time
- gst_base_audio_decoder_get_delay
- gst_base_audio_decoder_get_latency
- gst_base_audio_decoder_get_max_errors
- gst_base_audio_decoder_get_min_latency
- gst_base_audio_decoder_get_parse_state
- gst_base_audio_decoder_get_plc
- gst_base_audio_decoder_get_plc_aware
- gst_base_audio_decoder_get_tolerance
- gst_base_audio_decoder_get_type
- gst_base_audio_decoder_set_byte_time
- gst_base_audio_decoder_set_latency
- gst_base_audio_decoder_set_max_errors
- gst_base_audio_decoder_set_min_latency
- gst_base_audio_decoder_set_plc
- gst_base_audio_decoder_set_plc_aware
- gst_base_audio_decoder_set_tolerance
- gst_base_audio_encoder_finish_frame
- gst_base_audio_encoder_get_audio_info
- gst_base_audio_encoder_get_frame_max
- gst_base_audio_encoder_get_frame_samples
- gst_base_audio_encoder_get_hard_resync
- gst_base_audio_encoder_get_latency
- gst_base_audio_encoder_get_lookahead
- gst_base_audio_encoder_get_mark_granule
- gst_base_audio_encoder_get_perfect_timestamp
- gst_base_audio_encoder_get_tolerance
- gst_base_audio_encoder_get_type
- gst_base_audio_encoder_proxy_getcaps
- gst_base_audio_encoder_set_frame_max
- gst_base_audio_encoder_set_frame_samples
- gst_base_audio_encoder_set_hard_resync
- gst_base_audio_encoder_set_latency
- gst_base_audio_encoder_set_lookahead
- gst_base_audio_encoder_set_mark_granule
- gst_base_audio_encoder_set_perfect_timestamp
- gst_base_audio_encoder_set_tolerance
gst_base_audio_sink_create_ringbuffer
gst_base_audio_sink_get_drift_tolerance
gst_base_audio_sink_get_provide_clock