Revision: 9137 http://sourceforge.net/p/playerstage/svn/9137 Author: jpgr87 Date: 2014-02-16 17:38:42 +0000 (Sun, 16 Feb 2014) Log Message: ----------- Applied patch #670: Camerav4l2 support for Logilink USB 2.0 Video Grabber
Modified Paths: -------------- code/player/trunk/server/drivers/camera/v4l2/camerav4l2.cc code/player/trunk/server/drivers/camera/v4l2/v4l2.c Modified: code/player/trunk/server/drivers/camera/v4l2/camerav4l2.cc =================================================================== --- code/player/trunk/server/drivers/camera/v4l2/camerav4l2.cc 2013-11-12 00:11:47 UTC (rev 9136) +++ code/player/trunk/server/drivers/camera/v4l2/camerav4l2.cc 2014-02-16 17:38:42 UTC (rev 9137) @@ -74,13 +74,14 @@ - norm (string) - Default: "NTSC" - - Capture format; "NTSC", "PAL" or "UNKNOWN" + - Capture format; "NTSC", "PAL", "PAL60" or "UNKNOWN" - Case sensitive! - size (integer tuple) - Default: varies with norm - - PAL: [768 576] - - NTSC: [640 480] + - PAL: [768 576] + - PAL60: [720 480] + - NTSC: [640 480] - other: [320 240] - Desired image size. This may not be honoured if the driver does not support the requested size). @@ -198,6 +199,49 @@ ) @endverbatim +@par LogiLink USB 2.0 Video Grabber (two sources: 0 = composite, 1 = s-video). + +- One camera scenario: + +driver +( + name "camerav4l2" + port "/dev/video0" + sources [0] + norm "UNKNOWN" + size [720 480] + mode "YUYV" + buffers 2 + sleep_nsec 10000 + provides ["ch0:::camera:0"] +) + +- Two cameras scenario: + +@verbatim +driver +( + name "camerav4l2" + port "/dev/video0" + sources [0 1] + norm "PAL60" + size [720 480] + mode "YUYV" + buffers 2 + sleep_nsec 10000 + settle_time 0.1 + skip_frames 7 + provides ["ch0:::camera:0" "ch1:::camera:1"] +) +@endverbatim + +WARNING! This device uses very unstable driver (usbtv.ko), e.g. setting norm +to "PAL" always resulted in kernel panic. Use "PAL60" instead. +Buffers should be always set to 2, it won't initialize otherwise. +The settle_time and skip_frames in two cameras scenario were chosen +experimentally, may require some tweaking. +Sizes different than 720x480 seem to be unsupported (messy image). + @author Paul Osmialowski, Takafumi Mizuno */ @@ -412,7 +456,7 @@ this->SetError(-1); return; } - // NTSC, PAL or UNKNOWN + // NTSC, PAL, PAL60 or UNKNOWN str = cf->ReadString(section, "norm", "NTSC"); if (!str) { @@ -429,6 +473,10 @@ { this->width = 768; this->height = 576; + } else if (!(strcmp(this->norm, "PAL60"))) + { + this->width = 720; + this->height = 480; } else { this->width = 320; Modified: code/player/trunk/server/drivers/camera/v4l2/v4l2.c =================================================================== --- code/player/trunk/server/drivers/camera/v4l2/v4l2.c 2013-11-12 00:11:47 UTC (rev 9136) +++ code/player/trunk/server/drivers/camera/v4l2/v4l2.c 2014-02-16 17:38:42 UTC (rev 9137) @@ -72,6 +72,7 @@ } if (!strcmp(mode, "UNKNOWN")) m = 0; else if (!strcmp(mode, "PAL")) m = V4L2_STD_PAL; + else if (!strcmp(mode, "PAL60")) m = V4L2_STD_PAL_60; else if (!strcmp(mode, "NTSC")) m = V4L2_STD_NTSC; else { @@ -428,6 +429,19 @@ free(fg); return NULL; } + } else if ((fg->pixformat) == v4l2_fmtbyname("YUYV")) + { + fg->depth = 2; + fg->r = 0; fg->g = 1; fg->b = 2; + fg->bayerbuf_size = width * height * 3; + fg->bayerbuf = malloc(fg->bayerbuf_size); + if (!(fg->bayerbuf)) + { + fprintf(stderr, "out of memory\n"); + fg->bayerbuf_size = 0; + free(fg); + return NULL; + } } else if ((fg->pixformat) == v4l2_fmtbyname("MJPG")) { fg->r = 0; fg->g = 0; fg->b = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit