diff options
author | Filippo Argiolas <filippo.argiolas@gmail.com> | 2009-04-27 15:39:27 +0200 |
---|---|---|
committer | Filippo Argiolas <filippo.argiolas@gmail.com> | 2009-04-27 15:39:27 +0200 |
commit | 262624d2ac1d9c67a8676b1f20423c5349099332 (patch) | |
tree | b715ace188ba80a8d626953ae0820082f54f5fdb | |
parent | f804d21b842bf707ca420398acd1185b1b346cd5 (diff) |
Forgot to add a couple of files
-rw-r--r-- | src/cheese-actor.c | 121 | ||||
-rw-r--r-- | src/cheese-actor.h | 64 |
2 files changed, 185 insertions, 0 deletions
diff --git a/src/cheese-actor.c b/src/cheese-actor.c new file mode 100644 index 0000000..bcfb6eb --- /dev/null +++ b/src/cheese-actor.c @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2009 Filippo Argiolas <filippo.argiolas@gmail.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 "cheese-texture.h" +#include "cheese-actor.h" + +#include <clutter/clutter.h> +#include <gst/gst.h> + +G_DEFINE_TYPE (CheeseActor, cheese_actor, CHEESE_TYPE_TEXTURE); + +#define CHEESE_ACTOR_GET_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_ACTOR, CheeseActorPrivate)) + +struct _CheeseActorPrivate +{ + /* stuff */ + gpointer data; + gchar *name; + GstElement *sink; +}; + +enum +{ + PROP_0, + PROP_SINK, + PROP_NAME +}; + +static void +cheese_actor_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + CheeseActor *self = CHEESE_ACTOR (object); + CheeseActorPrivate *priv = CHEESE_ACTOR_GET_PRIVATE (self); + + switch (prop_id) + { + case PROP_SINK: + g_value_set_object (value, priv->sink); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +cheese_actor_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + CheeseActor *self = CHEESE_ACTOR (object); + CheeseActorPrivate *priv = CHEESE_ACTOR_GET_PRIVATE (self); + + switch (prop_id) + { + case PROP_SINK: + priv->sink = g_value_get_object (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +cheese_actor_class_init (CheeseActorClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); + + g_type_class_add_private (klass, sizeof (CheeseActorPrivate)); + + gobject_class->get_property = cheese_actor_get_property; + gobject_class->set_property = cheese_actor_set_property; + + + g_object_class_install_property (gobject_class, + PROP_SINK, + g_param_spec_object ("sink", + "Sink", + "The Sink", + GST_TYPE_ELEMENT, + G_PARAM_READWRITE)); +} + +static void +cheese_actor_init (CheeseActor * self) +{ + CheeseActorPrivate *priv = CHEESE_ACTOR_GET_PRIVATE (self); + priv->name = NULL; + priv->sink = NULL; +} + +ClutterActor * +cheese_actor_new (void) +{ + ClutterActor *self = g_object_new (CHEESE_TYPE_ACTOR, NULL); + + return self; +} diff --git a/src/cheese-actor.h b/src/cheese-actor.h new file mode 100644 index 0000000..4bdd0a2 --- /dev/null +++ b/src/cheese-actor.h @@ -0,0 +1,64 @@ +/* + * Cheese Texture + * + * An actor to import textures from gstreamer video sinks using TFP + * + * Copyright (C) 2009 Filippo Argiolas + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef __CHEESE_ACTOR_H__ +#define __CHEESE_ACTOR_H__ + +#include <clutter/clutter.h> +/* TODO: fallback to X11 TFP if GLX is not supported */ +#include "cheese-texture.h" + +#define DEFAULT_W 160 +#define DEFAULT_H 120 + +G_BEGIN_DECLS + +#define CHEESE_TYPE_ACTOR (cheese_actor_get_type()) +#define CHEESE_ACTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CHEESE_TYPE_ACTOR, CheeseActor)) +#define CHEESE_ACTOR_CLASS(k) (G_TYPE_CHECK_CLASS((k), CHEESE_TYPE_ACTOR, CheeseActorClass)) +#define CHEESE_IS_ACTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), CHEESE_TYPE_ACTOR)) +#define CHEESE_IS_ACTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), CHEESE_TYPE_ACTOR)) +#define CHEESE_ACTOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), CHEESE_TYPE_ACTOR, CheeseActorClass)) + +typedef struct _CheeseActor CheeseActor; +typedef struct _CheeseActorClass CheeseActorClass; +typedef struct _CheeseActorPrivate CheeseActorPrivate; + +struct _CheeseActor { + /*< private >*/ + CheeseTexture parent; + CheeseActorPrivate *priv; +}; + +struct _CheeseActorClass { + /*< private >*/ + CheeseTextureClass parent_class; +}; + +GType cheese_actor_get_type (void); + +ClutterActor *cheese_actor_new (void); + +G_END_DECLS + +#endif /* __CHEESE_ACTOR_H__ */ |