diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/tarkin/gsttarkin.c | 107 | ||||
-rw-r--r-- | ext/tarkin/gsttarkindec.c | 62 | ||||
-rw-r--r-- | ext/tarkin/gsttarkinenc.c | 62 |
3 files changed, 127 insertions, 104 deletions
diff --git a/ext/tarkin/gsttarkin.c b/ext/tarkin/gsttarkin.c index 04270231..8026bde5 100644 --- a/ext/tarkin/gsttarkin.c +++ b/ext/tarkin/gsttarkin.c @@ -21,107 +21,26 @@ #include "gsttarkinenc.h" #include "gsttarkindec.h" -extern GstElementDetails tarkinenc_details; -extern GstElementDetails tarkindec_details; - -GstPadTemplate *enc_src_template, *enc_sink_template; -GstPadTemplate *dec_src_template, *dec_sink_template; - -static GstCaps* -tarkin_caps_factory (void) -{ - return - gst_caps_new ( - "tarkin_tarkin", - "application/ogg", - NULL); -} - -static GstCaps* -raw_caps_factory (void) -{ - return - GST_CAPS_NEW ( - "tarkin_raw", - "video/x-raw-rgb", - "bpp", GST_PROPS_INT (24), - "depth", GST_PROPS_INT (24), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "red_mask", GST_PROPS_INT (0xff0000), - "green_mask", GST_PROPS_INT (0xff00), - "blue_mask", GST_PROPS_INT (0xff), - "width", GST_PROPS_INT_RANGE (0, G_MAXINT), - "height", GST_PROPS_INT_RANGE (0, G_MAXINT), - "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) - ); -} - static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - GstElementFactory *enc, *dec; - GstCaps *raw_caps, *tarkin_caps; - - gst_plugin_set_longname (plugin, "The OGG Tarkin Codec"); - - /* create an elementfactory for the tarkinenc element */ - enc = gst_element_factory_new ("tarkinenc", GST_TYPE_TARKINENC, - &tarkinenc_details); - g_return_val_if_fail (enc != NULL, FALSE); - - raw_caps = raw_caps_factory (); - tarkin_caps = tarkin_caps_factory (); - - /* register sink pads */ - enc_sink_template = gst_pad_template_new ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - raw_caps, - NULL); - gst_element_factory_add_pad_template (enc, enc_sink_template); - - /* register src pads */ - enc_src_template = gst_pad_template_new ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - tarkin_caps, - NULL); - gst_element_factory_add_pad_template (enc, enc_src_template); - - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (enc)); - - /* create an elementfactory for the tarkindec element */ - dec = gst_element_factory_new ("tarkindec", GST_TYPE_TARKINDEC, - &tarkindec_details); - g_return_val_if_fail (dec != NULL, FALSE); - - raw_caps = raw_caps_factory (); - tarkin_caps = tarkin_caps_factory (); - - /* register sink pads */ - dec_sink_template = gst_pad_template_new ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - tarkin_caps, - NULL); - gst_element_factory_add_pad_template (dec, dec_sink_template); - - /* register src pads */ - dec_src_template = gst_pad_template_new ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - raw_caps, - NULL); - gst_element_factory_add_pad_template (dec, dec_src_template); + if (!gst_element_register (plugin, "tarkinenc", GST_RANK_NONE, GST_TYPE_TARKINENC)) + return FALSE; - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (dec)); + if (!gst_element_register (plugin, "tarkindec", GST_RANK_NONE, GST_TYPE_TARKINDEC)) + return FALSE; return TRUE; } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "tarkin", - plugin_init -}; + "Tarkin plugin library", + plugin_init, + VERSION, + "LGPL", + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN) diff --git a/ext/tarkin/gsttarkindec.c b/ext/tarkin/gsttarkindec.c index c8936b63..a87bb9a3 100644 --- a/ext/tarkin/gsttarkindec.c +++ b/ext/tarkin/gsttarkindec.c @@ -26,18 +26,15 @@ #include "gsttarkindec.h" -extern GstPadTemplate *dec_src_template, *dec_sink_template; +static GstPadTemplate *dec_src_template, *dec_sink_template; /* elementfactory information */ GstElementDetails tarkindec_details = { "Ogg Tarkin decoder", "Filter/Video/Decoder", - "LGPL", "Decodes video in OGG Tarkin format", - VERSION, "Monty <monty@xiph.org>, " "Wim Taymans <wim.taymans@chello.be>", - "(C) 2002", }; /* TarkinDec signals and args */ @@ -53,6 +50,7 @@ enum ARG_BITRATE, }; +static void gst_tarkindec_base_init (gpointer g_class); static void gst_tarkindec_class_init (TarkinDecClass *klass); static void gst_tarkindec_init (TarkinDec *arkindec); @@ -77,7 +75,7 @@ tarkindec_get_type (void) if (!tarkindec_type) { static const GTypeInfo tarkindec_info = { sizeof (TarkinDecClass), - NULL, + gst_tarkindec_base_init, NULL, (GClassInitFunc) gst_tarkindec_class_init, NULL, @@ -92,6 +90,60 @@ tarkindec_get_type (void) return tarkindec_type; } +static GstCaps* +tarkin_caps_factory (void) +{ + return + gst_caps_new ( + "tarkin_tarkin", + "application/ogg", + NULL); +} + +static GstCaps* +raw_caps_factory (void) +{ + return + GST_CAPS_NEW ( + "tarkin_raw", + "video/x-raw-rgb", + "bpp", GST_PROPS_INT (24), + "depth", GST_PROPS_INT (24), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "red_mask", GST_PROPS_INT (0xff0000), + "green_mask", GST_PROPS_INT (0xff00), + "blue_mask", GST_PROPS_INT (0xff), + "width", GST_PROPS_INT_RANGE (0, G_MAXINT), + "height", GST_PROPS_INT_RANGE (0, G_MAXINT), + "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) + ); +} + +static void +gst_tarkindec_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + GstCaps *raw_caps, *tarkin_caps; + + raw_caps = raw_caps_factory (); + tarkin_caps = tarkin_caps_factory (); + + dec_sink_template = gst_pad_template_new ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + tarkin_caps, + NULL); + dec_src_template = gst_pad_template_new ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + raw_caps, + NULL); + gst_element_class_add_pad_template (element_class, dec_sink_template); + gst_element_class_add_pad_template (element_class, dec_src_template); + + gst_element_class_set_details (element_class, &tarkindec_details); +} + static void gst_tarkindec_class_init (TarkinDecClass *klass) { diff --git a/ext/tarkin/gsttarkinenc.c b/ext/tarkin/gsttarkinenc.c index beddd876..5c918a4e 100644 --- a/ext/tarkin/gsttarkinenc.c +++ b/ext/tarkin/gsttarkinenc.c @@ -26,18 +26,15 @@ #include "gsttarkinenc.h" -extern GstPadTemplate *enc_src_template, *enc_sink_template; +static GstPadTemplate *enc_src_template, *enc_sink_template; /* elementfactory information */ GstElementDetails tarkinenc_details = { "Ogg Tarkin encoder", "Filter/Video/Encoder", - "LGPL", "Encodes video in OGG Tarkin format", - VERSION, "Monty <monty@xiph.org>, " "Wim Taymans <wim.taymans@chello.be>", - "(C) 2002", }; /* TarkinEnc signals and args */ @@ -55,6 +52,7 @@ enum ARG_A_MOMENTS, }; +static void gst_tarkinenc_base_init (gpointer g_class); static void gst_tarkinenc_class_init (TarkinEncClass *klass); static void gst_tarkinenc_init (TarkinEnc *arkinenc); @@ -77,7 +75,7 @@ tarkinenc_get_type (void) if (!tarkinenc_type) { static const GTypeInfo tarkinenc_info = { sizeof (TarkinEncClass), - NULL, + gst_tarkinenc_base_init, NULL, (GClassInitFunc) gst_tarkinenc_class_init, NULL, @@ -92,6 +90,60 @@ tarkinenc_get_type (void) return tarkinenc_type; } +static GstCaps* +tarkin_caps_factory (void) +{ + return + gst_caps_new ( + "tarkin_tarkin", + "application/ogg", + NULL); +} + +static GstCaps* +raw_caps_factory (void) +{ + return + GST_CAPS_NEW ( + "tarkin_raw", + "video/x-raw-rgb", + "bpp", GST_PROPS_INT (24), + "depth", GST_PROPS_INT (24), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "red_mask", GST_PROPS_INT (0xff0000), + "green_mask", GST_PROPS_INT (0xff00), + "blue_mask", GST_PROPS_INT (0xff), + "width", GST_PROPS_INT_RANGE (0, G_MAXINT), + "height", GST_PROPS_INT_RANGE (0, G_MAXINT), + "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) + ); +} + +static void +gst_tarkinenc_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + GstCaps *raw_caps, *tarkin_caps; + + raw_caps = raw_caps_factory (); + tarkin_caps = tarkin_caps_factory (); + + enc_sink_template = gst_pad_template_new ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + raw_caps, + NULL); + enc_src_template = gst_pad_template_new ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + tarkin_caps, + NULL); + gst_element_class_add_pad_template (element_class, enc_sink_template); + gst_element_class_add_pad_template (element_class, enc_src_template); + + gst_element_class_set_details (element_class, &tarkinenc_details); +} + static void gst_tarkinenc_class_init (TarkinEncClass *klass) { |