<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>RawDev.net &#187; uvc</title>
	<atom:link href="http://rawdev.net/tag/uvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://rawdev.net</link>
	<description>Just another Zabreznik.si Sites site</description>
	<lastBuildDate>Fri, 30 Sep 2011 12:16:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>mjpg stream + potrace</title>
		<link>http://rawdev.net/2008/04/11/mjpg-stream-potrace/</link>
		<comments>http://rawdev.net/2008/04/11/mjpg-stream-potrace/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 15:34:34 +0000</pubDate>
		<dc:creator>marko</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[uvc]]></category>
		<category><![CDATA[webcam]]></category>

		<guid isPermaLink="false">http://www.rawdev.net/?p=24</guid>
		<description><![CDATA[Working on the same principle as the last mjpg_stream implemenation, here it is: a portace plugin ! /****************************************************************************** Description.: Send a complete HTTP response and a svg file Input Value.: fildescriptor fd to send the answer to Return Value: - ******************************************************************************/ void send_svg(int fd) { unsigned char *frame=NULL; int frame_size=0; char buffer[BUFFER_SIZE] = {0}; if [...]]]></description>
			<content:encoded><![CDATA[<p>Working on the same principle as the last mjpg_stream implemenation, here it is: a portace plugin !</p>
<p><img class="alignnone size-thumbnail wp-image-25" src="http://rawdev.net/files/2008/04/svg.jpg" alt="" width="222" height="166" /><img class="alignnone size-thumbnail wp-image-26" src="http://rawdev.net/files/2008/04/jpg.jpg" alt="" width="222" height="166" /></p>
<p><span id="more-22"></span></p>
<pre>/******************************************************************************
Description.: Send a complete HTTP response and a svg file
Input Value.: fildescriptor fd to send the answer to
Return Value: -
******************************************************************************/
void send_svg(int fd) {
unsigned char *frame=NULL;
int frame_size=0;
char buffer[BUFFER_SIZE] = {0};

if ( (frame = (unsigned char *)malloc(MAX_FRAME_SIZE)) == NULL ) {
fprintf(stderr, "not enough memory\n");
exit(EXIT_FAILURE);
}

/* wait for a fresh frame */
pthread_cond_wait(&amp;pglobal-&gt;db_update, &amp;pglobal-&gt;db);

/* read buffer */
frame_size = pglobal-&gt;size;
memcpy(frame, pglobal-&gt;buf, frame_size);
DBG("got frame (size: %d kB)\n", frame_size/1024);

pthread_mutex_unlock( &amp;pglobal-&gt;db );

/* make file */
FILE *filesvg;
filesvg = fopen("/dev/shm/svgpipe", "w");
fwrite(frame, 1, frame_size, filesvg);

fclose(filesvg);
free(frame);

system("/usr/bin/convert /dev/shm/svgpipe /dev/shm/svgpipe.ppm");
system("/usr/bin/potrace -s /dev/shm/svgpipe.ppm");

/* response */
sprintf(buffer, "HTTP/1.0 200 OK\r\n" \
STD_HEADER \
"Content-type: image/svg+xml\r\n" \
"\r\n");
if( write(fd, buffer, strlen(buffer)) &lt; 0 ) return;
/* read -&gt; send file */

FILE *filesvg2;
filesvg2 = fopen("/dev/shm/svgpipe.svg", "r");
while (fgets(buffer,BUFFER_SIZE,filesvg2))
write(fd, buffer, strlen(buffer));
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://rawdev.net/2008/04/11/mjpg-stream-potrace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mjpg-Stream + libcaca</title>
		<link>http://rawdev.net/2008/03/22/mjpg-stream-libcaca/</link>
		<comments>http://rawdev.net/2008/03/22/mjpg-stream-libcaca/#comments</comments>
		<pubDate>Sat, 22 Mar 2008 16:18:39 +0000</pubDate>
		<dc:creator>marko</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[uvc]]></category>
		<category><![CDATA[webcam]]></category>

		<guid isPermaLink="false">http://www.rawdev.net/2008/03/22/mjpg-stream-libcaca/</guid>
		<description><![CDATA[After couple of hours, here is it: A libcaca extension to Mjpg-Stream[singlepic=141,300,200,,][singlepic=140,300,200,,] You need img2txt from the libcaca-utilities and /dev/shm to be mounted and writable (or change to another location) /dev/shm is present on most systems and is a mounted filesystem located on the main ram. The source is in past the page brake. First, [...]]]></description>
			<content:encoded><![CDATA[<p>After couple of hours, here is it: A libcaca extension to Mjpg-Stream[singlepic=141,300,200,,][singlepic=140,300,200,,]</p>
<p>You need img2txt from the libcaca-utilities and /dev/shm to be mounted and writable (or change to another location)</p>
<p>/dev/shm is present on most systems and is a mounted filesystem located on the main ram.</p>
<p>The source is in past the page brake.</p>
<p><span id="more-15"></span><br />
First, a header to change: /src/httpd.h: 114</p>
<pre>typedef enum { A_UNKNOWN, A_SNAPSHOT, A_ASCII, A_STREAM, A_COMMAND, A_FILE } answer_t;</pre>
<p>Next, a hook: /src/httpd.c:  720</p>
<pre>case A_ASCII:
DBG("Request for ascii\n");
send_ascii(lcfd.fd);
break;</pre>
<p>And now, the main function:</p>
<pre>/******************************************************************************
Description.: Send a complete HTTP response and a ascii html
Input Value.: fildescriptor fd to send the answer to
Return Value: -
******************************************************************************/
void send_ascii(int fd) {
unsigned char *frame=NULL;
int frame_size=0,i;
char buffer[BUFFER_SIZE] = {0};  if ( (frame = (unsigned char *)malloc(MAX_FRAME_SIZE)) == NULL ) {
fprintf(stderr, "not enough memory\n");
exit(EXIT_FAILURE);
}

/* wait for a fresh frame */

pthread_cond_wait(&amp;pglobal-&gt;db_update, &amp;pglobal-&gt;db);

/* read buffer */  frame_size = pglobal-&gt;size;
memcpy(frame, pglobal-&gt;buf, frame_size);
DBG("got frame (size: %d kB)\n", frame_size/1024);

pthread_mutex_unlock( &amp;pglobal-&gt;db );  /* make file */  FILE *fileascii;
fileascii = fopen("/dev/shm/asciipipe", "w");
fwrite(frame, 1, frame_size, fileascii);

fclose(fileascii);
free(frame);

system("/usr/bin/img2txt -W 100 -f html /dev/shm/asciipipe &gt; /dev/shm/asciipipe2");

/* response */
sprintf(buffer, "HTTP/1.0 200 OK\r\n" \
STD_HEADER \
"Content-type: text/html\r\n" \
"\r\n");
if( write(fd, buffer, strlen(buffer)) &lt; 0 ) return;
/* read -&gt; send file */

FILE *fileascii2;
fileascii2 = fopen("/dev/shm/asciipipe2", "r");
while (fgets(buffer,BUFFER_SIZE,fileascii2))
write(fd, buffer, strlen(buffer));
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://rawdev.net/2008/03/22/mjpg-stream-libcaca/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux-UVC (USB Video Class)</title>
		<link>http://rawdev.net/2008/03/19/linux-uvc/</link>
		<comments>http://rawdev.net/2008/03/19/linux-uvc/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 18:05:42 +0000</pubDate>
		<dc:creator>marko</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[uvc]]></category>
		<category><![CDATA[webcam]]></category>

		<guid isPermaLink="false">http://www.rawdev.net/2008/03/19/linux-uvc/</guid>
		<description><![CDATA[The past few days i looked at ways could use my Logitech Quickcam Pro 5000 USB Webcamera. Skype 2 did a nice job using all its features, including to my surprise, the integrated microphone. Installing the driver/module was a piece of cake, goto http://linux-uvc.berlios.de/ pickup the latest stable and do the usual compile&#38;install, then load [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://rawdev.net/files/2008/03/webcam.jpg"><img class="alignright size-full wp-image-18" style="float: right;" src="http://rawdev.net/files/2008/03/webcam.jpg" alt="" width="260" height="388" /></a>The past few days i looked at ways could use my Logitech Quickcam Pro 5000 USB Webcamera. Skype 2 did a nice job using all its features, including to my surprise, the integrated microphone.</p>
<p>Installing the driver/module was a piece of cake, goto <a rel="nofollow" href="http://linux-uvc.berlios.de/">http://linux-uvc.berlios.de/</a> pickup the latest stable and do the usual compile&amp;install, then load the module.</p>
<p>You may need to reboot at this point.</p>
<p>Now some testing was in order, pickup the <a href="http://mxhaard.free.fr/spca50x/Investigation/uvc/"><strong>luvcview</strong> viewer</a> (you need libsdl-dev packages to compile). Make it, then you can run it just by ./luvcview ( if you have more video devices installed, you may need to set the according device it needs to read, see readme ) or install it with a quick &#8216;sudo cp luvcview /usr/local/bin/&#8217; for later reuse.</p>
<p>Ok, i got the cam running, i can see myself, and i can chat to people with Skype, what next ? (If it didnt work for you at this stage, the next steps wont help you.)</p>
<p><span id="more-14"></span> A bit of googling later, i found<strong> <a rel="nofollow" href="http://openfacts.berlios.de/index-en.phtml?title=HowTo_install_UVC_Streamer">UVC_Streamer</a></strong> (<a rel="nofollow" href="http://naaa.de/uvc_streamer.htm">homepage</a>), nifty little thing, that streams the output of the cam directly on port 8080 (or any other port you set didnt work on 80 for me tho.) The format of the output is M-Jepg, so browsers like Firefox (konqueror works fine too) and players like <a href="http://www.videolan.org/">VLC</a> can play it. (Firefox needs a config change to display the stream nicely under about:config change browser.cache.check_doc_frequency to 1).</p>
<p>Those things didnt look to good for me, since i wanted it to work OOTB, so another googling session got me this: <a href="http://freshmeat.net/projects/mjpg-streamer/">http://freshmeat.net/projects/mjpg-streamer/</a>,</p>
<p><strong>Mjpg streamer</strong>. Said to be the successor of UVC Streamer, it fixes the problems with viewing streams.</p>
<p>In addition to a stream, it makes a simple HTTP server, that gives you a page and a static image of the stream to start with. Then goes on with options to either view the stream with the help of a JavaScript that refreshes the image every 20ms, a Java viewer (that gave by far the best results) and a command interface, to change the cameras settings (saturation, color, panning etc..). The java app has also some software zooming and panning. With that, any type of browser is supported.</p>
<p>But i wanted more.</p>
<p>I wanted filters and fancy gadgets. What i found what another app with built in pushing of files to remote FTP servers or to a file. Namely a ASCII art from stream generating <strong><a href="http://ascii.dyne.org/">HasciiCam</a></strong></p>
<p>Needing no plugins to view, become it makes HTML/TEXT pages of its input. It uses the standard aalib to generate those. Sadly it didn&#8217;t work for my webcam. ( Worked on my tvtuner perfectly. neone for ascii tv <img src='http://rawdev.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So the next big thing i would expect to see in UVC streaming software would be filters.</p>
]]></content:encoded>
			<wfw:commentRss>http://rawdev.net/2008/03/19/linux-uvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

