<div class="gmail_quote"><br><div>This is the code and i am able to get only buffer of image but hoe to display it I am not able to get around it...............please help me out on this</div><div><br></div><div><br></div>
<div><br></div><div>#include <gst/gst.h></div>
<div><br></div><div><br></div><div>GstElement *pipe, *dec, *sink, *src;</div><div><br></div><div>static void</div><div>print_one_tag (const GstTagList * list, const gchar * tag, gpointer user_data)</div><div>{</div><div>
if(!strcmp(tag,"image")) {</div>
<div> guint i;</div><div> const GValue *val;</div><div> g_printf("Image Detected");</div><div> i=gst_tag_list_get_tag_size(list,tag);</div><div> g_printf("\n%d",i);</div><div> val = gst_tag_list_get_value_index(list, tag, 0);</div>
<div> g_printf("\n%s",GST_BUFFER_DATA (gst_value_get_buffer (val)));</div><div> }</div><div>}</div><div><br></div><div>static void</div><div>on_new_pad (GstElement * dec, GstPad * pad, GstElement * fakesink)</div>
<div>{</div><div> GstPad *sinkpad;</div><div><br></div><div> sinkpad = gst_element_get_static_pad (fakesink, "sink");</div><div> if (!gst_pad_is_linked (sinkpad)) {</div><div> if (gst_pad_link (pad, sinkpad) != GST_PAD_LINK_OK)</div>
<div> g_error ("Failed to link pads!");</div><div> }</div><div> gst_object_unref (sinkpad);</div><div>}</div><div><br></div><div>int</div><div>main (int argc, char ** argv)</div><div>{</div><div> GstMessage *msg;</div>
<div><br></div><div> gst_init (&argc, &argv);</div><div><br></div><div> pipe = gst_pipeline_new ("pipeline");</div><div><br></div><div> dec = gst_element_factory_make ("decodebin2", NULL);</div>
<div> src = gst_element_factory_make ("filesrc",NULL);</div><div> g_object_set (src, "location", argv[1], NULL);</div><div> gst_bin_add (GST_BIN (pipe), dec);</div><div> gst_bin_add (GST_BIN (pipe), src);</div>
<div> gst_element_link(src,dec);</div><div> sink = gst_element_factory_make ("alsasink", NULL);</div><div> gst_bin_add (GST_BIN (pipe), sink);</div><div><br></div><div> g_signal_connect (dec, "pad-added", G_CALLBACK (on_new_pad), sink);</div>
<div><br></div><div> gst_element_set_state (pipe, GST_STATE_PLAYING);</div><div><br></div><div> while (TRUE) {</div><div> GstTagList *tags = NULL;</div><div><br></div><div> msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipe),</div>
<div> GST_CLOCK_TIME_NONE,</div><div> GST_MESSAGE_ASYNC_DONE | GST_MESSAGE_TAG | GST_MESSAGE_ERROR);</div><div><br></div><div> if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_TAG) /* error or async_done */</div>
<div> break;</div><div><br></div><div> gst_message_parse_tag (msg, &tags);</div><div><br></div><div> g_print ("Got tags from element %s:\n", GST_OBJECT_NAME (msg->src));</div><div> gst_tag_list_foreach (tags, print_one_tag, NULL);</div>
<div> g_print ("\n");</div><div> gst_tag_list_free (tags);</div><div><br></div><div> gst_message_unref (msg);</div><div> };</div><div><br></div><div> if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR)</div>
<div> g_error ("Got error");</div><div><br></div><div> gst_message_unref (msg);</div><div> gst_element_set_state (pipe, GST_STATE_NULL);</div><div> gst_object_unref (pipe);</div><div> return 0;</div><div>
}</div>
</div><br>