#define MAX_TS_MASK 0xff
-typedef struct _GstEmulDec
+typedef struct _GstMaruDec
{
GstElement element;
/* reverse playback queue */
GList *queued;
-} GstEmulDec;
+} GstMaruDec;
-typedef struct _GstEmulDecClass
+typedef struct _GstMaruDecClass
{
GstElementClass parent_class;
CodecElement *codec;
GstPadTemplate *sinktempl;
GstPadTemplate *srctempl;
-} GstEmulDecClass;
+} GstMaruDecClass;
static GstElementClass *parent_class = NULL;
-static void gst_marudec_base_init (GstEmulDecClass *klass);
-static void gst_marudec_class_init (GstEmulDecClass *klass);
-static void gst_marudec_init (GstEmulDec *marudec);
+static void gst_marudec_base_init (GstMaruDecClass *klass);
+static void gst_marudec_class_init (GstMaruDecClass *klass);
+static void gst_marudec_init (GstMaruDec *marudec);
static void gst_marudec_finalize (GObject *object);
static gboolean gst_marudec_setcaps (GstPad *pad, GstCaps *caps);
static GstStateChangeReturn gst_marudec_change_state (GstElement *element,
GstStateChange transition);
-static gboolean gst_marudec_negotiate (GstEmulDec *dec, gboolean force);
+static gboolean gst_marudec_negotiate (GstMaruDec *dec, gboolean force);
-static gint gst_marudec_frame (GstEmulDec *marudec, guint8 *data,
+static gint gst_marudec_frame (GstMaruDec *marudec, guint8 *data,
guint size, gint *got_data,
const GstTSInfo *dec_info, gint64 in_offset, GstFlowReturn *ret);
-static gboolean gst_marudec_open (GstEmulDec *marudec);
-static int gst_marudec_close (GstEmulDec *marudec);
+static gboolean gst_marudec_open (GstMaruDec *marudec);
+static int gst_marudec_close (GstMaruDec *marudec);
static const GstTSInfo *
-gst_ts_info_store (GstEmulDec *dec, GstClockTime timestamp,
+gst_ts_info_store (GstMaruDec *dec, GstClockTime timestamp,
GstClockTime duration, gint64 offset)
{
gint idx = dec->ts_idx;
}
static const GstTSInfo *
-gst_ts_info_get (GstEmulDec *dec, gint idx)
+gst_ts_info_get (GstMaruDec *dec, gint idx)
{
if (G_UNLIKELY (idx < 0 || idx > MAX_TS_MASK))
return GST_TS_INFO_NONE;
}
static void
-gst_marudec_reset_ts (GstEmulDec *marudec)
+gst_marudec_reset_ts (GstMaruDec *marudec)
{
marudec->next_out = GST_CLOCK_TIME_NONE;
}
static void
-gst_marudec_update_qos (GstEmulDec *marudec, gdouble proportion,
+gst_marudec_update_qos (GstMaruDec *marudec, gdouble proportion,
GstClockTime timestamp)
{
GST_LOG_OBJECT (marudec, "update QOS: %f, %" GST_TIME_FORMAT,
}
static void
-gst_marudec_reset_qos (GstEmulDec *marudec)
+gst_marudec_reset_qos (GstMaruDec *marudec)
{
gst_marudec_update_qos (marudec, 0.5, GST_CLOCK_TIME_NONE);
marudec->processed = 0;
}
static gboolean
-gst_marudec_do_qos (GstEmulDec *marudec, GstClockTime timestamp,
+gst_marudec_do_qos (GstMaruDec *marudec, GstClockTime timestamp,
gboolean *mode_switch)
{
GstClockTimeDiff diff;
}
static void
-clear_queued (GstEmulDec *marudec)
+clear_queued (GstMaruDec *marudec)
{
g_list_foreach (marudec->queued, (GFunc) gst_mini_object_unref, NULL);
g_list_free (marudec->queued);
}
static GstFlowReturn
-flush_queued (GstEmulDec *marudec)
+flush_queued (GstMaruDec *marudec)
{
GstFlowReturn res = GST_FLOW_OK;
}
static void
-gst_marudec_drain (GstEmulDec *marudec)
+gst_marudec_drain (GstMaruDec *marudec)
{
- GstEmulDecClass *oclass;
+ GstMaruDecClass *oclass;
- oclass = (GstEmulDecClass *) (G_OBJECT_GET_CLASS (marudec));
+ oclass = (GstMaruDecClass *) (G_OBJECT_GET_CLASS (marudec));
// TODO: drain
#if 1
* Implementation
*/
static void
-gst_marudec_base_init (GstEmulDecClass *klass)
+gst_marudec_base_init (GstMaruDecClass *klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstCaps *sinkcaps = NULL, *srccaps = NULL;
}
static void
-gst_marudec_class_init (GstEmulDecClass *klass)
+gst_marudec_class_init (GstMaruDecClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
}
static void
-gst_marudec_init (GstEmulDec *marudec)
+gst_marudec_init (GstMaruDec *marudec)
{
- GstEmulDecClass *oclass;
+ GstMaruDecClass *oclass;
- oclass = (GstEmulDecClass*) (G_OBJECT_GET_CLASS(marudec));
+ oclass = (GstMaruDecClass*) (G_OBJECT_GET_CLASS(marudec));
marudec->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
gst_pad_set_setcaps_function (marudec->sinkpad,
static void
gst_marudec_finalize (GObject *object)
{
- GstEmulDec *marudec = (GstEmulDec *) object;
+ GstMaruDec *marudec = (GstMaruDec *) object;
if (marudec->context) {
g_free (marudec->context);
static gboolean
gst_marudec_src_event (GstPad *pad, GstEvent *event)
{
- GstEmulDec *marudec;
+ GstMaruDec *marudec;
gboolean res;
- marudec = (GstEmulDec *) gst_pad_get_parent (pad);
+ marudec = (GstMaruDec *) gst_pad_get_parent (pad);
switch (GST_EVENT_TYPE (event)) {
/* Quality Of Service (QOS) event contains a report
static gboolean
gst_marudec_sink_event (GstPad *pad, GstEvent *event)
{
- GstEmulDec *marudec;
+ GstMaruDec *marudec;
gboolean ret = FALSE;
- marudec = (GstEmulDec *) gst_pad_get_parent (pad);
+ marudec = (GstMaruDec *) gst_pad_get_parent (pad);
GST_DEBUG_OBJECT (marudec, "Handling %s event",
GST_EVENT_TYPE_NAME (event));
static gboolean
gst_marudec_setcaps (GstPad *pad, GstCaps *caps)
{
- GstEmulDec *marudec;
- GstEmulDecClass *oclass;
+ GstMaruDec *marudec;
+ GstMaruDecClass *oclass;
GstStructure *structure;
const GValue *par;
const GValue *fps;
GST_DEBUG_OBJECT (pad, "setcaps called.");
- marudec = (GstEmulDec *) (gst_pad_get_parent (pad));
- oclass = (GstEmulDecClass *) (G_OBJECT_GET_CLASS (marudec));
+ marudec = (GstMaruDec *) (gst_pad_get_parent (pad));
+ oclass = (GstMaruDecClass *) (G_OBJECT_GET_CLASS (marudec));
GST_OBJECT_LOCK (marudec);
}
static gboolean
-gst_marudec_open (GstEmulDec *marudec)
+gst_marudec_open (GstMaruDec *marudec)
{
- GstEmulDecClass *oclass;
+ GstMaruDecClass *oclass;
- oclass = (GstEmulDecClass *) (G_OBJECT_GET_CLASS (marudec));
+ oclass = (GstMaruDecClass *) (G_OBJECT_GET_CLASS (marudec));
if (!marudec->dev) {
return FALSE;
}
static int
-gst_marudec_close (GstEmulDec *marudec)
+gst_marudec_close (GstMaruDec *marudec)
{
int ret = 0;
static gboolean
-gst_marudec_negotiate (GstEmulDec *marudec, gboolean force)
+gst_marudec_negotiate (GstMaruDec *marudec, gboolean force)
{
- GstEmulDecClass *oclass;
+ GstMaruDecClass *oclass;
GstCaps *caps;
- oclass = (GstEmulDecClass *) (G_OBJECT_GET_CLASS (marudec));
+ oclass = (GstMaruDecClass *) (G_OBJECT_GET_CLASS (marudec));
switch (oclass->codec->media_type) {
case AVMEDIA_TYPE_VIDEO:
}
static GstFlowReturn
-get_output_buffer (GstEmulDec *marudec, GstBuffer **outbuf)
+get_output_buffer (GstMaruDec *marudec, GstBuffer **outbuf)
{
gint pict_size;
GstFlowReturn ret;
}
static gboolean
-clip_video_buffer (GstEmulDec *dec, GstBuffer *buf,
+clip_video_buffer (GstMaruDec *dec, GstBuffer *buf,
GstClockTime in_ts, GstClockTime in_dur)
{
gboolean res = TRUE;
}
static gboolean
-clip_audio_buffer (GstEmulDec *dec, GstBuffer *buf,
+clip_audio_buffer (GstMaruDec *dec, GstBuffer *buf,
GstClockTime in_ts, GstClockTime in_dur)
{
GstClockTime stop;
}
static gint
-gst_marudec_video_frame (GstEmulDec *marudec, guint8 *data, guint size,
+gst_marudec_video_frame (GstMaruDec *marudec, guint8 *data, guint size,
const GstTSInfo *dec_info, gint64 in_offset, GstBuffer **outbuf,
GstFlowReturn *ret)
{
}
static gint
-gst_marudec_audio_frame (GstEmulDec *marudec, CodecElement *codec,
+gst_marudec_audio_frame (GstMaruDec *marudec, CodecElement *codec,
guint8 *data, guint size,
const GstTSInfo *dec_info, GstBuffer **outbuf,
GstFlowReturn *ret)
}
static gint
-gst_marudec_frame (GstEmulDec *marudec, guint8 *data, guint size,
+gst_marudec_frame (GstMaruDec *marudec, guint8 *data, guint size,
gint *got_data, const GstTSInfo *dec_info, gint64 in_offset, GstFlowReturn *ret)
{
- GstEmulDecClass *oclass;
+ GstMaruDecClass *oclass;
GstBuffer *outbuf = NULL;
gint have_data = 0, len = 0;
}
*ret = GST_FLOW_OK;
- oclass = (GstEmulDecClass *) (G_OBJECT_GET_CLASS (marudec));
+ oclass = (GstMaruDecClass *) (G_OBJECT_GET_CLASS (marudec));
switch (oclass->codec->media_type) {
case AVMEDIA_TYPE_VIDEO:
static GstFlowReturn
gst_marudec_chain (GstPad *pad, GstBuffer *buffer)
{
- GstEmulDec *marudec;
- GstEmulDecClass *oclass;
+ GstMaruDec *marudec;
+ GstMaruDecClass *oclass;
guint8 *in_buf;
gint in_size, len, have_data;
GstFlowReturn ret = GST_FLOW_OK;
const GstTSInfo *in_info;
const GstTSInfo *dec_info;
- marudec = (GstEmulDec *) (GST_PAD_PARENT (pad));
+ marudec = (GstMaruDec *) (GST_PAD_PARENT (pad));
if (G_UNLIKELY (!marudec->opened)) {
// not_negotiated
- oclass = (GstEmulDecClass *) (G_OBJECT_GET_CLASS (marudec));
+ oclass = (GstMaruDecClass *) (G_OBJECT_GET_CLASS (marudec));
GST_ELEMENT_ERROR (marudec, CORE, NEGOTIATION, (NULL),
("maru_%sdec: input format was not set before data start",
oclass->codec->name));
}
// marudec->clear_ts = TRUE;
- oclass = (GstEmulDecClass *) (G_OBJECT_GET_CLASS (marudec));
+ oclass = (GstMaruDecClass *) (G_OBJECT_GET_CLASS (marudec));
#if 0
if (G_UNLIKELY (marudec->waiting_for_key)) {
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT) &&
static GstStateChangeReturn
gst_marudec_change_state (GstElement *element, GstStateChange transition)
{
- GstEmulDec *marudec = (GstEmulDec *) element;
+ GstMaruDec *marudec = (GstMaruDec *) element;
GstStateChangeReturn ret;
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
gst_marudec_register (GstPlugin *plugin, GList *element)
{
GTypeInfo typeinfo = {
- sizeof (GstEmulDecClass),
+ sizeof (GstMaruDecClass),
(GBaseInitFunc) gst_marudec_base_init,
NULL,
(GClassInitFunc) gst_marudec_class_init,
NULL,
NULL,
- sizeof (GstEmulDec),
+ sizeof (GstMaruDec),
0,
(GInstanceInitFunc) gst_marudec_init,
};
GType type;
gchar *type_name;
- gint rank = GST_RANK_PRIMARY;
+ gint rank = GST_RANK_NONE;
GList *elem = element;
CodecElement *codec = NULL;
#define GST_MARUENC_PARAMS_QDATA g_quark_from_static_string("maruenc-params")
-typedef struct _GstEmulEnc
+typedef struct _GstMaruEnc
{
GstElement element;
GQueue *delay;
-} GstEmulEnc;
+} GstMaruEnc;
-typedef struct _GstEmulEncClass
+typedef struct _GstMaruEncClass
{
GstElementClass parent_class;
GstPadTemplate *sinktempl;
GstPadTemplate *srctempl;
GstCaps *sinkcaps;
-} GstEmulEncClass;
+} GstMaruEncClass;
static GstElementClass *parent_class = NULL;
-static void gst_maruenc_base_init (GstEmulEncClass *klass);
-static void gst_maruenc_class_init (GstEmulEncClass *klass);
-static void gst_maruenc_init (GstEmulEnc *maruenc);
+static void gst_maruenc_base_init (GstMaruEncClass *klass);
+static void gst_maruenc_class_init (GstMaruEncClass *klass);
+static void gst_maruenc_init (GstMaruEnc *maruenc);
static void gst_maruenc_finalize (GObject *object);
static gboolean gst_maruenc_setcaps (GstPad *pad, GstCaps *caps);
static GstCaps *gst_maruenc_getcaps (GstPad *pad);
-static GstCaps *gst_maruenc_get_possible_sizes (GstEmulEnc *maruenc,
+static GstCaps *gst_maruenc_get_possible_sizes (GstMaruEnc *maruenc,
GstPad *pad, const GstCaps *caps);
static GstFlowReturn gst_maruenc_chain_video (GstPad *pad, GstBuffer *buffer);
* Implementation
*/
static void
-gst_maruenc_base_init (GstEmulEncClass *klass)
+gst_maruenc_base_init (GstMaruEncClass *klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstPadTemplate *sinktempl = NULL, *srctempl = NULL;
}
static void
-gst_maruenc_class_init (GstEmulEncClass *klass)
+gst_maruenc_class_init (GstMaruEncClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
}
static void
-gst_maruenc_init (GstEmulEnc *maruenc)
+gst_maruenc_init (GstMaruEnc *maruenc)
{
- GstEmulEncClass *oclass;
- oclass = (GstEmulEncClass*) (G_OBJECT_GET_CLASS(maruenc));
+ GstMaruEncClass *oclass;
+ oclass = (GstMaruEncClass*) (G_OBJECT_GET_CLASS(maruenc));
maruenc->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
gst_pad_set_setcaps_function (maruenc->sinkpad,
gst_maruenc_finalize (GObject *object)
{
// Deinit Decoder
- GstEmulEnc *maruenc = (GstEmulEnc *) object;
+ GstMaruEnc *maruenc = (GstMaruEnc *) object;
if (maruenc->opened) {
gst_maru_avcodec_close (maruenc->context, maruenc->dev);
}
static GstCaps *
-gst_maruenc_get_possible_sizes (GstEmulEnc *maruenc, GstPad *pad,
+gst_maruenc_get_possible_sizes (GstMaruEnc *maruenc, GstPad *pad,
const GstCaps *caps)
{
GstCaps *othercaps = NULL;
static GstCaps *
gst_maruenc_getcaps (GstPad *pad)
{
- GstEmulEnc *maruenc = (GstEmulEnc *) GST_PAD_PARENT (pad);
- GstEmulEncClass *oclass =
- (GstEmulEncClass *) G_OBJECT_GET_CLASS (maruenc);
+ GstMaruEnc *maruenc = (GstMaruEnc *) GST_PAD_PARENT (pad);
+ GstMaruEncClass *oclass =
+ (GstMaruEncClass *) G_OBJECT_GET_CLASS (maruenc);
CodecContext *ctx = NULL;
enum PixelFormat pixfmt;
GstCaps *caps = NULL;
static gboolean
gst_maruenc_setcaps (GstPad *pad, GstCaps *caps)
{
- GstEmulEnc *maruenc;
- GstEmulEncClass *oclass;
+ GstMaruEnc *maruenc;
+ GstMaruEncClass *oclass;
GstCaps *other_caps;
GstCaps *allowed_caps;
GstCaps *icaps;
enum PixelFormat pix_fmt;
int32_t buf_size;
- maruenc = (GstEmulEnc *) (gst_pad_get_parent (pad));
- oclass = (GstEmulEncClass *) (G_OBJECT_GET_CLASS (maruenc));
+ maruenc = (GstMaruEnc *) (gst_pad_get_parent (pad));
+ oclass = (GstMaruEncClass *) (G_OBJECT_GET_CLASS (maruenc));
if (maruenc->opened) {
gst_maru_avcodec_close (maruenc->context, maruenc->dev);
}
static void
-gst_maruenc_setup_working_buf (GstEmulEnc *maruenc)
+gst_maruenc_setup_working_buf (GstMaruEnc *maruenc)
{
guint wanted_size =
maruenc->context->video.width * maruenc->context->video.height * 6 +
GstFlowReturn
gst_maruenc_chain_video (GstPad *pad, GstBuffer *buffer)
{
- GstEmulEnc *maruenc = (GstEmulEnc *) (GST_PAD_PARENT (pad));
+ GstMaruEnc *maruenc = (GstMaruEnc *) (GST_PAD_PARENT (pad));
GstBuffer *outbuf;
gint ret_size = 0, frame_size;
maruenc->dev);
if (ret_size < 0) {
- GstEmulEncClass *oclass =
- (GstEmulEncClass *) (G_OBJECT_GET_CLASS (maruenc));
+ GstMaruEncClass *oclass =
+ (GstMaruEncClass *) (G_OBJECT_GET_CLASS (maruenc));
GST_ERROR_OBJECT (maruenc,
"maru_%senc: failed to encode buffer", oclass->codec->name);
gst_buffer_unref (buffer);
}
GstFlowReturn
-gst_maruenc_encode_audio (GstEmulEnc *maruenc, guint8 *audio_in,
+gst_maruenc_encode_audio (GstMaruEnc *maruenc, guint8 *audio_in,
guint in_size, guint max_size, GstClockTime timestamp,
GstClockTime duration, gboolean discont)
{
static GstFlowReturn
gst_maruenc_chain_audio (GstPad *pad, GstBuffer *buffer)
{
- GstEmulEnc *maruenc;
- GstEmulEncClass *oclass;
+ GstMaruEnc *maruenc;
+ GstMaruEncClass *oclass;
GstClockTime timestamp, duration;
guint in_size, frame_size;
gint osize;
guint8 *in_data;
CodecContext *ctx;
- maruenc = (GstEmulEnc *) (GST_OBJECT_PARENT (pad));
- oclass = (GstEmulEncClass *) G_OBJECT_GET_CLASS (maruenc);
+ maruenc = (GstMaruEnc *) (GST_OBJECT_PARENT (pad));
+ oclass = (GstMaruEncClass *) G_OBJECT_GET_CLASS (maruenc);
ctx = maruenc->context;
}
static void
-gst_maruenc_flush_buffers (GstEmulEnc *maruenc, gboolean send)
+gst_maruenc_flush_buffers (GstMaruEnc *maruenc, gboolean send)
{
GstBuffer *outbuf, *inbuf;
gint ret_size = 0;
maruenc->dev);
if (ret_size < 0) {
- GstEmulEncClass *oclass =
- (GstEmulEncClass *) (G_OBJECT_GET_CLASS (maruenc));
+ GstMaruEncClass *oclass =
+ (GstMaruEncClass *) (G_OBJECT_GET_CLASS (maruenc));
GST_WARNING_OBJECT (maruenc,
"maru_%senc: failed to flush buffer", oclass->codec->name);
break;
static gboolean
gst_maruenc_event_video (GstPad *pad, GstEvent *event)
{
- GstEmulEnc *maruenc;
- maruenc = (GstEmulEnc *) gst_pad_get_parent (pad);
+ GstMaruEnc *maruenc;
+ maruenc = (GstMaruEnc *) gst_pad_get_parent (pad);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
static gboolean
gst_maruenc_event_src (GstPad *pad, GstEvent *event)
{
- GstEmulEnc *maruenc = (GstEmulEnc *) (GST_PAD_PARENT (pad));
+ GstMaruEnc *maruenc = (GstMaruEnc *) (GST_PAD_PARENT (pad));
gboolean forward = TRUE;
switch (GST_EVENT_TYPE (event)) {
GstStateChangeReturn
gst_maruenc_change_state (GstElement *element, GstStateChange transition)
{
- GstEmulEnc *maruenc = (GstEmulEnc*)element;
+ GstMaruEnc *maruenc = (GstMaruEnc*)element;
GstStateChangeReturn ret;
switch (transition) {
gst_maruenc_register (GstPlugin *plugin, GList *element)
{
GTypeInfo typeinfo = {
- sizeof (GstEmulEncClass),
+ sizeof (GstMaruEncClass),
(GBaseInitFunc) gst_maruenc_base_init,
NULL,
(GClassInitFunc) gst_maruenc_class_init,
NULL,
NULL,
- sizeof (GstEmulEnc),
+ sizeof (GstMaruEnc),
0,
(GInstanceInitFunc) gst_maruenc_init,
};