#define JIFFIE (GST_SECOND/70)
-static GstCaps* flxdec_type_find (GstByteStream *bs, gpointer private);
-
/* flx element information */
static GstElementDetails flxdec_details = {
"FLX Decoder",
- "Codec/Audio/Decoder",
- "LGPL",
+ "Codec/Decoder/Audio",
"FLX decoder",
- VERSION,
- "Sepp Wijnands <mrrazz@garbage-coderz.net>",
- "(C) 2001",
-};
-
-static GstTypeDefinition flxdec_definition = {
- "flxdec_video/fli",
- "video/fli",
- ".flc .fli",
- flxdec_type_find,
+ "Sepp Wijnands <mrrazz@garbage-coderz.net>"
};
/* Flx signals and args */
};
/* input */
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
+static GstStaticPadTemplate sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "flxdec_sink",
- "video/x-fli",
- NULL
- )
-)
+ GST_STATIC_CAPS ( "video/x-fli" )
+);
/* output */
-GST_PAD_TEMPLATE_FACTORY (src_video_factory,
+static GstStaticPadTemplate src_video_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "src_video",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT (32),
- "depth", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT (R_MASK_32),
- "green_mask", GST_PROPS_INT (G_MASK_32),
- "blue_mask", GST_PROPS_INT (B_MASK_32),
- "width", GST_PROPS_INT_RANGE(320, 1280),
- "height", GST_PROPS_INT_RANGE(200, 1024),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
- )
-)
+ GST_STATIC_CAPS ( GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 )
+);
static void gst_flxdec_class_init (GstFlxDecClass *klass);
+static void gst_flxdec_base_init (GstFlxDecClass *klass);
static void gst_flxdec_init (GstFlxDec *flxdec);
static void gst_flxdec_loop (GstElement *element);
static GstElementClass *parent_class = NULL;
-static GstCaps*
-flxdec_type_find (GstByteStream *bs, gpointer private)
-{
- GstBuffer *buf = NULL;
- GstCaps *new = NULL;
-
- if (gst_bytestream_peek (bs, &buf, 134) == 134) {
- guint8 *data = GST_BUFFER_DATA (buf);
-
- /* check magic */
- if ((data[4] == 0x11 || data[4] == 0x12 ||
- data[4] == 0x30 || data[4] == 0x44) &&
- data[5] == 0xaf) {
- /* check the frame type of the first frame */
- if ((data[132] == 0x00 || data[132] == 0xfa) && data[133] == 0xf1) {
- GST_DEBUG ("GstFlxDec: found supported flx format");
- new = gst_caps_new ("flxdec_type_find",
- "video/x-fli",
- NULL);
- }
- }
- }
-
- if (buf != NULL) {
- gst_buffer_unref (buf);
- }
-
- return new;
-}
-
-
GType
gst_flxdec_get_type(void)
{
if (!flxdec_type) {
static const GTypeInfo flxdec_info = {
- sizeof(GstFlxDecClass), NULL,
+ sizeof(GstFlxDecClass),
+ (GBaseInitFunc)gst_flxdec_base_init,
NULL,
(GClassInitFunc)gst_flxdec_class_init,
NULL,
return flxdec_type;
}
+static void
+gst_flxdec_base_init (GstFlxDecClass *klass)
+{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
+
+ gst_element_class_set_details (gstelement_class, &flxdec_details);
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sink_factory));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&src_video_factory));
+}
+
static void
gst_flxdec_class_init (GstFlxDecClass *klass)
{
gst_flxdec_init(GstFlxDec *flxdec)
{
flxdec->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ gst_static_pad_template_get (&sink_factory), "sink");
gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->sinkpad);
gst_element_set_loop_function(GST_ELEMENT(flxdec),gst_flxdec_loop);
flxdec->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_video_factory), "src");
+ gst_static_pad_template_get (&src_video_factory), "src");
gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->srcpad);
flxdec->bs = NULL;
GstBuffer *buf;
GstBuffer *databuf;
guchar *data, *chunk;
+ GstCaps *caps;
GstFlxDec *flxdec;
FlxHeader *flxh;
flxdec->frame_time = flxh->speed * GST_MSECOND;
}
- gst_pad_try_set_caps (flxdec->srcpad,
- GST_CAPS_NEW (
- "src_video",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT (32),
- "depth", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT (R_MASK_32),
- "green_mask", GST_PROPS_INT (G_MASK_32),
- "blue_mask", GST_PROPS_INT (B_MASK_32),
- "width", GST_PROPS_INT (flxh->width),
- "height", GST_PROPS_INT (flxh->height),
- "framerate", GST_PROPS_FLOAT (GST_SECOND/flxdec->frame_time)));
+ caps = gst_caps_from_string (GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32);
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, flxh->width,
+ "height", G_TYPE_INT, flxh->height,
+ "framerate", G_TYPE_DOUBLE, GST_SECOND/flxdec->frame_time, NULL);
if (flxh->depth <= 8)
flxdec->converter = flx_colorspace_converter_new(flxh->width, flxh->height);
g_print("GstFlxDec: (FLC) oframe1 : 0x%08x\n", flxh->oframe1);
g_print("GstFlxDec: (FLC) oframe2 : 0x%08x\n", flxh->oframe2);
}
-
flxdec->size = (flxh->width * flxh->height);
GST_BUFFER_TIMESTAMP (out) = flxdec->next_time;
flxdec->next_time += flxdec->frame_time;
- gst_pad_push(flxdec->srcpad, out);
+ gst_pad_push(flxdec->srcpad, GST_DATA (out));
break;
}
}
static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
{
- GstElementFactory *factory;
- GstTypeFactory *type;
+ if (!gst_library_load ("gstbytestream"))
+ return FALSE;
- factory = gst_element_factory_new("flxdec", GST_TYPE_FLXDEC, &flxdec_details);
- g_return_val_if_fail(factory != NULL, FALSE);
- gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_PRIMARY);
-
- gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_factory));
- gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_video_factory));
-
- gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
-
- type = gst_type_factory_new (&flxdec_definition);
- gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
-
- return TRUE;
+ return gst_element_register (plugin, "flxdec",
+ GST_RANK_PRIMARY, GST_TYPE_FLXDEC);
}
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"flxdec",
- plugin_init
-};
+ "FLX video decoder",
+ plugin_init,
+ VERSION,
+ GST_LICENSE,
+ GST_PACKAGE,
+ GST_ORIGIN
+)