summaryrefslogtreecommitdiff
path: root/ext/hermes
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-07-06 20:49:52 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-07-06 20:49:52 +0000
commit95011fd7e8eb3a2ec3a87ff9dad523d18005db42 (patch)
tree6e75f9139c6520126f9344e15e1dea2a49f70f9c /ext/hermes
parent85a8dd7ecb04d043be8192e27e3c89ef8ccebe55 (diff)
New mimetypes gone into effect today - this commit changes all old mimetypes over to the new mimetypes spec as descri...
Original commit message from CVS: New mimetypes gone into effect today - this commit changes all old mimetypes over to the new mimetypes spec as described in the previous commit's document. Note: some plugins will break, some pipelines will break, expect HEAD to be broken or at least not 100% working for a few days, but don't forget to report bugs
Diffstat (limited to 'ext/hermes')
-rw-r--r--ext/hermes/gstcolorspace.c116
-rw-r--r--ext/hermes/gstcolorspace.h1
2 files changed, 64 insertions, 53 deletions
diff --git a/ext/hermes/gstcolorspace.c b/ext/hermes/gstcolorspace.c
index 7e99a7497..86b3fc6be 100644
--- a/ext/hermes/gstcolorspace.c
+++ b/ext/hermes/gstcolorspace.c
@@ -21,6 +21,7 @@
#include "config.h"
#endif
#include <gst/gst.h>
+#include <gst/video/video.h>
#include "gstcolorspace.h"
#include "yuv2rgb.h"
@@ -50,42 +51,6 @@ enum {
ARG_DEST,
};
-GST_PAD_TEMPLATE_FACTORY (colorspace_src_template_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "colorspace_src",
- "video/raw",
- "format", GST_PROPS_LIST (
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
- GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
- GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")),
- GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB "))
- ),
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT)
- )
-)
-
-GST_PAD_TEMPLATE_FACTORY (colorspace_sink_template_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "colorspace_sink",
- "video/raw",
- "format", GST_PROPS_LIST (
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
- GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
- GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")),
- GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB "))
- ),
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT)
- )
-)
-
static void gst_colorspace_class_init (GstColorspaceClass *klass);
static void gst_colorspace_init (GstColorspace *space);
@@ -110,6 +75,7 @@ extern void gst_colorspace_rgb32_to_i420 (unsigned char *src, unsigned char *de
extern void gst_colorspace_rgb32_to_yv12 (unsigned char *src, unsigned char *dest,
guint width, guint height);
+static GstPadTemplate *srctempl, *sinktempl;
static GstElementClass *parent_class = NULL;
/*static guint gst_colorspace_signals[LAST_SIGNAL] = { 0 }; */
@@ -134,10 +100,20 @@ colorspace_setup_converter (GstColorspace *space, GstCaps *from_caps, GstCaps *t
g_return_val_if_fail (to_caps != NULL, FALSE);
g_return_val_if_fail (from_caps != NULL, FALSE);
- gst_caps_get_fourcc_int (from_caps, "format", &from_space);
- gst_caps_get_fourcc_int (to_caps, "format", &to_space);
+ if (gst_caps_has_property (from_caps, "format"))
+ gst_caps_get_fourcc_int (from_caps, "format", &from_space);
+ else
+ from_space = GST_MAKE_FOURCC ('R','G','B',' ');
+
+ if (gst_caps_has_property (to_caps, "format"))
+ gst_caps_get_fourcc_int (to_caps, "format", &to_space);
+ else
+ to_space = GST_MAKE_FOURCC ('R','G','B',' ');
- GST_INFO ( "set up converter for %08x to %08x", from_space, to_space);
+ GST_INFO ("set up converter for " GST_FOURCC_FORMAT
+ " (%08x) to " GST_FOURCC_FORMAT " (%08x)",
+ GST_FOURCC_ARGS (from_space), from_space,
+ GST_FOURCC_ARGS (to_space), to_space);
switch (from_space) {
case GST_MAKE_FOURCC ('R','G','B',' '):
@@ -308,6 +284,7 @@ gst_colorspace_sinkconnect (GstPad *pad, GstCaps *caps)
gst_caps_get_int (caps, "width", &space->width);
gst_caps_get_int (caps, "height", &space->height);
+ gst_caps_get_float (caps, "framerate", &space->fps);
GST_INFO ( "size: %dx%d", space->width, space->height);
@@ -367,12 +344,20 @@ gst_colorspace_srcconnect_func (GstPad *pad, GstCaps *caps, gboolean newcaps)
gst_caps_unref (peercaps);
}
- to_intersect = GST_CAPS_NEW (
+ to_intersect = gst_caps_append (
+ GST_CAPS_NEW (
"colorspace_filter",
- "video/raw",
- "width", GST_PROPS_INT (space->width),
- "height", GST_PROPS_INT (space->height)
- );
+ "video/x-raw-yuv",
+ "width", GST_PROPS_INT (space->width),
+ "height", GST_PROPS_INT (space->height),
+ "framerate", GST_PROPS_FLOAT (space->fps)
+ ), GST_CAPS_NEW (
+ "colorspace_filter",
+ "video/x-raw-rgb",
+ "width", GST_PROPS_INT (space->width),
+ "height", GST_PROPS_INT (space->height),
+ "framerate", GST_PROPS_FLOAT (space->fps)
+ ));
/* then see what the peer has that matches the size */
peercaps = gst_caps_intersect (caps, to_intersect);
@@ -456,16 +441,14 @@ gst_colorspace_class_init (GstColorspaceClass *klass)
static void
gst_colorspace_init (GstColorspace *space)
{
- space->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (colorspace_sink_template_factory), "sink");
+ space->sinkpad = gst_pad_new_from_template (sinktempl, "sink");
gst_pad_set_link_function (space->sinkpad, gst_colorspace_sinkconnect);
gst_pad_set_getcaps_function (space->sinkpad, gst_colorspace_getcaps);
gst_pad_set_bufferpool_function (space->sinkpad, colorspace_get_bufferpool);
gst_pad_set_chain_function(space->sinkpad,gst_colorspace_chain);
gst_element_add_pad(GST_ELEMENT(space),space->sinkpad);
- space->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (colorspace_src_template_factory), "src");
+ space->srcpad = gst_pad_new_from_template (srctempl, "src");
gst_element_add_pad(GST_ELEMENT(space),space->srcpad);
gst_pad_set_link_function (space->srcpad, gst_colorspace_srcconnect);
@@ -623,6 +606,7 @@ static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
{
GstElementFactory *factory;
+ GstCaps *caps;
#ifdef HAVE_HERMES
gint hermes_res;
@@ -634,11 +618,37 @@ plugin_init (GModule *module, GstPlugin *plugin)
&colorspace_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 (colorspace_src_template_factory));
- gst_element_factory_add_pad_template (factory,
- GST_PAD_TEMPLATE_GET (colorspace_sink_template_factory));
+
+ /* create caps for templates */
+ caps = gst_caps_new ("csp_templ_yuv",
+ "video/x-raw-yuv",
+ GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
+ GST_PROPS_LIST (
+ GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
+ GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
+ GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")))));
+ caps = gst_caps_append (caps,
+ gst_caps_new ("csp_templ_rgb24_32",
+ "video/x-raw-rgb",
+ GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32));
+ caps = gst_caps_append (caps,
+ gst_caps_new ("csp_templ_rgb15_16",
+ "video/x-raw-rgb",
+ GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15_16));
+
+ /* build templates */
+ srctempl = gst_pad_template_new ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ caps, NULL);
+ gst_caps_ref (caps);
+ sinktempl = gst_pad_template_new ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ caps, NULL);
+
+ gst_element_factory_add_pad_template (factory, srctempl);
+ gst_element_factory_add_pad_template (factory, sinktempl);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
diff --git a/ext/hermes/gstcolorspace.h b/ext/hermes/gstcolorspace.h
index 37a80c5cd..45371c72d 100644
--- a/ext/hermes/gstcolorspace.h
+++ b/ext/hermes/gstcolorspace.h
@@ -76,6 +76,7 @@ struct _GstColorspace {
GstColorSpaceConverterType type;
gint width, height;
+ gfloat fps;
gint srcbpp, destbpp;
gboolean disabled;