gstreamer/tools/element-templates/videoencoder

185 lines
5.4 KiB
Text
Raw Normal View History

/* 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 GST_FLOW_OK;
}
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