[gst-devel] (no subject)

harsha doki harshadoki at gmail.com
Fri Dec 1 13:31:25 CET 2006


I want a to capture a png image and as well as display the video
stream coming from a video source. I am able to display the video
stream but not able to capture the image.
It is not able to link the filter to the encoder. The code that i have
written is :

 image_bin = gst_bin_new("image_bin");
 gst_bin_add(GST_BIN(pipeline), image_bin);

 image_queue = gst_element_factory_make("queue","image_queue");
 image_filter = gst_element_factory_make ("capsfilter", "video_filter");
 image_filter_caps = gst_caps_new_simple(
 			"video/x-raw-rgb",
                        "width", G_TYPE_INT, 176 ,
                        "height", G_TYPE_INT, 144,
                        "framerate", GST_TYPE_FRACTION, 15, 1,
                        NULL);
  g_object_set(image_filter,"caps",image_filter_caps,NULL);
  image_encoder = gst_element_factory_make("pngenc","image_encoder");
  g_object_set(G_OBJECT(image_encoder),"snapshot",TRUE, NULL);
  image_sink_pad = gst_element_get_pad(image_queue,"sink");
  image_sink = gst_element_factory_make("filesink","image_sink");
  g_object_set(G_OBJECT(image_sink),"location","abhijit.png", NULL);

  gst_bin_add( GST_BIN(image_bin),image_queue);
  gst_bin_add( GST_BIN(image_bin),image_filter);
  gst_bin_add( GST_BIN(image_bin),image_encoder);
  gst_bin_add( GST_BIN(image_bin),image_sink);

 gst_element_add_pad(image_bin,gst_ghost_pad_new("sink",image_sink_pad));
 image_bin_pad = gst_element_get_pad(image_bin,"sink");

        if(gst_pad_link(tee_src_pad, image_bin_pad) != 0) {
                g_print ("image Source Pad Linking Failed\n");
        }
        if(!gst_element_link(image_queue,image_filter)) {
                g_print ("Image Queue Linking Failed\n");
        }
        if(!gst_element_link(image_filter,image_encoder)) {
                g_print ("Image Filter Linking Failed\n");
        }
        if(!gst_element_link(image_encoder,image_sink)) {
                g_print ("Image Encoder Linking Failed\n");
        }


        bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
	if (!bus) {
                g_print(" Bus is not created\n");
        }
        gst_bus_set_sync_handler (bus, (GstBusSyncHandler)bus_sync_cb,
                                                        video_sink);
        g_signal_connect(G_OBJECT(bus),"message::eos",
				G_CALLBACK(image_capture_cb), pipeline);

        if(!gst_element_set_state (pipeline, GST_STATE_PLAYING)) {
                g_print ("cannot display_camera_images ends\n");
        }

And the callback that i have called for the bus is not being called .
Is That a bug or is there any other way to catch the signal from png
enc as we have
"frame-encoded" signal in jpegenc. Kindly help me out.




More information about the gstreamer-devel mailing list