Re: Webcam init and get



In article <slrng3tfk7.a3j.stefano.sabatini@xxxxxxxxxxxxxxxxxxxx>,
Stefano Sabatini <stefano.sabatini@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
On 2008-05-12, frakie <frakieack@xxxxxxxxx> wrote:

I need a simple and stupid few line source code to access my webcam.

You could consider using libavdevice from ffmpeg, video4linux and
video4windows should be supported, it is plain and portable C (but not
trivial to use, but that's the price you have to pay to deal with
multimedia).

http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/v4l2_8c-source.html

#include "config.h"
#include "libavformat/avformat.h"
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <asm/types.h>
#include <linux/videodev2.h>
#include <time.h>


That's not portable C !

C89 3.8.2 Source File Inclusion
[...]
There shall be an implementation-defined mapping between the
delimited sequence and the external source file name. The
implementation shall provide unique mappings for sequences
consisting of one or more letters (as defined in 2.2.1) followed
by a period (.) and a single letter. The implementation may ignore
distinctions of alphabetical case and restrict the mapping
to six significant characters before the period.


Now "libavformat/avformat.h" has more than six significant characters
before the period, so which, if any, file that will map to is
implementation-defined -- and thus not portable C.
--
"I like to build things, I like to do things. I am having
a lot of fun." -- Walter Chrysler
.



Relevant Pages

  • Re: Sleeping or waiting
    ... delimited sequence and the external source file name. ... by a period and a single letter. ... standard wisely didn't take advantage of that. ... C99 increases the limit to eight significant characters ...
    (comp.lang.c)
  • Re: #include behavior
    ... possibility to place a source file into some place. ... standard header names. ... which ignores the mapping specified by 6.10.2. ... case, for simplicity), then those two mappings map characters sequences ...
    (comp.lang.c)
  • Re: #include behavior
    ... possibility to place a source file into some place. ... which ignores the mapping specified by 6.10.2. ... the source file identified by the specified sequence between the ...
    (comp.lang.c)
  • Re: ASM => C
    ... >> The mapping between some large number of C programs and a given ... >> assembler listing is understood, ... >> I don't care at all how close to the original program it is. ... > The value of a source file is that it can be read and ...
    (comp.lang.c)
  • RE: BTS 2004 EDI Tutorial mapping Error
    ... We are having the same problem and I have been unable to find any reference in the MS Knowledge Base. ... > The source document in this mapping is not recognized. ... orchestrations and source file were supplied in the ...
    (microsoft.public.biztalk.general)