element-maker: Update templates for 1.0

This are (almost) completely autogenerated from the documentation.
This commit is contained in:
David Schleef 2013-03-14 23:57:06 -07:00
parent 6005ab322d
commit b45a1df5de
27 changed files with 1501 additions and 1074 deletions

View file

@ -0,0 +1,191 @@
/* vim: set filetype=c: */
% ClassName
GstAudioDecoder
% TYPE_CLASS_NAME
GST_TYPE_AUDIO_DECODER
% pads
srcpad-audio
sinkpad-simple
% pkg-config
gstreamer-audio-1.0
% includes
#include <gst/audio/gstaudiodecoder.h>
% prototypes
static gboolean gst_replace_start (GstAudioDecoder * decoder);
static gboolean gst_replace_stop (GstAudioDecoder * decoder);
static gboolean gst_replace_set_format (GstAudioDecoder * decoder, GstCaps * caps);
static GstFlowReturn gst_replace_parse (GstAudioDecoder * decoder,
GstAdapter * adapter, gint * offset, gint * length);
static GstFlowReturn gst_replace_handle_frame (GstAudioDecoder * decoder,
GstBuffer * buffer);
static void gst_replace_flush (GstAudioDecoder * decoder, gboolean hard);
static GstFlowReturn gst_replace_pre_push (GstAudioDecoder * decoder,
GstBuffer ** buffer);
static gboolean gst_replace_sink_event (GstAudioDecoder * decoder,
GstEvent * event);
static gboolean gst_replace_src_event (GstAudioDecoder * decoder, GstEvent * event);
static gboolean gst_replace_open (GstAudioDecoder * decoder);
static gboolean gst_replace_close (GstAudioDecoder * decoder);
static gboolean gst_replace_negotiate (GstAudioDecoder * decoder);
static gboolean gst_replace_decide_allocation (GstAudioDecoder * decoder,
GstQuery * query);
static gboolean gst_replace_propose_allocation (GstAudioDecoder * decoder,
GstQuery * query);
% declare-class
GstAudioDecoderClass *audio_decoder_class = GST_AUDIO_DECODER_CLASS (klass);
% set-methods
audio_decoder_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
audio_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
audio_decoder_class->set_format = GST_DEBUG_FUNCPTR (gst_replace_set_format);
audio_decoder_class->parse = GST_DEBUG_FUNCPTR (gst_replace_parse);
audio_decoder_class->handle_frame = GST_DEBUG_FUNCPTR (gst_replace_handle_frame);
audio_decoder_class->flush = GST_DEBUG_FUNCPTR (gst_replace_flush);
audio_decoder_class->pre_push = GST_DEBUG_FUNCPTR (gst_replace_pre_push);
audio_decoder_class->sink_event = GST_DEBUG_FUNCPTR (gst_replace_sink_event);
audio_decoder_class->src_event = GST_DEBUG_FUNCPTR (gst_replace_src_event);
audio_decoder_class->open = GST_DEBUG_FUNCPTR (gst_replace_open);
audio_decoder_class->close = GST_DEBUG_FUNCPTR (gst_replace_close);
audio_decoder_class->negotiate = GST_DEBUG_FUNCPTR (gst_replace_negotiate);
audio_decoder_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_replace_decide_allocation);
audio_decoder_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_replace_propose_allocation);
% methods
static gboolean
gst_replace_start (GstAudioDecoder * decoder)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "start");
return TRUE;
}
static gboolean
gst_replace_stop (GstAudioDecoder * decoder)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "stop");
return TRUE;
}
static gboolean
gst_replace_set_format (GstAudioDecoder * decoder, GstCaps * caps)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "set_format");
return TRUE;
}
static GstFlowReturn
gst_replace_parse (GstAudioDecoder * decoder, GstAdapter * adapter, gint * offset,
gint * length)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "parse");
return GST_FLOW_OK;
}
static GstFlowReturn
gst_replace_handle_frame (GstAudioDecoder * decoder, GstBuffer * buffer)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "handle_frame");
return GST_FLOW_OK;
}
static void
gst_replace_flush (GstAudioDecoder * decoder, gboolean hard)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "flush");
}
static GstFlowReturn
gst_replace_pre_push (GstAudioDecoder * decoder, GstBuffer ** buffer)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "pre_push");
return GST_FLOW_OK;
}
static gboolean
gst_replace_sink_event (GstAudioDecoder * decoder, GstEvent * event)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "sink_event");
return TRUE;
}
static gboolean
gst_replace_src_event (GstAudioDecoder * decoder, GstEvent * event)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "src_event");
return TRUE;
}
static gboolean
gst_replace_open (GstAudioDecoder * decoder)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "open");
return TRUE;
}
static gboolean
gst_replace_close (GstAudioDecoder * decoder)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "close");
return TRUE;
}
static gboolean
gst_replace_negotiate (GstAudioDecoder * decoder)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "negotiate");
return TRUE;
}
static gboolean
gst_replace_decide_allocation (GstAudioDecoder * decoder, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "decide_allocation");
return TRUE;
}
static gboolean
gst_replace_propose_allocation (GstAudioDecoder * decoder, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "propose_allocation");
return TRUE;
}
% end

View file

@ -0,0 +1,190 @@
/* vim: set filetype=c: */
% ClassName
GstAudioEncoder
% TYPE_CLASS_NAME
GST_TYPE_AUDIO_ENCODER
% pads
srcpad-simple
sinkpad-audio
% pkg-config
gstreamer-audio-1.0
% includes
#include <gst/audio/gstaudioencoder.h>
% prototypes
static gboolean gst_replace_start (GstAudioEncoder * encoder);
static gboolean gst_replace_stop (GstAudioEncoder * encoder);
static gboolean gst_replace_set_format (GstAudioEncoder * encoder,
GstAudioInfo * info);
static GstFlowReturn gst_replace_handle_frame (GstAudioEncoder * encoder,
GstBuffer * buffer);
static void gst_replace_flush (GstAudioEncoder * encoder);
static GstFlowReturn gst_replace_pre_push (GstAudioEncoder * encoder,
GstBuffer ** buffer);
static gboolean gst_replace_sink_event (GstAudioEncoder * encoder,
GstEvent * event);
static gboolean gst_replace_src_event (GstAudioEncoder * encoder, GstEvent * event);
static GstCaps *gst_replace_getcaps (GstAudioEncoder * encoder, GstCaps * filter);
static gboolean gst_replace_open (GstAudioEncoder * encoder);
static gboolean gst_replace_close (GstAudioEncoder * encoder);
static gboolean gst_replace_negotiate (GstAudioEncoder * encoder);
static gboolean gst_replace_decide_allocation (GstAudioEncoder * encoder,
GstQuery * query);
static gboolean gst_replace_propose_allocation (GstAudioEncoder * encoder,
GstQuery * query);
% declare-class
GstAudioEncoderClass *audio_encoder_class = GST_AUDIO_ENCODER_CLASS (klass);
% set-methods
audio_encoder_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
audio_encoder_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
audio_encoder_class->set_format = GST_DEBUG_FUNCPTR (gst_replace_set_format);
audio_encoder_class->handle_frame = GST_DEBUG_FUNCPTR (gst_replace_handle_frame);
audio_encoder_class->flush = GST_DEBUG_FUNCPTR (gst_replace_flush);
audio_encoder_class->pre_push = GST_DEBUG_FUNCPTR (gst_replace_pre_push);
audio_encoder_class->sink_event = GST_DEBUG_FUNCPTR (gst_replace_sink_event);
audio_encoder_class->src_event = GST_DEBUG_FUNCPTR (gst_replace_src_event);
audio_encoder_class->getcaps = GST_DEBUG_FUNCPTR (gst_replace_getcaps);
audio_encoder_class->open = GST_DEBUG_FUNCPTR (gst_replace_open);
audio_encoder_class->close = GST_DEBUG_FUNCPTR (gst_replace_close);
audio_encoder_class->negotiate = GST_DEBUG_FUNCPTR (gst_replace_negotiate);
audio_encoder_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_replace_decide_allocation);
audio_encoder_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_replace_propose_allocation);
% methods
static gboolean
gst_replace_start (GstAudioEncoder * encoder)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "start");
return TRUE;
}
static gboolean
gst_replace_stop (GstAudioEncoder * encoder)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "stop");
return TRUE;
}
static gboolean
gst_replace_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "set_format");
return TRUE;
}
static GstFlowReturn
gst_replace_handle_frame (GstAudioEncoder * encoder, GstBuffer * buffer)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "handle_frame");
return GST_FLOW_OK;
}
static void
gst_replace_flush (GstAudioEncoder * encoder)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "flush");
}
static GstFlowReturn
gst_replace_pre_push (GstAudioEncoder * encoder, GstBuffer ** buffer)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "pre_push");
return GST_FLOW_OK;
}
static gboolean
gst_replace_sink_event (GstAudioEncoder * encoder, GstEvent * event)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "sink_event");
return TRUE;
}
static gboolean
gst_replace_src_event (GstAudioEncoder * encoder, GstEvent * event)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "src_event");
return TRUE;
}
static GstCaps *
gst_replace_getcaps (GstAudioEncoder * encoder, GstCaps * filter)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "getcaps");
return NULL;
}
static gboolean
gst_replace_open (GstAudioEncoder * encoder)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "open");
return TRUE;
}
static gboolean
gst_replace_close (GstAudioEncoder * encoder)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "close");
return TRUE;
}
static gboolean
gst_replace_negotiate (GstAudioEncoder * encoder)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "negotiate");
return TRUE;
}
static gboolean
gst_replace_decide_allocation (GstAudioEncoder * encoder, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "decide_allocation");
return TRUE;
}
static gboolean
gst_replace_propose_allocation (GstAudioEncoder * encoder, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT (replace, "propose_allocation");
return TRUE;
}
% end

View file

@ -4,64 +4,27 @@ GstAudioFilter
% TYPE_CLASS_NAME
GST_TYPE_AUDIO_FILTER
% pads
sinkpad-simple srcpad-simple
srcpad-audio
sinkpad-audio
% pkg-config
gstreamer-audio-0.10
gstreamer-audio-1.0
% includes
#include <gst/audio/gstaudiofilter.h>
% prototypes
static gboolean
gst_replace_setup (GstAudioFilter * filter, GstRingBufferSpec * format);
static gboolean
gst_replace_start (GstBaseTransform * trans);
static GstFlowReturn
gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf);
static gboolean
gst_replace_stop (GstBaseTransform * trans);
static gboolean gst_replace_setup (GstAudioFilter * filter,
const GstAudioInfo * info);
% declare-class
GstAudioFilterClass *audio_filter_class = GST_AUDIO_FILTER_CLASS (klass);
GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass);
% set-methods
audio_filter_class->setup = GST_DEBUG_FUNCPTR (gst_replace_setup);
base_transform_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
base_transform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_replace_transform_ip);
base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
% methods
static gboolean
gst_replace_setup (GstAudioFilter * filter, GstRingBufferSpec * format)
gst_replace_setup (GstAudioFilter * filter, const GstAudioInfo * info)
{
/* GstReplace *replace = GST_REPLACE (filter); */
GstReplace *replace = GST_REPLACE (filter);
GST_DEBUG_OBJECT (replace, "setup");
/* handle audio format changes */
return TRUE;
}
static gboolean
gst_replace_start (GstBaseTransform * trans)
{
/* GstReplace *replace = GST_REPLACE (trans); */
/* initialize processing */
return TRUE;
}
static GstFlowReturn
gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
{
/* GstReplace *replace = GST_REPLACE (trans); */
/* process the audio data in the buffer in-place */
return GST_FLOW_OK;
}
static gboolean
gst_replace_stop (GstBaseTransform * trans)
{
/* GstReplace *replace = GST_REPLACE (trans); */
/* finalize processing */
return TRUE;
}
% end

View file

@ -4,18 +4,19 @@ GstAudioSink
% TYPE_CLASS_NAME
GST_TYPE_AUDIO_SINK
% pads
sinkpad-simple
sinkpad-audio
% pkg-config
gstreamer-audio-0.10
gstreamer-audio-1.0
% includes
#include <gst/audio/gstaudiosink.h>
% prototypes
static gboolean gst_replace_open (GstAudioSink * sink);
static gboolean
gst_replace_prepare (GstAudioSink * sink, GstRingBufferSpec * spec);
static gboolean gst_replace_prepare (GstAudioSink * sink,
GstAudioRingBufferSpec * spec);
static gboolean gst_replace_unprepare (GstAudioSink * sink);
static gboolean gst_replace_close (GstAudioSink * sink);
static guint gst_replace_write (GstAudioSink * sink, gpointer data, guint length);
static gint gst_replace_write (GstAudioSink * sink, gpointer data,
guint length);
static guint gst_replace_delay (GstAudioSink * sink);
static void gst_replace_reset (GstAudioSink * sink);
% declare-class
@ -29,45 +30,79 @@ static void gst_replace_reset (GstAudioSink * sink);
audio_sink_class->delay = GST_DEBUG_FUNCPTR (gst_replace_delay);
audio_sink_class->reset = GST_DEBUG_FUNCPTR (gst_replace_reset);
% methods
/* open the device with given specs */
static gboolean
gst_replace_open (GstAudioSink * sink)
{
return FALSE;
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "open");
return TRUE;
}
/* prepare resources and state to operate with the given specs */
static gboolean
gst_replace_prepare (GstAudioSink * sink, GstRingBufferSpec * spec)
gst_replace_prepare (GstAudioSink * sink, GstAudioRingBufferSpec * spec)
{
return FALSE;
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "prepare");
return TRUE;
}
/* undo anything that was done in prepare() */
static gboolean
gst_replace_unprepare (GstAudioSink * sink)
{
return FALSE;
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "unprepare");
return TRUE;
}
/* close the device */
static gboolean
gst_replace_close (GstAudioSink * sink)
{
return FALSE;
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "close");
return TRUE;
}
static guint
/* write samples to the device */
static gint
gst_replace_write (GstAudioSink * sink, gpointer data, guint length)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "write");
return 0;
}
/* get number of samples queued in the device */
static guint
gst_replace_delay (GstAudioSink * sink)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "delay");
return 0;
}
/* reset the audio device, unblock from a write */
static void
gst_replace_reset (GstAudioSink * sink)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "reset");
}
% end

View file

@ -4,19 +4,19 @@ GstAudioSrc
% TYPE_CLASS_NAME
GST_TYPE_AUDIO_SRC
% pads
srcpad-simple
srcpad-audio
% pkg-config
gstreamer-audio-0.10
gstreamer-audio-1.0
% includes
#include <gst/audio/gstaudiosrc.h>
% prototypes
static gboolean gst_replace_open (GstAudioSrc * src);
static gboolean
gst_replace_prepare (GstAudioSrc * src, GstRingBufferSpec * spec);
static gboolean gst_replace_prepare (GstAudioSrc * src,
GstAudioRingBufferSpec * spec);
static gboolean gst_replace_unprepare (GstAudioSrc * src);
static gboolean gst_replace_close (GstAudioSrc * src);
static guint
gst_replace_read (GstAudioSrc * src, gpointer data, guint length);
static guint gst_replace_read (GstAudioSrc * src, gpointer data, guint length,
GstClockTime * timestamp);
static guint gst_replace_delay (GstAudioSrc * src);
static void gst_replace_reset (GstAudioSrc * src);
% declare-class
@ -30,45 +30,80 @@ static void gst_replace_reset (GstAudioSrc * src);
audio_src_class->delay = GST_DEBUG_FUNCPTR (gst_replace_delay);
audio_src_class->reset = GST_DEBUG_FUNCPTR (gst_replace_reset);
% methods
/* open the device with given specs */
static gboolean
gst_replace_open (GstAudioSrc * src)
{
return FALSE;
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "open");
return TRUE;
}
/* prepare resources and state to operate with the given specs */
static gboolean
gst_replace_prepare (GstAudioSrc * src, GstRingBufferSpec * spec)
gst_replace_prepare (GstAudioSrc * src, GstAudioRingBufferSpec * spec)
{
return FALSE;
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "prepare");
return TRUE;
}
/* undo anything that was done in prepare() */
static gboolean
gst_replace_unprepare (GstAudioSrc * src)
{
return FALSE;
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "unprepare");
return TRUE;
}
/* close the device */
static gboolean
gst_replace_close (GstAudioSrc * src)
{
return FALSE;
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "close");
return TRUE;
}
/* read samples from the device */
static guint
gst_replace_read (GstAudioSrc * src, gpointer data, guint length)
gst_replace_read (GstAudioSrc * src, gpointer data, guint length,
GstClockTime * timestamp)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "read");
return 0;
}
/* get number of samples queued in the device */
static guint
gst_replace_delay (GstAudioSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "delay");
return 0;
}
/* reset the audio device, unblock from a write */
static void
gst_replace_reset (GstAudioSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "reset");
}
% end

View file

@ -1,34 +0,0 @@
/* vim: set filetype=c: */
% copyright
/* GStreamer
* Copyright (C) 2010 REAL_NAME <EMAIL_ADDRESS>
*
* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
% includes
#include <gst/gst.h>
% part2
enum
{
ARG_0
};
% end

View file

@ -1,25 +0,0 @@
/* vim: set filetype=c: */
% ClassName
GstBaseAudioSink
% TYPE_CLASS_NAME
GST_TYPE_BASE_AUDIO_SINK
% pads
sinkpad-simple
% pkg-config
gstreamer-audio-0.10
% includes
#include <gst/audio/gstbaseaudiosink.h>
% prototypes
static GstRingBuffer *gst_replace_create_ringbuffer (GstBaseAudioSink * sink);
% declare-class
GstBaseAudioSinkClass *base_audio_sink_class = GST_BASE_AUDIO_SINK_CLASS (klass);
% set-methods
base_audio_sink_class->create_ringbuffer = GST_DEBUG_FUNCPTR (gst_replace_create_ringbuffer);
% methods
static GstRingBuffer *
gst_replace_create_ringbuffer (GstBaseAudioSink * sink)
{
return NULL;
}
% end

View file

@ -1,26 +0,0 @@
/* vim: set filetype=c: */
% ClassName
GstBaseAudioSrc
% TYPE_CLASS_NAME
GST_TYPE_BASE_AUDIO_SRC
% pads
srcpad-simple
% pkg-config
gstreamer-audio-0.10
% includes
#include <gst/audio/gstbaseaudiosrc.h>
% prototypes
static GstRingBuffer *gst_replace_create_ringbuffer (GstBaseAudioSrc * src);
% declare-class
GstBaseAudioSrcClass *base_audio_src_class = GST_BASE_AUDIO_SRC_CLASS (klass);
% set-methods
base_audio_src_class->create_ringbuffer = GST_DEBUG_FUNCPTR (gst_replace_create_ringbuffer);
% methods
static GstRingBuffer *
gst_replace_create_ringbuffer (GstBaseAudioSrc * src)
{
return NULL;
}
% end

View file

@ -1,76 +1,94 @@
/* vim: set filetype=c: */
% ClassName
GstBaseParse
% TYPE_CLASS_NAME
GST_TYPE_BASE_PARSE
% pads
srcpad-simple
sinkpad-simple
% pkg-config
gstreamer-base-0.10
gstreamer-base-1.0
% includes
#include <gst/base/gstbaseparse.h>
% prototypes
static gboolean gst_replace_start (GstBaseParse *parse);
static gboolean gst_replace_stop (GstBaseParse *parse);
static gboolean gst_replace_set_sink_caps (GstBaseParse *parse, GstCaps *caps);
static gboolean gst_replace_check_valid_frame (GstBaseParse *parse,
GstBaseParseFrame *frame, guint *framesize, gint *skipsize);
static GstFlowReturn gst_replace_parse_frame (GstBaseParse *parse,
GstBaseParseFrame *frame);
static gboolean gst_replace_convert (GstBaseParse * parse,
GstFormat src_format, gint64 src_value, GstFormat dest_format,
gint64 * dest_value);
static gboolean gst_replace_event (GstBaseParse *parse, GstEvent *event);
static gboolean gst_replace_src_event (GstBaseParse *parse, GstEvent *event);
static GstFlowReturn gst_replace_pre_push_frame (GstBaseParse *parse,
GstBaseParseFrame *frame);
static gboolean gst_replace_start (GstBaseParse * parse);
static gboolean gst_replace_stop (GstBaseParse * parse);
static gboolean gst_replace_set_sink_caps (GstBaseParse * parse,
GstCaps * caps);
static GstFlowReturn gst_replace_handle_frame (GstBaseParse * parse,
GstBaseParseFrame * frame, gint * skipsize);
static GstFlowReturn gst_replace_pre_push_frame (GstBaseParse * parse,
GstBaseParseFrame * frame);
static gboolean gst_replace_convert (GstBaseParse * parse, GstFormat src_format,
gint64 src_value, GstFormat dest_format, gint64 * dest_value);
static gboolean gst_replace_sink_event (GstBaseParse * parse, GstEvent * event);
static gboolean gst_replace_src_event (GstBaseParse * parse, GstEvent * event);
static GstCaps *gst_replace_get_sink_caps (GstBaseParse * parse,
GstCaps * filter);
static GstFlowReturn gst_replace_detect (GstBaseParse * parse,
GstBuffer * buffer);
% declare-class
GstBaseParseClass *base_parse_class = GST_BASE_PARSE_CLASS (klass);
% set-methods
base_parse_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
base_parse_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
base_parse_class->set_sink_caps = GST_DEBUG_FUNCPTR (gst_replace_set_sink_caps);
base_parse_class->check_valid_frame = GST_DEBUG_FUNCPTR (gst_replace_check_valid_frame);
base_parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_replace_parse_frame);
base_parse_class->handle_frame = GST_DEBUG_FUNCPTR (gst_replace_handle_frame);
base_parse_class->pre_push_frame = GST_DEBUG_FUNCPTR (gst_replace_pre_push_frame);
base_parse_class->convert = GST_DEBUG_FUNCPTR (gst_replace_convert);
base_parse_class->event = GST_DEBUG_FUNCPTR (gst_replace_event);
base_parse_class->sink_event = GST_DEBUG_FUNCPTR (gst_replace_sink_event);
base_parse_class->src_event = GST_DEBUG_FUNCPTR (gst_replace_src_event);
base_parse_class->get_sink_caps = GST_DEBUG_FUNCPTR (gst_replace_get_sink_caps);
base_parse_class->detect = GST_DEBUG_FUNCPTR (gst_replace_detect);
% methods
static gboolean
gst_replace_start (GstBaseParse *parse)
gst_replace_start (GstBaseParse * parse)
{
GstReplace *replace = GST_REPLACE (parse);
GST_DEBUG_OBJECT (replace, "start");
return TRUE;
}
static gboolean
gst_replace_stop (GstBaseParse *parse)
gst_replace_stop (GstBaseParse * parse)
{
GstReplace *replace = GST_REPLACE (parse);
GST_DEBUG_OBJECT (replace, "stop");
return TRUE;
}
static gboolean
gst_replace_set_sink_caps (GstBaseParse *parse, GstCaps *caps)
gst_replace_set_sink_caps (GstBaseParse * parse, GstCaps * caps)
{
/* Called when sink caps are set */
return TRUE;
}
GstReplace *replace = GST_REPLACE (parse);
GST_DEBUG_OBJECT (replace, "set_sink_caps");
static gboolean
gst_replace_check_valid_frame (GstBaseParse *parse,
GstBaseParseFrame *frame, guint *framesize, gint *skipsize)
{
/* Called when processing incoming buffers. Function should check
whether the buffer contains a valid frame */
/* MUST implement */
return TRUE;
}
static GstFlowReturn
gst_replace_parse_frame (GstBaseParse *parse,
GstBaseParseFrame *frame)
gst_replace_handle_frame (GstBaseParse * parse, GstBaseParseFrame * frame,
gint * skipsize)
{
/* Called when processing incoming buffers. Function should parse
a checked frame. */
/* MUST implement */
GstReplace *replace = GST_REPLACE (parse);
GST_DEBUG_OBJECT (replace, "handle_frame");
return GST_FLOW_OK;
}
static GstFlowReturn
gst_replace_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
{
GstReplace *replace = GST_REPLACE (parse);
GST_DEBUG_OBJECT (replace, "pre_push_frame");
return GST_FLOW_OK;
}
@ -78,32 +96,50 @@ static gboolean
gst_replace_convert (GstBaseParse * parse, GstFormat src_format,
gint64 src_value, GstFormat dest_format, gint64 * dest_value)
{
/* Convert between formats */
GstReplace *replace = GST_REPLACE (parse);
return FALSE;
GST_DEBUG_OBJECT (replace, "convert");
return TRUE;
}
static gboolean
gst_replace_event (GstBaseParse *parse, GstEvent *event)
gst_replace_sink_event (GstBaseParse * parse, GstEvent * event)
{
/* Sink pad event handler */
GstReplace *replace = GST_REPLACE (parse);
return FALSE;
GST_DEBUG_OBJECT (replace, "sink_event");
return TRUE;
}
static gboolean
gst_replace_src_event (GstBaseParse *parse, GstEvent *event)
gst_replace_src_event (GstBaseParse * parse, GstEvent * event)
{
/* Src pad event handler */
GstReplace *replace = GST_REPLACE (parse);
return FALSE;
GST_DEBUG_OBJECT (replace, "src_event");
return TRUE;
}
static GstCaps *
gst_replace_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
{
GstReplace *replace = GST_REPLACE (parse);
GST_DEBUG_OBJECT (replace, "get_sink_caps");
return NULL;
}
static GstFlowReturn
gst_replace_pre_push_frame (GstBaseParse *parse, GstBaseParseFrame *frame)
gst_replace_detect (GstBaseParse * parse, GstBuffer * buffer)
{
GstReplace *replace = GST_REPLACE (parse);
GST_DEBUG_OBJECT (replace, "detect");
return GST_FLOW_OK;
}
% end

View file

@ -1,68 +0,0 @@
/* vim: set filetype=c: */
% ClassName
GstBaseRTPDepayload
% TYPE_CLASS_NAME
GST_TYPE_BASE_RTP_DEPAYLOAD
% pads
sinkpad-simple srcpad-simple
% pkg-config
gstreamer-rtp-0.10
% includes
#include <gst/rtp/gstbasertpdepayload.h>
% prototypes
static gboolean
gst_replace_set_caps (GstBaseRTPDepayload * filter, GstCaps * caps);
static GstFlowReturn
gst_replace_add_to_queue (GstBaseRTPDepayload * filter, GstBuffer * in);
static GstBuffer *gst_replace_process (GstBaseRTPDepayload * base,
GstBuffer * in);
static void
gst_replace_set_gst_timestamp (GstBaseRTPDepayload * filter, guint32 timestamp,
GstBuffer * buf);
static gboolean
gst_replace_packet_lost (GstBaseRTPDepayload * filter, GstEvent * event);
% declare-class
GstBaseRTPDepayloadClass *base_rtpdepayload_class = GST_BASE_RTP_DEPAYLOAD_CLASS (klass);
% set-methods
base_rtpdepayload_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
base_rtpdepayload_class->add_to_queue = GST_DEBUG_FUNCPTR (gst_replace_add_to_queue);
base_rtpdepayload_class->process = GST_DEBUG_FUNCPTR (gst_replace_process);
base_rtpdepayload_class->set_gst_timestamp = GST_DEBUG_FUNCPTR (gst_replace_set_gst_timestamp);
base_rtpdepayload_class->packet_lost = GST_DEBUG_FUNCPTR (gst_replace_packet_lost);
% methods
static gboolean
gst_replace_set_caps (GstBaseRTPDepayload * filter, GstCaps * caps)
{
return FALSE;
}
static GstFlowReturn
gst_replace_add_to_queue (GstBaseRTPDepayload * filter, GstBuffer * in)
{
return GST_FLOW_ERROR;
}
static GstBuffer *
gst_replace_process (GstBaseRTPDepayload * base, GstBuffer * in)
{
return NULL;
}
static void
gst_replace_set_gst_timestamp (GstBaseRTPDepayload * filter, guint32 timestamp,
GstBuffer * buf)
{
}
static gboolean
gst_replace_packet_lost (GstBaseRTPDepayload * filter, GstEvent * event)
{
return FALSE;
}
% end

View file

@ -1,56 +0,0 @@
/* vim: set filetype=c: */
% ClassName
GstBaseRTPPayload
% TYPE_CLASS_NAME
GST_TYPE_BASE_RTP_PAYLOAD
% pads
sinkpad-simple srcpad-simple
% pkg-config
gstreamer-rtp-0.10
% includes
#include <gst/rtp/gstbasertppayload.h>
% prototypes
static gboolean
gst_replace_set_caps (GstBaseRTPPayload * payload, GstCaps * caps);
static GstFlowReturn
gst_replace_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer);
static gboolean gst_replace_handle_event (GstPad * pad, GstEvent * event);
static GstCaps *gst_replace_get_caps (GstBaseRTPPayload * payload,
GstPad * pad);
% declare-class
GstBaseRTPPayloadClass *base_rtppayload_class = GST_BASE_RTP_PAYLOAD_CLASS (klass);
% set-methods
base_rtppayload_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
base_rtppayload_class->handle_buffer = GST_DEBUG_FUNCPTR (gst_replace_handle_buffer);
base_rtppayload_class->handle_event = GST_DEBUG_FUNCPTR (gst_replace_handle_event);
base_rtppayload_class->get_caps = GST_DEBUG_FUNCPTR (gst_replace_get_caps);
% methods
static gboolean
gst_replace_set_caps (GstBaseRTPPayload * payload, GstCaps * caps)
{
return FALSE;
}
static GstFlowReturn
gst_replace_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer)
{
return GST_FLOW_ERROR;
}
static gboolean
gst_replace_handle_event (GstPad * pad, GstEvent * event)
{
return FALSE;
}
static GstCaps *
gst_replace_get_caps (GstBaseRTPPayload * payload, GstPad * pad)
{
return NULL;
}
% end

View file

@ -6,85 +6,130 @@ GST_TYPE_BASE_SINK
% pads
sinkpad-simple
% pkg-config
gstreamer-base-0.10
gstreamer-base-1.0
% includes
#include <gst/base/gstbasesink.h>
% prototypes
static GstCaps *gst_replace_get_caps (GstBaseSink * sink);
static GstCaps *gst_replace_get_caps (GstBaseSink * sink, GstCaps * filter);
static gboolean gst_replace_set_caps (GstBaseSink * sink, GstCaps * caps);
static GstFlowReturn
gst_replace_buffer_alloc (GstBaseSink * sink, guint64 offset, guint size,
GstCaps * caps, GstBuffer ** buf);
static void
gst_replace_get_times (GstBaseSink * sink, GstBuffer * buffer,
static GstCaps *gst_replace_fixate (GstBaseSink * sink, GstCaps * caps);
static gboolean gst_replace_activate_pull (GstBaseSink * sink, gboolean active);
static void gst_replace_get_times (GstBaseSink * sink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end);
static gboolean gst_replace_propose_allocation (GstBaseSink * sink,
GstQuery * query);
static gboolean gst_replace_start (GstBaseSink * sink);
static gboolean gst_replace_stop (GstBaseSink * sink);
static gboolean gst_replace_unlock (GstBaseSink * sink);
static gboolean gst_replace_event (GstBaseSink * sink, GstEvent * event);
static GstFlowReturn
gst_replace_preroll (GstBaseSink * sink, GstBuffer * buffer);
static GstFlowReturn
gst_replace_render (GstBaseSink * sink, GstBuffer * buffer);
static GstStateChangeReturn gst_replace_async_play (GstBaseSink * sink);
static gboolean gst_replace_activate_pull (GstBaseSink * sink, gboolean active);
static void gst_replace_fixate (GstBaseSink * sink, GstCaps * caps);
static gboolean gst_replace_unlock_stop (GstBaseSink * sink);
static GstFlowReturn
gst_replace_render_list (GstBaseSink * sink, GstBufferList * buffer_list);
static gboolean gst_replace_query (GstBaseSink * sink, GstQuery * query);
static gboolean gst_replace_event (GstBaseSink * sink, GstEvent * event);
static GstFlowReturn gst_replace_wait_event (GstBaseSink * sink,
GstEvent * event);
static GstFlowReturn gst_replace_prepare (GstBaseSink * sink,
GstBuffer * buffer);
static GstFlowReturn gst_replace_prepare_list (GstBaseSink * sink,
GstBufferList * buffer_list);
static GstFlowReturn gst_replace_preroll (GstBaseSink * sink,
GstBuffer * buffer);
static GstFlowReturn gst_replace_render (GstBaseSink * sink,
GstBuffer * buffer);
static GstFlowReturn gst_replace_render_list (GstBaseSink * sink,
GstBufferList * buffer_list);
% declare-class
GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass);
% set-methods
base_sink_class->get_caps = GST_DEBUG_FUNCPTR (gst_replace_get_caps);
base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
base_sink_class->buffer_alloc = GST_DEBUG_FUNCPTR (gst_replace_buffer_alloc);
base_sink_class->fixate = GST_DEBUG_FUNCPTR (gst_replace_fixate);
base_sink_class->activate_pull = GST_DEBUG_FUNCPTR (gst_replace_activate_pull);
base_sink_class->get_times = GST_DEBUG_FUNCPTR (gst_replace_get_times);
base_sink_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_replace_propose_allocation);
base_sink_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
base_sink_class->unlock = GST_DEBUG_FUNCPTR (gst_replace_unlock);
base_sink_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_replace_unlock_stop);
base_sink_class->query = GST_DEBUG_FUNCPTR (gst_replace_query);
base_sink_class->event = GST_DEBUG_FUNCPTR (gst_replace_event);
base_sink_class->wait_event = GST_DEBUG_FUNCPTR (gst_replace_wait_event);
base_sink_class->prepare = GST_DEBUG_FUNCPTR (gst_replace_prepare);
base_sink_class->prepare_list = GST_DEBUG_FUNCPTR (gst_replace_prepare_list);
base_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_replace_preroll);
base_sink_class->render = GST_DEBUG_FUNCPTR (gst_replace_render);
base_sink_class->async_play = GST_DEBUG_FUNCPTR (gst_replace_async_play);
base_sink_class->activate_pull = GST_DEBUG_FUNCPTR (gst_replace_activate_pull);
base_sink_class->fixate = GST_DEBUG_FUNCPTR (gst_replace_fixate);
base_sink_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_replace_unlock_stop);
base_sink_class->render_list = GST_DEBUG_FUNCPTR (gst_replace_render_list);
% methods
static GstCaps *
gst_replace_get_caps (GstBaseSink * sink)
gst_replace_get_caps (GstBaseSink * sink, GstCaps * filter)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "get_caps");
return NULL;
}
/* notify subclass of new caps */
static gboolean
gst_replace_set_caps (GstBaseSink * sink, GstCaps * caps)
{
GstReplace *replace = GST_REPLACE (sink);
return FALSE;
GST_DEBUG_OBJECT (replace, "set_caps");
return TRUE;
}
static GstFlowReturn
gst_replace_buffer_alloc (GstBaseSink * sink, guint64 offset, guint size,
GstCaps * caps, GstBuffer ** buf)
/* fixate sink caps during pull-mode negotiation */
static GstCaps *
gst_replace_fixate (GstBaseSink * sink, GstCaps * caps)
{
GstReplace *replace = GST_REPLACE (sink);
return GST_FLOW_ERROR;
GST_DEBUG_OBJECT (replace, "fixate");
return NULL;
}
/* start or stop a pulling thread */
static gboolean
gst_replace_activate_pull (GstBaseSink * sink, gboolean active)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "activate_pull");
return TRUE;
}
/* get the start and end times for syncing on this buffer */
static void
gst_replace_get_times (GstBaseSink * sink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "get_times");
}
/* propose allocation parameters for upstream */
static gboolean
gst_replace_propose_allocation (GstBaseSink * sink, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "propose_allocation");
return TRUE;
}
/* start and stop processing, ideal for opening/closing the resource */
static gboolean
gst_replace_start (GstBaseSink * sink)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "start");
return TRUE;
}
@ -92,27 +137,99 @@ gst_replace_start (GstBaseSink * sink)
static gboolean
gst_replace_stop (GstBaseSink * sink)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "stop");
return TRUE;
}
/* unlock any pending access to the resource. subclasses should unlock
* any function ASAP. */
static gboolean
gst_replace_unlock (GstBaseSink * sink)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "unlock");
return TRUE;
}
/* Clear a previously indicated unlock request not that unlocking is
* complete. Sub-classes should clear any command queue or indicator they
* set during unlock */
static gboolean
gst_replace_unlock_stop (GstBaseSink * sink)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "unlock_stop");
return TRUE;
}
/* notify subclass of query */
static gboolean
gst_replace_query (GstBaseSink * sink, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "query");
return TRUE;
}
/* notify subclass of event */
static gboolean
gst_replace_event (GstBaseSink * sink, GstEvent * event)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "event");
return TRUE;
}
/* wait for eos or gap, subclasses should chain up to parent first */
static GstFlowReturn
gst_replace_wait_event (GstBaseSink * sink, GstEvent * event)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "wait_event");
return GST_FLOW_OK;
}
/* notify subclass of buffer or list before doing sync */
static GstFlowReturn
gst_replace_prepare (GstBaseSink * sink, GstBuffer * buffer)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "prepare");
return GST_FLOW_OK;
}
static GstFlowReturn
gst_replace_prepare_list (GstBaseSink * sink, GstBufferList * buffer_list)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "prepare_list");
return GST_FLOW_OK;
}
/* notify subclass of preroll buffer or real buffer */
static GstFlowReturn
gst_replace_preroll (GstBaseSink * sink, GstBuffer * buffer)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "preroll");
return GST_FLOW_OK;
}
@ -120,44 +237,21 @@ gst_replace_preroll (GstBaseSink * sink, GstBuffer * buffer)
static GstFlowReturn
gst_replace_render (GstBaseSink * sink, GstBuffer * buffer)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "render");
return GST_FLOW_OK;
}
static GstStateChangeReturn
gst_replace_async_play (GstBaseSink * sink)
{
return GST_STATE_CHANGE_SUCCESS;
}
static gboolean
gst_replace_activate_pull (GstBaseSink * sink, gboolean active)
{
return TRUE;
}
static void
gst_replace_fixate (GstBaseSink * sink, GstCaps * caps)
{
}
static gboolean
gst_replace_unlock_stop (GstBaseSink * sink)
{
return TRUE;
}
/* Render a BufferList */
static GstFlowReturn
gst_replace_render_list (GstBaseSink * sink, GstBufferList * buffer_list)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "render_list");
return GST_FLOW_OK;
}
% end

View file

@ -6,60 +6,61 @@ GST_TYPE_BASE_SRC
% pads
srcpad-simple
% pkg-config
gstreamer-base-0.10
gstreamer-base-1.0
% includes
#include <gst/base/gstbasesrc.h>
% prototypes
static GstCaps *gst_replace_get_caps (GstBaseSrc * src);
static gboolean gst_replace_set_caps (GstBaseSrc * src, GstCaps * caps);
static GstCaps *gst_replace_get_caps (GstBaseSrc * src, GstCaps * filter);
static gboolean gst_replace_negotiate (GstBaseSrc * src);
static gboolean gst_replace_newsegment (GstBaseSrc * src);
static GstCaps *gst_replace_fixate (GstBaseSrc * src, GstCaps * caps);
static gboolean gst_replace_set_caps (GstBaseSrc * src, GstCaps * caps);
static gboolean gst_replace_decide_allocation (GstBaseSrc * src,
GstQuery * query);
static gboolean gst_replace_start (GstBaseSrc * src);
static gboolean gst_replace_stop (GstBaseSrc * src);
static void
gst_replace_get_times (GstBaseSrc * src, GstBuffer * buffer,
static void gst_replace_get_times (GstBaseSrc * src, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end);
static gboolean gst_replace_get_size (GstBaseSrc * src, guint64 * size);
static gboolean gst_replace_is_seekable (GstBaseSrc * src);
static gboolean gst_replace_unlock (GstBaseSrc * src);
static gboolean gst_replace_event (GstBaseSrc * src, GstEvent * event);
static GstFlowReturn
gst_replace_create (GstBaseSrc * src, guint64 offset, guint size,
GstBuffer ** buf);
static gboolean gst_replace_prepare_seek_segment (GstBaseSrc * src,
GstEvent * seek, GstSegment * segment);
static gboolean gst_replace_do_seek (GstBaseSrc * src, GstSegment * segment);
static gboolean gst_replace_query (GstBaseSrc * src, GstQuery * query);
static gboolean gst_replace_check_get_range (GstBaseSrc * src);
static void gst_replace_fixate (GstBaseSrc * src, GstCaps * caps);
static gboolean gst_replace_unlock (GstBaseSrc * src);
static gboolean gst_replace_unlock_stop (GstBaseSrc * src);
static gboolean
gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
GstSegment * segment);
static gboolean gst_replace_query (GstBaseSrc * src, GstQuery * query);
static gboolean gst_replace_event (GstBaseSrc * src, GstEvent * event);
static GstFlowReturn gst_replace_create (GstBaseSrc * src, guint64 offset,
guint size, GstBuffer ** buf);
static GstFlowReturn gst_replace_alloc (GstBaseSrc * src, guint64 offset,
guint size, GstBuffer ** buf);
static GstFlowReturn gst_replace_fill (GstBaseSrc * src, guint64 offset,
guint size, GstBuffer * buf);
% declare-class
GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
% set-methods
base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_replace_get_caps);
base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
base_src_class->negotiate = GST_DEBUG_FUNCPTR (gst_replace_negotiate);
base_src_class->newsegment = GST_DEBUG_FUNCPTR (gst_replace_newsegment);
base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_replace_fixate);
base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
base_src_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_replace_decide_allocation);
base_src_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
base_src_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
base_src_class->get_times = GST_DEBUG_FUNCPTR (gst_replace_get_times);
base_src_class->get_size = GST_DEBUG_FUNCPTR (gst_replace_get_size);
base_src_class->is_seekable = GST_DEBUG_FUNCPTR (gst_replace_is_seekable);
base_src_class->prepare_seek_segment = GST_DEBUG_FUNCPTR (gst_replace_prepare_seek_segment);
base_src_class->do_seek = GST_DEBUG_FUNCPTR (gst_replace_do_seek);
base_src_class->unlock = GST_DEBUG_FUNCPTR (gst_replace_unlock);
base_src_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_replace_unlock_stop);
base_src_class->query = GST_DEBUG_FUNCPTR (gst_replace_query);
base_src_class->event = GST_DEBUG_FUNCPTR (gst_replace_event);
base_src_class->create = GST_DEBUG_FUNCPTR (gst_replace_create);
base_src_class->do_seek = GST_DEBUG_FUNCPTR (gst_replace_do_seek);
base_src_class->query = GST_DEBUG_FUNCPTR (gst_replace_query);
base_src_class->check_get_range = GST_DEBUG_FUNCPTR (gst_replace_check_get_range);
base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_replace_fixate);
base_src_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_replace_unlock_stop);
base_src_class->prepare_seek_segment = GST_DEBUG_FUNCPTR (gst_replace_prepare_seek_segment);
base_src_class->alloc = GST_DEBUG_FUNCPTR (gst_replace_alloc);
base_src_class->fill = GST_DEBUG_FUNCPTR (gst_replace_fill);
% methods
/* get caps from subclass */
static GstCaps *
gst_replace_get_caps (GstBaseSrc * src)
gst_replace_get_caps (GstBaseSrc * src, GstCaps * filter)
{
GstReplace *replace = GST_REPLACE (src);
@ -68,16 +69,7 @@ gst_replace_get_caps (GstBaseSrc * src)
return NULL;
}
static gboolean
gst_replace_set_caps (GstBaseSrc * src, GstCaps * caps)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "set_caps");
return TRUE;
}
/* decide on caps */
static gboolean
gst_replace_negotiate (GstBaseSrc * src)
{
@ -88,16 +80,40 @@ gst_replace_negotiate (GstBaseSrc * src)
return TRUE;
}
static gboolean
gst_replace_newsegment (GstBaseSrc * src)
/* called if, in negotiation, caps need fixating */
static GstCaps *
gst_replace_fixate (GstBaseSrc * src, GstCaps * caps)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "newsegment");
GST_DEBUG_OBJECT (replace, "fixate");
return NULL;
}
/* notify the subclass of new caps */
static gboolean
gst_replace_set_caps (GstBaseSrc * src, GstCaps * caps)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "set_caps");
return TRUE;
}
/* setup allocation query */
static gboolean
gst_replace_decide_allocation (GstBaseSrc * src, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "decide_allocation");
return TRUE;
}
/* start and stop processing, ideal for opening/closing the resource */
static gboolean
gst_replace_start (GstBaseSrc * src)
{
@ -118,6 +134,8 @@ gst_replace_stop (GstBaseSrc * src)
return TRUE;
}
/* given a buffer, return start and stop time when it should be pushed
* out. The base class will sync on the clock using these times. */
static void
gst_replace_get_times (GstBaseSrc * src, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end)
@ -125,8 +143,10 @@ gst_replace_get_times (GstBaseSrc * src, GstBuffer * buffer,
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "get_times");
}
/* get the total size of the resource in bytes */
static gboolean
gst_replace_get_size (GstBaseSrc * src, guint64 * size)
{
@ -137,6 +157,7 @@ gst_replace_get_size (GstBaseSrc * src, guint64 * size)
return TRUE;
}
/* check if the resource is seekable */
static gboolean
gst_replace_is_seekable (GstBaseSrc * src)
{
@ -144,9 +165,35 @@ gst_replace_is_seekable (GstBaseSrc * src)
GST_DEBUG_OBJECT (replace, "is_seekable");
return FALSE;
return TRUE;
}
/* Prepare the segment on which to perform do_seek(), converting to the
* current basesrc format. */
static gboolean
gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
GstSegment * segment)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "prepare_seek_segment");
return TRUE;
}
/* notify subclasses of a seek */
static gboolean
gst_replace_do_seek (GstBaseSrc * src, GstSegment * segment)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "do_seek");
return TRUE;
}
/* unlock any pending access to the resource. subclasses should unlock
* any function ASAP. */
static gboolean
gst_replace_unlock (GstBaseSrc * src)
{
@ -157,22 +204,41 @@ gst_replace_unlock (GstBaseSrc * src)
return TRUE;
}
/* Clear any pending unlock request, as we succeeded in unlocking */
static gboolean
gst_replace_unlock_stop (GstBaseSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "unlock_stop");
return TRUE;
}
/* notify subclasses of a query */
static gboolean
gst_replace_query (GstBaseSrc * src, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "query");
return TRUE;
}
/* notify subclasses of an event */
static gboolean
gst_replace_event (GstBaseSrc * src, GstEvent * event)
{
GstReplace *replace = GST_REPLACE (src);
gboolean ret;
GST_DEBUG_OBJECT (replace, "event");
switch (GST_EVENT_TYPE (event)) {
default:
ret = GST_BASE_SRC_CLASS (parent_class)->event (src, event);
}
return ret;
return TRUE;
}
/* ask the subclass to create a buffer with offset and size, the default
* implementation will call alloc and fill. */
static GstFlowReturn
gst_replace_create (GstBaseSrc * src, guint64 offset, guint size,
GstBuffer ** buf)
@ -184,68 +250,27 @@ gst_replace_create (GstBaseSrc * src, guint64 offset, guint size,
return GST_FLOW_OK;
}
static gboolean
gst_replace_do_seek (GstBaseSrc * src, GstSegment * segment)
/* ask the subclass to allocate an output buffer. The default implementation
* will use the negotiated allocator. */
static GstFlowReturn
gst_replace_alloc (GstBaseSrc * src, guint64 offset, guint size,
GstBuffer ** buf)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "do_seek");
GST_DEBUG_OBJECT (replace, "alloc");
return FALSE;
return GST_FLOW_OK;
}
static gboolean
gst_replace_query (GstBaseSrc * src, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (src);
gboolean ret;
GST_DEBUG_OBJECT (replace, "query");
switch (GST_QUERY_TYPE (query)) {
default:
ret = GST_BASE_SRC_CLASS (parent_class)->query (src, query);
}
return ret;
}
static gboolean
gst_replace_check_get_range (GstBaseSrc * src)
/* ask the subclass to fill the buffer with data from offset and size */
static GstFlowReturn
gst_replace_fill (GstBaseSrc * src, guint64 offset, guint size, GstBuffer * buf)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "get_range");
GST_DEBUG_OBJECT (replace, "fill");
return FALSE;
}
static void
gst_replace_fixate (GstBaseSrc * src, GstCaps * caps)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "fixate");
}
static gboolean
gst_replace_unlock_stop (GstBaseSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "stop");
return TRUE;
}
static gboolean
gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
GstSegment * segment)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "seek_segment");
return FALSE;
return GST_FLOW_OK;
}
% end

View file

@ -4,34 +4,32 @@ GstBaseTransform
% TYPE_CLASS_NAME
GST_TYPE_BASE_TRANSFORM
% pads
sinkpad-simple srcpad-simple
srcpad-simple
sinkpad-simple
% pkg-config
gstreamer-base-1.0
% pads
sinkpad-simple srcpad-simple
% includes
#include <gst/base/gstbasetransform.h>
% prototypes
static GstCaps *gst_replace_transform_caps (GstBaseTransform *trans,
GstPadDirection direction, GstCaps *caps, GstCaps *filter);
static GstCaps *
gst_replace_fixate_caps (GstBaseTransform * trans,
static GstCaps *gst_replace_transform_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
static GstCaps *gst_replace_fixate_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
static gboolean gst_replace_accept_caps (GstBaseTransform *trans,
GstPadDirection direction, GstCaps *caps);
static gboolean gst_replace_set_caps (GstBaseTransform *trans, GstCaps *incaps,
GstCaps *outcaps);
static gboolean gst_replace_query (GstBaseTransform *trans, GstPadDirection direction,
GstQuery *query);
static gboolean gst_replace_decide_allocation (GstBaseTransform *trans,
GstQuery *query);
static gboolean gst_replace_filter_meta (GstBaseTransform *trans, GstQuery *query,
GType api, const GstStructure *params);
static gboolean gst_replace_propose_allocation (GstBaseTransform *trans,
GstQuery *decide_query, GstQuery *query);
static gboolean gst_replace_accept_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps);
static gboolean gst_replace_set_caps (GstBaseTransform * trans,
GstCaps * incaps, GstCaps * outcaps);
static gboolean gst_replace_query (GstBaseTransform * trans,
GstPadDirection direction, GstQuery * query);
static gboolean gst_replace_decide_allocation (GstBaseTransform * trans,
GstQuery * query);
static gboolean gst_replace_filter_meta (GstBaseTransform * trans,
GstQuery * query, GType api, const GstStructure * params);
static gboolean gst_replace_propose_allocation (GstBaseTransform * trans,
GstQuery * decide_query, GstQuery * query);
static gboolean gst_replace_transform_size (GstBaseTransform * trans,
GstPadDirection direction,
GstCaps * caps, gsize size, GstCaps * othercaps, gsize * othersize);
GstPadDirection direction, GstCaps * caps, gsize size, GstCaps * othercaps,
gsize * othersize);
static gboolean gst_replace_get_unit_size (GstBaseTransform * trans,
GstCaps * caps, gsize * size);
static gboolean gst_replace_start (GstBaseTransform * trans);
@ -40,19 +38,18 @@ static gboolean gst_replace_sink_event (GstBaseTransform * trans,
GstEvent * event);
static gboolean gst_replace_src_event (GstBaseTransform * trans,
GstEvent * event);
static GstFlowReturn gst_replace_prepare_output_buffer (
GstBaseTransform * trans, GstBuffer *input, GstBuffer **outbuf);
static gboolean gst_replace_copy_metadata (GstBaseTransform *trans,
GstBuffer *input, GstBuffer *outbuf);
static gboolean gst_replace_transform_meta (GstBaseTransform *trans,
GstBuffer *outbuf, GstMeta *meta, GstBuffer *inbuf);
static void
gst_replace_before_transform (GstBaseTransform * trans, GstBuffer * buffer);
static GstFlowReturn
gst_replace_transform (GstBaseTransform * trans, GstBuffer * inbuf,
GstBuffer * outbuf);
static GstFlowReturn
gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf);
static GstFlowReturn gst_replace_prepare_output_buffer (GstBaseTransform *
trans, GstBuffer * input, GstBuffer ** outbuf);
static gboolean gst_replace_copy_metadata (GstBaseTransform * trans,
GstBuffer * input, GstBuffer * outbuf);
static gboolean gst_replace_transform_meta (GstBaseTransform * trans,
GstBuffer * outbuf, GstMeta * meta, GstBuffer * inbuf);
static void gst_replace_before_transform (GstBaseTransform * trans,
GstBuffer * buffer);
static GstFlowReturn gst_replace_transform (GstBaseTransform * trans,
GstBuffer * inbuf, GstBuffer * outbuf);
static GstFlowReturn gst_replace_transform_ip (GstBaseTransform * trans,
GstBuffer * buf);
% declare-class
GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass);
% set-methods
@ -77,27 +74,36 @@ gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf);
base_transform_class->transform = GST_DEBUG_FUNCPTR (gst_replace_transform);
base_transform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_replace_transform_ip);
% methods
static GstCaps *
gst_replace_transform_caps (GstBaseTransform *trans,
GstPadDirection direction, GstCaps *caps, GstCaps *filter)
gst_replace_transform_caps (GstBaseTransform * trans, GstPadDirection direction,
GstCaps * caps, GstCaps * filter)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "transform_caps");
return NULL;
}
static GstCaps *
gst_replace_fixate_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
gst_replace_fixate_caps (GstBaseTransform * trans, GstPadDirection direction,
GstCaps * caps, GstCaps * othercaps)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "fixate_caps");
return NULL;
}
static gboolean
gst_replace_accept_caps (GstBaseTransform *trans,
GstPadDirection direction, GstCaps *caps)
gst_replace_accept_caps (GstBaseTransform * trans, GstPadDirection direction,
GstCaps * caps)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "accept_caps");
return TRUE;
}
@ -105,106 +111,153 @@ static gboolean
gst_replace_set_caps (GstBaseTransform * trans, GstCaps * incaps,
GstCaps * outcaps)
{
GstReplace *replace = GST_REPLACE (trans);
return FALSE;
}
static gboolean
gst_replace_query (GstBaseTransform *trans, GstPadDirection direction,
GstQuery *query)
{
GST_DEBUG_OBJECT (replace, "set_caps");
return TRUE;
}
static gboolean
gst_replace_decide_allocation (GstBaseTransform *trans, GstQuery *query)
gst_replace_query (GstBaseTransform * trans, GstPadDirection direction,
GstQuery * query)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "query");
return TRUE;
}
/* decide allocation query for output buffers */
static gboolean
gst_replace_decide_allocation (GstBaseTransform * trans, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "decide_allocation");
return TRUE;
}
static gboolean
gst_replace_filter_meta (GstBaseTransform *trans, GstQuery *query,
GType api, const GstStructure *params)
gst_replace_filter_meta (GstBaseTransform * trans, GstQuery * query, GType api,
const GstStructure * params)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "filter_meta");
return TRUE;
}
/* propose allocation query parameters for input buffers */
static gboolean
gst_replace_propose_allocation (GstBaseTransform *trans,
GstQuery *decide_query, GstQuery *query)
gst_replace_propose_allocation (GstBaseTransform * trans,
GstQuery * decide_query, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "propose_allocation");
return TRUE;
}
/* transform size */
static gboolean
gst_replace_transform_size (GstBaseTransform * trans,
GstPadDirection direction,
gst_replace_transform_size (GstBaseTransform * trans, GstPadDirection direction,
GstCaps * caps, gsize size, GstCaps * othercaps, gsize * othersize)
{
GstReplace *replace = GST_REPLACE (trans);
return FALSE;
GST_DEBUG_OBJECT (replace, "transform_size");
return TRUE;
}
static gboolean
gst_replace_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
gsize * size)
{
GstReplace *replace = GST_REPLACE (trans);
return FALSE;
GST_DEBUG_OBJECT (replace, "get_unit_size");
return TRUE;
}
/* states */
static gboolean
gst_replace_start (GstBaseTransform * trans)
{
GstReplace *replace = GST_REPLACE (trans);
return FALSE;
}
static gboolean
gst_replace_stop (GstBaseTransform * trans)
{
return FALSE;
}
static gboolean
gst_replace_sink_event (GstBaseTransform * trans, GstEvent * event)
{
return FALSE;
}
static gboolean
gst_replace_src_event (GstBaseTransform * trans, GstEvent * event)
{
return FALSE;
}
static GstFlowReturn
gst_replace_prepare_output_buffer (GstBaseTransform * trans,
GstBuffer * input, GstBuffer ** buf)
{
return GST_FLOW_ERROR;
}
static gboolean
gst_replace_copy_metadata (GstBaseTransform *trans,
GstBuffer *input, GstBuffer *outbuf)
{
GST_DEBUG_OBJECT (replace, "start");
return TRUE;
}
static gboolean
gst_replace_transform_meta (GstBaseTransform *trans,
GstBuffer *outbuf, GstMeta *meta, GstBuffer *inbuf)
gst_replace_stop (GstBaseTransform * trans)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "stop");
return TRUE;
}
/* sink and src pad event handlers */
static gboolean
gst_replace_sink_event (GstBaseTransform * trans, GstEvent * event)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "sink_event");
return TRUE;
}
static gboolean
gst_replace_src_event (GstBaseTransform * trans, GstEvent * event)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "src_event");
return TRUE;
}
static GstFlowReturn
gst_replace_prepare_output_buffer (GstBaseTransform * trans, GstBuffer * input,
GstBuffer ** outbuf)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "prepare_output_buffer");
return GST_FLOW_OK;
}
/* metadata */
static gboolean
gst_replace_copy_metadata (GstBaseTransform * trans, GstBuffer * input,
GstBuffer * outbuf)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "copy_metadata");
return TRUE;
}
static gboolean
gst_replace_transform_meta (GstBaseTransform * trans, GstBuffer * outbuf,
GstMeta * meta, GstBuffer * inbuf)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "transform_meta");
return TRUE;
}
@ -212,22 +265,31 @@ gst_replace_transform_meta (GstBaseTransform *trans,
static void
gst_replace_before_transform (GstBaseTransform * trans, GstBuffer * buffer)
{
GstReplace *replace = GST_REPLACE (trans);
GST_DEBUG_OBJECT (replace, "before_transform");
}
/* transform */
static GstFlowReturn
gst_replace_transform (GstBaseTransform * trans, GstBuffer * inbuf,
GstBuffer * outbuf)
{
GstReplace *replace = GST_REPLACE (trans);
return GST_FLOW_ERROR;
GST_DEBUG_OBJECT (replace, "transform");
return GST_FLOW_OK;
}
static GstFlowReturn
gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
{
GstReplace *replace = GST_REPLACE (trans);
return GST_FLOW_ERROR;
GST_DEBUG_OBJECT (replace, "transform_ip");
return GST_FLOW_OK;
}
% end

View file

@ -1,62 +0,0 @@
/* vim: set filetype=c: */
% ClassName
GstCddaBaseSrc
% TYPE_CLASS_NAME
GST_TYPE_CDDA_BASE_SRC
% pads
srcpad-simple
% pkg-config
gstreamer-cdda-0.10
% includes
#include <gst/cdda/gstcddabasesrc.h>
% prototypes
static gboolean gst_replace_open (GstCddaBaseSrc * src, const gchar * device);
static void gst_replace_close (GstCddaBaseSrc * src);
static GstBuffer *gst_replace_read_sector (GstCddaBaseSrc * src, gint sector);
static gchar *gst_replace_get_default_device (GstCddaBaseSrc * src);
static gchar **gst_replace_probe_devices (GstCddaBaseSrc * src);
% declare-class
GstCddaBaseSrcClass *cddabase_src_class = GST_CDDA_BASE_SRC_CLASS (klass);
% set-methods
cddabase_src_class->open = GST_DEBUG_FUNCPTR (gst_replace_open);
cddabase_src_class->close = GST_DEBUG_FUNCPTR (gst_replace_close);
cddabase_src_class->read_sector = GST_DEBUG_FUNCPTR (gst_replace_read_sector);
cddabase_src_class->get_default_device = GST_DEBUG_FUNCPTR (gst_replace_get_default_device);
cddabase_src_class->probe_devices = GST_DEBUG_FUNCPTR (gst_replace_probe_devices);
% methods
static gboolean
gst_replace_open (GstCddaBaseSrc * src, const gchar * device)
{
return FALSE;
}
static void
gst_replace_close (GstCddaBaseSrc * src)
{
}
static GstBuffer *
gst_replace_read_sector (GstCddaBaseSrc * src, gint sector)
{
return NULL;
}
static gchar *
gst_replace_get_default_device (GstCddaBaseSrc * src)
{
return NULL;
}
static gchar **
gst_replace_probe_devices (GstCddaBaseSrc * src)
{
return NULL;
}
% end

View file

@ -6,7 +6,7 @@ GST_TYPE_ELEMENT
% pads
sinkpad srcpad
% pkg-config
gstreamer-0.10
gstreamer-1.0
% includes
#include <gst/gst.h>
% prototypes

View file

@ -26,7 +26,9 @@ void
gst_replace_set_property (GObject * object, guint property_id,
const GValue * value, GParamSpec * pspec)
{
/* GstReplace *replace = GST_REPLACE (object); */
GstReplace *replace = GST_REPLACE (object);
GST_DEBUG_OBJECT (replace, "set_property");
switch (property_id) {
default:
@ -39,7 +41,9 @@ void
gst_replace_get_property (GObject * object, guint property_id,
GValue * value, GParamSpec * pspec)
{
/* GstReplace *replace = GST_REPLACE (object); */
GstReplace *replace = GST_REPLACE (object);
GST_DEBUG_OBJECT (replace, "get_property");
switch (property_id) {
default:
@ -51,7 +55,9 @@ gst_replace_get_property (GObject * object, guint property_id,
void
gst_replace_dispose (GObject * object)
{
/* GstReplace *replace = GST_REPLACE (object); */
GstReplace *replace = GST_REPLACE (object);
GST_DEBUG_OBJECT (replace, "dispose");
/* clean up as possible. may be called multiple times */
@ -61,7 +67,9 @@ gst_replace_dispose (GObject * object)
void
gst_replace_finalize (GObject * object)
{
/* GstReplace *replace = GST_REPLACE (object); */
GstReplace *replace = GST_REPLACE (object);
GST_DEBUG_OBJECT (replace, "finalize");
/* clean up object here */

View file

@ -1,235 +0,0 @@
/* vim: set filetype=c: */
% ClassName
GstPushSrc
% TYPE_CLASS_NAME
GST_TYPE_PUSH_SRC
% pads
srcpad-simple
% pkg-config
gstreamer-base-0.10
% includes
#include <gst/base/gstpushsrc.h>
% prototypes
static GstCaps *gst_replace_get_caps (GstBaseSrc * src);
static gboolean gst_replace_set_caps (GstBaseSrc * src, GstCaps * caps);
static gboolean gst_replace_negotiate (GstBaseSrc * src);
static gboolean gst_replace_newsegment (GstBaseSrc * src);
static gboolean gst_replace_start (GstBaseSrc * src);
static gboolean gst_replace_stop (GstBaseSrc * src);
static void
gst_replace_get_times (GstBaseSrc * src, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end);
static gboolean gst_replace_get_size (GstBaseSrc * src, guint64 * size);
static gboolean gst_replace_is_seekable (GstBaseSrc * src);
static gboolean gst_replace_unlock (GstBaseSrc * src);
static gboolean gst_replace_event (GstBaseSrc * src, GstEvent * event);
static gboolean gst_replace_do_seek (GstBaseSrc * src, GstSegment * segment);
static gboolean gst_replace_query (GstBaseSrc * src, GstQuery * query);
static gboolean gst_replace_check_get_range (GstBaseSrc * src);
static void gst_replace_fixate (GstBaseSrc * src, GstCaps * caps);
static gboolean gst_replace_unlock_stop (GstBaseSrc * src);
static gboolean
gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
GstSegment * segment);
static GstFlowReturn gst_replace_create (GstPushSrc * src, GstBuffer ** buf);
% declare-class
GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
GstPushSrcClass *push_src_class = GST_PUSH_SRC_CLASS (klass);
% set-methods
base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_replace_get_caps);
base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
base_src_class->negotiate = GST_DEBUG_FUNCPTR (gst_replace_negotiate);
base_src_class->newsegment = GST_DEBUG_FUNCPTR (gst_replace_newsegment);
base_src_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
base_src_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
base_src_class->get_times = GST_DEBUG_FUNCPTR (gst_replace_get_times);
base_src_class->get_size = GST_DEBUG_FUNCPTR (gst_replace_get_size);
base_src_class->is_seekable = GST_DEBUG_FUNCPTR (gst_replace_is_seekable);
base_src_class->unlock = GST_DEBUG_FUNCPTR (gst_replace_unlock);
base_src_class->event = GST_DEBUG_FUNCPTR (gst_replace_event);
base_src_class->do_seek = GST_DEBUG_FUNCPTR (gst_replace_do_seek);
base_src_class->query = GST_DEBUG_FUNCPTR (gst_replace_query);
base_src_class->check_get_range = GST_DEBUG_FUNCPTR (gst_replace_check_get_range);
base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_replace_fixate);
base_src_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_replace_unlock_stop);
base_src_class->prepare_seek_segment = GST_DEBUG_FUNCPTR (gst_replace_prepare_seek_segment);
push_src_class->create = GST_DEBUG_FUNCPTR (gst_replace_create);
% methods
static GstCaps *
gst_replace_get_caps (GstBaseSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "get_caps");
return NULL;
}
static gboolean
gst_replace_set_caps (GstBaseSrc * src, GstCaps * caps)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "set_caps");
return TRUE;
}
static gboolean
gst_replace_negotiate (GstBaseSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "negotiate");
return TRUE;
}
static gboolean
gst_replace_newsegment (GstBaseSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "newsegment");
return TRUE;
}
static gboolean
gst_replace_start (GstBaseSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "start");
return TRUE;
}
static gboolean
gst_replace_stop (GstBaseSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "stop");
return TRUE;
}
static void
gst_replace_get_times (GstBaseSrc * src, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "get_times");
}
static gboolean
gst_replace_get_size (GstBaseSrc * src, guint64 * size)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "get_size");
return TRUE;
}
static gboolean
gst_replace_is_seekable (GstBaseSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "is_seekable");
return FALSE;
}
static gboolean
gst_replace_unlock (GstBaseSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "unlock");
return TRUE;
}
static gboolean
gst_replace_event (GstBaseSrc * src, GstEvent * event)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "event");
return TRUE;
}
static gboolean
gst_replace_do_seek (GstBaseSrc * src, GstSegment * segment)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "do_seek");
return FALSE;
}
static gboolean
gst_replace_query (GstBaseSrc * src, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "query");
return TRUE;
}
static gboolean
gst_replace_check_get_range (GstBaseSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "get_range");
return FALSE;
}
static void
gst_replace_fixate (GstBaseSrc * src, GstCaps * caps)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "fixate");
}
static gboolean
gst_replace_unlock_stop (GstBaseSrc * src)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "stop");
return TRUE;
}
static gboolean
gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
GstSegment * segment)
{
GstReplace *replace = GST_REPLACE (src);
GST_DEBUG_OBJECT (replace, "seek_segment");
return FALSE;
}
static GstFlowReturn
gst_replace_create (GstPushSrc * src, GstBuffer ** buf)
{
return GST_FLOW_OK;
}
% end

View file

@ -0,0 +1,26 @@
/* vim: set filetype=c: */
% instance-members
GstPad *sinkpad;
% prototypes
% pad-template
/* FIXME add/remove the formats that you want to support */
static GstStaticPadTemplate gst_replace_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw,format=S16LE,rate=[1,max],"
"channels=[1,max],layout=interleaved")
);
% base-init
gst_element_class_add_pad_template (GST_ELEMENT_CLASS(klass),
gst_static_pad_template_get (&gst_replace_sink_template));
% instance-init
replace->sinkpad = gst_pad_new_from_static_template (&gst_replace_sink_template
,
"sink");
% methods
% end

View file

@ -0,0 +1,26 @@
/* vim: set filetype=c: */
% instance-members
GstPad *srcpad;
% prototypes
% pad-template
/* FIXME add/remove the formats that you want to support */
static GstStaticPadTemplate gst_replace_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw,format=S16LE,rate=[1,max],"
"channels=[1,max],layout=interleaved")
);
% base-init
gst_element_class_add_pad_template (GST_ELEMENT_CLASS(klass),
gst_static_pad_template_get (&gst_replace_src_template));
% instance-init
replace->srcpad = gst_pad_new_from_static_template (&gst_replace_src_template
,
"src");
% methods
% end

View file

@ -1,55 +0,0 @@
/* vim: set filetype=c: */
% ClassName
GstTagDemux
% TYPE_CLASS_NAME
GST_TYPE_TAG_DEMUX
% pads
sinkpad-simple srcpad-simple
% pkg-config
gstreamer-tag-0.10
% includes
#include <gst/tag/gsttagdemux.h>
% prototypes
static gboolean
gst_replace_identify_tag (GstTagDemux * demux,
GstBuffer * buffer, gboolean start_tag, guint * tag_size);
static GstTagDemuxResult
gst_replace_parse_tag (GstTagDemux * demux,
GstBuffer * buffer,
gboolean start_tag, guint * tag_size, GstTagList ** tags);
static GstTagList *gst_replace_merge_tags (GstTagDemux * demux,
const GstTagList * start_tags, const GstTagList * end_tags);
% declare-class
GstTagDemuxClass *tagdemux_class = GST_TAG_DEMUX_CLASS (klass);
% set-methods
tagdemux_class->identify_tag = GST_DEBUG_FUNCPTR (gst_replace_identify_tag);
tagdemux_class->parse_tag = GST_DEBUG_FUNCPTR (gst_replace_parse_tag);
tagdemux_class->merge_tags = GST_DEBUG_FUNCPTR (gst_replace_merge_tags);
% methods
static gboolean
gst_replace_identify_tag (GstTagDemux * demux,
GstBuffer * buffer, gboolean start_tag, guint * tag_size)
{
return FALSE;
}
static GstTagDemuxResult
gst_replace_parse_tag (GstTagDemux * demux,
GstBuffer * buffer,
gboolean start_tag, guint * tag_size, GstTagList ** tags)
{
return GST_TAG_DEMUX_RESULT_BROKEN_TAG;
}
static GstTagList *
gst_replace_merge_tags (GstTagDemux * demux,
const GstTagList * start_tags, const GstTagList * end_tags)
{
return NULL;
}
% end

View file

@ -0,0 +1,194 @@
/* vim: set filetype=c: */
% ClassName
GstVideoDecoder
% TYPE_CLASS_NAME
GST_TYPE_VIDEO_DECODER
% pads
sinkpad-simple
srcpad-template-video
% pkg-config
gstreamer-video-1.0
% includes
#include <gst/video/video.h>
#include <gst/video/gstvideodecoder.h>
% prototypes
static gboolean gst_replace_open (GstVideoDecoder * decoder);
static gboolean gst_replace_close (GstVideoDecoder * decoder);
static gboolean gst_replace_start (GstVideoDecoder * decoder);
static gboolean gst_replace_stop (GstVideoDecoder * decoder);
static GstFlowReturn gst_replace_parse (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame, GstAdapter * adapter, gboolean at_eos);
static gboolean gst_replace_set_format (GstVideoDecoder * decoder,
GstVideoCodecState * state);
static gboolean gst_replace_reset (GstVideoDecoder * decoder, gboolean hard);
static GstFlowReturn gst_replace_finish (GstVideoDecoder * decoder);
static GstFlowReturn gst_replace_handle_frame (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame);
static gboolean gst_replace_sink_event (GstVideoDecoder * decoder,
GstEvent * event);
static gboolean gst_replace_src_event (GstVideoDecoder * decoder,
GstEvent * event);
static gboolean gst_replace_negotiate (GstVideoDecoder * decoder);
static gboolean gst_replace_decide_allocation (GstVideoDecoder * decoder,
GstQuery * query);
static gboolean gst_replace_propose_allocation (GstVideoDecoder * decoder,
GstQuery * query);
% declare-class
GstVideoDecoderClass *video_decoder_class = GST_VIDEO_DECODER_CLASS (klass);
% set-methods
video_decoder_class->open = GST_DEBUG_FUNCPTR (gst_replace_open);
video_decoder_class->close = GST_DEBUG_FUNCPTR (gst_replace_close);
video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
video_decoder_class->parse = GST_DEBUG_FUNCPTR (gst_replace_parse);
video_decoder_class->set_format = GST_DEBUG_FUNCPTR (gst_replace_set_format);
video_decoder_class->reset = GST_DEBUG_FUNCPTR (gst_replace_reset);
video_decoder_class->finish = GST_DEBUG_FUNCPTR (gst_replace_finish);
video_decoder_class->handle_frame = GST_DEBUG_FUNCPTR (gst_replace_handle_frame);
video_decoder_class->sink_event = GST_DEBUG_FUNCPTR (gst_replace_sink_event);
video_decoder_class->src_event = GST_DEBUG_FUNCPTR (gst_replace_src_event);
video_decoder_class->negotiate = GST_DEBUG_FUNCPTR (gst_replace_negotiate);
video_decoder_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_replace_decide_allocation);
video_decoder_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_replace_propose_allocation);
% methods
static gboolean
gst_replace_open (GstVideoDecoder * decoder)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "open");
return TRUE;
}
static gboolean
gst_replace_close (GstVideoDecoder * decoder)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "close");
return TRUE;
}
static gboolean
gst_replace_start (GstVideoDecoder * decoder)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "start");
return TRUE;
}
static gboolean
gst_replace_stop (GstVideoDecoder * decoder)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "stop");
return TRUE;
}
static GstFlowReturn
gst_replace_parse (GstVideoDecoder * decoder, GstVideoCodecFrame * frame,
GstAdapter * adapter, gboolean at_eos)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "parse");
return GST_FLOW_OK;
}
static gboolean
gst_replace_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "set_format");
return TRUE;
}
static gboolean
gst_replace_reset (GstVideoDecoder * decoder, gboolean hard)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "reset");
return TRUE;
}
static GstFlowReturn
gst_replace_finish (GstVideoDecoder * decoder)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "finish");
return GST_FLOW_OK;
}
static GstFlowReturn
gst_replace_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "handle_frame");
return GST_FLOW_OK;
}
static gboolean
gst_replace_sink_event (GstVideoDecoder * decoder, GstEvent * event)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "sink_event");
return TRUE;
}
static gboolean
gst_replace_src_event (GstVideoDecoder * decoder, GstEvent * event)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "src_event");
return TRUE;
}
static gboolean
gst_replace_negotiate (GstVideoDecoder * decoder)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "negotiate");
return TRUE;
}
static gboolean
gst_replace_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "decide_allocation");
return TRUE;
}
static gboolean
gst_replace_propose_allocation (GstVideoDecoder * decoder, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (decoder);
GST_DEBUG_OBJECT (replace, "propose_allocation");
return TRUE;
}
% end

View file

@ -0,0 +1,184 @@
/* vim: set filetype=c: */
% ClassName
GstVideoEncoder
% TYPE_CLASS_NAME
GST_TYPE_VIDEO_ENCODER
% pads
srcpad-template-video
sinkpad-simple
% pkg-config
gstreamer-video-1.0
% includes
#include <gst/video/video.h>
#include <gst/video/gstvideoencoder.h>
% prototypes
static gboolean gst_replace_open (GstVideoEncoder *encoder);
static gboolean gst_replace_close (GstVideoEncoder *encoder);
static gboolean gst_replace_start (GstVideoEncoder *encoder);
static gboolean gst_replace_stop (GstVideoEncoder *encoder);
static gboolean gst_replace_set_format (GstVideoEncoder *encoder, GstVideoCodecState *state);
static GstFlowReturn gst_replace_handle_frame (GstVideoEncoder *encoder, GstVideoCodecFrame *frame);
static gboolean gst_replace_reset (GstVideoEncoder *encoder, gboolean hard);
static GstFlowReturn gst_replace_finish (GstVideoEncoder *encoder);
static GstFlowReturn gst_replace_pre_push (GstVideoEncoder *encoder, GstVideoCodecFrame *frame);
static GstCaps * gst_replace_getcaps (GstVideoEncoder *encoder, GstCaps *filter);
static gboolean gst_replace_sink_event (GstVideoEncoder *encoder, GstEvent *event);
static gboolean gst_replace_src_event (GstVideoEncoder *encoder, GstEvent *event);
static gboolean gst_replace_negotiate (GstVideoEncoder *encoder);
static gboolean gst_replace_decide_allocation (GstVideoEncoder *encoder, GstQuery *query);
static gboolean gst_replace_propose_allocation (GstVideoEncoder * encoder, GstQuery * query);
% declare-class
GstVideoEncoderClass *video_encoder_class = GST_VIDEO_ENCODER_CLASS (klass);
% set-methods
video_encoder_class->open = GST_DEBUG_FUNCPTR (gst_replace_open);
video_encoder_class->close = GST_DEBUG_FUNCPTR (gst_replace_close);
video_encoder_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
video_encoder_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
video_encoder_class->set_format = GST_DEBUG_FUNCPTR (gst_replace_set_format);
video_encoder_class->handle_frame = GST_DEBUG_FUNCPTR (gst_replace_handle_frame);
video_encoder_class->reset = GST_DEBUG_FUNCPTR (gst_replace_reset);
video_encoder_class->finish = GST_DEBUG_FUNCPTR (gst_replace_finish);
video_encoder_class->pre_push = GST_DEBUG_FUNCPTR (gst_replace_pre_push);
video_encoder_class->getcaps = GST_DEBUG_FUNCPTR (gst_replace_getcaps);
video_encoder_class->sink_event = GST_DEBUG_FUNCPTR (gst_replace_sink_event);
video_encoder_class->src_event = GST_DEBUG_FUNCPTR (gst_replace_src_event);
video_encoder_class->negotiate = GST_DEBUG_FUNCPTR (gst_replace_negotiate);
video_encoder_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_replace_decide_allocation);
video_encoder_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_replace_propose_allocation);
% methods
static gboolean gst_replace_open (GstVideoEncoder *encoder)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "open");
return TRUE;
}
static gboolean gst_replace_close (GstVideoEncoder *encoder)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "close");
return TRUE;
}
static gboolean gst_replace_start (GstVideoEncoder *encoder)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "start");
return TRUE;
}
static gboolean gst_replace_stop (GstVideoEncoder *encoder)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "stop");
return TRUE;
}
static gboolean gst_replace_set_format (GstVideoEncoder *encoder, GstVideoCodecState *state)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "set_format");
return TRUE;
}
static GstFlowReturn gst_replace_handle_frame (GstVideoEncoder *encoder, GstVideoCodecFrame *frame)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "handle_frame");
return TRUE;
}
static gboolean gst_replace_reset (GstVideoEncoder *encoder, gboolean hard)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "reset");
return TRUE;
}
static GstFlowReturn gst_replace_finish (GstVideoEncoder *encoder)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "finish");
return GST_FLOW_OK;
}
static GstFlowReturn gst_replace_pre_push (GstVideoEncoder *encoder, GstVideoCodecFrame *frame)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "pre_push");
return GST_FLOW_OK;
}
static GstCaps * gst_replace_getcaps (GstVideoEncoder *encoder, GstCaps *filter)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "getcaps");
return NULL;
}
static gboolean gst_replace_sink_event (GstVideoEncoder *encoder, GstEvent *event)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "sink_event");
return TRUE;
}
static gboolean gst_replace_src_event (GstVideoEncoder *encoder, GstEvent *event)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "src_event");
return TRUE;
}
static gboolean gst_replace_negotiate (GstVideoEncoder *encoder)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "negotiate");
return TRUE;
}
static gboolean gst_replace_decide_allocation (GstVideoEncoder *encoder, GstQuery *query)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "decide_allocation");
return TRUE;
}
static gboolean gst_replace_propose_allocation (GstVideoEncoder * encoder, GstQuery * query)
{
GstReplace *replace = GST_REPLACE (encoder);
GST_DEBUG_OBJECT(replace, "propose_allocation");
return TRUE;
}
% end

View file

@ -4,75 +4,57 @@ GstVideoFilter
% TYPE_CLASS_NAME
GST_TYPE_VIDEO_FILTER
% pads
sinkpad-template-video srcpad-template-video
srcpad-template-video
sinkpad-template-video
% pkg-config
gstreamer-video-0.10
gstreamer-video-1.0
% includes
#include <gst/video/video.h>
#include <gst/video/gstvideofilter.h>
% prototypes
static gboolean
gst_replace_start (GstBaseTransform * trans);
static gboolean
gst_replace_stop (GstBaseTransform * trans);
static GstFlowReturn
gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf);
static gboolean
gst_replace_set_caps (GstBaseTransform * trans, GstCaps * incaps,
GstCaps * outcaps);
static gboolean gst_replace_set_info (GstVideoFilter * filter, GstCaps * incaps,
GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info);
static GstFlowReturn gst_replace_transform_frame (GstVideoFilter * filter,
GstVideoFrame * inframe, GstVideoFrame * outframe);
static GstFlowReturn gst_replace_transform_frame_ip (GstVideoFilter * filter,
GstVideoFrame * frame);
% declare-class
GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass);
GstVideoFilterClass *video_filter_class = GST_VIDEO_FILTER_CLASS (klass);
% set-methods
base_transform_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
base_transform_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
base_transform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_replace_transform_ip);
video_filter_class->set_info = GST_DEBUG_FUNCPTR (gst_replace_set_info);
video_filter_class->transform_frame = GST_DEBUG_FUNCPTR (gst_replace_transform_frame);
video_filter_class->transform_frame_ip = GST_DEBUG_FUNCPTR (gst_replace_transform_frame_ip);
% methods
static gboolean
gst_replace_start (GstBaseTransform * trans)
gst_replace_set_info (GstVideoFilter * filter, GstCaps * incaps,
GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info)
{
/* GstReplace *replace = GST_REPLACE (trans); */
GstReplace *replace = GST_REPLACE (filter);
GST_DEBUG_OBJECT (replace, "set_info");
/* initialize processing */
return TRUE;
}
static gboolean
gst_replace_stop (GstBaseTransform * trans)
{
/* GstReplace *replace = GST_REPLACE (trans); */
/* finalize processing */
return TRUE;
}
static gboolean
gst_replace_set_caps (GstBaseTransform * trans, GstCaps * incaps,
GstCaps * outcaps)
{
/* GstReplace *replace = GST_REPLACE (trans); */
GstVideoFormat video_format;
int w, h;
/* parse input caps, output caps are the same so we ignore them */
if (!gst_video_format_parse_caps (incaps, &video_format, &w, &h))
return FALSE;
/* You'll need to add those fields to the instance struct first */
/* replace->video_format = video_format; */
/* replace->width = w; */
/* replace->height = h; */
return TRUE;
}
/* transform */
static GstFlowReturn
gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
gst_replace_transform_frame (GstVideoFilter * filter, GstVideoFrame * inframe,
GstVideoFrame * outframe)
{
/* GstReplace *replace = GST_REPLACE (trans); */
GstReplace *replace = GST_REPLACE (filter);
GST_DEBUG_OBJECT (replace, "transform_frame");
/* process the video data in the buffer in-place */
return GST_FLOW_OK;
}
static GstFlowReturn
gst_replace_transform_frame_ip (GstVideoFilter * filter, GstVideoFrame * frame)
{
GstReplace *replace = GST_REPLACE (filter);
GST_DEBUG_OBJECT (replace, "transform_frame_ip");
return GST_FLOW_OK;
}
% end

View file

@ -1,67 +0,0 @@
/* vim: set filetype=c: */
% ClassName
GstVideoFilter2
% TYPE_CLASS_NAME
GST_TYPE_VIDEO_FILTER2
% pads
% pkg-config
gstreamer-base-0.10
% pads
% includes
#include <gst/base/gstbasetransform.h>
#include <gst/video/video.h>
#include "../gst/videofilters/gstvideofilter2.h"
% prototypes
static gboolean gst_replace_start (GstBaseTransform * trans);
static gboolean gst_replace_stop (GstBaseTransform * trans);
static GstFlowReturn
gst_replace_prefilter (GstVideoFilter2 *videofilter2, GstBuffer * buf);
static GstVideoFilter2Functions gst_replace_filter_functions[];
% declare-class
GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass);
GstVideoFilter2Class *video_filter2_class = GST_VIDEO_FILTER2_CLASS (klass);
% set-methods
base_transform_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
video_filter2_class->prefilter = GST_DEBUG_FUNCPTR (gst_replace_prefilter);
gst_video_filter2_class_add_functions (video_filter2_class,
gst_replace_filter_functions);
% methods
static gboolean
gst_replace_start (GstBaseTransform * trans)
{
return TRUE;
}
static gboolean
gst_replace_stop (GstBaseTransform * trans)
{
return TRUE;
}
static GstFlowReturn
gst_replace_prefilter (GstVideoFilter2 *video_filter2, GstBuffer * buf)
{
return GST_FLOW_OK;
}
static GstFlowReturn
gst_replace_filter_ip_I420 (GstVideoFilter2 * videofilter2,
GstBuffer * buf, int start, int end)
{
return GST_FLOW_OK;
}
static GstVideoFilter2Functions gst_replace_filter_functions[] = {
{GST_VIDEO_FORMAT_I420, NULL, gst_replace_filter_ip_I420},
{GST_VIDEO_FORMAT_UNKNOWN}
};
% end

View file

@ -4,29 +4,27 @@ GstVideoSink
% TYPE_CLASS_NAME
GST_TYPE_VIDEO_SINK
% pads
sinkpad-simple
sinkpad-template-video
% pkg-config
gstreamer-video-0.10
gstreamer-video-1.0
% includes
#include <gst/video/video.h>
#include <gst/video/gstvideosink.h>
% prototypes
static GstFlowReturn
gst_replace_show_frame (GstVideoSink * video_sink, GstBuffer * buf);
static GstFlowReturn gst_replace_show_frame (GstVideoSink * video_sink,
GstBuffer * buf);
% declare-class
GstVideoSinkClass *video_sink_class = GST_VIDEO_SINK_CLASS (klass);
% set-methods
video_sink_class->show_frame = GST_DEBUG_FUNCPTR (gst_replace_show_frame);
% methods
static GstFlowReturn
gst_replace_show_frame (GstVideoSink * video_sink, GstBuffer * buf)
gst_replace_show_frame (GstVideoSink * sink, GstBuffer * buf)
{
GstReplace *replace = GST_REPLACE (sink);
GST_DEBUG_OBJECT (replace, "show_frame");
return GST_FLOW_OK;
}
% end

View file

@ -233,10 +233,16 @@ static gboolean
plugin_init (GstPlugin * plugin)
{
/* FIXME Remember to set the rank if it's an element that is meant
to be autoplugged by decodebin. */
return gst_element_register (plugin, "replace", GST_RANK_NONE,
GST_TYPE_REPLACE);
}
/* FIXME: these are normally defined by the GStreamer build system.
If you are creating an element to be included in gst-plugins-*,
remove these, as they're always defined. Otherwise, edit as
appropriate for your external plugin package. */
#ifndef VERSION
#define VERSION "0.0.FIXME"
#endif
@ -371,7 +377,7 @@ gst-indent $gstreplace.c
echo pkg is $pkg
gcc -Wall -fPIC $CPPFLAGS $(pkg-config --cflags gstreamer-1.0 $pkg) -c -o $gstreplace.o $gstreplace.c
gcc -Wall -Werror -fPIC $CPPFLAGS $(pkg-config --cflags gstreamer-1.0 $pkg) -c -o $gstreplace.o $gstreplace.c
if test $? -ne 0; then
exit 1
fi