|
From: libvidcap c. m. <lib...@li...> - 2007-09-13 18:33:15
|
Revision: 19
http://libvidcap.svn.sourceforge.net/libvidcap/?rev=19&view=rev
Author: jpgrayson
Date: 2007-09-13 11:32:29 -0700 (Thu, 13 Sep 2007)
Log Message:
-----------
Fix problem with starting and stopping capture by making sure we sync with all the frames we start capture for.
Modified Paths:
--------------
trunk/src/sapi_v4l.c
Modified: trunk/src/sapi_v4l.c
===================================================================
--- trunk/src/sapi_v4l.c 2007-09-13 13:05:21 UTC (rev 18)
+++ trunk/src/sapi_v4l.c 2007-09-13 18:32:29 UTC (rev 19)
@@ -43,7 +43,7 @@
enum
{
- DEVICE_PATH_MAX = 128,
+ device_path_max = 128,
v4l_fps_mask = 0x003f0000,
v4l_fps_shift = 16,
};
@@ -58,7 +58,7 @@
struct sapi_v4l_src_context
{
int fd;
- char device_path[DEVICE_PATH_MAX];
+ char device_path[device_path_max];
int channel;
struct video_capability caps;
@@ -256,7 +256,7 @@
scan_sources(struct sapi_context * sapi_ctx, struct sapi_src_list * src_list)
{
static const char * device_prefix = "/dev/video";
- char device_path[DEVICE_PATH_MAX];
+ char device_path[device_path_max];
int list_len = 0;
int i;
@@ -357,6 +357,22 @@
++capture_frame_count;
}
+ /* Sync with the last frame when capture has stopped (since we
+ * have overlapped capture kickoffs).
+ */
+ {
+ const unsigned int capture_frame =
+ capture_frame_count % v4l_src_ctx->mbuf.frames;
+
+ if ( ioctl( v4l_src_ctx->fd, VIDIOCSYNC,
+ &capture_frame ) == -1 )
+ {
+ log_error("failed VIDIOCSYNC (2) %d\n", errno);
+ goto bail;
+ }
+ }
+
+
if ( munmap((void *)fb_base, v4l_src_ctx->mbuf.size) == -1 )
{
log_error("failed munmap() %d\n", errno);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|