summaryrefslogtreecommitdiffstats
path: root/ext/libpng
diff options
context:
space:
mode:
authorIain Holmes <iain@prettypeople.org>2003-11-02 00:21:14 +0000
committerIain Holmes <iain@prettypeople.org>2003-11-02 00:21:14 +0000
commitb509505b49d74330372632463a2c4d7b2e3980d8 (patch)
tree3d25c40adcb136b835a41d513040d967a9aef929 /ext/libpng
parentf57a2a9d543639018123aa801f20edb4b6acab90 (diff)
pngenc fixed
Original commit message from CVS: pngenc fixed
Diffstat (limited to 'ext/libpng')
-rw-r--r--ext/libpng/gstpng.c66
-rw-r--r--ext/libpng/gstpngenc.c52
2 files changed, 61 insertions, 57 deletions
diff --git a/ext/libpng/gstpng.c b/ext/libpng/gstpng.c
index f3ac003c..54bcccbd 100644
--- a/ext/libpng/gstpng.c
+++ b/ext/libpng/gstpng.c
@@ -16,70 +16,30 @@
*
*/
+#include <config.h>
+
#include <string.h>
#include <gst/gst.h>
-#include <gst/video/video.h>
#include "gstpngenc.h"
-extern GstElementDetails gst_pngenc_details;
-
-static GstCaps*
-png_caps_factory (void)
-{
- return gst_caps_new ( "png_png",
- "video/x-png",
- gst_props_new (
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- NULL));
-}
-
-
-static GstCaps*
-raw_caps_factory (void)
-{
- return gst_caps_new ( "png_raw",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24
- );
-}
-
static gboolean
-plugin_init (GModule * module, GstPlugin * plugin)
+plugin_init (GstPlugin * plugin)
{
- GstElementFactory *png_enc;
- GstCaps *raw_caps, *png_caps;
-
- /* create an elementfactory for the jpegdec element */
- png_enc = gst_element_factory_new("pngenc", GST_TYPE_PNGENC, &gst_pngenc_details);
- g_return_val_if_fail(png_enc != NULL, FALSE);
-
- raw_caps = raw_caps_factory ();
- png_caps = png_caps_factory ();
-
- /* register sink pads */
- pngenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS,
- raw_caps, NULL);
- gst_element_factory_add_pad_template (png_enc, pngenc_sink_template);
-
+ if (!gst_element_register (plugin, "pngenc", GST_RANK_NONE, GST_TYPE_PNGENC))
+ return FALSE;
- /* register src pads */
- pngenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS,
- png_caps, NULL);
- gst_element_factory_add_pad_template (png_enc, pngenc_src_template);
-
- gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (png_enc));
-
return TRUE;
}
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"png",
- plugin_init
-};
+ "PNG plugin library",
+ plugin_init,
+ VERSION,
+ "LGPL",
+ GST_COPYRIGHT,
+ GST_PACKAGE,
+ GST_ORIGIN)
diff --git a/ext/libpng/gstpngenc.c b/ext/libpng/gstpngenc.c
index a4578477..061e3514 100644
--- a/ext/libpng/gstpngenc.c
+++ b/ext/libpng/gstpngenc.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <gst/gst.h>
#include "gstpngenc.h"
+#include <gst/video/video.h>
#define MAX_HEIGHT 4096
@@ -29,11 +30,8 @@
GstElementDetails gst_pngenc_details = {
"PNG encoder",
"Codec/Image",
- "LGPL",
"Encode a video frame to a .png image",
- VERSION,
"Jeremy SIMON <jsimon13@yahoo.fr>",
- "(C) 2000 Donald Graft",
};
@@ -49,6 +47,7 @@ enum
ARG_0
};
+static void gst_pngenc_base_init (gpointer g_class);
static void gst_pngenc_class_init (GstPngEncClass *klass);
static void gst_pngenc_init (GstPngEnc *pngenc);
@@ -74,7 +73,8 @@ GType gst_pngenc_get_type (void)
if (!pngenc_type) {
static const GTypeInfo pngenc_info = {
- sizeof (GstPngEncClass), NULL,
+ sizeof (GstPngEncClass),
+ gst_pngenc_base_init,
NULL,
(GClassInitFunc) gst_pngenc_class_init,
NULL,
@@ -90,6 +90,50 @@ GType gst_pngenc_get_type (void)
return pngenc_type;
}
+static GstCaps*
+png_caps_factory (void)
+{
+ return gst_caps_new ( "png_png",
+ "video/x-png",
+ gst_props_new (
+ "width", GST_PROPS_INT_RANGE (16, 4096),
+ "height", GST_PROPS_INT_RANGE (16, 4096),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
+ NULL));
+}
+
+
+static GstCaps*
+raw_caps_factory (void)
+{
+ return gst_caps_new ( "png_raw",
+ "video/x-raw-rgb",
+ GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24
+ );
+}
+
+static void
+gst_pngenc_base_init (gpointer g_class)
+{
+ GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+ GstCaps *raw_caps, *png_caps;
+
+ raw_caps = raw_caps_factory ();
+ png_caps = png_caps_factory ();
+
+ pngenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ raw_caps, NULL);
+
+ pngenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ png_caps, NULL);
+
+ gst_element_class_add_pad_template (element_class, pngenc_sink_template);
+ gst_element_class_add_pad_template (element_class, pngenc_src_template);
+ gst_element_class_set_details (element_class, &gst_pngenc_details);
+}
+
static void
gst_pngenc_class_init (GstPngEncClass *klass)
{