1/* vim: set filetype=c: */ 2% ClassName 3GstVideoEncoder 4% TYPE_CLASS_NAME 5GST_TYPE_VIDEO_ENCODER 6% pads 7srcpad-simple 8sinkpad-template-video 9% pkg-config 10gstreamer-video-1.0 11% includes 12#include <gst/video/video.h> 13#include <gst/video/gstvideoencoder.h> 14% prototypes 15static gboolean gst_replace_open (GstVideoEncoder *encoder); 16static gboolean gst_replace_close (GstVideoEncoder *encoder); 17static gboolean gst_replace_start (GstVideoEncoder *encoder); 18static gboolean gst_replace_stop (GstVideoEncoder *encoder); 19static gboolean gst_replace_set_format (GstVideoEncoder *encoder, GstVideoCodecState *state); 20static GstFlowReturn gst_replace_handle_frame (GstVideoEncoder *encoder, GstVideoCodecFrame *frame); 21static gboolean gst_replace_reset (GstVideoEncoder *encoder, gboolean hard); 22static GstFlowReturn gst_replace_finish (GstVideoEncoder *encoder); 23static GstFlowReturn gst_replace_pre_push (GstVideoEncoder *encoder, GstVideoCodecFrame *frame); 24static GstCaps * gst_replace_getcaps (GstVideoEncoder *encoder, GstCaps *filter); 25static gboolean gst_replace_sink_event (GstVideoEncoder *encoder, GstEvent *event); 26static gboolean gst_replace_src_event (GstVideoEncoder *encoder, GstEvent *event); 27static gboolean gst_replace_negotiate (GstVideoEncoder *encoder); 28static gboolean gst_replace_decide_allocation (GstVideoEncoder *encoder, GstQuery *query); 29static gboolean gst_replace_propose_allocation (GstVideoEncoder * encoder, GstQuery * query); 30% declare-class 31 GstVideoEncoderClass *video_encoder_class = GST_VIDEO_ENCODER_CLASS (klass); 32% set-methods 33 video_encoder_class->open = GST_DEBUG_FUNCPTR (gst_replace_open); 34 video_encoder_class->close = GST_DEBUG_FUNCPTR (gst_replace_close); 35 video_encoder_class->start = GST_DEBUG_FUNCPTR (gst_replace_start); 36 video_encoder_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop); 37 video_encoder_class->set_format = GST_DEBUG_FUNCPTR (gst_replace_set_format); 38 video_encoder_class->handle_frame = GST_DEBUG_FUNCPTR (gst_replace_handle_frame); 39 video_encoder_class->reset = GST_DEBUG_FUNCPTR (gst_replace_reset); 40 video_encoder_class->finish = GST_DEBUG_FUNCPTR (gst_replace_finish); 41 video_encoder_class->pre_push = GST_DEBUG_FUNCPTR (gst_replace_pre_push); 42 video_encoder_class->getcaps = GST_DEBUG_FUNCPTR (gst_replace_getcaps); 43 video_encoder_class->sink_event = GST_DEBUG_FUNCPTR (gst_replace_sink_event); 44 video_encoder_class->src_event = GST_DEBUG_FUNCPTR (gst_replace_src_event); 45 video_encoder_class->negotiate = GST_DEBUG_FUNCPTR (gst_replace_negotiate); 46 video_encoder_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_replace_decide_allocation); 47 video_encoder_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_replace_propose_allocation); 48% methods 49static gboolean gst_replace_open (GstVideoEncoder *encoder) 50{ 51 GstReplace *replace = GST_REPLACE (encoder); 52 53 GST_DEBUG_OBJECT(replace, "open"); 54 55 return TRUE; 56} 57 58static gboolean gst_replace_close (GstVideoEncoder *encoder) 59{ 60 GstReplace *replace = GST_REPLACE (encoder); 61 62 GST_DEBUG_OBJECT(replace, "close"); 63 64 return TRUE; 65} 66 67static gboolean gst_replace_start (GstVideoEncoder *encoder) 68{ 69 GstReplace *replace = GST_REPLACE (encoder); 70 71 GST_DEBUG_OBJECT(replace, "start"); 72 73 return TRUE; 74} 75 76static gboolean gst_replace_stop (GstVideoEncoder *encoder) 77{ 78 GstReplace *replace = GST_REPLACE (encoder); 79 80 GST_DEBUG_OBJECT(replace, "stop"); 81 82 return TRUE; 83} 84 85static gboolean gst_replace_set_format (GstVideoEncoder *encoder, GstVideoCodecState *state) 86{ 87 GstReplace *replace = GST_REPLACE (encoder); 88 89 GST_DEBUG_OBJECT(replace, "set_format"); 90 91 return TRUE; 92} 93 94static GstFlowReturn gst_replace_handle_frame (GstVideoEncoder *encoder, GstVideoCodecFrame *frame) 95{ 96 GstReplace *replace = GST_REPLACE (encoder); 97 98 GST_DEBUG_OBJECT(replace, "handle_frame"); 99 100 return GST_FLOW_OK; 101} 102 103static gboolean gst_replace_reset (GstVideoEncoder *encoder, gboolean hard) 104{ 105 GstReplace *replace = GST_REPLACE (encoder); 106 107 GST_DEBUG_OBJECT(replace, "reset"); 108 109 return TRUE; 110} 111 112static GstFlowReturn gst_replace_finish (GstVideoEncoder *encoder) 113{ 114 GstReplace *replace = GST_REPLACE (encoder); 115 116 GST_DEBUG_OBJECT(replace, "finish"); 117 118 return GST_FLOW_OK; 119} 120 121static GstFlowReturn gst_replace_pre_push (GstVideoEncoder *encoder, GstVideoCodecFrame *frame) 122{ 123 GstReplace *replace = GST_REPLACE (encoder); 124 125 GST_DEBUG_OBJECT(replace, "pre_push"); 126 127 return GST_FLOW_OK; 128} 129 130static GstCaps * gst_replace_getcaps (GstVideoEncoder *encoder, GstCaps *filter) 131{ 132 GstReplace *replace = GST_REPLACE (encoder); 133 134 GST_DEBUG_OBJECT(replace, "getcaps"); 135 136 return NULL; 137} 138 139static gboolean gst_replace_sink_event (GstVideoEncoder *encoder, GstEvent *event) 140{ 141 GstReplace *replace = GST_REPLACE (encoder); 142 143 GST_DEBUG_OBJECT(replace, "sink_event"); 144 145 return TRUE; 146} 147 148static gboolean gst_replace_src_event (GstVideoEncoder *encoder, GstEvent *event) 149{ 150 GstReplace *replace = GST_REPLACE (encoder); 151 152 GST_DEBUG_OBJECT(replace, "src_event"); 153 154 return TRUE; 155} 156 157static gboolean gst_replace_negotiate (GstVideoEncoder *encoder) 158{ 159 GstReplace *replace = GST_REPLACE (encoder); 160 161 GST_DEBUG_OBJECT(replace, "negotiate"); 162 163 return TRUE; 164} 165 166static gboolean gst_replace_decide_allocation (GstVideoEncoder *encoder, GstQuery *query) 167{ 168 GstReplace *replace = GST_REPLACE (encoder); 169 170 GST_DEBUG_OBJECT(replace, "decide_allocation"); 171 172 return TRUE; 173} 174 175static gboolean gst_replace_propose_allocation (GstVideoEncoder * encoder, GstQuery * query) 176{ 177 GstReplace *replace = GST_REPLACE (encoder); 178 179 GST_DEBUG_OBJECT(replace, "propose_allocation"); 180 181 return TRUE; 182} 183 184% end 185