Revision: 304
http://artoolkit.svn.sourceforge.net/artoolkit/?rev=304&view=rev
Author: retrakker
Date: 2008-09-09 22:04:18 +0000 (Tue, 09 Sep 2008)
Log Message:
-----------
minor addition to debug problems with GStreamer
Modified Paths:
--------------
branches/hartmut-pre-2_8/artoolkit/lib/SRC/VideoGStreamer/video.c
Modified: branches/hartmut-pre-2_8/artoolkit/lib/SRC/VideoGStreamer/video.c
===================================================================
--- branches/hartmut-pre-2_8/artoolkit/lib/SRC/VideoGStreamer/video.c 2008-09-01 22:21:35 UTC (rev 303)
+++ branches/hartmut-pre-2_8/artoolkit/lib/SRC/VideoGStreamer/video.c 2008-09-09 22:04:18 UTC (rev 304)
@@ -39,6 +39,10 @@
/* GStreamer identity needed for probing */
GstElement *probe;
+ /* give external APIs a hint of progress */
+ unsigned int frame;
+ unsigned int frame_req;
+
};
@@ -69,6 +73,7 @@
if (vid->videoBuffer)
{
+ vid->frame++;
memcpy(vid->videoBuffer, buffer->data, buffer->size);
}
@@ -108,8 +113,6 @@
/* allocate the buffer */
arMalloc(vid->videoBuffer, ARUint8, (vid->width * vid->height * AR_PIX_SIZE_DEFAULT) );
-
-
}
}
@@ -327,8 +330,16 @@
int
ar2VideoClose(AR2VideoParamT *vid) {
+
/* stop the pipeline */
gst_element_set_state (vid->pipeline, GST_STATE_NULL);
+
+ /* wait until it'stops or failed */
+ if (gst_element_get_state (vid->pipeline, NULL, NULL, -1) == GST_STATE_CHANGE_FAILURE) {
+ g_error ("libARvideo: failed to put GStreamer into STOPPED state!\n");
+ } else {
+ g_print ("libARvideo: GStreamer pipeline is STOPPED!\n");
+ }
/* free the pipeline handle */
gst_object_unref (GST_OBJECT (vid->pipeline));
@@ -377,15 +388,21 @@
int
ar2VideoCapNext(AR2VideoParamT *vid)
{
+ if (vid && vid->frame != vid->frame_req) {
+ vid->frame_req = vid->frame;
+ }
return 0;
}
int
ar2VideoInqSize(AR2VideoParamT *vid, int *x, int *y )
{
+ if(vid && x && y) {
- *x = vid->width; // width of your static image
- *y = vid->height; // height of your static image
+ *x = vid->width; // width of your static image
+ *y = vid->height; // height of your static image
+ g_print ("libARvideo: reported size: %dx%d\n", *x, *y);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|