From: Ales Zikmund Date: Tue, 27 Jan 2009 16:44:29 +0000 (+0100) Subject: Initial commit X-Git-Url: https://rtime.felk.cvut.cz/gitweb/v4l-streaming.git/commitdiff_plain/d8c505f71290f3c0821838273db450a616e57caf Initial commit --- d8c505f71290f3c0821838273db450a616e57caf diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..12aa287 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +# překladač C +CC=gcc +# nepovinný parametr, míra optimalizace +CFLAGS=-O2 + +test: cam + $(CC) -Wall $(CFLAGS) -lpthread -lavutil -lavformat -lavcodec -lz -lavutil -lm camv4l.o grab_mpeg.c -o grab_mpeg + +cam: + $(CC) -Wall $(CFLAGS) camv4l.c -c + +clean: + rm grab_mpeg + rm camv4l.o diff --git a/READ_ME.txt b/READ_ME.txt new file mode 100644 index 0000000..364e328 --- /dev/null +++ b/READ_ME.txt @@ -0,0 +1,52 @@ + +This File serves as instruction to compile the grab application. + + +REQUIREMENTS + + driver: + ov51x-jpeg-1.5.9 + + + library: + - ffmpeg library + - avcodec library + - avformat library + + You must download packages : + ffmpeg + libavcodec + libavdevice + libavformat + + and their header files: + libavcodec-dev + libavdevice-dev + libavformat-dev + + + +INSTALL + + 1.change directory to the "grab_ap" + 2.make + + +BEFORE RUN APPLICATION + + Application has two switches: + + '-d' specify video device e.g "-d /dev/video1". Defualt is "/dev/video0" + '-f' specify frame count "-f 5000". Default is 300. + +RUN + + Examples: + + ./grab_mpeg -> then will be captured 300 frames on the device "/dev/video0" + ./grab_mpeg -f 5000 -d /dev/video1 -> then will be captured 5000 frames on the device "/dev/video1" + + +DELETE BINARY FILE + + make clean diff --git a/camv4l.c b/camv4l.c new file mode 100644 index 0000000..cd9a495 --- /dev/null +++ b/camv4l.c @@ -0,0 +1,517 @@ +#include "camv4l.h" +/** + * \file camv4l.c + * + * \brief This file implement function. + * + */ + +///Definitions +int PAL[] ={VIDEO_PALETTE_YUV420P,VIDEO_PALETTE_RGB565,VIDEO_PALETTE_RGB24,VIDEO_PALETTE_RGB32}; + +#define LEN_PALLETE 4 + +int SIZE[] = { 640,480,384,288,352,288,320,240,192,144,176,144,160,120 }; + + +static int GetVideoPict (struct vdIn *vd); + +static int SetVideoPict (struct vdIn *vd); + +static int GetDepth ( int format); + +static int probePalette ( struct vdIn *vd ); + +static int probeSize ( struct vdIn *vd ); + + +int init_v4l (struct vdIn *vd) +{ + int f; + int erreur = 0; + + if ((vd->fd = open (vd->videodevice, O_RDWR)) == -1){ + perror ("ERROR opening V4L interface \n"); + exit (1); + } + if (ioctl (vd->fd, VIDIOCGCAP, &(vd->videocap)) == -1){ + printf ("wrong device\n"); + exit (1); + } + printf ("Camera found: %s \n", vd->videocap.name); + snprintf (vd->cameraname, 32, "%s", vd->videocap.name); + + erreur = GetVideoPict (vd); + vd->formatIn = vd->videopict.palette; + vd->bppIn = vd->videopict.depth; + vd->flipUV = 0; + + /* To Compute the estimate frame size perhaps not need !!! + if ((vd->bppIn = GetDepth (vd->formatIn)) < 0) + { + perror ("getdepth failed \n"); + exit (1); + } + */ + if (ioctl (vd->fd, VIDIOCGCHAN, &vd->videochan) == -1){ + printf ("did not support Video_channel\n"); + vd->cameratype = UNKNOW; + } else { + printf ("Bridge found: %s \n", vd->videochan.name); + snprintf (vd->bridge, 9, "%s", vd->videochan.name); + vd->cameratype = UNKNOW;// GetStreamId (vd->videochan.name); + } + + if (vd->cameratype == UNKNOW){ + /* process others cams default parameters should be set */ + printf ("StreamId: %d Unknow Camera\n", vd->cameratype); + printf("Probe Pallete\n"); + if (probePalette (vd ) < 0) { + printf ("Sorry cannot probe Palette for that Unknow Camera\n"); + exit (0); + } + printf("Probe Size\n"); + if (probeSize (vd ) < 0) { + printf ("Sorry cannot probe Size for that Unknow Camera\n"); + exit (0); + } + } else { + printf("Find camera with supported bridge\n"); + } + + /**********************************************************/ + /* alloc the frame buffer to read */ + vd->framesizeIn = (vd->hdrwidth * vd->hdrheight * (vd->bppIn >> 3)); + /*************************** *******************/ + if (vd->grabMethod){ + printf (" grabbing method default MMAP asked \n"); + // MMAP VIDEO acquisition + memset (&(vd->videombuf), 0, sizeof (vd->videombuf)); + if (ioctl (vd->fd, VIDIOCGMBUF, &(vd->videombuf)) < 0){ + perror (" init VIDIOCGMBUF FAILED\n"); + } + + printf ("VIDIOCGMBUF size %d frames %d offets[0]=%d offsets[1]=%d\n", + vd->videombuf.size, vd->videombuf.frames, + vd->videombuf.offsets[0], vd->videombuf.offsets[1]); + + vd->pFramebuffer = (unsigned char *) mmap (0, vd->videombuf.size, PROT_READ | PROT_WRITE,MAP_SHARED, vd->fd, 0); + vd->mmapsize = vd->videombuf.size; + vd->vmmap.height = vd->hdrheight; + vd->vmmap.width = vd->hdrwidth; + vd->vmmap.format = vd->formatIn; + + for (f = 0; f < vd->videombuf.frames; f++){ + vd->vmmap.frame = f; + if (ioctl (vd->fd, VIDIOCMCAPTURE, &(vd->vmmap))){ + perror ("cmcapture"); + } + } + vd->vmmap.frame = 0; + + } else { + /* read method */ + printf (" grabbing method READ asked \n"); + if (ioctl (vd->fd, VIDIOCGWIN, &(vd->videowin)) < 0){ + perror ("VIDIOCGWIN failed \n"); + } + + vd->videowin.height = vd->hdrheight; + vd->videowin.width = vd->hdrwidth; + + if (ioctl (vd->fd, VIDIOCSWIN, &(vd->videowin)) < 0){ + perror ("VIDIOCSWIN failed \n"); + } + printf ("VIDIOCSWIN height %d width %d \n", vd->videowin.height, vd->videowin.width); + } + + vd->pixTmp = (unsigned char *) malloc (vd->framesizeIn); + + return erreur; +} + + +int close_v4l (struct vdIn *vd){ + if (vd->grabMethod){ + printf ("unmapping frame buffer\n"); + munmap (vd->pFramebuffer, vd->mmapsize); + } + printf ("freeing frame buffer\n"); + free (vd->pixTmp); + + printf ("close v4l \n"); + close (vd->fd); + return 0; +} + + +static void flipUV (unsigned char *src, int format, int w, int h){ + __u32 *lpix; + __u16 *pix; + __u8 *V; + __u8 *U; + __u8 *savC = NULL; + unsigned char tmp; + int sizetransfert = 0; + int i; + + if (format == VIDEO_PALETTE_RAW_JPEG){ + /*nothing todo */ + return; + } + + switch (format){ + case VIDEO_PALETTE_YUV420P:{ + /* allocate a helper buffer */ + sizetransfert = (w * h >> 2); + savC = (__u8 *) realloc (savC, (size_t) sizetransfert); + U = src + (w * h); + V = src + (w * h) + sizetransfert; + /* save U */ + memcpy (savC, U, sizetransfert); + /* flip UV */ + memcpy (U, V, sizetransfert); + /* restore U */ + memcpy (V, savC, sizetransfert); + free (savC); + savC = NULL; + } + break; + case VIDEO_PALETTE_RGB565: { + pix = (__u16 *) src; + for (i = 0; i < (w * h); i++){ + pix[i] = (((pix[i] & 0xF800) >> 11) | ((pix[i] & 0x001F) << 11) | (pix[i] & 0x07E0)); + } + } + break; + case VIDEO_PALETTE_RGB24:{ + for (i = 0; i < (w * h * 3); i += 3){ + tmp = src[i]; + src[i] = src[i + 2]; + src[i + 2] = tmp; + } + } + break; + case VIDEO_PALETTE_RGB32:{ + lpix = (__u32 *) src; + for (i = 0; i < (w * h); i++){ + lpix[i] = (((lpix[i] & 0x00FF0000) >> 16) | ((lpix[i] & 0x000000FF) << 16) + | (lpix[i] & 0x0000FF00)); + } + } + break; + default: + break; + } +} + + +int grab (struct vdIn *vd){ + int ff; + int len; + int status=0; + //int count = 0; + int size; + int erreur = 0; + + if (vd->grabMethod){ + ff = vd->vmmap.frame; + vd->vmmap.height = vd->hdrheight; + vd->vmmap.width = vd->hdrwidth; + vd->vmmap.format = vd->formatIn; + if (ioctl (vd->fd, VIDIOCSYNC, &ff) < 0){ + perror ("cvsync err\n"); + erreur = -1; + } + vd->vmmap.frame = ff; + memcpy (vd->pixTmp,vd->pFramebuffer + vd->videombuf.offsets[vd->vmmap.frame], vd->framesizeIn); + + if (vd->flipUV){ + printf("Flip UV\n"); + flipUV (vd->pixTmp, vd->formatIn, vd->hdrwidth, vd->hdrheight); + } + + if ((ioctl (vd->fd, VIDIOCMCAPTURE, &(vd->vmmap))) < 0){ + perror ("cmcapture"); + printf (">>cmcapture err %d\n", status); + erreur = -1; + } + vd->vmmap.frame = (vd->vmmap.frame + 1) % vd->videombuf.frames; + //printf("frame nb %d\n",vd->vmmap.frame); + } else { + /* read method */ + size = vd->framesizeIn; + len = read (vd->fd, vd->pixTmp, size); + if (len != size){ + printf ("v4l read error\n"); + printf ("len %d asked %d \n", len, size); + erreur = -1; + } + if (vd->flipUV){ + flipUV (vd->pixTmp, vd->formatIn, vd->hdrwidth, vd->hdrheight); + } + } + return erreur; +} + +int setPalette (struct vdIn *vd) +{ + vd->bppIn = GetDepth (vd->formatIn); + vd->videopict.palette = vd->formatIn; + vd->videopict.depth = vd->bppIn; + SetVideoPict (vd); + vd->framesizeIn = ((vd->hdrwidth * vd->hdrheight * vd->bppIn) >> 3); + vd->pixTmp = (unsigned char *) realloc (vd->pixTmp, (size_t) vd->framesizeIn); + + return 1; +} + +/* probe palette and set a default one for unknow cams*/ +static int probePalette ( struct vdIn *vd ) +{ + struct video_picture pict; + int masq = 0x2; + int i; + int availpal = 0; + int defaut = 1; + /* initialize the internal struct */ + if (ioctl (vd->fd, VIDIOCGPICT, &pict) < 0) + { + perror ("Couldnt get videopict params with VIDIOCGPICT\n"); + return -1; + } + /* try each palette we have we skip raw_jpeg */ + for(i = 0; i < LEN_PALLETE ; i++){ + pict.palette = PAL[i]; + /* maybe correct the bug on qca driver depth always 24 ? */ + pict.depth = GetDepth (PAL[i]); + printf("try palette %d depth %d\n",pict.palette,pict.depth); + if (ioctl (vd->fd, VIDIOCSPICT, &pict) < 0){ + printf("Couldn't set palette first try %d \n", PAL[i]); + } + if (ioctl (vd->fd, VIDIOCGPICT, &pict) < 0){ + printf("Couldnt get palette %d \n", PAL[i]); + } + if (pict.palette != PAL[i]){ + printf("Damned second try fail \n"); + } + else { + availpal = availpal | masq ; + printf("Available palette %d \n", PAL[i]); + if (defaut){ + defaut = 0; + vd->formatIn = PAL[i]; + vd->bppIn = GetDepth (PAL[i]); + } + } + masq = masq << 1; + } + vd->palette = availpal; + printf("Vybrana paleta je %d\n",availpal); + //should set default palette here ? + return 1; +} + + +/* probe size and set a default one for unknow cams */ +static int probeSize ( struct vdIn *vd ) +{ + struct video_window win; + int maxw,minw,maxh,minh; + int masq = 0x1; + int i = 0; + int defaut = 1 ; + /* initialize de parameters */ + maxw = vd->videocap.maxwidth; + minw = vd->videocap.minwidth; + maxh = vd->videocap.maxheight; + minh = vd->videocap.minheight; + printf("probe size in \n"); + + while (SIZE[i] > maxw){ + printf("skip size %d x %d\n",SIZE[i],SIZE[i+1]); + i += 2; + masq = masq << 1; + if (i > 13) break; + } + /* initialize the internal struct */ + if (ioctl (vd->fd, VIDIOCGWIN, &win) < 0) { + perror ("VIDIOCGWIN failed \n"); + return -1; + } + /* now i is on the first possible width */ + while ((SIZE[i] >= minw) && i < 13) { + win.width = SIZE[i]; + win.height = SIZE[i+1]; + if (ioctl (vd->fd, VIDIOCSWIN, &win) < 0) { + printf ("VIDIOCSWIN reject width %d height %d \n", + win.width, win.height); + } else { + vd->sizeothers = vd->sizeothers | masq; + printf ("Available Resolutions width %d heigth %d \n", + win.width, win.height); + if (defaut){ + vd->hdrwidth = win.width; + vd->hdrheight = win.height; + defaut = 0; + } + } + masq = masq << 1 ; + i += 2; + } + return 1; +} + +int changeSize (struct vdIn *vd) +{ + int erreur; + erreur = GetVideoPict (vd); + vd->formatIn = vd->videopict.palette; + vd->bppIn = vd->videopict.depth; + /* To Compute the estimate frame size perhaps not need !!! */ + if ((vd->bppIn = GetDepth (vd->formatIn)) < 0){ + perror ("getdepth failed \n"); + exit (1); + } + if (vd->grabMethod){ + vd->vmmap.height = vd->hdrheight; + vd->vmmap.width = vd->hdrwidth; + vd->vmmap.format = vd->formatIn; + } else { + if (ioctl (vd->fd, VIDIOCGWIN, &vd->videowin) < 0) + perror ("VIDIOCGWIN failed \n"); + vd->videowin.height = vd->hdrheight; + vd->videowin.width = vd->hdrwidth; + if (ioctl (vd->fd, VIDIOCSWIN, &vd->videowin) < 0) + perror ("VIDIOCSWIN failed \n"); + + printf ("VIDIOCGWIN height %d width %d \n",vd->videowin.height, vd->videowin.width); + } + vd->framesizeIn = ((vd->hdrwidth * vd->hdrheight * vd->bppIn) >> 3); + vd->pixTmp = + (unsigned char *) realloc (vd->pixTmp, (size_t) vd->framesizeIn); + return 1; +} + + +static int GetVideoPict (struct vdIn *vd) +{ + if (ioctl (vd->fd, VIDIOCGPICT, &vd->videopict) < 0){ + perror ("Couldnt get videopict params with VIDIOCGPICT\n"); + return -1; + } + + printf ("VIDIOCGPICT brightnes=%d hue=%d color=%d contrast=%d whiteness=%d" + "depth=%d palette=%d\n", vd->videopict.brightness, + vd->videopict.hue, vd->videopict.colour, vd->videopict.contrast, + vd->videopict.whiteness, vd->videopict.depth, + vd->videopict.palette); + + return 0; +} + +static int SetVideoPict (struct vdIn *vd) +{ + if (ioctl (vd->fd, VIDIOCSPICT, &vd->videopict) < 0){ + perror ("Couldnt set videopict params with VIDIOCSPICT\n"); + return -1; + } + + printf ("VIDIOCSPICT brightnes=%d hue=%d color=%d contrast=%d whiteness=%d" + "depth=%d palette=%d\n", vd->videopict.brightness, + vd->videopict.hue, vd->videopict.colour, vd->videopict.contrast, + vd->videopict.whiteness, vd->videopict.depth, + vd->videopict.palette); + + return 0; +} + +static int GetDepth(int format) +{ + int depth; + switch (format) + { + case VIDEO_PALETTE_RAW_JPEG: + { + depth = 8; // be sure spca50x ask raw data + } + break; + case VIDEO_PALETTE_YUV420P: + { + depth = (8 * 3) >> 1; + } + break; + case VIDEO_PALETTE_RGB565: + depth = 16; + break; + case VIDEO_PALETTE_RGB24: + depth = 24; + break; + case VIDEO_PALETTE_RGB32: + { + depth = 32; + } + break; + default: + depth = -1; + break; + } + return depth; +} + +__u8 getBrightness (struct vdIn * vdin) +{ + if (GetVideoPict (vdin) < 0) + { + printf (" Error getBrightness \n"); + return 0; + } + return ((vdin->videopict.brightness) >> 8); +} + +void setBrightness (struct vdIn *vdin, __u8 bright) +{ + vdin->videopict.brightness = bright << 8; + if (SetVideoPict (vdin) < 0) + { + printf (" Error setBrightness \n"); + } + +} + +__u8 getContrast (struct vdIn *vdin) +{ + if (GetVideoPict (vdin) < 0) + { + printf (" Error getContrast \n"); + return 0; + } + return ((vdin->videopict.contrast) >> 8); +} + +void setContrast (struct vdIn *vdin, __u8 contrast) +{ + vdin->videopict.contrast = contrast << 8; + if (SetVideoPict (vdin) < 0) + { + printf (" Error setContrast \n"); + } +} +__u8 getColors (struct vdIn *vdin) +{ + if (GetVideoPict (vdin) < 0) + { + printf (" Error getColors \n"); + return 0; + } + return ((vdin->videopict.colour) >> 8); +} + +void setColors (struct vdIn *vdin, __u8 colors) +{ + vdin->videopict.colour = colors << 8; + if (SetVideoPict (vdin) < 0) + { + printf (" Error setColors \n"); + } +} diff --git a/camv4l.h b/camv4l.h new file mode 100644 index 0000000..db93722 --- /dev/null +++ b/camv4l.h @@ -0,0 +1,241 @@ +#ifndef CAM_V4L_H +#define CAM_V4L_H + +/** + * \file camv4l.h + * + * \brief This is header file v4l device (camera). + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DWIDTH 320 ///>Default width +#define DHEIGHT 240 ///>Default height + +/* Input data output Palette define here */ +#define VIDEO_PALETTE_RGB565 3 /* 16bit RGB */ +#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */ +#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */ +#define VIDEO_PALETTE_YUV420P 15 /* YUV 420P */ +#define VIDEO_PALETTE_RAW_JPEG 20 + + +/** + * Camera type format date + */ +enum cam_form { + JPEG, + YUVY, + YYUV, + YUYV, + GREY, + GBRG, + UNKNOW, +}; + +/** + * Struct represents input capture device + */ +struct vdIn { + int fd; // file descriptor + char *videodevice ; //name of camera + + struct video_mmap vmmap; + struct video_capability videocap; + int mmapsize; + struct video_mbuf videombuf; + struct video_picture videopict; + struct video_window videowin; + struct video_channel videochan; + + unsigned int format ; /* Format asked by apps for this frame */ + int cameratype ; /* native in frame format */ + char *cameraname; + char *bridge; + int sizenative; + int sizeothers; + int palette; + int norme ; + int channel ; + int grabMethod ; ///> Grab Methode 1=mmap 0=read + unsigned char *pFramebuffer; + unsigned char *pixTmp; + int framesizeIn ; + int frame_cour; + int bppIn; + int hdrwidth; + int hdrheight; + int formatIn; + int flipUV; +}; + +/* +struct palette_list { + int num; + const char *name; +}; + + +//Camera type jpeg yuvy yyuv yuyv grey gbrg +static struct palette_list Plist[] ={ + {JPEG,"JPEG"}, + {YUVY,"YUVY"}, + {YYUV,"YYUV"}, + {YUYV,"YUYV"}, + {GREY,"GREY"}, + {GBRG,"GBRG"}, + {-1,NULL} +}; +*/ + + +/** + * Fuction for initialization v4l device. + * \ingroup common + * \param vd Video device pointer + * + * \return 0 if succesful or error number -1 + */ +int init_v4l ( struct vdIn *vd ); + +/** + * Fuction for initialization v4l device. + * \ingroup common + * \param vd Video device pointer + * + * \return 0 if succesful or error number -1 + */ +int grab (struct vdIn *vd ); + +/** + * Fuction close v4l device. + * \ingroup common + * \param vd Video device pointer + * \return 0 + */ +int close_v4l (struct vdIn *vd); + +/** + * Fuction sets color pallete video device. + * \ingroup common + * \param vd Video device pointer + * + * \return 1 + */ +int setPalette (struct vdIn *vd); + +/** + * Fuction change size of image array video device. + * \ingroup common + * \param vd Video device pointer + * + * \return 1 + */ +int changeSize (struct vdIn *vd); + + +/** + * Fuction get brightness from the camera. + * \ingroup common + * \param vd Video device pointer + * + * \retutn brightness + */ +__u8 getBrightness ( struct vdIn *vd); + +/** + * Fuction set brightness to the camera. + * \ingroup common + * \param vd Video device pointer + * \param bright New brightness value + */ +void setBrightness ( struct vdIn *vd, __u8 bright); + +/** + * Fuction get contrast from the camera. + * \ingroup common + * \param vd Video device pointer + * + * \return contrast + */ +__u8 getContrast ( struct vdIn *vd); + +/** + * Fuction set contrast to the camera. + * \ingroup common + * \param vd Video device pointer + * \param contrast New contrast value + */ +void setContrast ( struct vdIn *vd, __u8 contrast); + +/** + * Fuction get colors from the camera. + * \ingroup common + * \param vd Video device pointer + * + * \return colors + */ +__u8 getColors ( struct vdIn *vd); + +/** + * Fuction set colors to the camera. + * \ingroup common + * \param vd Video device pointer + * \param colors New colors value + */ +void setColors ( struct vdIn *vd, __u8 colors); + +/** + * Fuction get norme from the camera. + * \ingroup common + * \param vd Video device pointer + * + * \return norme + */ +__u8 getNorme ( struct vdIn *vd); + +/** + * Fuction set norme to the camera. + * \ingroup common + * \param vd Video device pointer + * \param norme New norme value + */ +void setNorme (struct vdIn *vd,__u8 norme); + +/** + * Fuction get channel from the camera. + * \ingroup common + * \param vd Video device pointer + * + * \return channel + */ +__u8 getChannel (struct vdIn *vd); + +/** + * Fuction set channels to the camera. + * \ingroup common + * \param vd Video device pointer + * \param channel New channel value + */ +void setChannel( struct vdIn * vd,__u8 channel); + + +#endif /*CAM_V4L_H*/ + diff --git a/doc/doxygen b/doc/doxygen new file mode 100644 index 0000000..0843168 --- /dev/null +++ b/doc/doxygen @@ -0,0 +1,275 @@ +# Doxyfile 1.5.1 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "Camera grab convert to MPEG" +PROJECT_NUMBER = 1.0 +OUTPUT_DIRECTORY = /home/zial/diplom/grab/grab_mpeg_net/doc/ +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = /home/zial/diplom/grab/grab_mpeg_net/ +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = /home/zial/diplom/grab/grab_mpeg_net +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.C \ + *.CC \ + *.C++ \ + *.II \ + *.I++ \ + *.H \ + *.HH \ + *.H++ \ + *.CS \ + *.PHP \ + *.PHP3 \ + *.M \ + *.MM \ + *.PY +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = YES +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/doc/html/annotated.html b/doc/html/annotated.html new file mode 100644 index 0000000..677a73b --- /dev/null +++ b/doc/html/annotated.html @@ -0,0 +1,27 @@ + + +Camera grab convert to MPEG: Data Structures + + + + + + +

Camera grab convert to MPEG Data Structures

Here are the data structures with brief descriptions: + +
vdIn
+
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/camv4l_8c-source.html b/doc/html/camv4l_8c-source.html new file mode 100644 index 0000000..154e4d1 --- /dev/null +++ b/doc/html/camv4l_8c-source.html @@ -0,0 +1,537 @@ + + +Camera grab convert to MPEG: camv4l.c Source File + + + + + + +

camv4l.c

Go to the documentation of this file.
00001 #include "camv4l.h"
+00009 
+00010 int PAL[] ={VIDEO_PALETTE_YUV420P,VIDEO_PALETTE_RGB565,VIDEO_PALETTE_RGB24,VIDEO_PALETTE_RGB32};
+00011 
+00012 #define LEN_PALLETE     4
+00013 
+00014 int SIZE[] = { 640,480,384,288,352,288,320,240,192,144,176,144,160,120 };
+00015 
+00016 
+00017 
+00018 
+00019 
+00020 static int GetVideoPict (struct vdIn *vd);
+00021 
+00022 static int SetVideoPict (struct vdIn *vd);
+00023 
+00024 static int GetDepth ( int format);
+00025 
+00026 static int probePalette ( struct vdIn *vd );
+00027 
+00028 static int probeSize ( struct vdIn *vd );       
+00029 
+00030 
+00031 int init_v4l (struct vdIn *vd)
+00032 {
+00033         int f;
+00034         int erreur = 0;
+00035 
+00036         if ((vd->fd = open (vd->videodevice, O_RDWR)) == -1){
+00037       perror ("ERROR opening V4L interface \n");
+00038       exit (1);
+00039         }
+00040         if (ioctl (vd->fd, VIDIOCGCAP, &(vd->videocap)) == -1){
+00041       printf ("wrong device\n");
+00042       exit (1);
+00043         }
+00044         printf ("Camera found: %s \n", vd->videocap.name);
+00045         snprintf (vd->cameraname, 32, "%s", vd->videocap.name);
+00046         
+00047         erreur = GetVideoPict (vd);
+00048         vd->formatIn = vd->videopict.palette;
+00049         vd->bppIn = vd->videopict.depth;
+00050         vd->flipUV = 0;
+00051   
+00052   /* To Compute the estimate frame size perhaps not need !!! 
+00053   if ((vd->bppIn = GetDepth (vd->formatIn)) < 0)
+00054     {
+00055       perror ("getdepth  failed \n");
+00056       exit (1);
+00057     }
+00058    */
+00059         if (ioctl (vd->fd, VIDIOCGCHAN, &vd->videochan) == -1){
+00060       printf ("did not support Video_channel\n");
+00061       vd->cameratype = UNKNOW;
+00062    } else {
+00063       printf ("Bridge found: %s \n", vd->videochan.name);
+00064       snprintf (vd->bridge, 9, "%s", vd->videochan.name);
+00065       vd->cameratype = UNKNOW;// GetStreamId (vd->videochan.name);
+00066         }
+00067         
+00068         if (vd->cameratype == UNKNOW){
+00069         /* process others cams default parameters should be set */
+00070                 printf ("StreamId: %d Unknow Camera\n", vd->cameratype);
+00071                 printf("Probe Pallete\n");
+00072                 if (probePalette (vd ) < 0) {
+00073                         printf ("Sorry cannot probe Palette for that Unknow Camera\n");
+00074                         exit (0);
+00075                 }
+00076                 printf("Probe Size\n");
+00077                 if (probeSize (vd ) < 0) {
+00078                         printf ("Sorry cannot probe Size for that Unknow Camera\n");
+00079                         exit (0);
+00080                 }
+00081         } else {
+00082                 printf("Find camera with supported bridge\n");
+00083         }
+00084 
+00085         /**********************************************************/
+00086         /*          alloc the frame buffer to read                */
+00087         vd->framesizeIn = (vd->hdrwidth * vd->hdrheight * (vd->bppIn >> 3));
+00088         /***************************            *******************/
+00089         if (vd->grabMethod){
+00090       printf (" grabbing method default MMAP asked \n");
+00091       // MMAP VIDEO acquisition
+00092       memset (&(vd->videombuf), 0, sizeof (vd->videombuf));
+00093       if (ioctl (vd->fd, VIDIOCGMBUF, &(vd->videombuf)) < 0){
+00094                         perror (" init VIDIOCGMBUF FAILED\n");
+00095                 }
+00096       
+00097                 printf ("VIDIOCGMBUF size %d  frames %d  offets[0]=%d offsets[1]=%d\n",
+00098                 vd->videombuf.size, vd->videombuf.frames,
+00099                 vd->videombuf.offsets[0], vd->videombuf.offsets[1]);
+00100 
+00101       vd->pFramebuffer = (unsigned char *) mmap (0, vd->videombuf.size, PROT_READ | PROT_WRITE,MAP_SHARED, vd->fd, 0);
+00102       vd->mmapsize = vd->videombuf.size;
+00103       vd->vmmap.height = vd->hdrheight;
+00104       vd->vmmap.width = vd->hdrwidth;
+00105       vd->vmmap.format = vd->formatIn;
+00106 
+00107                 for (f = 0; f < vd->videombuf.frames; f++){
+00108                         vd->vmmap.frame = f;
+00109                         if (ioctl (vd->fd, VIDIOCMCAPTURE, &(vd->vmmap))){
+00110                       perror ("cmcapture");
+00111                         }
+00112                 }
+00113                 vd->vmmap.frame = 0;
+00114                 
+00115         } else {
+00116       /* read method */
+00117                 printf (" grabbing method READ asked \n");
+00118       if (ioctl (vd->fd, VIDIOCGWIN, &(vd->videowin)) < 0){
+00119                         perror ("VIDIOCGWIN failed \n");
+00120                 }
+00121       
+00122                 vd->videowin.height = vd->hdrheight;
+00123       vd->videowin.width = vd->hdrwidth;
+00124       
+00125                 if (ioctl (vd->fd, VIDIOCSWIN, &(vd->videowin)) < 0){
+00126                         perror ("VIDIOCSWIN failed \n");
+00127                 }
+00128       printf ("VIDIOCSWIN height %d  width %d \n", vd->videowin.height, vd->videowin.width);
+00129         }
+00130 
+00131         vd->pixTmp = (unsigned char *) malloc (vd->framesizeIn);
+00132         
+00133         return erreur;
+00134 }
+00135 
+00136 
+00137 int close_v4l (struct vdIn *vd){
+00138         if (vd->grabMethod){
+00139                 printf ("unmapping frame buffer\n");
+00140       munmap (vd->pFramebuffer, vd->mmapsize);
+00141         }
+00142         printf ("freeing frame buffer\n");
+00143         free (vd->pixTmp);
+00144         
+00145         printf ("close v4l \n");
+00146         close (vd->fd);
+00147         return 0;
+00148 }
+00149 
+00150 
+00151 static void flipUV (unsigned char *src, int format, int w, int h){
+00152         __u32 *lpix;
+00153         __u16 *pix;
+00154         __u8 *V;
+00155         __u8 *U;
+00156         __u8 *savC = NULL;
+00157         unsigned char tmp;
+00158         int sizetransfert = 0;
+00159         int i;
+00160 
+00161         if (format == VIDEO_PALETTE_RAW_JPEG){
+00162       /*nothing todo */
+00163       return;
+00164         }
+00165 
+00166         switch (format){
+00167     case VIDEO_PALETTE_YUV420P:{
+00168                 /* allocate a helper buffer */
+00169                 sizetransfert = (w * h >> 2);
+00170                 savC = (__u8 *) realloc (savC, (size_t) sizetransfert);
+00171                 U = src + (w * h);
+00172                 V = src + (w * h) + sizetransfert;
+00173                 /* save U */
+00174                 memcpy (savC, U, sizetransfert);
+00175                 /* flip UV */
+00176                 memcpy (U, V, sizetransfert);
+00177                 /* restore U */
+00178                 memcpy (V, savC, sizetransfert);
+00179                 free (savC);
+00180                 savC = NULL;
+00181                 }
+00182       break;
+00183         case VIDEO_PALETTE_RGB565: {
+00184                 pix = (__u16 *) src;
+00185                 for (i = 0; i < (w * h); i++){
+00186                         pix[i] = (((pix[i] & 0xF800) >> 11) | ((pix[i] & 0x001F) << 11) | (pix[i] & 0x07E0));
+00187                 }
+00188         }
+00189       break;
+00190    case VIDEO_PALETTE_RGB24:{
+00191                 for (i = 0; i < (w * h * 3); i += 3){
+00192                         tmp = src[i];
+00193                         src[i] = src[i + 2];
+00194                         src[i + 2] = tmp;
+00195                 }
+00196    }
+00197       break;
+00198    case VIDEO_PALETTE_RGB32:{
+00199                 lpix = (__u32 *) src;
+00200                 for (i = 0; i < (w * h); i++){
+00201                     lpix[i] = (((lpix[i] & 0x00FF0000) >> 16) | ((lpix[i] & 0x000000FF) << 16)
+00202                | (lpix[i] & 0x0000FF00));
+00203                 }
+00204    }
+00205       break;
+00206    default:
+00207          break;
+00208   }
+00209 }
+00210 
+00211 
+00212 int grab (struct vdIn *vd){
+00213         int ff;
+00214         int len;
+00215         int status=0;
+00216         //int count = 0;
+00217         int size;
+00218         int erreur = 0;
+00219 
+00220         if (vd->grabMethod){
+00221       ff = vd->vmmap.frame;
+00222       vd->vmmap.height = vd->hdrheight;
+00223       vd->vmmap.width = vd->hdrwidth;
+00224       vd->vmmap.format = vd->formatIn;
+00225       if (ioctl (vd->fd, VIDIOCSYNC, &ff) < 0){
+00226                         perror ("cvsync err\n");
+00227                         erreur = -1;
+00228                 }
+00229       vd->vmmap.frame = ff;
+00230       memcpy (vd->pixTmp,vd->pFramebuffer + vd->videombuf.offsets[vd->vmmap.frame], vd->framesizeIn);
+00231 
+00232       if (vd->flipUV){
+00233                         printf("Flip UV\n");
+00234                         flipUV (vd->pixTmp, vd->formatIn, vd->hdrwidth, vd->hdrheight);
+00235                 }
+00236 
+00237       if ((ioctl (vd->fd, VIDIOCMCAPTURE, &(vd->vmmap))) < 0){
+00238                         perror ("cmcapture");
+00239                         printf (">>cmcapture err %d\n", status);
+00240                         erreur = -1;
+00241                 }
+00242       vd->vmmap.frame = (vd->vmmap.frame + 1) % vd->videombuf.frames;
+00243       //printf("frame nb %d\n",vd->vmmap.frame);
+00244         } else {
+00245       /* read method */
+00246       size = vd->framesizeIn;
+00247       len = read (vd->fd, vd->pixTmp, size);
+00248       if (len != size){
+00249                         printf ("v4l read error\n");
+00250                         printf ("len %d asked %d \n", len, size);
+00251                         erreur = -1;
+00252                 }
+00253       if (vd->flipUV){
+00254                         flipUV (vd->pixTmp, vd->formatIn, vd->hdrwidth, vd->hdrheight);
+00255                 }
+00256         }
+00257         return erreur;
+00258 }
+00259 
+00260 int setPalette (struct vdIn *vd)
+00261 {
+00262         vd->bppIn = GetDepth (vd->formatIn);
+00263         vd->videopict.palette = vd->formatIn;
+00264         vd->videopict.depth = vd->bppIn;
+00265         SetVideoPict (vd);
+00266         vd->framesizeIn = ((vd->hdrwidth * vd->hdrheight * vd->bppIn) >> 3);
+00267         vd->pixTmp = (unsigned char *) realloc (vd->pixTmp, (size_t) vd->framesizeIn);
+00268 
+00269         return 1;
+00270 }
+00271 
+00272 /* probe palette and set a default one for unknow cams*/
+00273 static int probePalette ( struct vdIn *vd )
+00274 {
+00275         struct video_picture pict;
+00276         int masq = 0x2;
+00277         int i;
+00278         int availpal = 0;
+00279         int defaut = 1;
+00280         /* initialize the internal struct */
+00281         if (ioctl (vd->fd, VIDIOCGPICT, &pict) < 0)
+00282                 {
+00283                 perror ("Couldnt get videopict params with VIDIOCGPICT\n");
+00284                 return -1;
+00285                  }
+00286         /* try each palette we have we skip raw_jpeg */
+00287         for(i = 0; i < LEN_PALLETE ; i++){
+00288                 pict.palette = PAL[i];
+00289                 /* maybe correct the bug on qca driver depth always 24 ? */     
+00290                 pict.depth = GetDepth (PAL[i]);
+00291                 printf("try palette %d depth %d\n",pict.palette,pict.depth);
+00292                 if (ioctl (vd->fd, VIDIOCSPICT, &pict) < 0){
+00293                         printf("Couldn't set palette first try %d \n", PAL[i]);
+00294                 }
+00295                 if (ioctl (vd->fd, VIDIOCGPICT, &pict) < 0){
+00296                 printf("Couldnt get palette %d \n", PAL[i]);
+00297         }
+00298                 if (pict.palette != PAL[i]){
+00299                         printf("Damned second try fail \n");    
+00300                 }
+00301                 else {
+00302                         availpal = availpal | masq ;
+00303                         printf("Available  palette %d \n", PAL[i]);
+00304                         if (defaut){
+00305                                 defaut = 0;
+00306                                 vd->formatIn = PAL[i];
+00307                                 vd->bppIn = GetDepth (PAL[i]);
+00308                         }
+00309                 }
+00310                 masq = masq << 1;
+00311         }
+00312         vd->palette = availpal;
+00313         printf("Vybrana paleta je %d\n",availpal);
+00314         //should set default palette here ?
+00315         return 1;       
+00316 }
+00317 
+00318 
+00319 /* probe size and set a default one for unknow cams */
+00320 static int probeSize ( struct vdIn *vd )
+00321 {
+00322         struct video_window win;
+00323         int maxw,minw,maxh,minh;
+00324         int masq = 0x1;
+00325         int i = 0;
+00326         int defaut = 1 ;
+00327         /* initialize de parameters */
+00328         maxw = vd->videocap.maxwidth;
+00329         minw = vd->videocap.minwidth;
+00330         maxh = vd->videocap.maxheight;
+00331         minh = vd->videocap.minheight;
+00332         printf("probe size in \n");
+00333 
+00334         while (SIZE[i] > maxw){
+00335                 printf("skip size %d x %d\n",SIZE[i],SIZE[i+1]);
+00336                 i += 2;
+00337                 masq = masq << 1;
+00338                 if (i > 13) break;
+00339         }
+00340         /* initialize the internal struct */
+00341         if (ioctl (vd->fd, VIDIOCGWIN, &win) < 0) {
+00342                 perror ("VIDIOCGWIN failed \n");
+00343                 return -1;
+00344         }
+00345         /* now i is on the first possible width */
+00346         while ((SIZE[i] >= minw) && i < 13) {
+00347                 win.width = SIZE[i];
+00348                 win.height = SIZE[i+1];
+00349                 if (ioctl (vd->fd, VIDIOCSWIN, &win) < 0) {
+00350                 printf ("VIDIOCSWIN reject width %d  height %d \n",
+00351                         win.width, win.height);       
+00352         } else {
+00353                         vd->sizeothers = vd->sizeothers | masq;
+00354                         printf ("Available Resolutions width %d  heigth %d \n",
+00355                         win.width, win.height);
+00356                         if (defaut){
+00357                                 vd->hdrwidth = win.width;
+00358                                 vd->hdrheight = win.height;
+00359                                 defaut = 0;
+00360                         }
+00361                 }
+00362                 masq = masq << 1 ;
+00363                 i += 2;
+00364         }
+00365         return 1;       
+00366 }
+00367 
+00368 int changeSize (struct vdIn *vd)
+00369 {
+00370         int erreur;
+00371         erreur = GetVideoPict (vd);
+00372         vd->formatIn = vd->videopict.palette;
+00373         vd->bppIn = vd->videopict.depth;
+00374         /* To Compute the estimate frame size perhaps not need !!! */
+00375         if ((vd->bppIn = GetDepth (vd->formatIn)) < 0){
+00376                 perror ("getdepth  failed \n");
+00377       exit (1);
+00378         }
+00379         if (vd->grabMethod){
+00380       vd->vmmap.height = vd->hdrheight;
+00381       vd->vmmap.width = vd->hdrwidth;
+00382       vd->vmmap.format = vd->formatIn;
+00383    } else {
+00384                 if (ioctl (vd->fd, VIDIOCGWIN, &vd->videowin) < 0)
+00385                         perror ("VIDIOCGWIN failed \n");
+00386       vd->videowin.height = vd->hdrheight;
+00387       vd->videowin.width = vd->hdrwidth;
+00388       if (ioctl (vd->fd, VIDIOCSWIN, &vd->videowin) < 0)
+00389                         perror ("VIDIOCSWIN failed \n");
+00390 
+00391       printf ("VIDIOCGWIN height %d  width %d \n",vd->videowin.height, vd->videowin.width);
+00392    }
+00393         vd->framesizeIn = ((vd->hdrwidth * vd->hdrheight * vd->bppIn) >> 3);
+00394         vd->pixTmp =
+00395    (unsigned char *) realloc (vd->pixTmp, (size_t) vd->framesizeIn);
+00396         return 1;
+00397 }
+00398 
+00399 
+00400 static int GetVideoPict (struct vdIn *vd)
+00401 {
+00402   if (ioctl (vd->fd, VIDIOCGPICT, &vd->videopict) < 0){
+00403       perror ("Couldnt get videopict params with VIDIOCGPICT\n");
+00404       return -1;
+00405   }
+00406 
+00407   printf ("VIDIOCGPICT brightnes=%d hue=%d color=%d contrast=%d whiteness=%d"
+00408           "depth=%d palette=%d\n", vd->videopict.brightness,
+00409           vd->videopict.hue, vd->videopict.colour, vd->videopict.contrast,
+00410           vd->videopict.whiteness, vd->videopict.depth,
+00411           vd->videopict.palette);
+00412 
+00413   return 0;
+00414 }
+00415 
+00416 static int SetVideoPict (struct vdIn *vd)
+00417 {
+00418         if (ioctl (vd->fd, VIDIOCSPICT, &vd->videopict) < 0){
+00419       perror ("Couldnt set videopict params with VIDIOCSPICT\n");
+00420       return -1;
+00421         }
+00422         
+00423         printf ("VIDIOCSPICT brightnes=%d hue=%d color=%d contrast=%d whiteness=%d"
+00424           "depth=%d palette=%d\n", vd->videopict.brightness,
+00425           vd->videopict.hue, vd->videopict.colour, vd->videopict.contrast,
+00426           vd->videopict.whiteness, vd->videopict.depth,
+00427           vd->videopict.palette);
+00428 
+00429   return 0;
+00430 }
+00431 
+00432 static int GetDepth(int format)
+00433 {
+00434   int depth;
+00435   switch (format)
+00436     {
+00437     case VIDEO_PALETTE_RAW_JPEG:
+00438       {
+00439         depth = 8;              // be sure spca50x ask raw data
+00440       }
+00441       break;
+00442     case VIDEO_PALETTE_YUV420P:
+00443       {
+00444         depth = (8 * 3) >> 1;
+00445       }
+00446       break;
+00447     case VIDEO_PALETTE_RGB565:
+00448       depth = 16;
+00449       break;
+00450     case VIDEO_PALETTE_RGB24:
+00451       depth = 24;
+00452       break;
+00453     case VIDEO_PALETTE_RGB32:
+00454       {
+00455         depth = 32;
+00456       }
+00457       break;
+00458     default:
+00459       depth = -1;
+00460       break;
+00461     }
+00462   return depth;
+00463 }
+00464 
+00465 __u8 getBrightness (struct vdIn * vdin)
+00466 {
+00467   if (GetVideoPict (vdin) < 0)
+00468     {
+00469       printf (" Error getBrightness \n");
+00470       return 0;
+00471     }
+00472   return ((vdin->videopict.brightness) >> 8);
+00473 }
+00474 
+00475 void setBrightness (struct vdIn *vdin, __u8 bright)
+00476 {
+00477   vdin->videopict.brightness = bright << 8;
+00478   if (SetVideoPict (vdin) < 0)
+00479     {
+00480       printf (" Error setBrightness \n");
+00481     }
+00482 
+00483 }
+00484 
+00485 __u8 getContrast (struct vdIn *vdin)
+00486 {
+00487   if (GetVideoPict (vdin) < 0)
+00488     {
+00489       printf (" Error getContrast \n");
+00490       return 0;
+00491     }
+00492   return ((vdin->videopict.contrast) >> 8);
+00493 }
+00494 
+00495 void setContrast (struct vdIn *vdin, __u8 contrast)
+00496 {
+00497   vdin->videopict.contrast = contrast << 8;
+00498   if (SetVideoPict (vdin) < 0)
+00499     {
+00500       printf (" Error setContrast \n");
+00501     }
+00502 }
+00503 __u8 getColors (struct vdIn *vdin)
+00504 {
+00505   if (GetVideoPict (vdin) < 0)
+00506     {
+00507       printf (" Error getColors \n");
+00508       return 0;
+00509     }
+00510   return ((vdin->videopict.colour) >> 8);
+00511 }
+00512 
+00513 void setColors (struct vdIn *vdin, __u8 colors)
+00514 {
+00515   vdin->videopict.colour = colors << 8;
+00516   if (SetVideoPict (vdin) < 0)
+00517     {
+00518       printf (" Error setColors \n");
+00519     }
+00520 }
+

Generated on Mon Jan 26 20:51:50 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/camv4l_8c.html b/doc/html/camv4l_8c.html new file mode 100644 index 0000000..854a5a5 --- /dev/null +++ b/doc/html/camv4l_8c.html @@ -0,0 +1,322 @@ + + +Camera grab convert to MPEG: camv4l.c File Reference + + + + + + +

camv4l.c File Reference

This file implement function. More... +

+#include "camv4l.h"
+ +

+Include dependency graph for camv4l.c: +

+Go to the source code of this file. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Defines

#define LEN_PALLETE   4

Functions

static int GetVideoPict (struct vdIn *vd)
static int SetVideoPict (struct vdIn *vd)
static int GetDepth (int format)
static int probePalette (struct vdIn *vd)
static int probeSize (struct vdIn *vd)
int init_v4l (struct vdIn *vd)
int close_v4l (struct vdIn *vd)
static void flipUV (unsigned char *src, int format, int w, int h)
int grab (struct vdIn *vd)
int setPalette (struct vdIn *vd)
int changeSize (struct vdIn *vd)
__u8 getBrightness (struct vdIn *vdin)
void setBrightness (struct vdIn *vdin, __u8 bright)
__u8 getContrast (struct vdIn *vdin)
void setContrast (struct vdIn *vdin, __u8 contrast)
__u8 getColors (struct vdIn *vdin)
void setColors (struct vdIn *vdin, __u8 colors)

Variables

int PAL [] = {VIDEO_PALETTE_YUV420P,VIDEO_PALETTE_RGB565,VIDEO_PALETTE_RGB24,VIDEO_PALETTE_RGB32}
 Definitions.
int SIZE [] = { 640,480,384,288,352,288,320,240,192,144,176,144,160,120 }
+


Detailed Description

+This file implement function. +

+ +

+Definition in file camv4l.c.


Define Documentation

+ +
+
+ + + + +
#define LEN_PALLETE   4
+
+
+ +

+ +

+Definition at line 12 of file camv4l.c. +

+Referenced by probePalette(). +

+

+


Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static void flipUV (unsigned char *  src,
int  format,
int  w,
int  h 
) [static]
+
+
+ +

+ +

+Definition at line 151 of file camv4l.c. +

+References i, VIDEO_PALETTE_RAW_JPEG, VIDEO_PALETTE_RGB24, VIDEO_PALETTE_RGB32, VIDEO_PALETTE_RGB565, and VIDEO_PALETTE_YUV420P. +

+Referenced by grab(). +

+

+ +

+
+ + + + + + + + + +
static int GetDepth (int  format  )  [static]
+
+ +

+ +

+
+ + + + + + + + + +
static int GetVideoPict (struct vdIn vd  )  [static]
+
+
+ +

+ +

+Definition at line 400 of file camv4l.c. +

+References vdIn::fd, and vdIn::videopict. +

+Referenced by changeSize(), getBrightness(), getColors(), getContrast(), and init_v4l(). +

+

+ +

+
+ + + + + + + + + +
static int probePalette (struct vdIn vd  )  [static]
+
+
+ +

+ +

+Definition at line 273 of file camv4l.c. +

+References vdIn::bppIn, vdIn::fd, vdIn::formatIn, GetDepth(), i, LEN_PALLETE, PAL, and vdIn::palette. +

+Referenced by init_v4l(). +

+

+ +

+
+ + + + + + + + + +
static int probeSize (struct vdIn vd  )  [static]
+
+
+ +

+ +

+Definition at line 320 of file camv4l.c. +

+References vdIn::fd, vdIn::hdrheight, vdIn::hdrwidth, i, SIZE, vdIn::sizeothers, and vdIn::videocap. +

+Referenced by init_v4l(). +

+

+ +

+
+ + + + + + + + + +
static int SetVideoPict (struct vdIn vd  )  [static]
+
+
+ +

+ +

+Definition at line 416 of file camv4l.c. +

+References vdIn::fd, and vdIn::videopict. +

+Referenced by setBrightness(), setColors(), setContrast(), and setPalette(). +

+

+


Variable Documentation

+ +
+
+ + + + +
int PAL[] = {VIDEO_PALETTE_YUV420P,VIDEO_PALETTE_RGB565,VIDEO_PALETTE_RGB24,VIDEO_PALETTE_RGB32}
+
+
+ +

+Definitions. +

+ +

+Definition at line 10 of file camv4l.c. +

+Referenced by probePalette(). +

+

+ +

+
+ + + + +
int SIZE[] = { 640,480,384,288,352,288,320,240,192,144,176,144,160,120 }
+
+
+ +

+ +

+Definition at line 14 of file camv4l.c. +

+Referenced by probeSize(). +

+

+


Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/camv4l_8c__incl.dot b/doc/html/camv4l_8c__incl.dot new file mode 100644 index 0000000..5522476 --- /dev/null +++ b/doc/html/camv4l_8c__incl.dot @@ -0,0 +1,9 @@ +digraph G +{ + edge [fontname="FreeSans.ttf",fontsize=10,labelfontname="FreeSans.ttf",labelfontsize=10]; + node [fontname="FreeSans.ttf",fontsize=10,shape=record]; + rankdir=LR; + Node1 [label="camv4l.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; + Node1 -> Node2 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node2 [label="camv4l.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$camv4l_8h.html"]; +} diff --git a/doc/html/camv4l_8c__incl.md5 b/doc/html/camv4l_8c__incl.md5 new file mode 100644 index 0000000..fc6a45e --- /dev/null +++ b/doc/html/camv4l_8c__incl.md5 @@ -0,0 +1 @@ +573ca771940b819f569d7b1c70c72aa3 \ No newline at end of file diff --git a/doc/html/camv4l_8h-source.html b/doc/html/camv4l_8h-source.html new file mode 100644 index 0000000..28067ef --- /dev/null +++ b/doc/html/camv4l_8h-source.html @@ -0,0 +1,153 @@ + + +Camera grab convert to MPEG: camv4l.h Source File + + + + + + +

camv4l.h

Go to the documentation of this file.
00001 #ifndef CAM_V4L_H
+00002 #define CAM_V4L_H
+00003 
+00009 #include <stdio.h>
+00010 #include <unistd.h>
+00011 #include <stdlib.h>
+00012 #include <string.h>
+00013 #include <fcntl.h>
+00014 #include <signal.h>
+00015 #include <errno.h>
+00016 #include <time.h>
+00017 #include <math.h>
+00018 #include <stdarg.h>
+00019 #include <linux/types.h>
+00020 #include <linux/videodev.h>
+00021 #include <sys/mman.h>
+00022 #include <sys/ioctl.h>
+00023 #include <sys/file.h>
+00024 #include <sys/types.h>
+00025 #include <sys/stat.h>
+00026 
+00027 #define DWIDTH 320      
+00028 #define DHEIGHT 240  
+00029 
+00030 /* Input data output Palette define here */
+00031 #define VIDEO_PALETTE_RGB565 3          /* 16bit RGB */
+00032 #define VIDEO_PALETTE_RGB24  4          /* 24bit RGB */
+00033 #define VIDEO_PALETTE_RGB32  5          /* 32bit RGB */
+00034 #define VIDEO_PALETTE_YUV420P 15        /* YUV 420P */
+00035 #define VIDEO_PALETTE_RAW_JPEG  20
+00036 
+00037 
+00041 enum cam_form {
+00042         JPEG,
+00043         YUVY,
+00044         YYUV,
+00045         YUYV,
+00046         GREY,
+00047         GBRG,
+00048         UNKNOW,
+00049 };
+00050 
+00054 struct vdIn {
+00055         int fd;   // file descriptor
+00056         char *videodevice ; //name of camera
+00057 
+00058         struct video_mmap vmmap;
+00059         struct video_capability videocap;
+00060         int mmapsize;
+00061         struct video_mbuf videombuf;
+00062         struct video_picture videopict;
+00063         struct video_window videowin;
+00064         struct video_channel videochan;
+00065         
+00066         unsigned int format ;   /* Format asked by apps for this frame */
+00067         int cameratype ;                /* native in frame format */
+00068         char *cameraname;
+00069         char *bridge;
+00070         int sizenative;
+00071         int sizeothers;
+00072         int palette;
+00073         int norme ;
+00074         int channel ;
+00075         int grabMethod ;                
+00076         unsigned char *pFramebuffer;
+00077         unsigned char *pixTmp;  
+00078         int framesizeIn ;
+00079         int frame_cour;
+00080         int bppIn;
+00081         int hdrwidth;
+00082         int hdrheight;
+00083         int formatIn;
+00084         int flipUV;
+00085 };
+00086 
+00087 /*
+00088 struct palette_list {
+00089         int num;
+00090         const char *name;
+00091 };
+00092 
+00093 
+00094 //Camera type jpeg yuvy yyuv yuyv grey gbrg
+00095 static struct palette_list Plist[] ={
+00096         {JPEG,"JPEG"},
+00097         {YUVY,"YUVY"},
+00098         {YYUV,"YYUV"},
+00099         {YUYV,"YUYV"},
+00100         {GREY,"GREY"},
+00101         {GBRG,"GBRG"},
+00102         {-1,NULL}
+00103 };
+00104 */
+00105 
+00106 
+00112 int init_v4l ( struct vdIn *vd );
+00113 
+00119 int grab (struct vdIn *vd );
+00120 
+00126 int close_v4l (struct vdIn *vd);
+00127 
+00133 int setPalette (struct vdIn *vd);
+00134 
+00140 int changeSize (struct vdIn *vd);
+00141 
+00142 
+00148 __u8 getBrightness ( struct vdIn *vd);
+00149 
+00156 void setBrightness ( struct vdIn *vd, __u8 bright);
+00157 
+00163 __u8 getContrast ( struct vdIn *vd);
+00164 
+00171 void setContrast ( struct vdIn *vd, __u8 contrast);
+00172 
+00178 __u8 getColors ( struct vdIn *vd);
+00179 
+00186 void setColors ( struct vdIn *vd, __u8 colors);
+00187 
+00193 __u8 getNorme ( struct vdIn *vd);
+00194 
+00201 void setNorme (struct vdIn *vd,__u8 norme);
+00202 
+00208 __u8 getChannel (struct vdIn *vd);
+00209 
+00216 void setChannel( struct vdIn * vd,__u8 channel);
+00217 
+00218 
+00219 #endif /*CAM_V4L_H*/
+00220 
+

Generated on Mon Jan 26 20:51:50 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/camv4l_8h.html b/doc/html/camv4l_8h.html new file mode 100644 index 0000000..3e30006 --- /dev/null +++ b/doc/html/camv4l_8h.html @@ -0,0 +1,281 @@ + + +Camera grab convert to MPEG: camv4l.h File Reference + + + + + + +

camv4l.h File Reference

#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <errno.h>
+#include <time.h>
+#include <math.h>
+#include <stdarg.h>
+#include <linux/types.h>
+#include <linux/videodev.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include <sys/file.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+ +

+Include dependency graph for camv4l.h: +

+This graph shows which files directly or indirectly include this file: +

+Go to the source code of this file. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Data Structures

struct  vdIn

Defines

#define DWIDTH   320
#define DHEIGHT   240
#define VIDEO_PALETTE_RGB565   3
#define VIDEO_PALETTE_RGB24   4
#define VIDEO_PALETTE_RGB32   5
#define VIDEO_PALETTE_YUV420P   15
#define VIDEO_PALETTE_RAW_JPEG   20

Enumerations

enum  cam_form {
+  JPEG, +YUVY, +YYUV, +YUYV, +
+  GREY, +GBRG, +UNKNOW +
+ }

Functions

int init_v4l (struct vdIn *vd)
int grab (struct vdIn *vd)
int close_v4l (struct vdIn *vd)
int setPalette (struct vdIn *vd)
int changeSize (struct vdIn *vd)
__u8 getBrightness (struct vdIn *vd)
void setBrightness (struct vdIn *vd, __u8 bright)
__u8 getContrast (struct vdIn *vd)
void setContrast (struct vdIn *vd, __u8 contrast)
__u8 getColors (struct vdIn *vd)
void setColors (struct vdIn *vd, __u8 colors)
__u8 getNorme (struct vdIn *vd)
void setNorme (struct vdIn *vd, __u8 norme)
__u8 getChannel (struct vdIn *vd)
void setChannel (struct vdIn *vd, __u8 channel)
+


Detailed Description

+ +

+Definition in file camv4l.h.


Define Documentation

+ +
+
+ + + + +
#define DHEIGHT   240
+
+
+ +

+ +

+Definition at line 28 of file camv4l.h. +

+

+ +

+
+ + + + +
#define DWIDTH   320
+
+
+ +

+ +

+Definition at line 27 of file camv4l.h. +

+

+ +

+
+ + + + +
#define VIDEO_PALETTE_RAW_JPEG   20
+
+
+ +

+ +

+Definition at line 35 of file camv4l.h. +

+Referenced by flipUV(), and GetDepth(). +

+

+ +

+
+ + + + +
#define VIDEO_PALETTE_RGB24   4
+
+
+ +

+ +

+Definition at line 32 of file camv4l.h. +

+Referenced by flipUV(), and GetDepth(). +

+

+ +

+
+ + + + +
#define VIDEO_PALETTE_RGB32   5
+
+
+ +

+ +

+Definition at line 33 of file camv4l.h. +

+Referenced by flipUV(), and GetDepth(). +

+

+ +

+
+ + + + +
#define VIDEO_PALETTE_RGB565   3
+
+
+ +

+ +

+Definition at line 31 of file camv4l.h. +

+Referenced by flipUV(), and GetDepth(). +

+

+ +

+
+ + + + +
#define VIDEO_PALETTE_YUV420P   15
+
+
+ +

+ +

+Definition at line 34 of file camv4l.h. +

+Referenced by flipUV(), GetDepth(), and processvideo(). +

+

+


Enumeration Type Documentation

+ +
+
+ + + + +
enum cam_form
+
+
+ +

+Camera type format date

Enumerator:
+ + + + + + + + +
JPEG  +
YUVY  +
YYUV  +
YUYV  +
GREY  +
GBRG  +
UNKNOW  +
+
+ +

+Definition at line 41 of file camv4l.h. +

+

+


Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/camv4l_8h__dep__incl.dot b/doc/html/camv4l_8h__dep__incl.dot new file mode 100644 index 0000000..aef24ea --- /dev/null +++ b/doc/html/camv4l_8h__dep__incl.dot @@ -0,0 +1,11 @@ +digraph G +{ + edge [fontname="FreeSans.ttf",fontsize=10,labelfontname="FreeSans.ttf",labelfontsize=10]; + node [fontname="FreeSans.ttf",fontsize=10,shape=record]; + rankdir=LR; + Node1 [label="camv4l.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; + Node1 -> Node2 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node2 [label="camv4l.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$camv4l_8c.html"]; + Node1 -> Node3 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node3 [label="grab_mpeg.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$grab__mpeg_8c.html"]; +} diff --git a/doc/html/camv4l_8h__dep__incl.md5 b/doc/html/camv4l_8h__dep__incl.md5 new file mode 100644 index 0000000..8e13f60 --- /dev/null +++ b/doc/html/camv4l_8h__dep__incl.md5 @@ -0,0 +1 @@ +90e11acdedbbd610cb10d305ed99ea36 \ No newline at end of file diff --git a/doc/html/camv4l_8h__incl.dot b/doc/html/camv4l_8h__incl.dot new file mode 100644 index 0000000..753db06 --- /dev/null +++ b/doc/html/camv4l_8h__incl.dot @@ -0,0 +1,41 @@ +digraph G +{ + edge [fontname="FreeSans.ttf",fontsize=10,labelfontname="FreeSans.ttf",labelfontsize=10]; + node [fontname="FreeSans.ttf",fontsize=10,shape=record]; + rankdir=LR; + Node1 [label="camv4l.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; + Node1 -> Node2 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node2 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node3 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node3 [label="unistd.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node4 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node4 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node5 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node5 [label="string.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node6 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node6 [label="fcntl.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node7 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node7 [label="signal.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node8 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node8 [label="errno.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node9 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node9 [label="time.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node10 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node10 [label="math.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node11 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node11 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node12 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node12 [label="linux/types.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node13 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node13 [label="linux/videodev.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node14 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node14 [label="sys/mman.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node15 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node15 [label="sys/ioctl.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node16 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node16 [label="sys/file.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node17 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node17 [label="sys/types.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node18 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node18 [label="sys/stat.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; +} diff --git a/doc/html/camv4l_8h__incl.md5 b/doc/html/camv4l_8h__incl.md5 new file mode 100644 index 0000000..96ff62d --- /dev/null +++ b/doc/html/camv4l_8h__incl.md5 @@ -0,0 +1 @@ +ce2f1adf56b026a454d14ab5c024408a \ No newline at end of file diff --git a/doc/html/doxygen.css b/doc/html/doxygen.css new file mode 100644 index 0000000..c7db1a8 --- /dev/null +++ b/doc/html/doxygen.css @@ -0,0 +1,358 @@ +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} +H1 { + text-align: center; + font-size: 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} +CAPTION { font-weight: bold } +DIV.qindex { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.nav { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navtab { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1A419D; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1A419D +} +A.qindex:hover { + text-decoration: none; + background-color: #ddddff; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } +A.el { text-decoration: none; font-weight: bold } +A.elRef { font-weight: bold } +A.code:link { text-decoration: none; font-weight: normal; color: #0000FF} +A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF} +A.codeRef:link { font-weight: normal; color: #0000FF} +A.codeRef:visited { font-weight: normal; color: #0000FF} +A:hover { text-decoration: none; background-color: #f2f2ff } +DL.el { margin-left: -1cm } +.fragment { + font-family: monospace, fixed; + font-size: 95%; +} +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } + +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #e8eef2; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #e8eef2; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { text-align: center; } +IMG.formulaDsp { } +IMG.formulaInl { vertical-align: middle; } +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +TD.tiny { font-size: 75%; +} +a { + color: #1A41A8; +} +a:visited { + color: #2A3798; +} +.dirtab { padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; +} +TH.dirtab { background: #e8eef2; + font-weight: bold; +} +HR { height: 1px; + border: none; + border-top: 1px solid black; +} + +/* Style for detailed member documentation */ +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; +} +.memnav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +.memitem { + padding: 4px; + background-color: #eef3f5; + border-width: 1px; + border-style: solid; + border-color: #dedeee; + -moz-border-radius: 8px 8px 8px 8px; +} +.memname { + white-space: nowrap; + font-weight: bold; +} +.memdoc{ + padding-left: 10px; +} +.memproto { + background-color: #d5e1e8; + width: 100%; + border-width: 1px; + border-style: solid; + border-color: #84b0c7; + font-weight: bold; + -moz-border-radius: 8px 8px 8px 8px; +} +.paramkey { + text-align: right; +} +.paramtype { + white-space: nowrap; +} +.paramname { + color: #602020; + font-style: italic; + white-space: nowrap; +} +/* End Styling for detailed member documentation */ + +/* for the tree view */ +.ftvtree { + font-family: sans-serif; + margin:0.5em; +} +.directory { font-size: 9pt; font-weight: bold; } +.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } +.directory > h3 { margin-top: 0; } +.directory p { margin: 0px; white-space: nowrap; } +.directory div { display: none; margin: 0px; } +.directory img { vertical-align: -30%; } diff --git a/doc/html/doxygen.png b/doc/html/doxygen.png new file mode 100644 index 0000000..f0a274b Binary files /dev/null and b/doc/html/doxygen.png differ diff --git a/doc/html/files.html b/doc/html/files.html new file mode 100644 index 0000000..04e3dbc --- /dev/null +++ b/doc/html/files.html @@ -0,0 +1,29 @@ + + +Camera grab convert to MPEG: File Index + + + + + + +

Camera grab convert to MPEG File List

Here is a list of all files with brief descriptions: + + + +
camv4l.c [code]This file implement function
camv4l.h [code]
grab_mpeg.c [code]This is the main file where application run
+
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/ftv2blank.png b/doc/html/ftv2blank.png new file mode 100644 index 0000000..493c3c0 Binary files /dev/null and b/doc/html/ftv2blank.png differ diff --git a/doc/html/ftv2doc.png b/doc/html/ftv2doc.png new file mode 100644 index 0000000..f72999f Binary files /dev/null and b/doc/html/ftv2doc.png differ diff --git a/doc/html/ftv2folderclosed.png b/doc/html/ftv2folderclosed.png new file mode 100644 index 0000000..d6d0634 Binary files /dev/null and b/doc/html/ftv2folderclosed.png differ diff --git a/doc/html/ftv2folderopen.png b/doc/html/ftv2folderopen.png new file mode 100644 index 0000000..bbe2c91 Binary files /dev/null and b/doc/html/ftv2folderopen.png differ diff --git a/doc/html/ftv2lastnode.png b/doc/html/ftv2lastnode.png new file mode 100644 index 0000000..e7b9ba9 Binary files /dev/null and b/doc/html/ftv2lastnode.png differ diff --git a/doc/html/ftv2link.png b/doc/html/ftv2link.png new file mode 100644 index 0000000..14f3fed Binary files /dev/null and b/doc/html/ftv2link.png differ diff --git a/doc/html/ftv2mlastnode.png b/doc/html/ftv2mlastnode.png new file mode 100644 index 0000000..09ceb6a Binary files /dev/null and b/doc/html/ftv2mlastnode.png differ diff --git a/doc/html/ftv2mnode.png b/doc/html/ftv2mnode.png new file mode 100644 index 0000000..3254c05 Binary files /dev/null and b/doc/html/ftv2mnode.png differ diff --git a/doc/html/ftv2node.png b/doc/html/ftv2node.png new file mode 100644 index 0000000..c9f06a5 Binary files /dev/null and b/doc/html/ftv2node.png differ diff --git a/doc/html/ftv2plastnode.png b/doc/html/ftv2plastnode.png new file mode 100644 index 0000000..0b07e00 Binary files /dev/null and b/doc/html/ftv2plastnode.png differ diff --git a/doc/html/ftv2pnode.png b/doc/html/ftv2pnode.png new file mode 100644 index 0000000..2001b79 Binary files /dev/null and b/doc/html/ftv2pnode.png differ diff --git a/doc/html/ftv2vertline.png b/doc/html/ftv2vertline.png new file mode 100644 index 0000000..b330f3a Binary files /dev/null and b/doc/html/ftv2vertline.png differ diff --git a/doc/html/functions.html b/doc/html/functions.html new file mode 100644 index 0000000..134c533 --- /dev/null +++ b/doc/html/functions.html @@ -0,0 +1,90 @@ + + +Camera grab convert to MPEG: Data Fields + + + + + + +
+ +
+Here is a list of all struct and union fields with links to the structures/unions they belong to: +

+

+
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/functions_vars.html b/doc/html/functions_vars.html new file mode 100644 index 0000000..dc1fce7 --- /dev/null +++ b/doc/html/functions_vars.html @@ -0,0 +1,90 @@ + + +Camera grab convert to MPEG: Data Fields - Variables + + + + + + +
+ +
+  +

+

+
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/globals.html b/doc/html/globals.html new file mode 100644 index 0000000..608a845 --- /dev/null +++ b/doc/html/globals.html @@ -0,0 +1,203 @@ + + +Camera grab convert to MPEG: Data Fields + + + + + + + +
+ +
+ +

+Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to: +

+

- c -

+

- d -

+

- f -

+

- g -

+

- i -

+

- j -

+

- l -

+

- m -

+

- o -

+

- p -

+

- s -

+

- u -

+

- v -

+

- y -

+
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/globals_defs.html b/doc/html/globals_defs.html new file mode 100644 index 0000000..3dce741 --- /dev/null +++ b/doc/html/globals_defs.html @@ -0,0 +1,54 @@ + + +Camera grab convert to MPEG: Data Fields + + + + + + + +  +

+

+
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/globals_enum.html b/doc/html/globals_enum.html new file mode 100644 index 0000000..cb55f83 --- /dev/null +++ b/doc/html/globals_enum.html @@ -0,0 +1,40 @@ + + +Camera grab convert to MPEG: Data Fields + + + + + + + +  +

+

+
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/globals_eval.html b/doc/html/globals_eval.html new file mode 100644 index 0000000..530e543 --- /dev/null +++ b/doc/html/globals_eval.html @@ -0,0 +1,52 @@ + + +Camera grab convert to MPEG: Data Fields + + + + + + + +  +

+

+
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/globals_func.html b/doc/html/globals_func.html new file mode 100644 index 0000000..1e7b9f9 --- /dev/null +++ b/doc/html/globals_func.html @@ -0,0 +1,129 @@ + + +Camera grab convert to MPEG: Data Fields + + + + + + + +
+ +
+ +

+  +

+

- c -

+

- f -

+

- g -

+

- i -

+

- m -

+

- p -

+

- s -

+

- v -

+
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/globals_vars.html b/doc/html/globals_vars.html new file mode 100644 index 0000000..e3dcf46 --- /dev/null +++ b/doc/html/globals_vars.html @@ -0,0 +1,62 @@ + + +Camera grab convert to MPEG: Data Fields + + + + + + + +  +

+

+
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/grab__mpeg_8c-source.html b/doc/html/grab__mpeg_8c-source.html new file mode 100644 index 0000000..265420d --- /dev/null +++ b/doc/html/grab__mpeg_8c-source.html @@ -0,0 +1,228 @@ + + +Camera grab convert to MPEG: grab_mpeg.c Source File + + + + + + +

grab_mpeg.c

Go to the documentation of this file.
00001 
+00028 #include <stdlib.h>
+00029 #include <stdio.h>
+00030 #include <string.h>
+00031 
+00032 #include "camv4l.h"
+00033 #include <ffmpeg/avcodec.h>
+00034 
+00035 
+00037 AVCodec *codec;
+00038 
+00040 AVCodecContext *c;
+00041 
+00042 int i;
+00043 int out_size;
+00044 int size;
+00045 
+00047 FILE *f;
+00048 
+00050 AVFrame *picture;
+00051 
+00053 uint8_t *outbuf;// *picture_buf;
+00054 //Size of output 
+00055 int outbuf_size;
+00056 
+00057 
+00059 struct vdIn myvidIn;
+00060 
+00064 void processvideo ();
+00065 
+00069 void video_encode_alloc(const char *filename,uint8_t* in_buffer);
+00070 
+00074 void video_encode_mpeg();
+00075 
+00079 void video_encode_free();
+00080 
+00081 
+00088 int main(int count, char *strings[])
+00089 {       
+00090         c= NULL;
+00091         int retval;
+00092         //int cnt=10;
+00093 
+00094         //prevziti parametru z prikazove radky
+00095         /*if ( count != 2 ){//kontrola zda jsme zadali port
+00096                 printf("usage: %s <port>\n...Using default port (%d).\n", strings[0], port);
+00097         }
+00098         else {
+00099                 port = atoi(strings[1]); //prevod z parametru
+00100         }*/
+00101 
+00102         const char *videodev ="/dev/video0";
+00103         const char *filename = "pokus.mpg";
+00104         int grabmethod = 1; //or 0
+00105 
+00106         /* make room for init data */
+00107         myvidIn.videodevice = NULL;
+00108         myvidIn.cameraname = NULL;
+00109         myvidIn.bridge = NULL;
+00110         myvidIn.videodevice = (char *) realloc (myvidIn.videodevice, 16);
+00111         myvidIn.cameraname = (char *) realloc (myvidIn.cameraname, 32);
+00112         myvidIn.bridge = (char *) realloc (myvidIn.bridge, 9);
+00113         myvidIn.grabMethod = grabmethod;        // 1 mmap 0 read
+00114         snprintf (myvidIn.videodevice, 12, "%s", videodev);
+00115         printf ("video device %s\n", myvidIn.videodevice);
+00116         retval=init_v4l (&myvidIn);
+00117         printf("Device was been initialized %d \n",retval);
+00118 
+00119         video_encode_alloc(filename,myvidIn.pixTmp);
+00120         
+00121         processvideo();
+00122         
+00123         video_encode_free();
+00124 
+00125         free (myvidIn.videodevice);
+00126         free (myvidIn.cameraname);
+00127         free (myvidIn.bridge);
+00128         close_v4l (&myvidIn);
+00129 
+00130         printf("Zavreni \n");
+00131 
+00132         return 1;
+00133 }
+00134 
+00135 
+00136 
+00137 void processvideo () 
+00138 {
+00139         int run = 1;
+00140         int cnt=0;
+00141 
+00142         //set size of video
+00143         myvidIn.hdrwidth = 384;
+00144         myvidIn.hdrheight = 288;
+00145         myvidIn.formatIn = VIDEO_PALETTE_YUV420P;
+00146         /* input data maybe a jpeg one */
+00147         setPalette (&myvidIn);
+00148 
+00149         while (run){    
+00150                 grab (&myvidIn);
+00151 
+00152                 if(cnt>3)
+00153                         video_encode_mpeg();
+00154 
+00155                 //sleep(1);
+00156       cnt++;
+00157                 if(cnt==50){run=0;}
+00158                 printf("Frame %d\n",cnt);
+00159         }
+00160 }
+00161 
+00162 void video_encode_alloc(const char *filename,uint8_t* in_buffer){
+00163         
+00164         /* must be called before using avcodec lib */
+00165    avcodec_init();
+00166  
+00167    /* register all the codecs */
+00168         avcodec_register_all();
+00169 
+00170         //printf("Video encoding\n");
+00171         /* find the mpeg1 video encoder */
+00172         codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO);
+00173         if (!codec) {
+00174                 fprintf(stderr, "codec not found\n");
+00175                 exit(1);
+00176         }
+00177 
+00178         c= avcodec_alloc_context();
+00179         picture= avcodec_alloc_frame();
+00180         /* put sample parameters */
+00181         c->bit_rate = 1000000;
+00182         /* resolution must be a multiple of two */
+00183         c->width = 384;
+00184         c->height = 288;
+00185         /* frames per second */
+00186         c->time_base= (AVRational){1,25};
+00187         c->gop_size = 10; /* emit one intra frame every ten frames */
+00188         c->max_b_frames=1;
+00189         c->pix_fmt = PIX_FMT_YUV420P;
+00190  
+00191         /* open codec */
+00192         if (avcodec_open(c, codec) < 0) {
+00193                 fprintf(stderr, "could not open codec\n");
+00194                 exit(1);
+00195         }
+00196 
+00197         f = fopen(filename, "wb");
+00198         if (!f) {
+00199                 fprintf(stderr, "could not open %s\n", filename);
+00200                 exit(1);
+00201         }
+00202 
+00203         /* alloc image and output buffer */
+00204         //buffer pro zakodovany obrazek mpegem
+00205         outbuf_size = 100000;
+00206         outbuf = malloc(outbuf_size);
+00207 
+00208         size = c->width * c->height;
+00209 
+00210         picture->data[0] = in_buffer;
+00211         picture->data[1] = picture->data[0] + size;
+00212         picture->data[2] = picture->data[1] + size / 4;
+00213         picture->linesize[0] = c->width;
+00214         picture->linesize[1] = c->width / 2;
+00215         picture->linesize[2] = c->width / 2;
+00216 }
+00217 
+00218 void video_encode_mpeg(){
+00219         
+00220         /* encode the image */
+00221         out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
+00222         //printf("encoding frame %3d (size=%5d)\n", i, out_size);
+00223         fwrite(outbuf, 1, out_size, f);
+00224 }
+00225 
+00226 
+00227 void video_encode_free(){
+00228 
+00229         /* get the delayed frames */
+00230         for(; out_size; i++) {
+00231                 fflush(stdout);
+00232                 out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
+00233                 printf("write frame %3d (size=%5d)\n", i, out_size);
+00234                 fwrite(outbuf, 1, out_size, f);
+00235         }
+00236 
+00237         /* add sequence end code to have a real mpeg file */
+00238         outbuf[0] = 0x00;
+00239         outbuf[1] = 0x00;
+00240         outbuf[2] = 0x01;
+00241         outbuf[3] = 0xb7;
+00242 
+00243         fwrite(outbuf, 1, 4, f);
+00244 
+00245         fclose(f);
+00246         //free(picture_buf);
+00247         free(outbuf);
+00248 
+00249         avcodec_close(c);
+00250         av_free(c);
+00251         av_free(picture);
+00252         printf("\n");
+00253         printf("video codev was been freed\n");
+00254 }
+

Generated on Mon Jan 26 20:51:50 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/grab__mpeg_8c.html b/doc/html/grab__mpeg_8c.html new file mode 100644 index 0000000..1a36b9c --- /dev/null +++ b/doc/html/grab__mpeg_8c.html @@ -0,0 +1,435 @@ + + +Camera grab convert to MPEG: grab_mpeg.c File Reference + + + + + + +

grab_mpeg.c File Reference

This is the main file where application run. More... +

+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "camv4l.h"
+#include <ffmpeg/avcodec.h>
+ +

+Include dependency graph for grab_mpeg.c: +

+Go to the source code of this file. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Functions

void processvideo ()
void video_encode_alloc (const char *filename, uint8_t *in_buffer)
void video_encode_mpeg ()
void video_encode_free ()
int main (int count, char *strings[])

Variables

AVCodec * codec
 Codec.
AVCodecContext * c
 Contex of codec.
int i
int out_size
int size
FILE * f
 File name.
AVFrame * picture
 Frame of picture.
uint8_t * outbuf
 Output mpeg frame.
int outbuf_size
vdIn myvidIn
 V4L device.
+


Detailed Description

+This is the main file where application run. +

+ +

+Definition in file grab_mpeg.c.


Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
int main (int  count,
char *  strings[] 
)
+
+
+ +

+The main function

Parameters:
+ + + +
count Count of byte
strings String after run sequnce of aplicationss
+
+
Returns:
0 if all good
+ +

+Definition at line 88 of file grab_mpeg.c. +

+References vdIn::bridge, c, vdIn::cameraname, close_v4l(), vdIn::grabMethod, init_v4l(), myvidIn, vdIn::pixTmp, processvideo(), video_encode_alloc(), video_encode_free(), and vdIn::videodevice. +

+

+ +

+
+ + + + + + + + +
void processvideo (  ) 
+
+
+ +

+Function make frame from videodevice and send to. +

+Definition at line 137 of file grab_mpeg.c. +

+References vdIn::formatIn, grab(), vdIn::hdrheight, vdIn::hdrwidth, myvidIn, setPalette(), video_encode_mpeg(), and VIDEO_PALETTE_YUV420P. +

+Referenced by main(). +

+

+ +

+
+ + + + + + + + + + + + + + + + + + +
void video_encode_alloc (const char *  filename,
uint8_t *  in_buffer 
)
+
+
+ +

+Alloc and set codec +

+Definition at line 162 of file grab_mpeg.c. +

+References c, codec, f, outbuf, outbuf_size, picture, and size. +

+Referenced by main(). +

+

+ +

+
+ + + + + + + + +
void video_encode_free (  ) 
+
+
+ +

+Free memory +

+Definition at line 227 of file grab_mpeg.c. +

+References c, f, i, out_size, outbuf, outbuf_size, and picture. +

+Referenced by main(). +

+

+ +

+
+ + + + + + + + +
void video_encode_mpeg (  ) 
+
+
+ +

+Encode global buffer from picture . +

+Definition at line 218 of file grab_mpeg.c. +

+References c, f, out_size, outbuf, outbuf_size, and picture. +

+Referenced by processvideo(). +

+

+


Variable Documentation

+ +
+
+ + + + +
AVCodecContext* c
+
+
+ +

+Contex of codec. +

+ +

+Definition at line 40 of file grab_mpeg.c. +

+Referenced by main(), video_encode_alloc(), video_encode_free(), and video_encode_mpeg(). +

+

+ +

+
+ + + + +
AVCodec* codec
+
+
+ +

+Codec. +

+ +

+Definition at line 37 of file grab_mpeg.c. +

+Referenced by video_encode_alloc(). +

+

+ +

+
+ + + + +
FILE* f
+
+
+ +

+File name. +

+ +

+Definition at line 47 of file grab_mpeg.c. +

+Referenced by init_v4l(), video_encode_alloc(), video_encode_free(), and video_encode_mpeg(). +

+

+ +

+
+ + + + +
int i
+
+
+ +

+ +

+Definition at line 42 of file grab_mpeg.c. +

+Referenced by flipUV(), probePalette(), probeSize(), and video_encode_free(). +

+

+ +

+
+ + + + +
struct vdIn myvidIn
+
+
+ +

+V4L device. +

+ +

+Definition at line 59 of file grab_mpeg.c. +

+Referenced by main(), and processvideo(). +

+

+ +

+
+ + + + +
int out_size
+
+
+ +

+ +

+Definition at line 43 of file grab_mpeg.c. +

+Referenced by video_encode_free(), and video_encode_mpeg(). +

+

+ +

+
+ + + + +
uint8_t* outbuf
+
+
+ +

+Output mpeg frame. +

+ +

+Definition at line 53 of file grab_mpeg.c. +

+Referenced by video_encode_alloc(), video_encode_free(), and video_encode_mpeg(). +

+

+ +

+
+ + + + +
int outbuf_size
+
+
+ +

+ +

+Definition at line 55 of file grab_mpeg.c. +

+Referenced by video_encode_alloc(), video_encode_free(), and video_encode_mpeg(). +

+

+ +

+
+ + + + +
AVFrame* picture
+
+
+ +

+Frame of picture. +

+ +

+Definition at line 50 of file grab_mpeg.c. +

+Referenced by video_encode_alloc(), video_encode_free(), and video_encode_mpeg(). +

+

+ +

+
+ + + + +
int size
+
+
+ +

+ +

+Definition at line 44 of file grab_mpeg.c. +

+Referenced by grab(), and video_encode_alloc(). +

+

+


Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/grab__mpeg_8c__incl.dot b/doc/html/grab__mpeg_8c__incl.dot new file mode 100644 index 0000000..7acfb66 --- /dev/null +++ b/doc/html/grab__mpeg_8c__incl.dot @@ -0,0 +1,20 @@ +digraph G +{ + edge [fontname="FreeSans.ttf",fontsize=10,labelfontname="FreeSans.ttf",labelfontsize=10]; + node [fontname="FreeSans.ttf",fontsize=10,shape=record]; + rankdir=LR; + Node1 [label="grab_mpeg.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; + Node1 -> Node2 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node2 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node3 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node3 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node4 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node4 [label="string.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node5 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node5 [label="camv4l.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$camv4l_8h.html"]; + Node5 -> Node3 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node5 -> Node2 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node5 -> Node4 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node1 -> Node6 [color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node6 [label="ffmpeg/avcodec.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; +} diff --git a/doc/html/grab__mpeg_8c__incl.md5 b/doc/html/grab__mpeg_8c__incl.md5 new file mode 100644 index 0000000..8d3a2c6 --- /dev/null +++ b/doc/html/grab__mpeg_8c__incl.md5 @@ -0,0 +1 @@ +407db1be96cb9d0d84497c920893f638 \ No newline at end of file diff --git a/doc/html/graph_legend.dot b/doc/html/graph_legend.dot new file mode 100644 index 0000000..4a1a09c --- /dev/null +++ b/doc/html/graph_legend.dot @@ -0,0 +1,22 @@ +digraph G +{ + edge [fontname="FreeSans.ttf",fontsize=10,labelfontname="FreeSans.ttf",labelfontsize=10]; + node [fontname="FreeSans.ttf",fontsize=10,shape=record]; + Node9 [shape="box",label="Inherited",fontsize=10,height=0.2,width=0.4,fontname="FreeSans.ttf",fillcolor="grey75",style="filled" fontcolor="black"]; + Node10 -> Node9 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node10 [shape="box",label="PublicBase",fontsize=10,height=0.2,width=0.4,fontname="FreeSans.ttf",color="black",URL="$classPublicBase.html"]; + Node11 -> Node10 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node11 [shape="box",label="Truncated",fontsize=10,height=0.2,width=0.4,fontname="FreeSans.ttf",color="red",URL="$classTruncated.html"]; + Node13 -> Node9 [dir=back,color="darkgreen",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node13 [shape="box",label="ProtectedBase",fontsize=10,height=0.2,width=0.4,fontname="FreeSans.ttf",color="black",URL="$classProtectedBase.html"]; + Node14 -> Node9 [dir=back,color="firebrick4",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node14 [shape="box",label="PrivateBase",fontsize=10,height=0.2,width=0.4,fontname="FreeSans.ttf",color="black",URL="$classPrivateBase.html"]; + Node15 -> Node9 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node15 [shape="box",label="Undocumented",fontsize=10,height=0.2,width=0.4,fontname="FreeSans.ttf",color="grey75"]; + Node16 -> Node9 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="FreeSans.ttf"]; + Node16 [shape="box",label="Templ< int >",fontsize=10,height=0.2,width=0.4,fontname="FreeSans.ttf",color="black",URL="$classTempl.html"]; + Node17 -> Node16 [dir=back,color="orange",fontsize=10,style="dashed",label="< int >",fontname="FreeSans.ttf"]; + Node17 [shape="box",label="Templ< T >",fontsize=10,height=0.2,width=0.4,fontname="FreeSans.ttf",color="black",URL="$classTempl.html"]; + Node18 -> Node9 [dir=back,color="darkorchid3",fontsize=10,style="dashed",label="m_usedClass",fontname="FreeSans.ttf"]; + Node18 [shape="box",label="Used",fontsize=10,height=0.2,width=0.4,fontname="FreeSans.ttf",color="black",URL="$classUsed.html"]; +} diff --git a/doc/html/graph_legend.html b/doc/html/graph_legend.html new file mode 100644 index 0000000..7fa817f --- /dev/null +++ b/doc/html/graph_legend.html @@ -0,0 +1,81 @@ + + +Camera grab convert to MPEG: Graph Legend + + + + + +

Graph Legend

This page explains how to interpret the graphs that are generated by doxygen.

+Consider the following example:

/*! Invisible class because of truncation */
+class Invisible { };
+
+/*! Truncated class, inheritance relation is hidden */
+class Truncated : public Invisible { };
+
+/* Class not documented with doxygen comments */
+class Undocumented { };
+
+/*! Class that is inherited using public inheritance */
+class PublicBase : public Truncated { };
+
+/*! A template class */
+template<class T> class Templ { };
+
+/*! Class that is inherited using protected inheritance */
+class ProtectedBase { };
+
+/*! Class that is inherited using private inheritance */
+class PrivateBase { };
+
+/*! Class that is used by the Inherited class */
+class Used { };
+
+/*! Super class that inherits a number of other classes */
+class Inherited : public PublicBase,
+                  protected ProtectedBase,
+                  private PrivateBase,
+                  public Undocumented
+                  public Templ<int>
+{
+  private:
+    Used *m_usedClass;
+};
+
If the MAX_DOT_GRAPH_HEIGHT tag in the configuration file is set to 240 this will result in the following graph:

+

+graph_legend.png +
+

+The boxes in the above graph have the following meaning:

    +
  • +A filled black box represents the struct or class for which the graph is generated.
  • +
  • +A box with a black border denotes a documented struct or class.
  • +
  • +A box with a grey border denotes an undocumented struct or class.
  • +
  • +A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
  • +
+The arrows have the following meaning:
    +
  • +A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • +
  • +A dark green arrow is used for protected inheritance.
  • +
  • +A dark red arrow is used for private inheritance.
  • +
  • +A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible.
  • +
  • +A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labeled with the template parameters of the instance.
  • +
+
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/group__common.html b/doc/html/group__common.html new file mode 100644 index 0000000..9c6ad00 --- /dev/null +++ b/doc/html/group__common.html @@ -0,0 +1,559 @@ + + +Camera grab convert to MPEG: Common + + + + + +

Common

Grab form camere, transfer to the MPEG and transmitt to the LAN. +More... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Functions

int init_v4l (struct vdIn *vd)
int grab (struct vdIn *vd)
int close_v4l (struct vdIn *vd)
int setPalette (struct vdIn *vd)
int changeSize (struct vdIn *vd)
__u8 getBrightness (struct vdIn *vd)
void setBrightness (struct vdIn *vd, __u8 bright)
__u8 getContrast (struct vdIn *vd)
void setContrast (struct vdIn *vd, __u8 contrast)
__u8 getColors (struct vdIn *vd)
void setColors (struct vdIn *vd, __u8 colors)
__u8 getNorme (struct vdIn *vd)
void setNorme (struct vdIn *vd, __u8 norme)
__u8 getChannel (struct vdIn *vd)
void setChannel (struct vdIn *vd, __u8 channel)
+

Detailed Description

+Grab form camere, transfer to the MPEG and transmitt to the LAN. +

+This application handle USB camere.

+

Note:
Note.
+
Author:
(last to touch it)
Author
zial (Ales Zikmund)
+
+
Version:
Revision
1.0
+
+
Date:
Date
2008/12/12 5:45:20
+
+Contact: zikmua1@fel.cvut.cz

+Created on: Wed Dec 13 18:39:37 2008


Function Documentation

+ +
+
+ + + + + + + + + +
int changeSize (struct vdIn vd  ) 
+
+
+ +

+Fuction change size of image array video device.

+

Parameters:
+ + +
vd Video device pointer
+
+ +

+Definition at line 368 of file camv4l.c. +

+References vdIn::bppIn, vdIn::fd, vdIn::formatIn, vdIn::framesizeIn, GetDepth(), GetVideoPict(), vdIn::grabMethod, vdIn::hdrheight, vdIn::hdrwidth, vdIn::pixTmp, vdIn::videopict, vdIn::videowin, and vdIn::vmmap. +

+

+ +

+
+ + + + + + + + + +
int close_v4l (struct vdIn vd  ) 
+
+
+ +

+Fuction close v4l device.

+

Parameters:
+ + +
vd Video device pointer
+
+ +

+Definition at line 137 of file camv4l.c. +

+References vdIn::fd, vdIn::grabMethod, vdIn::mmapsize, vdIn::pFramebuffer, and vdIn::pixTmp. +

+Referenced by main(). +

+

+ +

+
+ + + + + + + + + +
__u8 getBrightness (struct vdIn vd  ) 
+
+
+ +

+Fuction get brightness from the camera.

+

Parameters:
+ + +
vd Video device pointer
+
+ +

+Definition at line 465 of file camv4l.c. +

+References GetVideoPict(). +

+

+ +

+
+ + + + + + + + + +
__u8 getChannel (struct vdIn vd  ) 
+
+
+ +

+Fuction get channel from the camera.

+

Parameters:
+ + +
vd Video device pointer
+
+ +
+

+ +

+
+ + + + + + + + + +
__u8 getColors (struct vdIn vd  ) 
+
+
+ +

+Fuction get colors from the camera.

+

Parameters:
+ + +
vd Video device pointer
+
+ +

+Definition at line 503 of file camv4l.c. +

+References GetVideoPict(). +

+

+ +

+
+ + + + + + + + + +
__u8 getContrast (struct vdIn vd  ) 
+
+
+ +

+Fuction get contrast from the camera.

+

Parameters:
+ + +
vd Video device pointer
+
+ +

+Definition at line 485 of file camv4l.c. +

+References GetVideoPict(). +

+

+ +

+
+ + + + + + + + + +
__u8 getNorme (struct vdIn vd  ) 
+
+
+ +

+Fuction get norme from the camera.

+

Parameters:
+ + +
vd Video device pointer
+
+ +
+

+ +

+
+ + + + + + + + + +
int grab (struct vdIn vd  ) 
+
+
+ +

+Fuction for initialization v4l device.

+

Parameters:
+ + +
vd Video device pointer
+
+ +

+Definition at line 212 of file camv4l.c. +

+References vdIn::fd, flipUV(), vdIn::flipUV, vdIn::formatIn, vdIn::framesizeIn, vdIn::grabMethod, vdIn::hdrheight, vdIn::hdrwidth, vdIn::pFramebuffer, vdIn::pixTmp, size, vdIn::videombuf, and vdIn::vmmap. +

+Referenced by processvideo(). +

+

+ +

+
+ + + + + + + + + +
int init_v4l (struct vdIn vd  ) 
+
+ +

+ +

+
+ + + + + + + + + + + + + + + + + + +
void setBrightness (struct vdIn vd,
__u8  bright 
)
+
+
+ +

+Fuction set brightness to the camera.

+

Parameters:
+ + + +
vd Video device pointer
bright New brightness value
+
+ +

+Definition at line 475 of file camv4l.c. +

+References SetVideoPict(), and vdIn::videopict. +

+

+ +

+
+ + + + + + + + + + + + + + + + + + +
void setChannel (struct vdIn vd,
__u8  channel 
)
+
+
+ +

+Fuction set channels to the camera.

+

Parameters:
+ + + +
vd Video device pointer
channel New channel value
+
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + +
void setColors (struct vdIn vd,
__u8  colors 
)
+
+
+ +

+Fuction set colors to the camera.

+

Parameters:
+ + + +
vd Video device pointer
colors New colors value
+
+ +

+Definition at line 513 of file camv4l.c. +

+References SetVideoPict(), and vdIn::videopict. +

+

+ +

+
+ + + + + + + + + + + + + + + + + + +
void setContrast (struct vdIn vd,
__u8  contrast 
)
+
+
+ +

+Fuction set contrast to the camera.

+

Parameters:
+ + + +
vd Video device pointer
contrast New contrast value
+
+ +

+Definition at line 495 of file camv4l.c. +

+References SetVideoPict(), and vdIn::videopict. +

+

+ +

+
+ + + + + + + + + + + + + + + + + + +
void setNorme (struct vdIn vd,
__u8  norme 
)
+
+
+ +

+Fuction set norme to the camera.

+

Parameters:
+ + + +
vd Video device pointer
norme New norme value
+
+ +
+

+ +

+
+ + + + + + + + + +
int setPalette (struct vdIn vd  ) 
+
+
+ +

+Fuction sets color pallete video device.

+

Parameters:
+ + +
vd Video device pointer
+
+ +

+Definition at line 260 of file camv4l.c. +

+References vdIn::bppIn, vdIn::formatIn, vdIn::framesizeIn, GetDepth(), vdIn::hdrheight, vdIn::hdrwidth, vdIn::pixTmp, SetVideoPict(), and vdIn::videopict. +

+Referenced by processvideo(). +

+

+


Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/index.html b/doc/html/index.html new file mode 100644 index 0000000..5ba1142 --- /dev/null +++ b/doc/html/index.html @@ -0,0 +1,8 @@ + + +Camera grab convert to MPEG + + + + + diff --git a/doc/html/main.html b/doc/html/main.html new file mode 100644 index 0000000..3a11b1f --- /dev/null +++ b/doc/html/main.html @@ -0,0 +1,21 @@ + + +Camera grab convert to MPEG: Main Page + + + + + +

Camera grab convert to MPEG Documentation

+

+

1.0


Generated on Mon Jan 26 20:51:50 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/modules.html b/doc/html/modules.html new file mode 100644 index 0000000..25f4ffc --- /dev/null +++ b/doc/html/modules.html @@ -0,0 +1,22 @@ + + +Camera grab convert to MPEG: Module Index + + + + + +

Camera grab convert to MPEG Modules

Here is a list of all modules: +
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/structvdIn.html b/doc/html/structvdIn.html new file mode 100644 index 0000000..c8eb31f --- /dev/null +++ b/doc/html/structvdIn.html @@ -0,0 +1,619 @@ + + +Camera grab convert to MPEG: vdIn Struct Reference + + + + + + +

vdIn Struct Reference

#include <camv4l.h> +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Data Fields

int fd
char * videodevice
video_mmap vmmap
video_capability videocap
int mmapsize
video_mbuf videombuf
video_picture videopict
video_window videowin
video_channel videochan
unsigned int format
int cameratype
char * cameraname
char * bridge
int sizenative
int sizeothers
int palette
int norme
int channel
int grabMethod
unsigned char * pFramebuffer
 > Grab Methode 1=mmap 0=read
unsigned char * pixTmp
int framesizeIn
int frame_cour
int bppIn
int hdrwidth
int hdrheight
int formatIn
int flipUV
+


Detailed Description

+Struct represents input capture device +

+ +

+Definition at line 54 of file camv4l.h.


Field Documentation

+ +
+
+ + + + +
int vdIn::fd
+
+
+ +

+ +

+Definition at line 55 of file camv4l.h. +

+Referenced by changeSize(), close_v4l(), GetVideoPict(), grab(), init_v4l(), probePalette(), probeSize(), and SetVideoPict(). +

+

+ +

+
+ + + + +
char* vdIn::videodevice
+
+
+ +

+ +

+Definition at line 56 of file camv4l.h. +

+Referenced by init_v4l(), and main(). +

+

+ +

+
+ + + + +
struct video_mmap vdIn::vmmap
+
+
+ +

+ +

+Definition at line 58 of file camv4l.h. +

+Referenced by changeSize(), grab(), and init_v4l(). +

+

+ +

+
+ + + + +
struct video_capability vdIn::videocap
+
+
+ +

+ +

+Definition at line 59 of file camv4l.h. +

+Referenced by init_v4l(), and probeSize(). +

+

+ +

+
+ + + + +
int vdIn::mmapsize
+
+
+ +

+ +

+Definition at line 60 of file camv4l.h. +

+Referenced by close_v4l(), and init_v4l(). +

+

+ +

+
+ + + + +
struct video_mbuf vdIn::videombuf
+
+
+ +

+ +

+Definition at line 61 of file camv4l.h. +

+Referenced by grab(), and init_v4l(). +

+

+ +

+
+ + + + +
struct video_picture vdIn::videopict
+
+
+ +

+ +

+Definition at line 62 of file camv4l.h. +

+Referenced by changeSize(), GetVideoPict(), init_v4l(), setBrightness(), setColors(), setContrast(), setPalette(), and SetVideoPict(). +

+

+ +

+
+ + + + +
struct video_window vdIn::videowin
+
+
+ +

+ +

+Definition at line 63 of file camv4l.h. +

+Referenced by changeSize(). +

+

+ +

+
+ + + + +
struct video_channel vdIn::videochan
+
+
+ +

+ +

+Definition at line 64 of file camv4l.h. +

+Referenced by init_v4l(). +

+

+ +

+
+ + + + +
unsigned int vdIn::format
+
+
+ +

+ +

+Definition at line 66 of file camv4l.h. +

+

+ +

+
+ + + + +
int vdIn::cameratype
+
+
+ +

+ +

+Definition at line 67 of file camv4l.h. +

+Referenced by init_v4l(). +

+

+ +

+
+ + + + +
char* vdIn::cameraname
+
+
+ +

+ +

+Definition at line 68 of file camv4l.h. +

+Referenced by init_v4l(), and main(). +

+

+ +

+
+ + + + +
char* vdIn::bridge
+
+
+ +

+ +

+Definition at line 69 of file camv4l.h. +

+Referenced by init_v4l(), and main(). +

+

+ +

+
+ + + + +
int vdIn::sizenative
+
+
+ +

+ +

+Definition at line 70 of file camv4l.h. +

+

+ +

+
+ + + + +
int vdIn::sizeothers
+
+
+ +

+ +

+Definition at line 71 of file camv4l.h. +

+Referenced by probeSize(). +

+

+ +

+
+ + + + +
int vdIn::palette
+
+
+ +

+ +

+Definition at line 72 of file camv4l.h. +

+Referenced by probePalette(). +

+

+ +

+
+ + + + +
int vdIn::norme
+
+
+ +

+ +

+Definition at line 73 of file camv4l.h. +

+

+ +

+
+ + + + +
int vdIn::channel
+
+
+ +

+ +

+Definition at line 74 of file camv4l.h. +

+

+ +

+
+ + + + +
int vdIn::grabMethod
+
+
+ +

+ +

+Definition at line 75 of file camv4l.h. +

+Referenced by changeSize(), close_v4l(), grab(), init_v4l(), and main(). +

+

+ +

+
+ + + + +
unsigned char* vdIn::pFramebuffer
+
+
+ +

+> Grab Methode 1=mmap 0=read +

+ +

+Definition at line 76 of file camv4l.h. +

+Referenced by close_v4l(), grab(), and init_v4l(). +

+

+ +

+
+ + + + +
unsigned char* vdIn::pixTmp
+
+
+ +

+ +

+Definition at line 77 of file camv4l.h. +

+Referenced by changeSize(), close_v4l(), grab(), main(), and setPalette(). +

+

+ +

+
+ + + + +
int vdIn::framesizeIn
+
+
+ +

+ +

+Definition at line 78 of file camv4l.h. +

+Referenced by changeSize(), grab(), init_v4l(), and setPalette(). +

+

+ +

+
+ + + + +
int vdIn::frame_cour
+
+
+ +

+ +

+Definition at line 79 of file camv4l.h. +

+

+ +

+
+ + + + +
int vdIn::bppIn
+
+
+ +

+ +

+Definition at line 80 of file camv4l.h. +

+Referenced by changeSize(), init_v4l(), probePalette(), and setPalette(). +

+

+ +

+
+ + + + +
int vdIn::hdrwidth
+
+
+ +

+ +

+Definition at line 81 of file camv4l.h. +

+Referenced by changeSize(), grab(), init_v4l(), probeSize(), processvideo(), and setPalette(). +

+

+ +

+
+ + + + +
int vdIn::hdrheight
+
+
+ +

+ +

+Definition at line 82 of file camv4l.h. +

+Referenced by changeSize(), grab(), init_v4l(), probeSize(), processvideo(), and setPalette(). +

+

+ +

+
+ + + + +
int vdIn::formatIn
+
+
+ +

+ +

+Definition at line 83 of file camv4l.h. +

+Referenced by changeSize(), grab(), init_v4l(), probePalette(), processvideo(), and setPalette(). +

+

+ +

+
+ + + + +
int vdIn::flipUV
+
+
+ +

+ +

+Definition at line 84 of file camv4l.h. +

+Referenced by grab(), and init_v4l(). +

+

+


The documentation for this struct was generated from the following file: +
Generated on Mon Jan 26 20:51:51 2009 for Camera grab convert to MPEG by  + +doxygen 1.5.1
+ + diff --git a/doc/html/tab_b.gif b/doc/html/tab_b.gif new file mode 100644 index 0000000..0d62348 Binary files /dev/null and b/doc/html/tab_b.gif differ diff --git a/doc/html/tab_l.gif b/doc/html/tab_l.gif new file mode 100644 index 0000000..9b1e633 Binary files /dev/null and b/doc/html/tab_l.gif differ diff --git a/doc/html/tab_r.gif b/doc/html/tab_r.gif new file mode 100644 index 0000000..ce9dd9f Binary files /dev/null and b/doc/html/tab_r.gif differ diff --git a/doc/html/tabs.css b/doc/html/tabs.css new file mode 100644 index 0000000..a61552a --- /dev/null +++ b/doc/html/tabs.css @@ -0,0 +1,102 @@ +/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ + +DIV.tabs +{ + float : left; + width : 100%; + background : url("tab_b.gif") repeat-x bottom; + margin-bottom : 4px; +} + +DIV.tabs UL +{ + margin : 0px; + padding-left : 10px; + list-style : none; +} + +DIV.tabs LI, DIV.tabs FORM +{ + display : inline; + margin : 0px; + padding : 0px; +} + +DIV.tabs FORM +{ + float : right; +} + +DIV.tabs A +{ + float : left; + background : url("tab_r.gif") no-repeat right top; + border-bottom : 1px solid #84B0C7; + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + +DIV.tabs A:hover +{ + background-position: 100% -150px; +} + +DIV.tabs A:link, DIV.tabs A:visited, +DIV.tabs A:active, DIV.tabs A:hover +{ + color: #1A419D; +} + +DIV.tabs SPAN +{ + float : left; + display : block; + background : url("tab_l.gif") no-repeat left top; + padding : 5px 9px; + white-space : nowrap; +} + +DIV.tabs INPUT +{ + float : right; + display : inline; + font-size : 1em; +} + +DIV.tabs TD +{ + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + + + +/* Commented Backslash Hack hides rule from IE5-Mac \*/ +DIV.tabs SPAN {float : none;} +/* End IE5-Mac hack */ + +DIV.tabs A:hover SPAN +{ + background-position: 0% -150px; +} + +DIV.tabs LI#current A +{ + background-position: 100% -150px; + border-width : 0px; +} + +DIV.tabs LI#current SPAN +{ + background-position: 0% -150px; + padding-bottom : 6px; +} + +DIV.nav +{ + background : none; + border : none; + border-bottom : 1px solid #84B0C7; +} diff --git a/doc/html/tree.html b/doc/html/tree.html new file mode 100644 index 0000000..6262290 --- /dev/null +++ b/doc/html/tree.html @@ -0,0 +1,85 @@ + + + + + + + TreeView + + + + +
+

Camera grab convert to MPEG

+ +
+ + diff --git a/doc/latex/FreeSans.ttf b/doc/latex/FreeSans.ttf new file mode 100644 index 0000000..b550b90 Binary files /dev/null and b/doc/latex/FreeSans.ttf differ diff --git a/doc/latex/Makefile b/doc/latex/Makefile new file mode 100644 index 0000000..a67f1b7 --- /dev/null +++ b/doc/latex/Makefile @@ -0,0 +1,17 @@ +all: clean refman.pdf + +refman.pdf: refman.tex + pdflatex refman.tex + makeindex refman.idx + pdflatex refman.tex + latex_count=5 ; \ + while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\ + do \ + echo "Rerunning latex...." ;\ + pdflatex refman.tex ;\ + latex_count=`expr $$latex_count - 1` ;\ + done + + +clean: + rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out refman.pdf diff --git a/doc/latex/annotated.tex b/doc/latex/annotated.tex new file mode 100644 index 0000000..bcaec59 --- /dev/null +++ b/doc/latex/annotated.tex @@ -0,0 +1,4 @@ +\section{Camera grab convert to MPEG Data Structures} +Here are the data structures with brief descriptions:\begin{CompactList} +\item\contentsline{section}{{\bf vd\-In} }{\pageref{structvdIn}}{} +\end{CompactList} diff --git a/doc/latex/camv4l_8c.tex b/doc/latex/camv4l_8c.tex new file mode 100644 index 0000000..f7187b1 --- /dev/null +++ b/doc/latex/camv4l_8c.tex @@ -0,0 +1,168 @@ +\section{camv4l.c File Reference} +\label{camv4l_8c}\index{camv4l.c@{camv4l.c}} +This file implement function. + +{\tt \#include \char`\"{}camv4l.h\char`\"{}}\par + + +Include dependency graph for camv4l.c:\subsection*{Defines} +\begin{CompactItemize} +\item +\#define {\bf LEN\_\-PALLETE}~4 +\end{CompactItemize} +\subsection*{Functions} +\begin{CompactItemize} +\item +static int {\bf Get\-Video\-Pict} (struct {\bf vd\-In} $\ast$vd) +\item +static int {\bf Set\-Video\-Pict} (struct {\bf vd\-In} $\ast$vd) +\item +static int {\bf Get\-Depth} (int format) +\item +static int {\bf probe\-Palette} (struct {\bf vd\-In} $\ast$vd) +\item +static int {\bf probe\-Size} (struct {\bf vd\-In} $\ast$vd) +\item +int {\bf init\_\-v4l} (struct {\bf vd\-In} $\ast$vd) +\item +int {\bf close\_\-v4l} (struct {\bf vd\-In} $\ast$vd) +\item +static void {\bf flip\-UV} (unsigned char $\ast$src, int format, int w, int h) +\item +int {\bf grab} (struct {\bf vd\-In} $\ast$vd) +\item +int {\bf set\-Palette} (struct {\bf vd\-In} $\ast$vd) +\item +int {\bf change\-Size} (struct {\bf vd\-In} $\ast$vd) +\item +\_\-\_\-u8 {\bf get\-Brightness} (struct {\bf vd\-In} $\ast$vdin) +\item +void {\bf set\-Brightness} (struct {\bf vd\-In} $\ast$vdin, \_\-\_\-u8 bright) +\item +\_\-\_\-u8 {\bf get\-Contrast} (struct {\bf vd\-In} $\ast$vdin) +\item +void {\bf set\-Contrast} (struct {\bf vd\-In} $\ast$vdin, \_\-\_\-u8 contrast) +\item +\_\-\_\-u8 {\bf get\-Colors} (struct {\bf vd\-In} $\ast$vdin) +\item +void {\bf set\-Colors} (struct {\bf vd\-In} $\ast$vdin, \_\-\_\-u8 colors) +\end{CompactItemize} +\subsection*{Variables} +\begin{CompactItemize} +\item +int {\bf PAL} [$\,$] = \{VIDEO\_\-PALETTE\_\-YUV420P,VIDEO\_\-PALETTE\_\-RGB565,VIDEO\_\-PALETTE\_\-RGB24,VIDEO\_\-PALETTE\_\-RGB32\} +\begin{CompactList}\small\item\em Definitions. \item\end{CompactList}\item +int {\bf SIZE} [$\,$] = \{ 640,480,384,288,352,288,320,240,192,144,176,144,160,120 \} +\end{CompactItemize} + + +\subsection{Detailed Description} +This file implement function. + + + +Definition in file {\bf camv4l.c}. + +\subsection{Define Documentation} +\index{camv4l.c@{camv4l.c}!LEN_PALLETE@{LEN\_\-PALLETE}} +\index{LEN_PALLETE@{LEN\_\-PALLETE}!camv4l.c@{camv4l.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define LEN\_\-PALLETE~4}\label{camv4l_8c_1ae3f99c00fbdb4eec4a4eb4fdfeacd0} + + + + +Definition at line 12 of file camv4l.c. + +Referenced by probe\-Palette(). + +\subsection{Function Documentation} +\index{camv4l.c@{camv4l.c}!flipUV@{flipUV}} +\index{flipUV@{flipUV}!camv4l.c@{camv4l.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static void flip\-UV (unsigned char $\ast$ {\em src}, int {\em format}, int {\em w}, int {\em h})\hspace{0.3cm}{\tt [static]}}\label{camv4l_8c_1da8db34b1923c570a40f54e2b22ca39} + + + + +Definition at line 151 of file camv4l.c. + +References i, VIDEO\_\-PALETTE\_\-RAW\_\-JPEG, VIDEO\_\-PALETTE\_\-RGB24, VIDEO\_\-PALETTE\_\-RGB32, VIDEO\_\-PALETTE\_\-RGB565, and VIDEO\_\-PALETTE\_\-YUV420P. + +Referenced by grab().\index{camv4l.c@{camv4l.c}!GetDepth@{GetDepth}} +\index{GetDepth@{GetDepth}!camv4l.c@{camv4l.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static int Get\-Depth (int {\em format})\hspace{0.3cm}{\tt [static]}}\label{camv4l_8c_283b0e82a3d74f512e682a8ac52659b7} + + + + +Definition at line 432 of file camv4l.c. + +References VIDEO\_\-PALETTE\_\-RAW\_\-JPEG, VIDEO\_\-PALETTE\_\-RGB24, VIDEO\_\-PALETTE\_\-RGB32, VIDEO\_\-PALETTE\_\-RGB565, and VIDEO\_\-PALETTE\_\-YUV420P. + +Referenced by change\-Size(), probe\-Palette(), and set\-Palette().\index{camv4l.c@{camv4l.c}!GetVideoPict@{GetVideoPict}} +\index{GetVideoPict@{GetVideoPict}!camv4l.c@{camv4l.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static int Get\-Video\-Pict (struct {\bf vd\-In} $\ast$ {\em vd})\hspace{0.3cm}{\tt [static]}}\label{camv4l_8c_8cb6f747fd7726860f771609946d09b3} + + + + +Definition at line 400 of file camv4l.c. + +References vd\-In::fd, and vd\-In::videopict. + +Referenced by change\-Size(), get\-Brightness(), get\-Colors(), get\-Contrast(), and init\_\-v4l().\index{camv4l.c@{camv4l.c}!probePalette@{probePalette}} +\index{probePalette@{probePalette}!camv4l.c@{camv4l.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static int probe\-Palette (struct {\bf vd\-In} $\ast$ {\em vd})\hspace{0.3cm}{\tt [static]}}\label{camv4l_8c_e2f8dd81ccfc3b70fdeb99b07586a1b1} + + + + +Definition at line 273 of file camv4l.c. + +References vd\-In::bpp\-In, vd\-In::fd, vd\-In::format\-In, Get\-Depth(), i, LEN\_\-PALLETE, PAL, and vd\-In::palette. + +Referenced by init\_\-v4l().\index{camv4l.c@{camv4l.c}!probeSize@{probeSize}} +\index{probeSize@{probeSize}!camv4l.c@{camv4l.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static int probe\-Size (struct {\bf vd\-In} $\ast$ {\em vd})\hspace{0.3cm}{\tt [static]}}\label{camv4l_8c_bee824dc095955f0175643284986b23e} + + + + +Definition at line 320 of file camv4l.c. + +References vd\-In::fd, vd\-In::hdrheight, vd\-In::hdrwidth, i, SIZE, vd\-In::sizeothers, and vd\-In::videocap. + +Referenced by init\_\-v4l().\index{camv4l.c@{camv4l.c}!SetVideoPict@{SetVideoPict}} +\index{SetVideoPict@{SetVideoPict}!camv4l.c@{camv4l.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static int Set\-Video\-Pict (struct {\bf vd\-In} $\ast$ {\em vd})\hspace{0.3cm}{\tt [static]}}\label{camv4l_8c_6391de2c695ffff5ba0a8632f6db3c1f} + + + + +Definition at line 416 of file camv4l.c. + +References vd\-In::fd, and vd\-In::videopict. + +Referenced by set\-Brightness(), set\-Colors(), set\-Contrast(), and set\-Palette(). + +\subsection{Variable Documentation} +\index{camv4l.c@{camv4l.c}!PAL@{PAL}} +\index{PAL@{PAL}!camv4l.c@{camv4l.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf PAL}[$\,$] = \{VIDEO\_\-PALETTE\_\-YUV420P,VIDEO\_\-PALETTE\_\-RGB565,VIDEO\_\-PALETTE\_\-RGB24,VIDEO\_\-PALETTE\_\-RGB32\}}\label{camv4l_8c_ee54b939c70ffe5540c8e77e8b75c331} + + +Definitions. + + + +Definition at line 10 of file camv4l.c. + +Referenced by probe\-Palette().\index{camv4l.c@{camv4l.c}!SIZE@{SIZE}} +\index{SIZE@{SIZE}!camv4l.c@{camv4l.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf SIZE}[$\,$] = \{ 640,480,384,288,352,288,320,240,192,144,176,144,160,120 \}}\label{camv4l_8c_26ffb7e515435a5ff2d24656ecacd181} + + + + +Definition at line 14 of file camv4l.c. + +Referenced by probe\-Size(). \ No newline at end of file diff --git a/doc/latex/camv4l_8c__incl.dot b/doc/latex/camv4l_8c__incl.dot new file mode 100644 index 0000000..e6d401b --- /dev/null +++ b/doc/latex/camv4l_8c__incl.dot @@ -0,0 +1,9 @@ +digraph G +{ + edge [fontname="FreeSans.ttf",fontsize=10,labelfontname="FreeSans.ttf",labelfontsize=10]; + node [fontname="FreeSans.ttf",fontsize=10,shape=record]; + rankdir=LR; + Node1 [label="camv4l.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; + Node1 -> Node2 [color="midnightblue",fontsize=10,style="solid"]; + Node2 [label="camv4l.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$camv4l_8h.html"]; +} diff --git a/doc/latex/camv4l_8c__incl.md5 b/doc/latex/camv4l_8c__incl.md5 new file mode 100644 index 0000000..3bd25ef --- /dev/null +++ b/doc/latex/camv4l_8c__incl.md5 @@ -0,0 +1 @@ +33442f9122a773e02075d330ac92f4f2 \ No newline at end of file diff --git a/doc/latex/camv4l_8h.tex b/doc/latex/camv4l_8h.tex new file mode 100644 index 0000000..52bc8df --- /dev/null +++ b/doc/latex/camv4l_8h.tex @@ -0,0 +1,190 @@ +\section{camv4l.h File Reference} +\label{camv4l_8h}\index{camv4l.h@{camv4l.h}} +{\tt \#include $<$stdio.h$>$}\par +{\tt \#include $<$unistd.h$>$}\par +{\tt \#include $<$stdlib.h$>$}\par +{\tt \#include $<$string.h$>$}\par +{\tt \#include $<$fcntl.h$>$}\par +{\tt \#include $<$signal.h$>$}\par +{\tt \#include $<$errno.h$>$}\par +{\tt \#include $<$time.h$>$}\par +{\tt \#include $<$math.h$>$}\par +{\tt \#include $<$stdarg.h$>$}\par +{\tt \#include $<$linux/types.h$>$}\par +{\tt \#include $<$linux/videodev.h$>$}\par +{\tt \#include $<$sys/mman.h$>$}\par +{\tt \#include $<$sys/ioctl.h$>$}\par +{\tt \#include $<$sys/file.h$>$}\par +{\tt \#include $<$sys/types.h$>$}\par +{\tt \#include $<$sys/stat.h$>$}\par + + +Include dependency graph for camv4l.h: + +This graph shows which files directly or indirectly include this file:\subsection*{Data Structures} +\begin{CompactItemize} +\item +struct {\bf vd\-In} +\end{CompactItemize} +\subsection*{Defines} +\begin{CompactItemize} +\item +\#define {\bf DWIDTH}~320 +\item +\#define {\bf DHEIGHT}~240 +\item +\#define {\bf VIDEO\_\-PALETTE\_\-RGB565}~3 +\item +\#define {\bf VIDEO\_\-PALETTE\_\-RGB24}~4 +\item +\#define {\bf VIDEO\_\-PALETTE\_\-RGB32}~5 +\item +\#define {\bf VIDEO\_\-PALETTE\_\-YUV420P}~15 +\item +\#define {\bf VIDEO\_\-PALETTE\_\-RAW\_\-JPEG}~20 +\end{CompactItemize} +\subsection*{Enumerations} +\begin{CompactItemize} +\item +enum {\bf cam\_\-form} \{ \par +{\bf JPEG}, +{\bf YUVY}, +{\bf YYUV}, +{\bf YUYV}, +\par +{\bf GREY}, +{\bf GBRG}, +{\bf UNKNOW} + \} +\end{CompactItemize} +\subsection*{Functions} +\begin{CompactItemize} +\item +int {\bf init\_\-v4l} (struct {\bf vd\-In} $\ast$vd) +\item +int {\bf grab} (struct {\bf vd\-In} $\ast$vd) +\item +int {\bf close\_\-v4l} (struct {\bf vd\-In} $\ast$vd) +\item +int {\bf set\-Palette} (struct {\bf vd\-In} $\ast$vd) +\item +int {\bf change\-Size} (struct {\bf vd\-In} $\ast$vd) +\item +\_\-\_\-u8 {\bf get\-Brightness} (struct {\bf vd\-In} $\ast$vd) +\item +void {\bf set\-Brightness} (struct {\bf vd\-In} $\ast$vd, \_\-\_\-u8 bright) +\item +\_\-\_\-u8 {\bf get\-Contrast} (struct {\bf vd\-In} $\ast$vd) +\item +void {\bf set\-Contrast} (struct {\bf vd\-In} $\ast$vd, \_\-\_\-u8 contrast) +\item +\_\-\_\-u8 {\bf get\-Colors} (struct {\bf vd\-In} $\ast$vd) +\item +void {\bf set\-Colors} (struct {\bf vd\-In} $\ast$vd, \_\-\_\-u8 colors) +\item +\_\-\_\-u8 {\bf get\-Norme} (struct {\bf vd\-In} $\ast$vd) +\item +void {\bf set\-Norme} (struct {\bf vd\-In} $\ast$vd, \_\-\_\-u8 norme) +\item +\_\-\_\-u8 {\bf get\-Channel} (struct {\bf vd\-In} $\ast$vd) +\item +void {\bf set\-Channel} (struct {\bf vd\-In} $\ast$vd, \_\-\_\-u8 channel) +\end{CompactItemize} + + +\subsection{Detailed Description} + + +Definition in file {\bf camv4l.h}. + +\subsection{Define Documentation} +\index{camv4l.h@{camv4l.h}!DHEIGHT@{DHEIGHT}} +\index{DHEIGHT@{DHEIGHT}!camv4l.h@{camv4l.h}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define DHEIGHT~240}\label{camv4l_8h_2c0e9cadedb91327295c0249e8a3ad6f} + + + + +Definition at line 28 of file camv4l.h.\index{camv4l.h@{camv4l.h}!DWIDTH@{DWIDTH}} +\index{DWIDTH@{DWIDTH}!camv4l.h@{camv4l.h}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define DWIDTH~320}\label{camv4l_8h_7f32e26ea2ffbc0c5408e65b30d4f0c8} + + + + +Definition at line 27 of file camv4l.h.\index{camv4l.h@{camv4l.h}!VIDEO_PALETTE_RAW_JPEG@{VIDEO\_\-PALETTE\_\-RAW\_\-JPEG}} +\index{VIDEO_PALETTE_RAW_JPEG@{VIDEO\_\-PALETTE\_\-RAW\_\-JPEG}!camv4l.h@{camv4l.h}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define VIDEO\_\-PALETTE\_\-RAW\_\-JPEG~20}\label{camv4l_8h_f86678f63c4ac31acaf68b38d90d94a9} + + + + +Definition at line 35 of file camv4l.h. + +Referenced by flip\-UV(), and Get\-Depth().\index{camv4l.h@{camv4l.h}!VIDEO_PALETTE_RGB24@{VIDEO\_\-PALETTE\_\-RGB24}} +\index{VIDEO_PALETTE_RGB24@{VIDEO\_\-PALETTE\_\-RGB24}!camv4l.h@{camv4l.h}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define VIDEO\_\-PALETTE\_\-RGB24~4}\label{camv4l_8h_8dd93a2c957ded118f8ff17680cbf220} + + + + +Definition at line 32 of file camv4l.h. + +Referenced by flip\-UV(), and Get\-Depth().\index{camv4l.h@{camv4l.h}!VIDEO_PALETTE_RGB32@{VIDEO\_\-PALETTE\_\-RGB32}} +\index{VIDEO_PALETTE_RGB32@{VIDEO\_\-PALETTE\_\-RGB32}!camv4l.h@{camv4l.h}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define VIDEO\_\-PALETTE\_\-RGB32~5}\label{camv4l_8h_d50994973596a30826522de0701ad02b} + + + + +Definition at line 33 of file camv4l.h. + +Referenced by flip\-UV(), and Get\-Depth().\index{camv4l.h@{camv4l.h}!VIDEO_PALETTE_RGB565@{VIDEO\_\-PALETTE\_\-RGB565}} +\index{VIDEO_PALETTE_RGB565@{VIDEO\_\-PALETTE\_\-RGB565}!camv4l.h@{camv4l.h}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define VIDEO\_\-PALETTE\_\-RGB565~3}\label{camv4l_8h_dbf692218d97fffa111494787562d9e8} + + + + +Definition at line 31 of file camv4l.h. + +Referenced by flip\-UV(), and Get\-Depth().\index{camv4l.h@{camv4l.h}!VIDEO_PALETTE_YUV420P@{VIDEO\_\-PALETTE\_\-YUV420P}} +\index{VIDEO_PALETTE_YUV420P@{VIDEO\_\-PALETTE\_\-YUV420P}!camv4l.h@{camv4l.h}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define VIDEO\_\-PALETTE\_\-YUV420P~15}\label{camv4l_8h_dea1e94780da3ba61a1a1d9a11affdd2} + + + + +Definition at line 34 of file camv4l.h. + +Referenced by flip\-UV(), Get\-Depth(), and processvideo(). + +\subsection{Enumeration Type Documentation} +\index{camv4l.h@{camv4l.h}!cam_form@{cam\_\-form}} +\index{cam_form@{cam\_\-form}!camv4l.h@{camv4l.h}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf cam\_\-form}}\label{camv4l_8h_2f8d40fca22af63d98fcaad73efe2161} + + +Camera type format date \begin{Desc} +\item[Enumerator: ]\par +\begin{description} +\index{JPEG@{JPEG}!camv4l.h@{camv4l.h}}\index{camv4l.h@{camv4l.h}!JPEG@{JPEG}}\item[{\em +JPEG\label{camv4l_8h_2f8d40fca22af63d98fcaad73efe216196f4d8a8c2070cf7bdd2236a48eae07a} +}]\index{YUVY@{YUVY}!camv4l.h@{camv4l.h}}\index{camv4l.h@{camv4l.h}!YUVY@{YUVY}}\item[{\em +YUVY\label{camv4l_8h_2f8d40fca22af63d98fcaad73efe21619c6051edb55a8fb694528d81aa2c92dc} +}]\index{YYUV@{YYUV}!camv4l.h@{camv4l.h}}\index{camv4l.h@{camv4l.h}!YYUV@{YYUV}}\item[{\em +YYUV\label{camv4l_8h_2f8d40fca22af63d98fcaad73efe21614dd75c8cff6ed2dad455d9b1e3066a7c} +}]\index{YUYV@{YUYV}!camv4l.h@{camv4l.h}}\index{camv4l.h@{camv4l.h}!YUYV@{YUYV}}\item[{\em +YUYV\label{camv4l_8h_2f8d40fca22af63d98fcaad73efe21610105757557d0eed9bac6f9f1c0185a0b} +}]\index{GREY@{GREY}!camv4l.h@{camv4l.h}}\index{camv4l.h@{camv4l.h}!GREY@{GREY}}\item[{\em +GREY\label{camv4l_8h_2f8d40fca22af63d98fcaad73efe216138566822dbd9408c447abfd3ed4a85d2} +}]\index{GBRG@{GBRG}!camv4l.h@{camv4l.h}}\index{camv4l.h@{camv4l.h}!GBRG@{GBRG}}\item[{\em +GBRG\label{camv4l_8h_2f8d40fca22af63d98fcaad73efe21613cae9f5260ee8e2b52164f174e076fa2} +}]\index{UNKNOW@{UNKNOW}!camv4l.h@{camv4l.h}}\index{camv4l.h@{camv4l.h}!UNKNOW@{UNKNOW}}\item[{\em +UNKNOW\label{camv4l_8h_2f8d40fca22af63d98fcaad73efe216109b024ff449662360c66ce18d20096fa} +}]\end{description} +\end{Desc} + + + +Definition at line 41 of file camv4l.h. \ No newline at end of file diff --git a/doc/latex/camv4l_8h__dep__incl.dot b/doc/latex/camv4l_8h__dep__incl.dot new file mode 100644 index 0000000..d96f724 --- /dev/null +++ b/doc/latex/camv4l_8h__dep__incl.dot @@ -0,0 +1,11 @@ +digraph G +{ + edge [fontname="FreeSans.ttf",fontsize=10,labelfontname="FreeSans.ttf",labelfontsize=10]; + node [fontname="FreeSans.ttf",fontsize=10,shape=record]; + rankdir=LR; + Node1 [label="camv4l.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; + Node1 -> Node2 [dir=back,color="midnightblue",fontsize=10,style="solid"]; + Node2 [label="camv4l.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$camv4l_8c.html"]; + Node1 -> Node3 [dir=back,color="midnightblue",fontsize=10,style="solid"]; + Node3 [label="grab_mpeg.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$grab__mpeg_8c.html"]; +} diff --git a/doc/latex/camv4l_8h__dep__incl.md5 b/doc/latex/camv4l_8h__dep__incl.md5 new file mode 100644 index 0000000..1e7c147 --- /dev/null +++ b/doc/latex/camv4l_8h__dep__incl.md5 @@ -0,0 +1 @@ +3f8b84c8ad7b2fe4457b586bee2792c8 \ No newline at end of file diff --git a/doc/latex/camv4l_8h__incl.dot b/doc/latex/camv4l_8h__incl.dot new file mode 100644 index 0000000..8c0a945 --- /dev/null +++ b/doc/latex/camv4l_8h__incl.dot @@ -0,0 +1,41 @@ +digraph G +{ + edge [fontname="FreeSans.ttf",fontsize=10,labelfontname="FreeSans.ttf",labelfontsize=10]; + node [fontname="FreeSans.ttf",fontsize=10,shape=record]; + rankdir=LR; + Node1 [label="camv4l.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; + Node1 -> Node2 [color="midnightblue",fontsize=10,style="solid"]; + Node2 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node3 [color="midnightblue",fontsize=10,style="solid"]; + Node3 [label="unistd.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node4 [color="midnightblue",fontsize=10,style="solid"]; + Node4 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node5 [color="midnightblue",fontsize=10,style="solid"]; + Node5 [label="string.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node6 [color="midnightblue",fontsize=10,style="solid"]; + Node6 [label="fcntl.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node7 [color="midnightblue",fontsize=10,style="solid"]; + Node7 [label="signal.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node8 [color="midnightblue",fontsize=10,style="solid"]; + Node8 [label="errno.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node9 [color="midnightblue",fontsize=10,style="solid"]; + Node9 [label="time.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node10 [color="midnightblue",fontsize=10,style="solid"]; + Node10 [label="math.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node11 [color="midnightblue",fontsize=10,style="solid"]; + Node11 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node12 [color="midnightblue",fontsize=10,style="solid"]; + Node12 [label="linux/types.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node13 [color="midnightblue",fontsize=10,style="solid"]; + Node13 [label="linux/videodev.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node14 [color="midnightblue",fontsize=10,style="solid"]; + Node14 [label="sys/mman.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node15 [color="midnightblue",fontsize=10,style="solid"]; + Node15 [label="sys/ioctl.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node16 [color="midnightblue",fontsize=10,style="solid"]; + Node16 [label="sys/file.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node17 [color="midnightblue",fontsize=10,style="solid"]; + Node17 [label="sys/types.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node18 [color="midnightblue",fontsize=10,style="solid"]; + Node18 [label="sys/stat.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; +} diff --git a/doc/latex/camv4l_8h__incl.md5 b/doc/latex/camv4l_8h__incl.md5 new file mode 100644 index 0000000..3500021 --- /dev/null +++ b/doc/latex/camv4l_8h__incl.md5 @@ -0,0 +1 @@ +33e57600d273717acb96e14e29a60ce5 \ No newline at end of file diff --git a/doc/latex/doxygen.sty b/doc/latex/doxygen.sty new file mode 100644 index 0000000..60c0c7c --- /dev/null +++ b/doc/latex/doxygen.sty @@ -0,0 +1,78 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{doxygen} +\RequirePackage{calc} +\RequirePackage{array} +\pagestyle{fancyplain} +\newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}} +\renewcommand{\chaptermark}[1]{\markboth{#1}{}} +\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} +\lhead[\fancyplain{}{\bfseries\thepage}] + {\fancyplain{}{\bfseries\rightmark}} +\rhead[\fancyplain{}{\bfseries\leftmark}] + {\fancyplain{}{\bfseries\thepage}} +\rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Mon Jan 26 20:51:50 2009 for Camera grab convert to MPEG by Doxygen }]{} +\lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Mon Jan 26 20:51:50 2009 for Camera grab convert to MPEG by Doxygen }} +\cfoot{} +\newenvironment{Code} +{\footnotesize} +{\normalsize} +\newcommand{\doxyref}[3]{\textbf{#1} (\textnormal{#2}\,\pageref{#3})} +\newenvironment{DocInclude} +{\footnotesize} +{\normalsize} +\newenvironment{VerbInclude} +{\footnotesize} +{\normalsize} +\newenvironment{Image} +{\begin{figure}[H]} +{\end{figure}} +\newenvironment{ImageNoCaption}{}{} +\newenvironment{CompactList} +{\begin{list}{}{ + \setlength{\leftmargin}{0.5cm} + \setlength{\itemsep}{0pt} + \setlength{\parsep}{0pt} + \setlength{\topsep}{0pt} + \renewcommand{\makelabel}{\hfill}}} +{\end{list}} +\newenvironment{CompactItemize} +{ + \begin{itemize} + \setlength{\itemsep}{-3pt} + \setlength{\parsep}{0pt} + \setlength{\topsep}{0pt} + \setlength{\partopsep}{0pt} +} +{\end{itemize}} +\newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp} +\newlength{\tmplength} +\newenvironment{TabularC}[1] +{ +\setlength{\tmplength} + {\linewidth/(#1)-\tabcolsep*2-\arrayrulewidth*(#1+1)/(#1)} + \par\begin{tabular*}{\linewidth} + {*{#1}{|>{\PBS\raggedright\hspace{0pt}}p{\the\tmplength}}|} +} +{\end{tabular*}\par} +\newcommand{\entrylabel}[1]{ + {\parbox[b]{\labelwidth-4pt}{\makebox[0pt][l]{\textbf{#1}}\vspace{1.5\baselineskip}}}} +\newenvironment{Desc} +{\begin{list}{} + { + \settowidth{\labelwidth}{40pt} + \setlength{\leftmargin}{\labelwidth} + \setlength{\parsep}{0pt} + \setlength{\itemsep}{-4pt} + \renewcommand{\makelabel}{\entrylabel} + } +} +{\end{list}} +\newenvironment{Indent} + {\begin{list}{}{\setlength{\leftmargin}{0.5cm}} + \item[]\ignorespaces} + {\unskip\end{list}} +\setlength{\parindent}{0cm} +\setlength{\parskip}{0.2cm} +\addtocounter{secnumdepth}{1} +\sloppy +\usepackage[T1]{fontenc} diff --git a/doc/latex/files.tex b/doc/latex/files.tex new file mode 100644 index 0000000..f83fa99 --- /dev/null +++ b/doc/latex/files.tex @@ -0,0 +1,6 @@ +\section{Camera grab convert to MPEG File List} +Here is a list of all files with brief descriptions:\begin{CompactList} +\item\contentsline{section}{{\bf camv4l.c} (This file implement function )}{\pageref{camv4l_8c}}{} +\item\contentsline{section}{{\bf camv4l.h} }{\pageref{camv4l_8h}}{} +\item\contentsline{section}{{\bf grab\_\-mpeg.c} (This is the main file where application run )}{\pageref{grab__mpeg_8c}}{} +\end{CompactList} diff --git a/doc/latex/grab__mpeg_8c.tex b/doc/latex/grab__mpeg_8c.tex new file mode 100644 index 0000000..1d0b8c6 --- /dev/null +++ b/doc/latex/grab__mpeg_8c.tex @@ -0,0 +1,223 @@ +\section{grab\_\-mpeg.c File Reference} +\label{grab__mpeg_8c}\index{grab_mpeg.c@{grab\_\-mpeg.c}} +This is the main file where application run. + +{\tt \#include $<$stdlib.h$>$}\par +{\tt \#include $<$stdio.h$>$}\par +{\tt \#include $<$string.h$>$}\par +{\tt \#include \char`\"{}camv4l.h\char`\"{}}\par +{\tt \#include $<$ffmpeg/avcodec.h$>$}\par + + +Include dependency graph for grab\_\-mpeg.c:\subsection*{Functions} +\begin{CompactItemize} +\item +void {\bf processvideo} () +\item +void {\bf video\_\-encode\_\-alloc} (const char $\ast$filename, uint8\_\-t $\ast$in\_\-buffer) +\item +void {\bf video\_\-encode\_\-mpeg} () +\item +void {\bf video\_\-encode\_\-free} () +\item +int {\bf main} (int count, char $\ast$strings[$\,$]) +\end{CompactItemize} +\subsection*{Variables} +\begin{CompactItemize} +\item +AVCodec $\ast$ {\bf codec} +\begin{CompactList}\small\item\em Codec. \item\end{CompactList}\item +AVCodec\-Context $\ast$ {\bf c} +\begin{CompactList}\small\item\em Contex of codec. \item\end{CompactList}\item +int {\bf i} +\item +int {\bf out\_\-size} +\item +int {\bf size} +\item +FILE $\ast$ {\bf f} +\begin{CompactList}\small\item\em File name. \item\end{CompactList}\item +AVFrame $\ast$ {\bf picture} +\begin{CompactList}\small\item\em Frame of picture. \item\end{CompactList}\item +uint8\_\-t $\ast$ {\bf outbuf} +\begin{CompactList}\small\item\em Output mpeg frame. \item\end{CompactList}\item +int {\bf outbuf\_\-size} +\item +{\bf vd\-In} {\bf myvid\-In} +\begin{CompactList}\small\item\em V4L device. \item\end{CompactList}\end{CompactItemize} + + +\subsection{Detailed Description} +This is the main file where application run. + + + +Definition in file {\bf grab\_\-mpeg.c}. + +\subsection{Function Documentation} +\index{grab_mpeg.c@{grab\_\-mpeg.c}!main@{main}} +\index{main@{main}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int main (int {\em count}, char $\ast$ {\em strings}[$\,$])}\label{grab__mpeg_8c_99ed24fde392ba5e0c427c04cd8ad429} + + +The main function \begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em count}]Count of byte \item[{\em strings}]String after run sequnce of aplicationss \end{description} +\end{Desc} +\begin{Desc} +\item[Returns:]0 if all good \end{Desc} + + +Definition at line 88 of file grab\_\-mpeg.c. + +References vd\-In::bridge, c, vd\-In::cameraname, close\_\-v4l(), vd\-In::grab\-Method, init\_\-v4l(), myvid\-In, vd\-In::pix\-Tmp, processvideo(), video\_\-encode\_\-alloc(), video\_\-encode\_\-free(), and vd\-In::videodevice.\index{grab_mpeg.c@{grab\_\-mpeg.c}!processvideo@{processvideo}} +\index{processvideo@{processvideo}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void processvideo ()}\label{grab__mpeg_8c_28603e93ac81b15f759127bbfdc7cb37} + + +Function make frame from videodevice and send to. + +Definition at line 137 of file grab\_\-mpeg.c. + +References vd\-In::format\-In, grab(), vd\-In::hdrheight, vd\-In::hdrwidth, myvid\-In, set\-Palette(), video\_\-encode\_\-mpeg(), and VIDEO\_\-PALETTE\_\-YUV420P. + +Referenced by main().\index{grab_mpeg.c@{grab\_\-mpeg.c}!video_encode_alloc@{video\_\-encode\_\-alloc}} +\index{video_encode_alloc@{video\_\-encode\_\-alloc}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void video\_\-encode\_\-alloc (const char $\ast$ {\em filename}, uint8\_\-t $\ast$ {\em in\_\-buffer})}\label{grab__mpeg_8c_dedd16f8b46d848fe3ef6179dd54956c} + + +Alloc and set codec + +Definition at line 162 of file grab\_\-mpeg.c. + +References c, codec, f, outbuf, outbuf\_\-size, picture, and size. + +Referenced by main().\index{grab_mpeg.c@{grab\_\-mpeg.c}!video_encode_free@{video\_\-encode\_\-free}} +\index{video_encode_free@{video\_\-encode\_\-free}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void video\_\-encode\_\-free ()}\label{grab__mpeg_8c_074665588885b7b51505b9331ba690e9} + + +Free memory + +Definition at line 227 of file grab\_\-mpeg.c. + +References c, f, i, out\_\-size, outbuf, outbuf\_\-size, and picture. + +Referenced by main().\index{grab_mpeg.c@{grab\_\-mpeg.c}!video_encode_mpeg@{video\_\-encode\_\-mpeg}} +\index{video_encode_mpeg@{video\_\-encode\_\-mpeg}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void video\_\-encode\_\-mpeg ()}\label{grab__mpeg_8c_aadbb0611fc321cf111d581db0ff62e4} + + +Encode global buffer from picture . + +Definition at line 218 of file grab\_\-mpeg.c. + +References c, f, out\_\-size, outbuf, outbuf\_\-size, and picture. + +Referenced by processvideo(). + +\subsection{Variable Documentation} +\index{grab_mpeg.c@{grab\_\-mpeg.c}!c@{c}} +\index{c@{c}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}AVCodec\-Context$\ast$ {\bf c}}\label{grab__mpeg_8c_e7991e0075301e249fa7d40d5b0eec81} + + +Contex of codec. + + + +Definition at line 40 of file grab\_\-mpeg.c. + +Referenced by main(), video\_\-encode\_\-alloc(), video\_\-encode\_\-free(), and video\_\-encode\_\-mpeg().\index{grab_mpeg.c@{grab\_\-mpeg.c}!codec@{codec}} +\index{codec@{codec}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}AVCodec$\ast$ {\bf codec}}\label{grab__mpeg_8c_3d92780da6f5146c4f47f425dd151d96} + + +Codec. + + + +Definition at line 37 of file grab\_\-mpeg.c. + +Referenced by video\_\-encode\_\-alloc().\index{grab_mpeg.c@{grab\_\-mpeg.c}!f@{f}} +\index{f@{f}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}FILE$\ast$ {\bf f}}\label{grab__mpeg_8c_3efb0e1a16208deecbd84c15401f7cf8} + + +File name. + + + +Definition at line 47 of file grab\_\-mpeg.c. + +Referenced by init\_\-v4l(), video\_\-encode\_\-alloc(), video\_\-encode\_\-free(), and video\_\-encode\_\-mpeg().\index{grab_mpeg.c@{grab\_\-mpeg.c}!i@{i}} +\index{i@{i}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf i}}\label{grab__mpeg_8c_cb559820d9ca11295b4500f179ef6392} + + + + +Definition at line 42 of file grab\_\-mpeg.c. + +Referenced by flip\-UV(), probe\-Palette(), probe\-Size(), and video\_\-encode\_\-free().\index{grab_mpeg.c@{grab\_\-mpeg.c}!myvidIn@{myvidIn}} +\index{myvidIn@{myvidIn}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf vd\-In} {\bf myvid\-In}}\label{grab__mpeg_8c_d282c1ee4754687cc4e30bce27cedf8f} + + +V4L device. + + + +Definition at line 59 of file grab\_\-mpeg.c. + +Referenced by main(), and processvideo().\index{grab_mpeg.c@{grab\_\-mpeg.c}!out_size@{out\_\-size}} +\index{out_size@{out\_\-size}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf out\_\-size}}\label{grab__mpeg_8c_6b2e93f2f2db9a65b19a2487c6b1f78b} + + + + +Definition at line 43 of file grab\_\-mpeg.c. + +Referenced by video\_\-encode\_\-free(), and video\_\-encode\_\-mpeg().\index{grab_mpeg.c@{grab\_\-mpeg.c}!outbuf@{outbuf}} +\index{outbuf@{outbuf}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t$\ast$ {\bf outbuf}}\label{grab__mpeg_8c_a85f3649904a9e7c4d21c42f95a2eac8} + + +Output mpeg frame. + + + +Definition at line 53 of file grab\_\-mpeg.c. + +Referenced by video\_\-encode\_\-alloc(), video\_\-encode\_\-free(), and video\_\-encode\_\-mpeg().\index{grab_mpeg.c@{grab\_\-mpeg.c}!outbuf_size@{outbuf\_\-size}} +\index{outbuf_size@{outbuf\_\-size}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf outbuf\_\-size}}\label{grab__mpeg_8c_7143b1416521b958e981da0f56586e8e} + + + + +Definition at line 55 of file grab\_\-mpeg.c. + +Referenced by video\_\-encode\_\-alloc(), video\_\-encode\_\-free(), and video\_\-encode\_\-mpeg().\index{grab_mpeg.c@{grab\_\-mpeg.c}!picture@{picture}} +\index{picture@{picture}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}AVFrame$\ast$ {\bf picture}}\label{grab__mpeg_8c_65f6cfcea30372e03b387bd67c2f8a8d} + + +Frame of picture. + + + +Definition at line 50 of file grab\_\-mpeg.c. + +Referenced by video\_\-encode\_\-alloc(), video\_\-encode\_\-free(), and video\_\-encode\_\-mpeg().\index{grab_mpeg.c@{grab\_\-mpeg.c}!size@{size}} +\index{size@{size}!grab_mpeg.c@{grab\_\-mpeg.c}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf size}}\label{grab__mpeg_8c_439227feff9d7f55384e8780cfc2eb82} + + + + +Definition at line 44 of file grab\_\-mpeg.c. + +Referenced by grab(), and video\_\-encode\_\-alloc(). \ No newline at end of file diff --git a/doc/latex/grab__mpeg_8c__incl.dot b/doc/latex/grab__mpeg_8c__incl.dot new file mode 100644 index 0000000..b0327a4 --- /dev/null +++ b/doc/latex/grab__mpeg_8c__incl.dot @@ -0,0 +1,20 @@ +digraph G +{ + edge [fontname="FreeSans.ttf",fontsize=10,labelfontname="FreeSans.ttf",labelfontsize=10]; + node [fontname="FreeSans.ttf",fontsize=10,shape=record]; + rankdir=LR; + Node1 [label="grab_mpeg.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; + Node1 -> Node2 [color="midnightblue",fontsize=10,style="solid"]; + Node2 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node3 [color="midnightblue",fontsize=10,style="solid"]; + Node3 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node4 [color="midnightblue",fontsize=10,style="solid"]; + Node4 [label="string.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; + Node1 -> Node5 [color="midnightblue",fontsize=10,style="solid"]; + Node5 [label="camv4l.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$camv4l_8h.html"]; + Node5 -> Node3 [color="midnightblue",fontsize=10,style="solid"]; + Node5 -> Node2 [color="midnightblue",fontsize=10,style="solid"]; + Node5 -> Node4 [color="midnightblue",fontsize=10,style="solid"]; + Node1 -> Node6 [color="midnightblue",fontsize=10,style="solid"]; + Node6 [label="ffmpeg/avcodec.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; +} diff --git a/doc/latex/grab__mpeg_8c__incl.md5 b/doc/latex/grab__mpeg_8c__incl.md5 new file mode 100644 index 0000000..e8e620b --- /dev/null +++ b/doc/latex/grab__mpeg_8c__incl.md5 @@ -0,0 +1 @@ +8bc2630b6091e88fd91f6822f1462d11 \ No newline at end of file diff --git a/doc/latex/group__common.tex b/doc/latex/group__common.tex new file mode 100644 index 0000000..2366a4b --- /dev/null +++ b/doc/latex/group__common.tex @@ -0,0 +1,295 @@ +\section{Common} +\label{group__common}\index{Common@{Common}} +Grab form camere, transfer to the MPEG and transmitt to the LAN. +\subsection*{Functions} +\begin{CompactItemize} +\item +int {\bf init\_\-v4l} (struct {\bf vd\-In} $\ast$vd) +\item +int {\bf grab} (struct {\bf vd\-In} $\ast$vd) +\item +int {\bf close\_\-v4l} (struct {\bf vd\-In} $\ast$vd) +\item +int {\bf set\-Palette} (struct {\bf vd\-In} $\ast$vd) +\item +int {\bf change\-Size} (struct {\bf vd\-In} $\ast$vd) +\item +\_\-\_\-u8 {\bf get\-Brightness} (struct {\bf vd\-In} $\ast$vd) +\item +void {\bf set\-Brightness} (struct {\bf vd\-In} $\ast$vd, \_\-\_\-u8 bright) +\item +\_\-\_\-u8 {\bf get\-Contrast} (struct {\bf vd\-In} $\ast$vd) +\item +void {\bf set\-Contrast} (struct {\bf vd\-In} $\ast$vd, \_\-\_\-u8 contrast) +\item +\_\-\_\-u8 {\bf get\-Colors} (struct {\bf vd\-In} $\ast$vd) +\item +void {\bf set\-Colors} (struct {\bf vd\-In} $\ast$vd, \_\-\_\-u8 colors) +\item +\_\-\_\-u8 {\bf get\-Norme} (struct {\bf vd\-In} $\ast$vd) +\item +void {\bf set\-Norme} (struct {\bf vd\-In} $\ast$vd, \_\-\_\-u8 norme) +\item +\_\-\_\-u8 {\bf get\-Channel} (struct {\bf vd\-In} $\ast$vd) +\item +void {\bf set\-Channel} (struct {\bf vd\-In} $\ast$vd, \_\-\_\-u8 channel) +\end{CompactItemize} + + +\subsection{Detailed Description} +Grab form camere, transfer to the MPEG and transmitt to the LAN. + +This application handle USB camere. + +\begin{Desc} +\item[Note:]Note.\end{Desc} +\begin{Desc} +\item[Author:](last to touch it) \begin{Desc} +\item[Author]zial (Ales Zikmund)\end{Desc} +\end{Desc} +\begin{Desc} +\item[Version:]\begin{Desc} +\item[Revision]1.0 \end{Desc} +\end{Desc} +\begin{Desc} +\item[Date:]\begin{Desc} +\item[Date]2008/12/12 5:45:20 \end{Desc} +\end{Desc} +Contact: {\tt zikmua1@fel.cvut.cz} + +Created on: Wed Dec 13 18:39:37 2008 + +\subsection{Function Documentation} +\index{common@{common}!changeSize@{changeSize}} +\index{changeSize@{changeSize}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int change\-Size (struct {\bf vd\-In} $\ast$ {\em vd})}\label{group__common_gc42ddb12fdb3b8855b07988e18d09432} + + +Fuction change size of image array video device. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \end{description} +\end{Desc} + + +Definition at line 368 of file camv4l.c. + +References vd\-In::bpp\-In, vd\-In::fd, vd\-In::format\-In, vd\-In::framesize\-In, Get\-Depth(), Get\-Video\-Pict(), vd\-In::grab\-Method, vd\-In::hdrheight, vd\-In::hdrwidth, vd\-In::pix\-Tmp, vd\-In::videopict, vd\-In::videowin, and vd\-In::vmmap.\index{common@{common}!close_v4l@{close\_\-v4l}} +\index{close_v4l@{close\_\-v4l}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int close\_\-v4l (struct {\bf vd\-In} $\ast$ {\em vd})}\label{group__common_ga7b6cf1c3b04b4758f8c256879c96672} + + +Fuction close v4l device. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \end{description} +\end{Desc} + + +Definition at line 137 of file camv4l.c. + +References vd\-In::fd, vd\-In::grab\-Method, vd\-In::mmapsize, vd\-In::p\-Framebuffer, and vd\-In::pix\-Tmp. + +Referenced by main().\index{common@{common}!getBrightness@{getBrightness}} +\index{getBrightness@{getBrightness}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\_\-\_\-u8 get\-Brightness (struct {\bf vd\-In} $\ast$ {\em vd})}\label{group__common_ga35212f7c527f755fd38ed31f6567876} + + +Fuction get brightness from the camera. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \end{description} +\end{Desc} + + +Definition at line 465 of file camv4l.c. + +References Get\-Video\-Pict().\index{common@{common}!getChannel@{getChannel}} +\index{getChannel@{getChannel}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\_\-\_\-u8 get\-Channel (struct {\bf vd\-In} $\ast$ {\em vd})}\label{group__common_g0f30a35aefb43f696c8700e8ee086158} + + +Fuction get channel from the camera. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \end{description} +\end{Desc} +\index{common@{common}!getColors@{getColors}} +\index{getColors@{getColors}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\_\-\_\-u8 get\-Colors (struct {\bf vd\-In} $\ast$ {\em vd})}\label{group__common_g099243def65c4c72efa563e1c3a95f6a} + + +Fuction get colors from the camera. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \end{description} +\end{Desc} + + +Definition at line 503 of file camv4l.c. + +References Get\-Video\-Pict().\index{common@{common}!getContrast@{getContrast}} +\index{getContrast@{getContrast}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\_\-\_\-u8 get\-Contrast (struct {\bf vd\-In} $\ast$ {\em vd})}\label{group__common_g27a2a2aa5b19632b19ebc8c0652b097e} + + +Fuction get contrast from the camera. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \end{description} +\end{Desc} + + +Definition at line 485 of file camv4l.c. + +References Get\-Video\-Pict().\index{common@{common}!getNorme@{getNorme}} +\index{getNorme@{getNorme}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\_\-\_\-u8 get\-Norme (struct {\bf vd\-In} $\ast$ {\em vd})}\label{group__common_g31aba12be45387bd98ccf111606f15e6} + + +Fuction get norme from the camera. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \end{description} +\end{Desc} +\index{common@{common}!grab@{grab}} +\index{grab@{grab}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int grab (struct {\bf vd\-In} $\ast$ {\em vd})}\label{group__common_g2b042146ea433ba800a754e3d056a86d} + + +Fuction for initialization v4l device. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \end{description} +\end{Desc} + + +Definition at line 212 of file camv4l.c. + +References vd\-In::fd, flip\-UV(), vd\-In::flip\-UV, vd\-In::format\-In, vd\-In::framesize\-In, vd\-In::grab\-Method, vd\-In::hdrheight, vd\-In::hdrwidth, vd\-In::p\-Framebuffer, vd\-In::pix\-Tmp, size, vd\-In::videombuf, and vd\-In::vmmap. + +Referenced by processvideo().\index{common@{common}!init_v4l@{init\_\-v4l}} +\index{init_v4l@{init\_\-v4l}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int init\_\-v4l (struct {\bf vd\-In} $\ast$ {\em vd})}\label{group__common_gdc0c206abad8d7210c57022190f93dc4} + + +Fuction for initialization v4l device. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \end{description} +\end{Desc} + + +Definition at line 31 of file camv4l.c. + +References vd\-In::bpp\-In, vd\-In::bridge, vd\-In::cameraname, vd\-In::cameratype, f, vd\-In::fd, vd\-In::flip\-UV, vd\-In::format\-In, vd\-In::framesize\-In, Get\-Video\-Pict(), vd\-In::grab\-Method, vd\-In::hdrheight, vd\-In::hdrwidth, vd\-In::mmapsize, vd\-In::p\-Framebuffer, probe\-Palette(), probe\-Size(), UNKNOW, vd\-In::videocap, vd\-In::videochan, vd\-In::videodevice, vd\-In::videombuf, vd\-In::videopict, and vd\-In::vmmap. + +Referenced by main().\index{common@{common}!setBrightness@{setBrightness}} +\index{setBrightness@{setBrightness}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void set\-Brightness (struct {\bf vd\-In} $\ast$ {\em vd}, \_\-\_\-u8 {\em bright})}\label{group__common_ge1d8001afa8f1cbe9ff187e53e9089bb} + + +Fuction set brightness to the camera. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \item[{\em bright}]New brightness value \end{description} +\end{Desc} + + +Definition at line 475 of file camv4l.c. + +References Set\-Video\-Pict(), and vd\-In::videopict.\index{common@{common}!setChannel@{setChannel}} +\index{setChannel@{setChannel}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void set\-Channel (struct {\bf vd\-In} $\ast$ {\em vd}, \_\-\_\-u8 {\em channel})}\label{group__common_g934ec7ef103b0ad6b7f319b289c13094} + + +Fuction set channels to the camera. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \item[{\em channel}]New channel value \end{description} +\end{Desc} +\index{common@{common}!setColors@{setColors}} +\index{setColors@{setColors}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void set\-Colors (struct {\bf vd\-In} $\ast$ {\em vd}, \_\-\_\-u8 {\em colors})}\label{group__common_g20703b2ca537132fde1e0a9fccbfd6c5} + + +Fuction set colors to the camera. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \item[{\em colors}]New colors value \end{description} +\end{Desc} + + +Definition at line 513 of file camv4l.c. + +References Set\-Video\-Pict(), and vd\-In::videopict.\index{common@{common}!setContrast@{setContrast}} +\index{setContrast@{setContrast}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void set\-Contrast (struct {\bf vd\-In} $\ast$ {\em vd}, \_\-\_\-u8 {\em contrast})}\label{group__common_g3386f2919710868906af5025aa220f64} + + +Fuction set contrast to the camera. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \item[{\em contrast}]New contrast value \end{description} +\end{Desc} + + +Definition at line 495 of file camv4l.c. + +References Set\-Video\-Pict(), and vd\-In::videopict.\index{common@{common}!setNorme@{setNorme}} +\index{setNorme@{setNorme}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void set\-Norme (struct {\bf vd\-In} $\ast$ {\em vd}, \_\-\_\-u8 {\em norme})}\label{group__common_ga723eaba9e11996dc99e8dace7b87aa5} + + +Fuction set norme to the camera. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \item[{\em norme}]New norme value \end{description} +\end{Desc} +\index{common@{common}!setPalette@{setPalette}} +\index{setPalette@{setPalette}!common@{common}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int set\-Palette (struct {\bf vd\-In} $\ast$ {\em vd})}\label{group__common_g4f1b347f61daa1e55c12a2a3ebb22ee3} + + +Fuction sets color pallete video device. + +\begin{Desc} +\item[Parameters:] +\begin{description} +\item[{\em vd}]Video device pointer \end{description} +\end{Desc} + + +Definition at line 260 of file camv4l.c. + +References vd\-In::bpp\-In, vd\-In::format\-In, vd\-In::framesize\-In, Get\-Depth(), vd\-In::hdrheight, vd\-In::hdrwidth, vd\-In::pix\-Tmp, Set\-Video\-Pict(), and vd\-In::videopict. + +Referenced by processvideo(). \ No newline at end of file diff --git a/doc/latex/modules.tex b/doc/latex/modules.tex new file mode 100644 index 0000000..b8aa623 --- /dev/null +++ b/doc/latex/modules.tex @@ -0,0 +1,4 @@ +\section{Camera grab convert to MPEG Modules} +Here is a list of all modules:\begin{CompactList} +\item \contentsline{section}{Common}{\pageref{group__common}}{} +\end{CompactList} diff --git a/doc/latex/refman.tex b/doc/latex/refman.tex new file mode 100644 index 0000000..13aebc6 --- /dev/null +++ b/doc/latex/refman.tex @@ -0,0 +1,46 @@ +\documentclass[a4paper]{book} +\usepackage{a4wide} +\usepackage{makeidx} +\usepackage{fancyhdr} +\usepackage{graphicx} +\usepackage{multicol} +\usepackage{float} +\usepackage{textcomp} +\usepackage{alltt} +\usepackage{times} +\usepackage{doxygen} +\makeindex +\setcounter{tocdepth}{1} +\renewcommand{\footrulewidth}{0.4pt} +\begin{document} +\begin{titlepage} +\vspace*{7cm} +\begin{center} +{\Large Camera grab convert to MPEG Reference Manual\\[1ex]\large 1.0 }\\ +\vspace*{1cm} +{\large Generated by Doxygen 1.5.1}\\ +\vspace*{0.5cm} +{\small Mon Jan 26 20:51:50 2009}\\ +\end{center} +\end{titlepage} +\clearemptydoublepage +\pagenumbering{roman} +\tableofcontents +\clearemptydoublepage +\pagenumbering{arabic} +\chapter{Camera grab convert to MPEG Module Index} +\input{modules} +\chapter{Camera grab convert to MPEG Data Structure Index} +\input{annotated} +\chapter{Camera grab convert to MPEG File Index} +\input{files} +\chapter{Camera grab convert to MPEG Module Documentation} +\input{group__common} +\chapter{Camera grab convert to MPEG Data Structure Documentation} +\input{structvdIn} +\chapter{Camera grab convert to MPEG File Documentation} +\input{camv4l_8c} +\include{camv4l_8h} +\include{grab__mpeg_8c} +\printindex +\end{document} diff --git a/doc/latex/structvdIn.tex b/doc/latex/structvdIn.tex new file mode 100644 index 0000000..cced9db --- /dev/null +++ b/doc/latex/structvdIn.tex @@ -0,0 +1,322 @@ +\section{vd\-In Struct Reference} +\label{structvdIn}\index{vdIn@{vdIn}} +{\tt \#include $<$camv4l.h$>$} + +\subsection*{Data Fields} +\begin{CompactItemize} +\item +int {\bf fd} +\item +char $\ast$ {\bf videodevice} +\item +video\_\-mmap {\bf vmmap} +\item +video\_\-capability {\bf videocap} +\item +int {\bf mmapsize} +\item +video\_\-mbuf {\bf videombuf} +\item +video\_\-picture {\bf videopict} +\item +video\_\-window {\bf videowin} +\item +video\_\-channel {\bf videochan} +\item +unsigned int {\bf format} +\item +int {\bf cameratype} +\item +char $\ast$ {\bf cameraname} +\item +char $\ast$ {\bf bridge} +\item +int {\bf sizenative} +\item +int {\bf sizeothers} +\item +int {\bf palette} +\item +int {\bf norme} +\item +int {\bf channel} +\item +int {\bf grab\-Method} +\item +unsigned char $\ast$ {\bf p\-Framebuffer} +\begin{CompactList}\small\item\em $>$ Grab Methode 1=mmap 0=read \item\end{CompactList}\item +unsigned char $\ast$ {\bf pix\-Tmp} +\item +int {\bf framesize\-In} +\item +int {\bf frame\_\-cour} +\item +int {\bf bpp\-In} +\item +int {\bf hdrwidth} +\item +int {\bf hdrheight} +\item +int {\bf format\-In} +\item +int {\bf flip\-UV} +\end{CompactItemize} + + +\subsection{Detailed Description} +Struct represents input capture device + + + +Definition at line 54 of file camv4l.h. + +\subsection{Field Documentation} +\index{vdIn@{vd\-In}!fd@{fd}} +\index{fd@{fd}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::fd}}\label{structvdIn_1fa060f09cd0b1a126c5cfe7f8755aa0} + + + + +Definition at line 55 of file camv4l.h. + +Referenced by change\-Size(), close\_\-v4l(), Get\-Video\-Pict(), grab(), init\_\-v4l(), probe\-Palette(), probe\-Size(), and Set\-Video\-Pict().\index{vdIn@{vd\-In}!videodevice@{videodevice}} +\index{videodevice@{videodevice}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ {\bf vd\-In::videodevice}}\label{structvdIn_a5bc365f449fae0bacc9ef7e813dfcdd} + + + + +Definition at line 56 of file camv4l.h. + +Referenced by init\_\-v4l(), and main().\index{vdIn@{vd\-In}!vmmap@{vmmap}} +\index{vmmap@{vmmap}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct video\_\-mmap {\bf vd\-In::vmmap}}\label{structvdIn_c9dc3dcb02f1472c47022ccc9f7a642a} + + + + +Definition at line 58 of file camv4l.h. + +Referenced by change\-Size(), grab(), and init\_\-v4l().\index{vdIn@{vd\-In}!videocap@{videocap}} +\index{videocap@{videocap}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct video\_\-capability {\bf vd\-In::videocap}}\label{structvdIn_6ff6c76abc3558e5065c29f7a4e22e62} + + + + +Definition at line 59 of file camv4l.h. + +Referenced by init\_\-v4l(), and probe\-Size().\index{vdIn@{vd\-In}!mmapsize@{mmapsize}} +\index{mmapsize@{mmapsize}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::mmapsize}}\label{structvdIn_b3e9cc01144f94caa3b30bde3ec7a353} + + + + +Definition at line 60 of file camv4l.h. + +Referenced by close\_\-v4l(), and init\_\-v4l().\index{vdIn@{vd\-In}!videombuf@{videombuf}} +\index{videombuf@{videombuf}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct video\_\-mbuf {\bf vd\-In::videombuf}}\label{structvdIn_f87db67e1e35c6699921cb9fa9712e95} + + + + +Definition at line 61 of file camv4l.h. + +Referenced by grab(), and init\_\-v4l().\index{vdIn@{vd\-In}!videopict@{videopict}} +\index{videopict@{videopict}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct video\_\-picture {\bf vd\-In::videopict}}\label{structvdIn_8f8297f0c56d57dcb8fe6dc70c80b357} + + + + +Definition at line 62 of file camv4l.h. + +Referenced by change\-Size(), Get\-Video\-Pict(), init\_\-v4l(), set\-Brightness(), set\-Colors(), set\-Contrast(), set\-Palette(), and Set\-Video\-Pict().\index{vdIn@{vd\-In}!videowin@{videowin}} +\index{videowin@{videowin}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct video\_\-window {\bf vd\-In::videowin}}\label{structvdIn_0e7511ef2c4e487b09c0cf0786cde912} + + + + +Definition at line 63 of file camv4l.h. + +Referenced by change\-Size().\index{vdIn@{vd\-In}!videochan@{videochan}} +\index{videochan@{videochan}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct video\_\-channel {\bf vd\-In::videochan}}\label{structvdIn_962c1ced095a997ba8715b281cf53e9e} + + + + +Definition at line 64 of file camv4l.h. + +Referenced by init\_\-v4l().\index{vdIn@{vd\-In}!format@{format}} +\index{format@{format}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int {\bf vd\-In::format}}\label{structvdIn_2aa4853006d92f1445ad83a91159693f} + + + + +Definition at line 66 of file camv4l.h.\index{vdIn@{vd\-In}!cameratype@{cameratype}} +\index{cameratype@{cameratype}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::cameratype}}\label{structvdIn_eabdb3eeaf3a80b396cf19fec19d9294} + + + + +Definition at line 67 of file camv4l.h. + +Referenced by init\_\-v4l().\index{vdIn@{vd\-In}!cameraname@{cameraname}} +\index{cameraname@{cameraname}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ {\bf vd\-In::cameraname}}\label{structvdIn_676d43607601940f318ee3b274e4716b} + + + + +Definition at line 68 of file camv4l.h. + +Referenced by init\_\-v4l(), and main().\index{vdIn@{vd\-In}!bridge@{bridge}} +\index{bridge@{bridge}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ {\bf vd\-In::bridge}}\label{structvdIn_4dcb789ec776b466e9e0ee388686e3b6} + + + + +Definition at line 69 of file camv4l.h. + +Referenced by init\_\-v4l(), and main().\index{vdIn@{vd\-In}!sizenative@{sizenative}} +\index{sizenative@{sizenative}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::sizenative}}\label{structvdIn_ce0f632ba9e72c3801f77f04f5a5376b} + + + + +Definition at line 70 of file camv4l.h.\index{vdIn@{vd\-In}!sizeothers@{sizeothers}} +\index{sizeothers@{sizeothers}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::sizeothers}}\label{structvdIn_c9e3e139d21e29564e594b3375bc14bf} + + + + +Definition at line 71 of file camv4l.h. + +Referenced by probe\-Size().\index{vdIn@{vd\-In}!palette@{palette}} +\index{palette@{palette}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::palette}}\label{structvdIn_c14641e9e17d20d732e717f3d2d4abe6} + + + + +Definition at line 72 of file camv4l.h. + +Referenced by probe\-Palette().\index{vdIn@{vd\-In}!norme@{norme}} +\index{norme@{norme}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::norme}}\label{structvdIn_92643e1a47d62b760a57fa2746d9e148} + + + + +Definition at line 73 of file camv4l.h.\index{vdIn@{vd\-In}!channel@{channel}} +\index{channel@{channel}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::channel}}\label{structvdIn_a5d5047850f329a3bf4be872615552ad} + + + + +Definition at line 74 of file camv4l.h.\index{vdIn@{vd\-In}!grabMethod@{grabMethod}} +\index{grabMethod@{grabMethod}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::grab\-Method}}\label{structvdIn_faaf5caccac448b15a6f350cd02756b3} + + + + +Definition at line 75 of file camv4l.h. + +Referenced by change\-Size(), close\_\-v4l(), grab(), init\_\-v4l(), and main().\index{vdIn@{vd\-In}!pFramebuffer@{pFramebuffer}} +\index{pFramebuffer@{pFramebuffer}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned char$\ast$ {\bf vd\-In::p\-Framebuffer}}\label{structvdIn_d25392b0e37b39942b75f36ef87b6de7} + + +$>$ Grab Methode 1=mmap 0=read + + + +Definition at line 76 of file camv4l.h. + +Referenced by close\_\-v4l(), grab(), and init\_\-v4l().\index{vdIn@{vd\-In}!pixTmp@{pixTmp}} +\index{pixTmp@{pixTmp}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned char$\ast$ {\bf vd\-In::pix\-Tmp}}\label{structvdIn_ab1c2508d67a5ad1ec88bf69b0a41fb7} + + + + +Definition at line 77 of file camv4l.h. + +Referenced by change\-Size(), close\_\-v4l(), grab(), main(), and set\-Palette().\index{vdIn@{vd\-In}!framesizeIn@{framesizeIn}} +\index{framesizeIn@{framesizeIn}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::framesize\-In}}\label{structvdIn_cc3732f98af3fe5088007d0b7b08cdca} + + + + +Definition at line 78 of file camv4l.h. + +Referenced by change\-Size(), grab(), init\_\-v4l(), and set\-Palette().\index{vdIn@{vd\-In}!frame_cour@{frame\_\-cour}} +\index{frame_cour@{frame\_\-cour}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::frame\_\-cour}}\label{structvdIn_6418a49afd84cd22a8318fa4768a6713} + + + + +Definition at line 79 of file camv4l.h.\index{vdIn@{vd\-In}!bppIn@{bppIn}} +\index{bppIn@{bppIn}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::bpp\-In}}\label{structvdIn_d8c35d451233262ff9a8f8e65be8b340} + + + + +Definition at line 80 of file camv4l.h. + +Referenced by change\-Size(), init\_\-v4l(), probe\-Palette(), and set\-Palette().\index{vdIn@{vd\-In}!hdrwidth@{hdrwidth}} +\index{hdrwidth@{hdrwidth}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::hdrwidth}}\label{structvdIn_21a92e9c30017da96ee881bef3469f18} + + + + +Definition at line 81 of file camv4l.h. + +Referenced by change\-Size(), grab(), init\_\-v4l(), probe\-Size(), processvideo(), and set\-Palette().\index{vdIn@{vd\-In}!hdrheight@{hdrheight}} +\index{hdrheight@{hdrheight}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::hdrheight}}\label{structvdIn_2de78c4cff91808eb64ccab86e8d56b9} + + + + +Definition at line 82 of file camv4l.h. + +Referenced by change\-Size(), grab(), init\_\-v4l(), probe\-Size(), processvideo(), and set\-Palette().\index{vdIn@{vd\-In}!formatIn@{formatIn}} +\index{formatIn@{formatIn}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::format\-In}}\label{structvdIn_da1a8b7c0f40c9d997f8e8fddd4bc27d} + + + + +Definition at line 83 of file camv4l.h. + +Referenced by change\-Size(), grab(), init\_\-v4l(), probe\-Palette(), processvideo(), and set\-Palette().\index{vdIn@{vd\-In}!flipUV@{flipUV}} +\index{flipUV@{flipUV}!vdIn@{vd\-In}} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf vd\-In::flip\-UV}}\label{structvdIn_3f2e15b67a340cc20fd9d8503afa574b} + + + + +Definition at line 84 of file camv4l.h. + +Referenced by grab(), and init\_\-v4l(). + +The documentation for this struct was generated from the following file:\begin{CompactItemize} +\item +{\bf camv4l.h}\end{CompactItemize} diff --git a/grab_mpeg.c b/grab_mpeg.c new file mode 100644 index 0000000..92cf180 --- /dev/null +++ b/grab_mpeg.c @@ -0,0 +1,283 @@ +/** + * \defgroup common + * + * \brief Grab form camere, transfer to the MPEG and transmitt to the LAN + * + * This application handle USB camere. + * + * \note Note. + * + * \author (last to touch it) $Author: zial (Ales Zikmund)$ + * + * \version $Revision: 1.0 $ + * + * \date $Date: 2008/12/12 5:45:20 $ + * + * Contact: zikmua1@fel.cvut.cz + * + * Created on: Wed Dec 13 18:39:37 2008 + * + */ + +/** + * \file grab_mpeg.c + * + * \brief This is the main file where application run. + * + */ +#include +#include +#include + +#include "camv4l.h" +#include + + +///Codec +AVCodec *codec; + +///Contex of codec +AVCodecContext *c; + +int i; +int out_size; +int size; + +///File name +FILE *f; + +///Frame of picture +AVFrame *picture; + +///Output mpeg frame +uint8_t *outbuf; +//Size of output +int outbuf_size; + +///Max count of frame +int max_frame; + +///V4L device +struct vdIn myvidIn; + +/** + * Function make frame from videodevice and send to. + */ +void processvideo (); + +/** + * Alloc and set codec + */ +void video_encode_alloc(const char *filename,uint8_t* in_buffer); + +/** + * Encode global buffer from picture . + */ +void video_encode_mpeg(); + +/** + * Free memory + */ +void video_encode_free(); + + +/** + * The main function + * \param count Count of byte + * \param strings String after run sequnce of aplicationss + * \return 1 if all good + */ +int main(int argc, char *argv[]) +{ + c= NULL; + int retval; + + const char *videodev ="/dev/video0"; + const char *filename = "pokus.mpg"; + + max_frame=300; + + + for (i = 1; i < argc; i++){ + /* skip bad arguments */ + if (argv[i] == NULL || *argv[i] == 0 || *argv[i] != '-'){ + continue; + } + if (strcmp (argv[i], "-f") == 0){ + if (i + 1 >= argc){ + printf ("No parameter specified with -f, aborting.\n"); + exit (1); + } + max_frame = atoi(argv[i + 1]); + } + if (strcmp (argv[i], "-d") == 0){ + if (i + 1 >= argc){ + printf ("No parameter specified with -d, aborting.\n"); + exit (1); + } + videodev = strdup (argv[i + 1]); + } + if (strcmp (argv[i], "-h") == 0) { + printf ("usage: grab_mpeg [-h -f] \n"); + printf ("-h print this help \n"); + printf ("-d /dev/videoX use videoX device\n"); + printf ("-f count of frame \n"); + exit (0); + } + } + + printf("Video device %s frames %d\n",videodev,max_frame); + + int grabmethod = 1; //or 0 + + printf("Open %s\n",videodev); + + /* make room for init data */ + myvidIn.videodevice = NULL; + myvidIn.cameraname = NULL; + myvidIn.bridge = NULL; + myvidIn.videodevice = (char *) realloc (myvidIn.videodevice, 16); + myvidIn.cameraname = (char *) realloc (myvidIn.cameraname, 32); + myvidIn.bridge = (char *) realloc (myvidIn.bridge, 9); + myvidIn.grabMethod = grabmethod; // 1 mmap 0 read + snprintf (myvidIn.videodevice, 12, "%s", videodev); + printf ("video device %s\n", myvidIn.videodevice); + retval=init_v4l (&myvidIn); + printf("Device was been initialized %d \n",retval); + + video_encode_alloc(filename,myvidIn.pixTmp); + + processvideo(); + + video_encode_free(); + + free (myvidIn.videodevice); + free (myvidIn.cameraname); + free (myvidIn.bridge); + close_v4l (&myvidIn); + + printf("Close \n"); + + return 1; +} + + + +void processvideo () +{ + int run = 1; + int cnt=0; + + //set size of video + myvidIn.hdrwidth = 384; + myvidIn.hdrheight = 288; + myvidIn.formatIn = VIDEO_PALETTE_YUV420P; + /* input data maybe a jpeg one */ + setPalette (&myvidIn); + + while (run){ + grab (&myvidIn); + + if(cnt>2) + video_encode_mpeg(); + + //sleep(1); + cnt++; + if(cnt==max_frame){run=0;} + printf("Frame %d\n",cnt); + } +} + +void video_encode_alloc(const char *filename,uint8_t* in_buffer){ + + /* must be called before using avcodec lib */ + avcodec_init(); + + /* register all the codecs */ + avcodec_register_all(); + + //printf("Video encoding\n"); + /* find the mpeg1 video encoder */ + codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO); + if (!codec) { + fprintf(stderr, "codec not found\n"); + exit(1); + } + + c= avcodec_alloc_context(); + picture= avcodec_alloc_frame(); + /* put sample parameters */ + c->bit_rate = 1000000; + /* resolution must be a multiple of two */ + c->width = 384; + c->height = 288; + /* frames per second */ + c->time_base= (AVRational){1,60}; + c->gop_size = 10; /* emit one intra frame every ten frames */ + c->max_b_frames=1; + c->pix_fmt = PIX_FMT_YUV420P; + + /* open codec */ + if (avcodec_open(c, codec) < 0) { + fprintf(stderr, "could not open codec\n"); + exit(1); + } + + f = fopen(filename, "wb"); + if (!f) { + fprintf(stderr, "could not open %s\n", filename); + exit(1); + } + + /* alloc image and output buffer */ + //buffer pro zakodovany obrazek mpegem + outbuf_size = 100000; + outbuf = malloc(outbuf_size); + + size = c->width * c->height; + + picture->data[0] = in_buffer; + picture->data[1] = picture->data[0] + size; + picture->data[2] = picture->data[1] + size / 4; + picture->linesize[0] = c->width; + picture->linesize[1] = c->width / 2; + picture->linesize[2] = c->width / 2; +} + +void video_encode_mpeg(){ + + /* encode the image */ + out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture); + //printf("encoding frame %3d (size=%5d)\n", i, out_size); + fwrite(outbuf, 1, out_size, f); +} + + +void video_encode_free(){ + + /* get the delayed frames */ + for(; out_size; i++) { + fflush(stdout); + out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); + printf("write frame %3d (size=%5d)\n", i, out_size); + fwrite(outbuf, 1, out_size, f); + } + + /* add sequence end code to have a real mpeg file */ + outbuf[0] = 0x00; + outbuf[1] = 0x00; + outbuf[2] = 0x01; + outbuf[3] = 0xb7; + + fwrite(outbuf, 1, 4, f); + + fclose(f); + //free(picture_buf); + free(outbuf); + + avcodec_close(c); + av_free(c); + av_free(picture); + printf("\n"); + printf("video codev was been freed\n"); +}