summaryrefslogtreecommitdiffstats
path: root/ext/libpng/gstpng.c
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2002-11-18 22:29:38 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2002-11-18 22:29:38 +0000
commit1c4686af940a6191c284c93b75968a24eb081fbc (patch)
treec855da10c37a43f999ac5921bbad28fefd3be8b6 /ext/libpng/gstpng.c
parent5ed59e18ed6bca07f66c7820694eb0a3f00b42e5 (diff)
putting in apoc's png encoder, needs some cleanup
Original commit message from CVS: putting in apoc's png encoder, needs some cleanup
Diffstat (limited to 'ext/libpng/gstpng.c')
-rw-r--r--ext/libpng/gstpng.c117
1 files changed, 117 insertions, 0 deletions
diff --git a/ext/libpng/gstpng.c b/ext/libpng/gstpng.c
new file mode 100644
index 00000000..61dfe0b2
--- /dev/null
+++ b/ext/libpng/gstpng.c
@@ -0,0 +1,117 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ *
+ * Filter:
+ * Copyright (C) 2000 Donald A. Graft
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <string.h>
+#include <gst/gst.h>
+#include "gstpng.h"
+
+
+struct _elements_entry {
+ gchar *name;
+ GType (*type) (void);
+ GstElementDetails *details;
+ gboolean (*factoryinit) (GstElementFactory *factory);
+};
+
+static struct _elements_entry _elements[] = {
+ { "pngenc", gst_pngenc_get_type, &gst_pngenc_details, NULL },
+ { NULL, 0 },
+};
+
+
+GstPadTemplate*
+gst_png_src_factory (void)
+{
+ static GstPadTemplate *templ = NULL;
+ if (!templ) {
+ templ = GST_PAD_TEMPLATE_NEW (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_CAPS_NEW (
+ "png_src",
+ "video/raw",
+ NULL
+ )
+ );
+ }
+ return templ;
+}
+
+GstPadTemplate*
+gst_png_sink_factory (void)
+{
+ static GstPadTemplate *templ = NULL;
+ if (!templ) {
+ templ = GST_PAD_TEMPLATE_NEW (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_CAPS_NEW (
+ "png_sink",
+ "video/raw",
+ "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
+ "bpp", GST_PROPS_INT (24),
+ "red_mask", GST_PROPS_INT (0xff0000),
+ "green_mask", GST_PROPS_INT (0xff00),
+ "blue_mask", GST_PROPS_INT (0xff),
+ "width", GST_PROPS_INT_RANGE (16, 4096),
+ "height", GST_PROPS_INT_RANGE (16, 4096)
+ )
+ );
+ }
+ return templ;
+}
+
+
+static gboolean
+plugin_init (GModule * module, GstPlugin * plugin)
+{
+ GstElementFactory *factory;
+ gint i = 0;
+
+ while (_elements[i].name) {
+ factory = gst_element_factory_new (_elements[i].name,
+ (_elements[i].type) (),
+ _elements[i].details);
+
+ if (!factory) {
+ g_warning ("gst_png_new failed for `%s'",
+ _elements[i].name);
+ continue;
+ }
+
+ gst_element_factory_add_pad_template (factory, gst_png_src_factory ());
+ gst_element_factory_add_pad_template (factory, gst_png_sink_factory ());
+
+ gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
+ if (_elements[i].factoryinit) {
+ _elements[i].factoryinit (factory);
+ }
+ i++;
+ }
+
+ return TRUE;
+}
+
+GstPluginDesc plugin_desc = {
+ GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "png",
+ plugin_init
+};