[gst-devel] Video freeze

lithium cmaster2 at hotmail.com
Thu Jan 6 02:40:10 CET 2011


I've adjusted so its how you suggested. It does seem like a better idea, but
as you can probably tell i'm completely new to gstreamer so I don't really
know much about ghost pads or anything which i'm fairly sure I need to use
to be able to use bins?

I've had a go at it anyway. At the moment the video pauses as soon as the
program starts, ie one image shows up that does not change
(setup_screenshotBin is called on program starting) which occurs on this:
gst_bin_add(GST_BIN(videoIO->pipeline), videoIO->screenshotBin);. I can get
the video to play properly again as before, by opening the tv card menu. On
taking a screenshot the release of the pad is not working. 
gst_element_release_request_pad(videoIO->tee, videoIO->screenshotOutPad);
causes "(tvprog:6329): GStreamer-CRITICAL **: Padname '':src1 does not
belong to element splitter when removing"

I do get a valid jpeg created when screenshot is clicked. But as soon as the
program starts an invalid (because theres no data in it) jpeg file is
created in my program directory. I'm assuming this is because the pipeline
is set to playing when the program starts. Is there a way I can stop it from
creating this file until the screenshot button is clicked?

This is what i've come up with:

openVideoPipeline is the same

void close_screenshot(GstElement *jpegEncode, videoIOStruct *videoIO)
{
	gst_pad_unlink(videoIO->screenshotOutPad, videoIO->screenshotInPad);
	gst_element_release_request_pad(videoIO->tee, videoIO->screenshotOutPad);
}

void take_screenshot(GtkWidget *widget, videoIOStruct *videoIO)
{
	videoIO->screenshotOutPad = gst_element_get_request_pad(videoIO->tee,
"src%d");
	gst_pad_link(videoIO->screenshotOutPad, videoIO->screenshotInPad);
}

int setup_screenshotBin(videoIOStruct *videoIO)
{
	videoIO->screenshotBin = gst_bin_new("screenshot_bin");
	GstElement *jpegOutput = gst_element_factory_make("filesink",
"jpegoutput");
	GstElement *jpegQueue = gst_element_factory_make("queue", "jpgqueue");
	GstElement *jpegEncode = gst_element_factory_make("jpegenc",
"jpegencoder");

	if (!jpegOutput || !jpegQueue || !jpegEncode || !videoIO->screenshotBin)
		return 0;

	//set arguments
	gchar filename[] = "test.jpg";
	g_object_set(G_OBJECT(jpegOutput), "location", filename, NULL);

	//link stuff
	gst_bin_add_many(GST_BIN(videoIO->screenshotBin), jpegQueue, jpegEncode,
jpegOutput, NULL);
	gst_element_link_many(jpegQueue, jpegEncode, jpegOutput, NULL);

	g_signal_connect(jpegEncode, "frame-encoded", G_CALLBACK(close_screenshot),
videoIO);

	GstPad *pad = gst_element_get_static_pad(jpegQueue, "sink");
	gst_element_add_pad(videoIO->screenshotBin, gst_ghost_pad_new("sink",
pad));
	gst_object_unref(GST_OBJECT(pad));

	gst_bin_add(GST_BIN(videoIO->pipeline), videoIO->screenshotBin);
	gst_element_sync_state_with_parent(videoIO->screenshotBin);

	videoIO->screenshotInPad =
gst_element_get_static_pad(videoIO->screenshotBin, "sink");

	return 1;
}

Thanks
-- 
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Video-freeze-tp3171570p3176765.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list