Hi,
Thanks Alejandro for your reply.
My problem is actually different than what you sensed from my Title.
I have to display the graphics on /dev/fb1 and a camera streaming on the background i.e. on /dev/fb0 at the same time (overlay on top of one another).
I am using lvds for display.so,parameters i am using are
video=mxcfb0:dev=ldb,if=RGB666.
Inside main(), i suppose i have to include both gstreamer APIs for camera streaming and graphics APIs for drawing .
************************************************************************************************************
////////////////******Graphics APIs for drawing onto /dev/fb1**********//////////////////
int main(int argc, char** argv)
{
printf("Lesson 03 \n");
int fd_fb,result;
//Applying color key
struct mxcfb_color_key color_key;
color_key.color_key = 0x0;
color_key.enable = 1;
if ((fd_fb = open("/dev/fb1", O_RDWR, 0)) < 0)
{
return 0;
}
if ( ioctl(fd_fb, MXCFB_SET_CLR_KEY, &color_key) < 0) {
printf("Error in applying Color Key\n");
}
struct mxcfb_loc_alpha loc_alpha;
ioctl(fd_fb, FBIOBLANK, FB_BLANK_NORMAL);
loc_alpha.enable = 1;
loc_alpha.alpha_in_pixel = 1;
result = ioctl(fd_fb, MXCFB_SET_LOC_ALPHA, &loc_alpha);
if (result < 0)
{
printf("fb ioctl MXCFB_SET_LOC_ALPHA fail\n");
//goto err1;
}
ioctl(fd_fb, MXCFB_WAIT_FOR_VSYNC, 0);
ioctl(fd_fb, FBIOBLANK, FB_BLANK_UNBLANK);
close(fd_fb);
signal(SIGINT, sighandler);
signal(SIGTERM, sighandler);
assert( init() );
while (!quit)
{
render();
eglSwapBuffers(egldisplay, eglsurface);
}
deinit();
return 1;
}
**********************************************************************************************
/////////////////////************Gstreamer APIs for video streaming onto /dev/fb0**********//////////////
GstElement *pipeline, *source, *sink;
GstBus *bus;
GstMessage *msg;
GstStateChangeReturn ret;
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Create the elements */
source = gst_element_factory_make ("mfw_v4lsrc", "source");
sink = gst_element_factory_make ("mfw_v4lsink", "sink");
/* Create the empty pipeline */
pipeline = gst_pipeline_new ("test-pipeline");
if (!pipeline || !source || !sink) {
g_printerr ("Not all elements could be created.\n");
return -1;
}
/* Build the pipeline */
gst_bin_add_many (GST_BIN (pipeline), source, sink, NULL);
if (gst_element_link (source, sink) != TRUE) {
g_printerr ("Elements could not be linked.\n");
gst_object_unref (pipeline);
return -1;
}
/* Modify the source's properties */
g_object_set (source, "device", "/dev/video2", NULL);
/* Start playing */
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
if (ret == GST_STATE_CHANGE_FAILURE) {
g_printerr ("Unable to set the pipeline to the playing state.\n");
gst_object_unref (pipeline);
return -1;
}
/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
/* Parse message */
if (msg != NULL) {
GError *err;
gchar *debug_info;
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_ERROR:
gst_message_parse_error (msg, &err, &debug_info);
g_printerr ("Error received from element %s: %s\n", GST_OBJECT_NAME (msg->src), err->message);
g_printerr ("Debugging information: %s\n", debug_info ? debug_info : "none");
g_clear_error (&err);
g_free (debug_info);
break;
case GST_MESSAGE_EOS:
g_print ("End-Of-Stream reached.\n");
break;
default:
/* We should not reach here because we only asked for ERRORs and EOS */
g_printerr ("Unexpected message received.\n");
break;
}
gst_message_unref (msg);
}
/* Free resources */
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
*********************************************************************************************************************
So, will both of them directed to their respective framebuffers and overlayed if i incude them in main( ) or will i have to do some modifications in the code to achieve this?
And is there any way to verify which framebuffer is being used while an applcation is running?
It would be highly appreciable if you help me regarding this.
With regards,
Sudlin