[clutter-gst] video-sink: remove dependency on ClutterGstVideoTexture
- From: Damien Lespiau <dlespiau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter-gst] video-sink: remove dependency on ClutterGstVideoTexture
- Date: Tue, 1 Nov 2011 18:11:22 +0000 (UTC)
commit 12e6a977478d7db9ad078cbe1649713f05d67d65
Author: Josep Torra <n770galaxy gmail com>
Date: Wed Sep 21 13:36:55 2011 +0200
video-sink: remove dependency on ClutterGstVideoTexture
* Add a property to set the pixel-aspect-ratio on a clutter-video-texture
and use it in the video sink element.
* Remove the _set_par private API that is not required anymore.
* Avoid that video-texture own properties overlap the CLUTTER_MEDIA and
CLUTTER_GST_TYPE_PLAYER ones.
clutter-gst/clutter-gst-private.h | 7 ------
clutter-gst/clutter-gst-video-sink.c | 24 ++++++++++----------
clutter-gst/clutter-gst-video-texture.c | 35 ++++++++++++++++--------------
3 files changed, 31 insertions(+), 35 deletions(-)
---
diff --git a/clutter-gst/clutter-gst-private.h b/clutter-gst/clutter-gst-private.h
index 81c6b10..7d63899 100644
--- a/clutter-gst/clutter-gst-private.h
+++ b/clutter-gst/clutter-gst-private.h
@@ -28,8 +28,6 @@
#include <glib.h>
-#include "clutter-gst-video-texture.h"
-
G_BEGIN_DECLS
/* GLib has some define for that, but defining it ourselves allows to require a
@@ -46,11 +44,6 @@ G_BEGIN_DECLS
#define CLUTTER_GST_PARAM_READWRITE \
(G_PARAM_READABLE | G_PARAM_WRITABLE | CLUTTER_GST_PARAM_STATIC)
-void
-_clutter_gst_video_texture_set_par (ClutterGstVideoTexture *texture,
- guint par_n,
- guint par_d);
-
G_END_DECLS
#endif /* __CLUTTER_GST_PRIVATE_H__ */
diff --git a/clutter-gst/clutter-gst-video-sink.c b/clutter-gst/clutter-gst-video-sink.c
index 95e55d7..9c676c8 100644
--- a/clutter-gst/clutter-gst-video-sink.c
+++ b/clutter-gst/clutter-gst-video-sink.c
@@ -43,7 +43,6 @@
#endif
#include "clutter-gst-video-sink.h"
-#include "clutter-gst-video-texture.h"
#include "clutter-gst-private.h"
#include "clutter-gst-shaders.h"
@@ -1064,23 +1063,24 @@ clutter_gst_video_sink_set_caps (GstBaseSink *bsink,
if (par)
{
+ GParamSpec *pspec;
+
+ /* If we happen to use a ClutterGstVideoTexture, now is to good time to
+ * instruct it about the pixel aspect ratio so we can have a correct
+ * natural width/height */
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (priv->texture),
+ "pixel-aspect-ratio");
+ if (pspec)
+ {
+ g_object_set_property (G_OBJECT(priv->texture),
+ "pixel-aspect-ratio", par);
+ }
priv->par_n = gst_value_get_fraction_numerator (par);
priv->par_d = gst_value_get_fraction_denominator (par);
}
else
priv->par_n = priv->par_d = 1;
- /* If we happen to use a ClutterGstVideoTexture, now is to good time to
- * instruct it about the pixel aspect ratio so we can have a correct
- * natural width/height */
- if (CLUTTER_GST_IS_VIDEO_TEXTURE (priv->texture))
- {
- ClutterGstVideoTexture *texture =
- (ClutterGstVideoTexture *) priv->texture;
-
- _clutter_gst_video_texture_set_par (texture, priv->par_n, priv->par_d);
- }
-
ret = gst_structure_get_fourcc (structure, "format", &fourcc);
if (ret && (fourcc == GST_MAKE_FOURCC ('Y', 'V', '1', '2')))
{
diff --git a/clutter-gst/clutter-gst-video-texture.c b/clutter-gst/clutter-gst-video-texture.c
index a5e7e79..5de9e06 100644
--- a/clutter-gst/clutter-gst-video-texture.c
+++ b/clutter-gst/clutter-gst-video-texture.c
@@ -73,9 +73,10 @@ struct _ClutterGstVideoTexturePrivate
};
enum {
- PROP_0,
+ PROP_0 = 32, /* Avoid overlap with player properties */
- PROP_IDLE_MATERIAL
+ PROP_IDLE_MATERIAL,
+ PROP_PAR
};
static void clutter_gst_video_texture_media_init (ClutterMediaIface *iface);
@@ -437,6 +438,7 @@ clutter_gst_video_texture_set_property (GObject *object,
GParamSpec *pspec)
{
ClutterGstVideoTexture *video_texture = CLUTTER_GST_VIDEO_TEXTURE (object);
+ ClutterGstVideoTexturePrivate *priv = video_texture->priv;
switch (property_id)
{
@@ -444,6 +446,10 @@ clutter_gst_video_texture_set_property (GObject *object,
clutter_gst_video_texture_set_idle_material (video_texture,
g_value_get_boxed (value));
break;
+ case PROP_PAR:
+ priv->par_n = gst_value_get_fraction_numerator (value);
+ priv->par_d = gst_value_get_fraction_denominator (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -467,6 +473,9 @@ clutter_gst_video_texture_get_property (GObject *object,
case PROP_IDLE_MATERIAL:
g_value_set_boxed (value, priv->idle_material);
break;
+ case PROP_PAR:
+ gst_value_set_fraction (value, priv->par_n, priv->par_d);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -503,6 +512,14 @@ clutter_gst_video_texture_class_init (ClutterGstVideoTextureClass *klass)
CLUTTER_GST_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_IDLE_MATERIAL, pspec);
+ pspec = gst_param_spec_fraction ("pixel-aspect-ratio",
+ "Pixel Aspect Ratio",
+ "Pixel aspect ratio of incoming frames",
+ 1, 100, 100, 1, 1, 1,
+ CLUTTER_GST_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_PAR, pspec);
+
+
clutter_gst_player_class_init (object_class);
}
@@ -573,20 +590,6 @@ clutter_gst_video_texture_init (ClutterGstVideoTexture *video_texture)
* Private symbols
*/
-/* This function is called from the sink set_caps(). we receive the first
- * buffer way after this so are told about the par before size_changed has
- * been fired */
-void
-_clutter_gst_video_texture_set_par (ClutterGstVideoTexture *texture,
- guint par_n,
- guint par_d)
-{
- ClutterGstVideoTexturePrivate *priv = texture->priv;
-
- priv->par_n = par_n;
- priv->par_d = par_d;
-}
-
/**
* clutter_gst_video_texture_new:
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]