meta-digi/meta-digi-dey/recipes-multimedia/gst-plugins/gst-fsl-plugin-2.0.3/0002-add-fb-dev.patch

146 lines
5.6 KiB
Diff

From: Alejandro Gonzalez <alex.gonzalez@digi.com>
Date: Tue, 13 Mar 2012 19:20:02 +0100
Subject: [PATCH] add-fb-dev
Add framebuffer select functionality to sink
To support displaying to the second monitor, the mfw_v4lsink sink
element needs to accept a device parameter specifying the framebuffer
device to use as output.
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
src/misc/v4l_sink/src/mfw_gst_fb.c | 5 ++++-
src/misc/v4l_sink/src/mfw_gst_fb.h | 2 +-
src/misc/v4l_sink/src/mfw_gst_v4l.c | 4 ++++
src/misc/v4l_sink/src/mfw_gst_v4lsink.c | 20 +++++++++++++++++++-
src/misc/v4l_sink/src/mfw_gst_v4lsink.h | 1 +
5 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/src/misc/v4l_sink/src/mfw_gst_fb.c b/src/misc/v4l_sink/src/mfw_gst_fb.c
index 8c251daa5df4..a0df95f09494 100755
--- a/src/misc/v4l_sink/src/mfw_gst_fb.c
+++ b/src/misc/v4l_sink/src/mfw_gst_fb.c
@@ -199,11 +199,14 @@ POST-CONDITIONS: None
IMPORTANT NOTES: None
=============================================================================*/
-gboolean mfw_gst_fb0_open(gint *fb)
+gboolean mfw_gst_fb0_open(gint *fb, gchar *device)
{
gboolean retval = TRUE;
gchar fb_device[100] = FB_DEIVCE;
+ if (device != NULL && device[0] != '\0')
+ strcpy(fb_device, device);
+
if ((*fb =
open(fb_device, O_RDWR, 0)) < 0) {
g_print("Unable to open %s %d\n", fb_device, *fb);
diff --git a/src/misc/v4l_sink/src/mfw_gst_fb.h b/src/misc/v4l_sink/src/mfw_gst_fb.h
index 01321d65488d..da11ca1cffd0 100755
--- a/src/misc/v4l_sink/src/mfw_gst_fb.h
+++ b/src/misc/v4l_sink/src/mfw_gst_fb.h
@@ -50,7 +50,7 @@
gboolean mfw_gst_set_gbl_alpha(gint fb, gint alphaVal);
gboolean mfw_gst_fb0_set_colorkey(gint fb,gulong *colorSrc);
-gboolean mfw_gst_fb0_open(gint *fb);
+gboolean mfw_gst_fb0_open(gint *fb, gchar *device);
gboolean mfw_gst_fb0_close(gint *fb);
#if ((defined (_MX37) || defined (_MX51)) && defined (LOC_ALPHA_SUPPORT))
diff --git a/src/misc/v4l_sink/src/mfw_gst_v4l.c b/src/misc/v4l_sink/src/mfw_gst_v4l.c
index b85879a057dd..d773f6aa5192 100755
--- a/src/misc/v4l_sink/src/mfw_gst_v4l.c
+++ b/src/misc/v4l_sink/src/mfw_gst_v4l.c
@@ -540,6 +540,10 @@ mfw_gst_v4l2_mx37_mx51_tv_close (MFW_GST_V4LSINK_INFO_T * v4l_info)
gint out = 3;
+ if (v4l_info->device && !strcmp(v4l_info->device, "/dev/fb1"))
+ out = 5;
+ g_free(v4l_info->device);
+
// mfw_gst_v4l2_mx37_mx51_tv_setblank (v4l_info);
v4l_info->tv_mode = NV_MODE;
diff --git a/src/misc/v4l_sink/src/mfw_gst_v4lsink.c b/src/misc/v4l_sink/src/mfw_gst_v4lsink.c
index 238d91956543..3a50bffedfe4 100755
--- a/src/misc/v4l_sink/src/mfw_gst_v4lsink.c
+++ b/src/misc/v4l_sink/src/mfw_gst_v4lsink.c
@@ -137,6 +137,7 @@ enum
TV_OUT,
TV_MODE,
#endif
+ DEVICE,
DUMP_LOCATION,
ADDITIONAL_BUFFER_DEPTH,
SETPARA,
@@ -741,6 +742,11 @@ mfw_gst_v4lsink_set_property (GObject * object, guint prop_id,
case DUMP_LOCATION:
dumpfile_set_location (v4l_info, g_value_get_string (value));
break;
+
+ case DEVICE:
+ v4l_info->device = g_strdup (g_value_get_string (value));
+ break;
+
case SETPARA:
v4l_info->setpara |= g_value_get_int (value);
break;
@@ -848,6 +854,10 @@ mfw_gst_v4lsink_get_property (GObject * object, guint prop_id,
case DUMP_LOCATION:
g_value_set_string (value, v4l_info->dump_location);
break;
+
+ case DEVICE:
+ g_value_set_string (value, v4l_info->device);
+ break;
case SETPARA:
g_value_set_int (value, v4l_info->setpara);
break;
@@ -1537,6 +1547,7 @@ mfw_gst_v4lsink_init (MFW_GST_V4LSINK_INFO_T * v4l_info,
v4l_info->dump_location = NULL;
v4l_info->dumpfile = NULL;
v4l_info->dump_length = 0;
+ v4l_info->device = NULL;
v4l_info->cr_left_bypixel_orig = 0;
v4l_info->cr_right_bypixel_orig = 0;
v4l_info->cr_top_bypixel_orig = 0;
@@ -1569,7 +1580,7 @@ mfw_gst_v4lsink_init (MFW_GST_V4LSINK_INFO_T * v4l_info,
memset (&v4l_info->crop, 0, sizeof (struct v4l2_crop));
memset (&v4l_info->prevCrop, 0, sizeof (struct v4l2_crop));
- mfw_gst_fb0_open (&v4l_info->fd_fb);
+ mfw_gst_fb0_open (&v4l_info->fd_fb, v4l_info->device);
v4l_info->chipcode = getChipCode();
v4l_info->v4l_id = -1;
@@ -1726,6 +1737,13 @@ mfw_gst_v4lsink_class_init (MFW_GST_V4LSINK_INFO_CLASS_T * klass)
NULL,
G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, DEVICE,
+ g_param_spec_string ("device",
+ "Framebuffer device",
+ "Framebuffer device to display output."
+ "/dev/fb0,/dev/fb1",
+ NULL,
+ G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_FORCE_ASPECT_RATIO,
g_param_spec_boolean
diff --git a/src/misc/v4l_sink/src/mfw_gst_v4lsink.h b/src/misc/v4l_sink/src/mfw_gst_v4lsink.h
index 504e06fb4ef0..28cd6b767ccf 100755
--- a/src/misc/v4l_sink/src/mfw_gst_v4lsink.h
+++ b/src/misc/v4l_sink/src/mfw_gst_v4lsink.h
@@ -279,6 +279,7 @@ typedef struct MFW_GST_V4LSINK_INFO_S
FILE *dumpfile;
guint64 dump_length;
+ gchar *device;
gint qbuff_count; /* buffer counter, increase when frame queued to v4l device */