CAPTURE Class Reference

SUMMARY.....: Class for manipulates video capture. More...

#include <funcoesHAIRCAPTURE.h>

Collaboration diagram for CAPTURE:

Collaboration graph
[legend]

Public Member Functions

void AdjustVideo (int lintMOVEMENT)
 Adjust video live.
void Background (char *name)
 Define JPEG background.
 CAPTURE ()
 SUMMARY.....: Construtor.
.
void Circle (int lintx, int linty, int lintrad, int lintR, int lintG, int lintB, TypeSurface lsurfaceScreen=TEXTS)
 Draw a circle over live video.
void ClearSurface (TypeSurface lsurfaceScreen, bool lboolSurface=false)
 Clear all surface.
void ClearSurface (TypeSurface lsurfaceScreen, int lintX, int lintY, int lintW, int lintH)
 Clear surface position.
void ColorBit (int depth)
 Set color bit video.
void convertYUV420PtoGray (void)
 Convert map image YUV to GrayScale.
void convertYUV420PtoRGB (bool forDISK)
 Convert frame YUV to RGB.
void DefinePositionButton (int lintBUTTON, int lintX, int lintY, int lintW, int lintH)
 Define the position button.
int FindButton (int lintX, int lintY)
 Scan a Button.
void FullScreen (void)
 Enable/Disable full Screen mode.
int GetLastButton (void)
 Get last Button.
std::string GetTouch (int lintX, int lintY, int linSize_font=30, bool lboolShadow=true)
 Wait the reading of the virtual keyboard, and write the text.
void HideMouse (void)
 Hide mouse cursor.
void InicializeWin (void)
 Inicialize screen main.
void Line (int lintx1, int linty1, int lintx2, int linty2, int lintR, int lintG, int lintB, TypeSurface lsurfaceScreen=TEXTS)
 Draw line over live video.
void Live (void)
 Thread of video live (Internal method ).
void LoadBMP (char *lcharBMP)
 Read read a bitmap file over live video.
void LoadJPG (char *name, int lintX=0, int lintY=0, float lfloatSCALE=0.5, TypeSurface lsurfaceScreen=TEXTS, int lintAngleRotate=0)
 Load frame in JPEG format file.
int MaxHeight (void)
 Return the Max height of the main window.
int MaxWidth (void)
 Return the Max witdth of the main window.
void Open (void)
 Open device video.
void PlayMPEG (char *name)
 Play MPEG video file.
void Progress (char *lcharText, int lintPROGRESS, int lintTOTAL)
 Draw progress bar.
void Rectangle (int lintx1, int linty1, int lintx2, int linty2, int lintR, int lintG, int lintB, TypeSurface lsurfaceScreen=TEXTS)
 Draw rectangle over live video.
void RectangleFill (int lintx1, int linty1, int lintx2, int linty2, int lintR, int lintG, int lintB, TypeSurface lsurfaceScreen=TEXTS)
 Draw rectangle fill over live video.
void RectangleZoom (int lintx1, int linty1, int lintx2, int linty2, int lintR, int lintG, int lintB)
 Draw rectangle over surface zoomout.
void Resolution (int width, int height)
 Define resolution video.
void ResolutionWin (int width, int height)
 Define window resolution.
bool SaveJPG (char *name, bool lboolFRAMEGRAY=false)
 Save frame in JPEG format file.
void SavePPM (char *name)
 Save frame in PPM format file.
void SelectAdjust (int lintMOVEMENT)
 Select Adjust video live.
void SelectBrightness (int lintVALUE)
 Select the function brightness.
void SelectColor (int lintVALUE)
 Select the function color.
void SelectContrast (int lintVALUE)
 Select the function contrast.
void SelectHue (void)
 Select the function hue.
void SetAngleText (int lintAngle)
 Define the angle for rotation text.
void SetAngleVideo (int lintAngle)
 Define the angle for rotation text surface.
void SetColorFont (int lintR, int lintG, int lintB)
 Define the color font.
void SetDevice (char *lDevice)
 Define video device.
void SetFont (char *lfontName)
 Define truetype model font.
void SetFontSize (int lintSize)
 Define font size.
void SetFormatPalette (int lFormat)
 Define format video palete.
void SetHardwareCaptureCard (void)
 Set the property for operation in Capture Card.
void SetHardwareWebCam (void)
 Set the property for operation in webcam.
void SetImageFile (char *lcharImageFile, TypeImage ltypeimageType)
 Define image file and type.
void SetInputCamera (int lInput, int lVideoMode)
 Define mode input camera.
void SetInputChannel (int lintVALUE)
 Set input channel.
void SetInputTelevision (int lVideoMode)
 Define mode input television.
void SetKeyFullScreeen (SDLKey Lkey)
 Define Full Screen key.
void SetKeyQuit (SDLKey Lkey)
 Define quit key.
void SetKeySaveFrame (SDLKey Lkey)
 Define save frame key.
void SetKeyVideoOn (SDLKey Lkey)
 Set key for play mpeg video.
void SetKeyZoomOutOff (SDLKey Lkey)
 Define function Off-ZoomOut key.
void SetKeyZoomOutOn (SDLKey Lkey)
 Define function On-ZoomOut key.
void SetMaxTextTouch (int lintVALUE)
 Set the max lenght for input touchscreen.
void SetTransparent (int lintR, int lintG, int lintB)
 Define transparent color.
void SetVideoPos (int x, int y)
 Define video live position.
void Show (void)
 Show live video.
void ShowMouse (void)
 Hide mouse cursor.
void swap_rgb24 (void)
 Convert map image to RGB.
int TouchScreen (bool lboolSTATUS)
 On/Off Touch Screen Display.
void VideoCapture (void)
 Save frame in the disk.
void VideoCreate (void)
 Create device video.
void VideoInicialize (void)
 Inicialize screen of the video capture.
void VideoTerminate (void)
 Terminate screen video capture.
void ViewLastMap (int lintX, int lintY, float lfloatSCALE, TypeSurface lsurfaceScreen=TEXTS)
 Show the last frame saved.
void WaitForVideo (void)
 Wait the ending thread (live video -Internal method ).
void WriteScreen (unsigned char *tmap)
 Write memory map in the screen.
void WriteText (int lintx, int linty, char *lcharText)
 Write text over live video.
void WriteText (int lintx, int linty, char *lcharText, int lintSIZE, bool lboolSHADOW)
 Write text over live video.
void ZoomOut (bool lboolStatus)
 On/Off show zoomout.
 ~CAPTURE ()
 SUMMARY.....: Destrutor.
.

Data Fields

bool AudioEnabled
 Enable audio.
bool debug
 Display debug msg.
int fd
 File device video.
bool GrabZoom
 Function GrabZoom.
std::string imageFile
 IMAGE file name.
int LastButton
 LastButton code.
int lintTouchX
 Internal variable for conversion X and Y.
int lintTouchY
TypeImage typeImageFile
 Type image file.
bool UseDraw
 Show surface draw?
bool UseText
 Show surface text?
bool UseVideo
 Show surface video mpeg?
bool UseZoomOut
 Show surface zoomout?

Private Attributes

int adjustVIDEO
 Ajust Picture.
char * arqPPM
 PPM file name.
video_audio audio
 Audio properties.
video_mbuf buffers
 Capability of the buffer.
video_capability capability
 Capability of the video.
SDL_Color colorFont
 Color font.
SDL_Color colorFontVideo
 Color font video.
Uint32 colorTransparent
 Transparent color video.
SDL_cond * cond
 Condicinal for GetLastButton function.
int depth
char * device
 Capture device name.
SDL_Surface * draw_surface
 Surface of graphics BMP.
SDL_Event event
 Keyboard event.
video_buffer fbuffers
 Capability of the suport for Frame Buffer.
char * fontName
 Font file name.
SDL_Rect gButtons [MAX_BUTTON]
 Position virtual buttons.
int height
 Height of video source.
int heightWin
 Height of Windows.
bool imageAdjust
 Flag for imageAdjust.
SMPEG_Info info
 Information mpeg file.
bool Invert
 Inverte show video.
SDLKey key
 Code keyboard.
SDLKey KeyFullScreeen
 Action FullScreen.
SDLKey KeyInvert
 Action invert video.
SDLKey KeyQuit
 Action exit.
SDLKey KeySaveFrame
 Action SaveFrame.
SDLKey KeyVideoOn
 Action Play Mpeg Video.
SDLKey KeyZoomOutOff
 Action ZoomOutOff.
SDLKey KeyZoomOutOn
 Action ZoomOutOn.
unsigned char * last_map
int Lastkey
 Scan Keuboard.
int left
 Left of video source.
int lintVideoFormat
 Internal Format Video.
int lintVideoMode
 Internal Video Mode.
long llongTuners
 Internal Tuner Mode.
unsigned char * map
 Memory map.
video_mmap map_buffer
 Memory mapped buffer.
int MaxTextTouch
 Max length for string input TouchScreen;.
SMPEG * mpeg
 Mpeg video.
char * mpegName
 MPEG video file name.
SDL_mutex * mutex
 Mutex for GetLastButton function.
TTF_Font * NameFont
 Truetype font name.
SDL_Surface * offscreen
 Surface offscreenRGB.
SDL_Overlay * offscreenOVL
 Surface offscreen YUV.
video_picture pic
 Image properties.
int RotateText
 Angle for rotation text surface.
int RotateVideo
 Angle for rotation video live surface.
bool ScanButtons
 Scan Buttons.
SDL_Surface * screen
 Surface show screen.
int size_font
 Size font.
SDL_Color SRCcolorTransparent
 Transparent color video.
SDL_Color temp
SDL_Rect TempRect
 Rect temp for work.
SDL_Rect TempRectImage
SDL_Surface * text_surface
 Suface of text and graphics.
pthread_t * thread
 Thread video live.
int top
 Top of video source.
unsigned char * v4l_convert_buf
 Map for convertion YUV.
video_channel vch
 Video input channel.
SDL_Surface * video_surface
 Surface of mpeg.
video_window videowin
 Capability of the video windows.
video_tuner vtuner
 Tuner properties.
int width
 Witdh of video source.
int widthWin
 Witdh of Windows.
int xText
 X position text.
int yText
 Y position text.
SDL_Surface * zoomout_surface
 Surface of ZoomOut.

Detailed Description

SUMMARY.....: Class for manipulates video capture.

TYPE........: Object Class
NAME........: CAPTURE - Linux Capture
CREATED.....: Jun-10-2004
MODIFIED....: Ago-10-2006

Definition at line 58 of file funcoesHAIRCAPTURE.h.


Constructor & Destructor Documentation

CAPTURE (  )  [inline]

SUMMARY.....: Construtor.
.

Definition at line 230 of file funcoesHAIRCAPTURE.h.

References CAPTURE::adjustVIDEO, CAPTURE::AudioEnabled, CAPTURE::colorFont, CAPTURE::colorFontVideo, CAPTURE::debug, CAPTURE::depth, CAPTURE::device, CAPTURE::fd, CAPTURE::fontName, CAPTURE::GrabZoom, CAPTURE::height, CAPTURE::heightWin, CAPTURE::imageAdjust, CAPTURE::imageFile, CAPTURE::Invert, JPG, CAPTURE::KeyFullScreeen, CAPTURE::KeyInvert, CAPTURE::KeyQuit, CAPTURE::KeySaveFrame, CAPTURE::KeyVideoOn, CAPTURE::KeyZoomOutOff, CAPTURE::KeyZoomOutOn, CAPTURE::Lastkey, CAPTURE::left, CAPTURE::lintTouchX, CAPTURE::lintTouchY, CAPTURE::lintVideoFormat, CAPTURE::lintVideoMode, CAPTURE::llongTuners, CAPTURE::MaxTextTouch, CAPTURE::mpegName, CAPTURE::RotateText, CAPTURE::RotateVideo, CAPTURE::ScanButtons, CAPTURE::size_font, CAPTURE::SRCcolorTransparent, CAPTURE::top, CAPTURE::typeImageFile, CAPTURE::UseDraw, CAPTURE::UseText, CAPTURE::UseVideo, CAPTURE::UseZoomOut, CAPTURE::width, CAPTURE::widthWin, CAPTURE::xText, and CAPTURE::yText.

00231       { 
00232          //Defauls values
00233          this->top            = 0;
00234          this->left           = 0;
00235          this->MaxTextTouch   = 6;
00236          this->Lastkey        = -1;
00237          this->width          = 320;
00238          this->height         = 240;
00239          this->widthWin       = 320;
00240          this->heightWin      = 240;
00241          this->depth          = 24;
00242          this->RotateText     = 0;
00243          this->RotateVideo    = 0;
00244          this->size_font      = 10;
00245          this->xText          = 0;
00246          this->yText          = 110;
00247          this->colorFont.r    = 255;
00248          this->colorFont.g    = 255;
00249          this->colorFont.b    = 255;
00250          this->colorFontVideo.r = 0;
00251          this->colorFontVideo.g = 255;
00252          this->colorFontVideo.b = 0;
00253          this->fd             = -1;
00254          this->debug          = true;
00255          this->AudioEnabled   = false;
00256          this->device         = "/dev/video";
00257          this->vch.channel    = 0;
00258          this->vch.norm       = VIDEO_MODE_NTSC;
00259          this->vch.tuners     = 1;
00260          this->lintVideoMode  = VIDEO_MODE_NTSC;
00261          this->llongTuners    = 1;
00262          this->map_buffer.format = 0;
00263          this->lintVideoFormat   = 0;
00264          this->pic.palette       = 0;
00265          this->pic.depth      = 24;
00266          this->pic.brightness = 60000;
00267          this->pic.contrast   = 60000;
00268          this->pic.whiteness  = 30000;
00269          this->pic.colour     = 30000;
00270          this->pic.hue        = 30000;
00271          this->SRCcolorTransparent.r = 0;
00272          this->SRCcolorTransparent.g = 0;
00273          this->SRCcolorTransparent.b = 0;
00274          this->KeyZoomOutOn   = SDLK_SPACE;
00275          this->KeyZoomOutOff  = SDLK_c;
00276          this->KeyFullScreeen = SDLK_f;
00277          this->KeySaveFrame   = SDLK_s;
00278          this->KeyQuit        = SDLK_q;
00279          this->KeyVideoOn     = SDLK_v;
00280          this->KeyInvert      = SDLK_i;
00281          this->fontName       = "VeraMono.ttf";
00282          this->mpegName       = "video.mpg";
00283          this->UseVideo       = false;
00284          this->UseDraw        = false; 
00285          this->UseZoomOut     = false;
00286          this->UseText        = false;
00287          this->GrabZoom       = false;
00288          this->ScanButtons    = false;
00289          this->Invert         = false;
00290          this->adjustVIDEO    = 0;
00291          this->imageAdjust    = false;
00292          this->imageFile      = "/tmp/image_cap.jpg";
00293          this->typeImageFile  = JPG;
00294          this->lintTouchX     = 0;
00295          this->lintTouchY     = 0; 
00296       }

~CAPTURE (  )  [inline]

SUMMARY.....: Destrutor.
.

Definition at line 304 of file funcoesHAIRCAPTURE.h.

00304 {} 


Member Function Documentation

void AdjustVideo ( int  lintMOVEMENT  ) 

Adjust video live.

Parameters:
lintMOVEMENT + or - Example: video1.AdjustVideo(1);

Definition at line 2243 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::imageAdjust, CAPTURE::pic, and CAPTURE::Progress().

Referenced by CAPTURE::WriteScreen().

02244 {
02245 if(!this->imageAdjust)
02246 {
02247    this->imageAdjust = true;  
02248    lintMOVEMENT *= 1000;
02249 
02250    switch(this->adjustVIDEO)
02251    {
02252    case 0:
02253       {
02254          this->pic.brightness += lintMOVEMENT;
02255          if(this->pic.brightness>64500)
02256          this->pic.brightness=64500;
02257 
02258          if(this->pic.brightness<1500)
02259          this->pic.brightness=1500;
02260          Progress("Brightness",this->pic.brightness,65535);
02261          printf("%d\n",this->pic.brightness); 
02262          break;
02263       }
02264    case 1:
02265       {
02266          this->pic.hue += lintMOVEMENT;
02267          if(this->pic.hue>64500)
02268          this->pic.hue=64500;
02269 
02270          if(this->pic.hue<1500)
02271          this->pic.hue=1500;
02272          Progress("Hue",this->pic.hue,65500);
02273          break;
02274       }
02275   case 2:
02276       {
02277          this->pic.colour += lintMOVEMENT;
02278          if(this->pic.colour>64500)
02279          this->pic.colour=64500;
02280 
02281          if(this->pic.colour<1500)
02282          this->pic.colour=1500;
02283          Progress("Color",this->pic.colour,65535);
02284          break;
02285       }
02286   case 3:
02287       {
02288          this->pic.contrast += lintMOVEMENT;
02289          if(this->pic.contrast>64500)
02290          this->pic.contrast=64500;
02291 
02292          if(this->pic.contrast<1500)
02293          this->pic.contrast=1500;
02294          Progress("Contrast",this->pic.contrast,65535);
02295          break;
02296       }
02297 
02298    }
02299    if (-1==ioctl( this->fd, VIDIOCSPICT, &this->pic ))
02300    {
02301       printf(" > ERRO: V4L function ioctl VIDIOCSPICT.\n");
02302          //exit(-1);
02303    }
02304    this->imageAdjust = false;
02305 }   
02306 }

Here is the call graph for this function:

void Background ( char *  name  ) 

Define JPEG background.

Parameters:
name JPEG image file name. Example: video1.Background("/tmp/sun.jpg");

Definition at line 559 of file funcoesHAIRCAPTURE.cpp.

00560 {
00561 
00562    SDL_Surface *LimageLarge;
00563 
00564    SDL_RWops *rwop;
00565    rwop=SDL_RWFromFile(name, "rb");
00566 
00567    LimageLarge = IMG_LoadJPG_RW(rwop);
00568   
00569    if(!LimageLarge)
00570    {
00571       printf(" > IMG_LoadJPG_RW: %s\n", IMG_GetError());
00572    }
00573      SDL_BlitSurface(LimageLarge, NULL, this->screen, NULL);
00574      SDL_UpdateRect(this->screen, 0, 0, 0, 0);
00575 
00576 }

void Circle ( int  lintx,
int  linty,
int  lintrad,
int  lintR,
int  lintG,
int  lintB,
TypeSurface  lsurfaceScreen = TEXTS 
)

Draw a circle over live video.

Parameters:
lintx position x in the screen.
linty position y in the screen.
lintrad radius of the circle.
lintR Color red in RGB.
lintG Color red in RGB.
lintB Color red in RGB.
lsurfaceScreen The type surface for work. Example: video1.Circel(10,30,5,0,255,0,DRAW);

Definition at line 1569 of file funcoesHAIRCAPTURE.cpp.

References DRAW, TEXTS, CAPTURE::UseDraw, CAPTURE::UseText, CAPTURE::UseVideo, CAPTURE::UseZoomOut, VIDEO, and ZOOM.

01570 {
01571    switch(lsurfaceScreen)
01572    {
01573    case TEXTS:
01574       {
01575          this->UseText = false;
01576          circleRGBA(this->text_surface,lintx, linty, lintrad, lintR, lintG, lintB, 255);
01577          this->UseText = true;
01578          break;
01579       }
01580    case DRAW:
01581       {
01582          this->UseDraw = false;
01583          circleRGBA(this->draw_surface,lintx, linty, lintrad, lintR, lintG, lintB, 255);
01584          this->UseDraw = true;
01585          break;
01586       }
01587    case ZOOM:
01588       {
01589          this->UseZoomOut = false;
01590          circleRGBA(this->zoomout_surface,lintx, linty, lintrad, lintR, lintG, lintB, 255);
01591          this->UseZoomOut = true;
01592          break;
01593       }
01594    case VIDEO:
01595       {
01596          this->UseVideo = false;
01597          circleRGBA(this->video_surface,lintx, linty, lintrad, lintR, lintG, lintB, 255);
01598          this->UseVideo = true;
01599          break;
01600       }
01601 
01602    }
01603 }

void ClearSurface ( TypeSurface  lsurfaceScreen,
bool  lboolSurface = false 
)

Clear all surface.

Parameters:
lsurfaceScreen this SDL_Surface to clear.
lboolSurface Enable or disable the use. Example: video1.ClearSurface(TEXTS);

Definition at line 1268 of file funcoesHAIRCAPTURE.cpp.

References DRAW, CAPTURE::draw_surface, CAPTURE::TempRect, CAPTURE::text_surface, TEXTS, CAPTURE::UseDraw, CAPTURE::UseText, CAPTURE::UseVideo, CAPTURE::UseZoomOut, VIDEO, CAPTURE::video_surface, ZOOM, and CAPTURE::zoomout_surface.

01269 {
01270    this->TempRect.x = 1;
01271    this->TempRect.y = 1;
01272 
01273    switch(lsurfaceScreen)
01274    {
01275    case DRAW:
01276       {  this->UseDraw = lboolSurface;
01277          this->TempRect.w = this->draw_surface->w;
01278          this->TempRect.h = this->draw_surface->h;
01279          SDL_FillRect(this->draw_surface,&this->TempRect, this->colorTransparent);
01280          break;
01281       }
01282    case TEXTS:
01283       {  this->UseText = lboolSurface;
01284          this->TempRect.w = this->text_surface->w;
01285          this->TempRect.h = this->text_surface->h;
01286          SDL_FillRect(this->text_surface,&this->TempRect, this->colorTransparent);
01287          break;
01288       }
01289   case ZOOM:
01290       {  this->UseZoomOut = lboolSurface;
01291          this->TempRect.w = this->zoomout_surface->w;
01292          this->TempRect.h = this->zoomout_surface->h;
01293          SDL_FillRect(this->zoomout_surface,&this->TempRect, this->colorTransparent);
01294          break;
01295       }
01296    case VIDEO:
01297       {  this->UseVideo = lboolSurface;
01298          this->TempRect.w = this->video_surface->w;
01299          this->TempRect.h = this->video_surface->h;
01300          SDL_FillRect(this->video_surface,&this->TempRect, this->colorTransparent);
01301          break;
01302       }
01303 
01304 
01305    }
01306 }

void ClearSurface ( TypeSurface  lsurfaceScreen,
int  lintX,
int  lintY,
int  lintW,
int  lintH 
)

Clear surface position.

Parameters:
lsurfaceScreen this SDL_Surface to clear.
lintX Position X in screen
lintY Position Y in screen
lintW Width of the area
lintH height of the area Example: video1.ClearSurface(TEXTS,10,20,40,30);

Definition at line 1317 of file funcoesHAIRCAPTURE.cpp.

References DRAW, CAPTURE::TempRect, TEXTS, VIDEO, and ZOOM.

Referenced by CAPTURE::GetTouch(), CAPTURE::Progress(), and CAPTURE::WriteScreen().

01318 {
01319    this->TempRect.x = lintX;
01320    this->TempRect.y = lintY;
01321 
01322    switch(lsurfaceScreen)
01323    {
01324    case VIDEO:
01325       {  
01326          this->TempRect.w = lintW;
01327          this->TempRect.h = lintH;
01328          SDL_FillRect(this->video_surface,&this->TempRect, this->colorTransparent);
01329          break;
01330       }  
01331    case TEXTS:
01332       {  
01333          this->TempRect.w = lintW;
01334          this->TempRect.h = lintH;
01335          SDL_FillRect(this->text_surface,&this->TempRect, this->colorTransparent);
01336          break;
01337       }
01338    case DRAW:
01339       {  
01340          this->TempRect.w = lintW;
01341          this->TempRect.h = lintH;
01342          SDL_FillRect(this->draw_surface,&this->TempRect, this->colorTransparent);
01343          break;
01344       }
01345   case ZOOM:
01346       {  
01347          this->TempRect.w = lintW;
01348          this->TempRect.h = lintH;
01349          SDL_FillRect(this->zoomout_surface,&this->TempRect, this->colorTransparent);
01350          break;
01351       }
01352 
01353 
01354    }
01355 }

void ColorBit ( int  depth  ) 

Set color bit video.

Parameters:
depth Depth video. Example: video1.ColorBit(24);

Definition at line 211 of file funcoesHAIRCAPTURE.cpp.

00212 {
00213    this->depth = depth; 
00214 }

void convertYUV420PtoGray ( void   ) 

Convert map image YUV to GrayScale.

Definition at line 304 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::height, CAPTURE::last_map, CAPTURE::v4l_convert_buf, and CAPTURE::width.

00305 {
00306    unsigned int gray;
00307    unsigned long len = (this->width*this->height*3)>> 2;
00308    unsigned char *src = this->v4l_convert_buf;
00309    unsigned char *dst = this->last_map;
00310    while(len--)
00311    {
00312       gray = src[0]+src[1]+src[2];
00313       dst[0]=dst[1]=dst[2]=gray/4;
00314 
00315       src += 4;
00316       dst += 4;
00317 
00318    }
00319    
00320    if (this->debug)
00321    printf(" > Convert to GrayScale.\n");
00322 }

void convertYUV420PtoRGB ( bool  forDISK  ) 

Convert frame YUV to RGB.

Parameters:
forDISK Convert frame for write in disk. Example: video1.convertYUV420PtoRGB(true);

Definition at line 333 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::height, CAPTURE::map, CAPTURE::v4l_convert_buf, and CAPTURE::width.

Referenced by CAPTURE::SaveJPG(), and CAPTURE::SavePPM().

00334 {
00335    unsigned char *y, *u, *v, *r, *g, *b;
00336    int tmp,i;
00337    // Convert if format same YUV
00338    if (this->map_buffer.format==VIDEO_PALETTE_YUV420P) 
00339    {
00340         r=this->v4l_convert_buf;
00341         g=this->v4l_convert_buf+1;
00342         b=this->v4l_convert_buf+2;
00343         if (this->debug)
00344         printf(" > Convert YUV to RGB for video live.\n");
00345      y=this->map;
00346 
00347       u=y+this->width*this->height;
00348       v=y+this->width*this->height+(this->width*this->height)/4;
00349       for (i=0; i<this->width*this->height; i++) 
00350       {
00351          tmp=(((int)*y-16)*76284 + 104595*((int)*u-128)) >>16;
00352          if (tmp<0) tmp=0; if (tmp>255) tmp=255;
00353          *b=tmp;
00354          tmp=(((int)*y-16)*76284 - 53281*((int)*u-128) - 25625*((int)*v-128)) >>16;
00355          if (tmp<0) tmp=0; if (tmp>255) tmp=255;
00356          *g=tmp;
00357          tmp=(((int)*y-16)*76284 + 132252*((int)*v-128)) >>16;
00358          if (tmp<0) tmp=0; if (tmp>255) tmp=255;
00359          *r=tmp;
00360          if (i & 1) 
00361          {
00362             u++;
00363             v++;
00364          }
00365          if (i%(this->width*2)==this->width-1) 
00366          {
00367             u-=this->width/2;
00368             v-=this->width/2;
00369          }
00370          r+=3;
00371          g+=3;
00372          b+=3;
00373          y++;
00374       }
00375    }
00376 
00377 }

void DefinePositionButton ( int  lintBUTTON,
int  lintX,
int  lintY,
int  lintW,
int  lintH 
)

Define the position button.

Parameters:
lintBUTTON Index of button
lintX Position X in screen
lintY Position Y in screen
lintW Width of the button
lintH height of the button Example: video1.DefinePositionButton(0,10,30,50,40);

Definition at line 2039 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::gButtons.

02040 {
02041    this->gButtons[lintBUTTON].x = lintX;
02042    this->gButtons[lintBUTTON].y = lintY;
02043    this->gButtons[lintBUTTON].w = lintW;
02044    this->gButtons[lintBUTTON].h = lintH;
02045 }

int FindButton ( int  lintX,
int  lintY 
)

Scan a Button.

Parameters:
lintX Position X in screen
lintY Position Y in screen Example: video1.FindButton(10,200);

Definition at line 2055 of file funcoesHAIRCAPTURE.cpp.

References MAX_BUTTON.

Referenced by CAPTURE::WriteScreen().

02056 {
02057    int lreturn = -1;
02058    for (int i=MAX_BUTTON; i>=0; i--)
02059    {
02060    if(((lintX>this->gButtons[i].x)  &&
02061        (lintX<(this->gButtons[i].x+this->gButtons[i].w))) &&
02062       ((lintY>this->gButtons[i].y)  &&
02063        (lintY<(this->gButtons[i].y+this->gButtons[i].h))))
02064        lreturn = i;
02065 
02066    }
02067    return lreturn;
02068 }

void FullScreen ( void   ) 

Enable/Disable full Screen mode.

Definition at line 2512 of file funcoesHAIRCAPTURE.cpp.

02513 {
02514    SDL_WM_ToggleFullScreen(this->screen);
02515 }

int GetLastButton ( void   ) 

Get last Button.

Definition at line 2078 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::cond, CAPTURE::LastButton, and CAPTURE::mutex.

02079 {
02080    this->mutex = SDL_CreateMutex();
02081    this->cond  = SDL_CreateCond();
02082 
02083    SDL_LockMutex(this->mutex);
02084    SDL_CondWait(this->cond, this->mutex);
02085    SDL_UnlockMutex(this->mutex);
02086 
02087    return this->LastButton;
02088 }

std::string GetTouch ( int  lintX,
int  lintY,
int  linSize_font = 30,
bool  lboolShadow = true 
)

Wait the reading of the virtual keyboard, and write the text.

Parameters:
lintX Position X in screen
lintY Position Y in screen
linSize_font Fonte size for text
lboolShadow Draw shadow in text Example: video1.GetTouch(20,50);

Definition at line 2332 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::ClearSurface(), CAPTURE::LastButton, CAPTURE::MaxTextTouch, TEXTS, ToString(), and CAPTURE::WriteText().

02333 {
02334    std::string gstringTXT ="";
02335    std::string lstringBUFFER ="";
02336 
02337    while(this->LastButton != 11)
02338    {  ToString(this->GetLastButton());
02339       if(this->LastButton == 10)
02340       {
02341          lstringBUFFER = "";
02342          this->ClearSurface(TEXTS);
02343       }
02344       else
02345       {
02346          if((this->LastButton != 11) && (this->LastButton != -1))
02347          { 
02348             lstringBUFFER += ToString(this->LastButton);
02349 
02350             if((lstringBUFFER.size()==1) && (gstringTXT.empty()))
02351             this->ClearSurface(TEXTS);
02352 
02353 //            gstringTXT = ": "+lstringBUFFER;
02354              gstringTXT = lstringBUFFER;
02355             this->WriteText(lintX,lintY,(char *)gstringTXT.c_str(),linSize_font,lboolShadow);
02356          }
02357          usleep(1); 
02358       }
02359 
02360       if(gstringTXT.size() > (this->MaxTextTouch))
02361       {
02362          lstringBUFFER = "";
02363          this->ClearSurface(TEXTS);
02364       }    
02365       
02366    }
02367    this->LastButton = -1;
02368 
02369    printf(" > Result of GetTouch: %s\n", lstringBUFFER.c_str());
02370 
02371    return lstringBUFFER;
02372 
02373 }

Here is the call graph for this function:

void HideMouse ( void   ) 

Hide mouse cursor.

Definition at line 2026 of file funcoesHAIRCAPTURE.cpp.

02027 {
02028    SDL_ShowCursor(SDL_DISABLE);
02029 }

void InicializeWin ( void   ) 

Inicialize screen main.

Definition at line 1193 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::colorTransparent, CAPTURE::draw_surface, CAPTURE::height, CAPTURE::heightWin, CAPTURE::screen, CAPTURE::SRCcolorTransparent, CAPTURE::TempRect, CAPTURE::text_surface, CAPTURE::video_surface, CAPTURE::width, CAPTURE::widthWin, and CAPTURE::zoomout_surface.

Referenced by main().

01194 {
01195    SDL_Init(SDL_INIT_VIDEO );
01196         
01197 //   this->screen = SDL_SetVideoMode(this->width, this->height, this->depth, 
01198 //                                   SDL_HWSURFACE | SDL_DOUBLEBUF);
01199    this->screen = SDL_SetVideoMode(this->widthWin, this->heightWin, this->depth,  
01200    SDL_HWSURFACE);
01201         
01202    if ( this->screen == NULL ) 
01203    {
01204       fprintf(stderr, " > SDL Error: Couldn't set %dx%d video mode: %s\n",
01205                        this->width,this->height, SDL_GetError());
01206       exit(-1);
01207    }
01208    SDL_WM_SetCaption("NETi TECNOLOGIA", NULL);
01209    this->TempRect.x = 0;
01210    this->TempRect.y = 0;
01211    this->TempRect.w = this->widthWin;
01212    this->TempRect.h = this->heightWin;
01213 
01214    printf( " > SDL Created %dx%d with %d color Surface Draw.\n",this->width, this->height,this->depth);
01215         
01216    this->draw_surface = SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_DOUBLEBUF, 
01217                                              this->widthWin, this->heightWin, this->depth, 
01218                                              screen->format->Rmask, screen->format->Gmask, 
01219                                              screen->format->Bmask, screen->format->Amask);
01220    this->colorTransparent = SDL_MapRGB(this->draw_surface->format,SRCcolorTransparent.r,
01221                                        SRCcolorTransparent.g,SRCcolorTransparent.b);
01222 
01223    SDL_SetColorKey(this->draw_surface,SDL_SRCCOLORKEY,this->colorTransparent);
01224    SDL_FillRect(this->draw_surface,&this->TempRect, this->colorTransparent);
01225 
01226    this->text_surface = SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_DOUBLEBUF,
01227                                              this->widthWin, this->heightWin, this->depth,
01228                                              screen->format->Rmask, screen->format->Gmask,
01229                                              screen->format->Bmask, screen->format->Amask);  
01230    SDL_SetColorKey(this->text_surface,SDL_SRCCOLORKEY,this->colorTransparent);
01231    SDL_FillRect(this->text_surface,&this->TempRect, this->colorTransparent);
01232 
01233    this->TempRect.w = this->width/2;
01234    this->TempRect.h = this->height/2;
01235 
01236    // Create surface MPEG video
01237    this->video_surface = SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_DOUBLEBUF, 
01238                                               this->TempRect.w, this->TempRect.h, this->depth, 
01239                                               screen->format->Rmask, screen->format->Gmask, 
01240                                               screen->format->Bmask, screen->format->Amask);
01241    SDL_SetColorKey( this->video_surface,SDL_SRCCOLORKEY,this->colorTransparent);
01242    SDL_FillRect(this->video_surface,&this->TempRect, this->colorTransparent);
01243 
01244 
01245    this->TempRect.w = this->width;
01246    this->TempRect.h = this->height;
01247 
01248 
01249    // Create surface ZoomOut
01250    this->zoomout_surface = SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_DOUBLEBUF, 
01251                                                 this->TempRect.w, this->TempRect.h, this->depth, 
01252                                                 screen->format->Rmask, screen->format->Gmask, 
01253                                                 screen->format->Bmask, screen->format->Amask);
01254    SDL_SetColorKey( this->zoomout_surface,SDL_SRCCOLORKEY,this->colorTransparent);
01255    SDL_FillRect(this->zoomout_surface,&this->TempRect, this->colorTransparent);
01256 }

void Line ( int  lintx1,
int  linty1,
int  lintx2,
int  linty2,
int  lintR,
int  lintG,
int  lintB,
TypeSurface  lsurfaceScreen = TEXTS 
)

Draw line over live video.

Parameters:
lintx1 position x1 in the screen.
linty1 position y1 in the screen.
lintx2 position x2 in the screen.
linty2 position y2 in the screen.
lintR Color red in RGB.
lintG Color red in RGB.
lintB Color red in RGB.
lsurfaceScreen The type surface for work. Example: video1.Line(10,30,60,90,255,0,0);

Definition at line 1615 of file funcoesHAIRCAPTURE.cpp.

References DRAW, TEXTS, CAPTURE::UseDraw, CAPTURE::UseText, CAPTURE::UseVideo, CAPTURE::UseZoomOut, VIDEO, and ZOOM.

01616 {
01617    switch(lsurfaceScreen)
01618    {
01619    case TEXTS:
01620       {
01621          this->UseText = false;
01622          lineRGBA(this->text_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01623          this->UseText = true;
01624          break;
01625       }
01626    case DRAW:
01627       {
01628          this->UseDraw = false;
01629          lineRGBA(this->draw_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01630          this->UseDraw = true;
01631          break;
01632       }
01633    case ZOOM:
01634       {
01635          this->UseZoomOut = false;
01636          lineRGBA(this->zoomout_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01637          this->UseZoomOut = true;
01638          break;
01639       }
01640    case VIDEO:
01641       {
01642          this->UseVideo = false;
01643          lineRGBA(this->video_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01644          this->UseVideo = true;
01645          break;
01646       }
01647 
01648    } 
01649 }

void Live ( void   ) 

Thread of video live (Internal method ).

Definition at line 131 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::event, CAPTURE::key, CAPTURE::map_buffer, and CAPTURE::WriteScreen().

00132 {
00133    this->map_buffer.frame = 1;
00134    do 
00135    {
00136       if (-1 == ioctl(this->fd, VIDIOCMCAPTURE, &this->map_buffer)) 
00137       {
00138          printf(" > Error: Grabber chip can't sync (no station tuned in?)\n"); 
00139          exit(-1);
00140       }
00141    this->map_buffer.frame = !this->map_buffer.frame;
00142    
00143    if (-1 == ioctl(this->fd, VIDIOCSYNC, &this->map_buffer.frame)) 
00144    {
00145       printf(" > Error: on sync!\n"); 
00146       exit(-1);
00147    }
00148    this->WriteScreen(this->map+ this->buffers.offsets[this->map_buffer.frame]);
00149    SDL_PollEvent(&this->event);
00150    this->key = this->event.key.keysym.sym;
00151    } while ((this->event.type != SDL_KEYDOWN) || (this->key!=SDLK_q));
00152   
00153    SMPEG_delete(this->mpeg);
00154    SDL_Quit();
00155 
00156 
00157 }

Here is the call graph for this function:

void LoadBMP ( char *  lcharBMP  ) 

Read read a bitmap file over live video.

Parameters:
lcharBMP BMP image file name. Example: video1.LoadBMP("/tmp/image.bmp");

Definition at line 1810 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::UseDraw.

Referenced by main().

01811 {
01812    this->UseDraw = false;
01813    SDL_Surface *Limage;
01814    Limage = SDL_LoadBMP(lcharBMP);
01815    SDL_SetColorKey(Limage,SDL_RLEACCEL,this->colorTransparent);
01816    SDL_BlitSurface(Limage, NULL, this->draw_surface, NULL);
01817    SDL_UpdateRect(this->draw_surface, 0, 0, 0, 0);
01818    SDL_FreeSurface(Limage);
01819    this->UseDraw = true;
01820 }       

void LoadJPG ( char *  name,
int  lintX = 0,
int  lintY = 0,
float  lfloatSCALE = 0.5,
TypeSurface  lsurfaceScreen = TEXTS,
int  lintAngleRotate = 0 
)

Load frame in JPEG format file.

Parameters:
name JPEG image file name.
lintX Position X in screen
lintY Position Y in screen
lfloatSCALE escale.
lsurfaceScreen The type surface for work.
lintAngleRotate The angle for rotation. Example: video1.LoadJPG("/tmp/image.jpg",10,20,.50,DRAW);

Definition at line 471 of file funcoesHAIRCAPTURE.cpp.

References DRAW, CAPTURE::TempRect, TEXTS, CAPTURE::UseDraw, CAPTURE::UseText, CAPTURE::UseVideo, CAPTURE::UseZoomOut, VIDEO, and ZOOM.

00472 {
00473 
00474    SDL_Surface *LimageLarge;
00475    SDL_Surface *LimageSmall;
00476 
00477    SDL_RWops *rwop;
00478    rwop=SDL_RWFromFile(name, "rb");
00479 
00480    if (this->debug)
00481    printf(" > LoadJPG ...");
00482    LimageLarge=IMG_LoadJPG_RW(rwop);
00483    if(!LimageLarge) 
00484    {
00485       printf(" > IMG_LoadJPG_RW: %s\n", IMG_GetError());
00486    }
00487   
00488    if (this->debug)
00489    printf(" OK!\n");
00490   
00491    LimageSmall = zoomSurface(LimageLarge, lfloatSCALE,lfloatSCALE, 1);
00492 
00493    this->TempRect.x = lintX;
00494    this->TempRect.y = lintY;
00495    this->TempRect.w = LimageSmall->w;
00496    this->TempRect.h = LimageSmall->h;
00497 
00498    if(lintAngleRotate!=0)
00499    {
00500          LimageSmall = rotozoomSurface(LimageSmall, lintAngleRotate, 1,SMOOTHING_ON);
00501          this->TempRect.w = LimageSmall->h;
00502          this->TempRect.h = LimageSmall->w;
00503    }
00504 
00505 
00506    switch(lsurfaceScreen)
00507    {
00508 
00509    case TEXTS:
00510       {
00511          SDL_BlitSurface(LimageSmall, NULL, this->text_surface, &TempRect);
00512          SDL_UpdateRect(this->text_surface, 0, 0, 0, 0);
00513          this->UseText = true;
00514          break; 
00515       }
00516    case DRAW:
00517       {
00518          SDL_BlitSurface(LimageSmall, NULL, this->draw_surface, &TempRect);
00519          SDL_UpdateRect(this->draw_surface, 0, 0, 0, 0);
00520          this->UseDraw = true;
00521          break;
00522       }
00523 
00524    case ZOOM:
00525       {
00526          SDL_BlitSurface(LimageSmall, NULL, this->zoomout_surface, &TempRect);
00527          SDL_UpdateRect(this->zoomout_surface, 0, 0, 0, 0);
00528          this->UseZoomOut = true;
00529          break;
00530       }
00531    case VIDEO:
00532       {
00533          SDL_BlitSurface(LimageSmall, NULL, this->video_surface, &TempRect);
00534          SDL_UpdateRect(this->video_surface, 0, 0, 0, 0);
00535          this->UseVideo = true;
00536          break;
00537       }
00538 
00539    }
00540 
00541    SDL_FreeSurface(LimageSmall);
00542    SDL_FreeSurface(LimageLarge);
00543 
00544    if (this->debug)
00545    printf(" > LoadJPG(%s,%d,%d,%f,%d)\n", name,lintX, lintY, lfloatSCALE,lsurfaceScreen);
00546 }

int MaxHeight ( void   ) 

Return the Max height of the main window.

Definition at line 2486 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::heightWin.

02487 {
02488    return this->heightWin;
02489 }

int MaxWidth ( void   ) 

Return the Max witdth of the main window.

Definition at line 2473 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::widthWin.

02474 {
02475    return this->widthWin;
02476 }

void Open ( void   ) 

Open device video.

Definition at line 895 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::arqPPM, CAPTURE::audio, CAPTURE::buffers, CAPTURE::depth, CAPTURE::height, CAPTURE::last_map, CAPTURE::lintVideoFormat, CAPTURE::lintVideoMode, CAPTURE::llongTuners, CAPTURE::map, CAPTURE::map_buffer, CAPTURE::pic, CAPTURE::SetHardwareCaptureCard(), CAPTURE::SetHardwareWebCam(), CAPTURE::v4l_convert_buf, CAPTURE::vch, CAPTURE::videowin, and CAPTURE::width.

Referenced by main(), and CAPTURE::VideoCreate().

00896 {
00897    if (-1 == (this->fd = open(this->device, O_RDWR))) 
00898    {
00899       printf(" > Error: opening device: %s\n", this->device);
00900       exit(-1);
00901    }
00902 
00903    if (-1 == ioctl(this->fd,VIDIOCGCAP,&this->capability)) 
00904    {
00905       printf(" > Error: ioctl(fd,VIDIOCGCAP,&capability)\n");
00906       exit(-1);
00907    }
00908   
00909    if (this->debug) 
00910    {
00911 
00912       printf(" _   _    _    ___ ____   ____    _    ____ _____ _   _ ____  _____ \n");
00913       printf("| | | |  / \\  |_ _|  _ \\ / ___|  / \\  |  _ \\_   _| | | |  _ \\| ____|\n");
00914       printf("| |_| | / _ \\  | || |_) | |     / _ \\ | |_) || | | | | | |_) |  _|  \n");
00915       printf("|  _  |/ ___ \\ | ||  _ <| |___ / ___ \\|  __/ | | | |_| |  _ <| |___ \n");
00916       printf("|_| |_/_/   \\_\\___|_| \\_\\\\____/_/   \\_\\_|    |_|  \\___/|_| \\_\\_____|\n");
00917 
00918       printf(" >  \n");
00919       printf(" > V4L function VIDIOCGCAP.\n");
00920       printf(" > Name             : %s\n", &this->capability.name);
00921       printf(" > Channels         : %i\n", this->capability.channels);
00922       printf(" > Audios           : %i\n", this->capability.audios);
00923       printf(" > Maxwidth         : %i\n", this->capability.maxwidth);
00924       printf(" > Maxheight        : %i\n", this->capability.maxheight);
00925       printf(" > Minwidth         : %i\n", this->capability.minwidth);
00926       printf(" > Minheight        : %i\n", this->capability.minheight);
00927    }
00928 
00929    if (-1==ioctl(this->fd,VIDIOCGFBUF,&this->fbuffers))
00930    {
00931       printf(" > ERRO: V4L function VIDIOCGFBUF.\n");
00932    }
00933    else 
00934    {
00935       if (-1==ioctl(this->fd,VIDIOCSFBUF,&this->fbuffers)) 
00936       {
00937          printf(" > ERRO: V4L function VIDIOCSFBUF.\n");
00938       }
00939       else
00940       { 
00941          if (this->debug) 
00942          {
00943             printf (" > V4L function VIDIOCSFBUF.\n");
00944             printf (" > Add           : %d\n",  this->fbuffers.base);
00945             printf (" > Height        : %d\n",  this->fbuffers.height);
00946             printf (" > Width         : %d\n",  this->fbuffers.width);
00947             printf (" > Depth         : %d\n",  this->fbuffers.depth);
00948             printf (" > BPL           : %d\n",  this->fbuffers.bytesperline);
00949          }
00950       }
00951    }
00952 
00953    if (-1==ioctl(this->fd,VIDIOCGWIN,&this->videowin))
00954    {
00955       printf(" > ERRO: V4L function VIDIOCGWIN.\n");
00956    }
00957    else
00958    {
00959       videowin.x = 0;
00960       videowin.y = 0;
00961       videowin.width = this->width;
00962       videowin.height = this->height;
00963       videowin.clipcount = 0;
00964       videowin.chromakey = 1;
00965       videowin.flags = VIDEO_CLIPMAP_SIZE;
00966 
00967       if (-1==ioctl(this->fd,VIDIOCSWIN,&this->videowin))
00968       {
00969          printf(" > ERRO: V4L function VIDIOCSWIN.\n");
00970       }
00971    }
00972 
00973    if(-1 == ioctl(this->fd, VIDIOCGCHAN,&this->vch)) 
00974    {
00975       printf(" > ERRO: V4L function VIDIOCGCHAN.\n");
00976       exit(-1);
00977    }
00978    else
00979    {
00980       this->vch.norm = this->lintVideoMode;
00981       this->vch.tuners = this->llongTuners;
00982 
00983       if(-1 == ioctl(this->fd, VIDIOCSCHAN,&this->vch)) 
00984       {
00985          printf(" > ERRO: V4L function VIDIOCSCHAN.\n");
00986          exit(-1);
00987       }
00988       else
00989       {
00990 
00991          if(this->debug)
00992          {
00993             printf(" > V4L function VIDIOCSCHAN.\n");
00994             printf(" > Name           : %s\n", this->vch.name);
00995             printf(" > Channel        : %i\n", this->vch.channel);
00996             printf(" > Tuners         : %i\n", this->vch.tuners);
00997             printf(" > Flags          : %i\n", this->vch.flags);
00998             printf(" > Type           : %i\n", this->vch.type);
00999             printf(" > Norm           : %i\n", this->vch.norm);
01000          }
01001       }
01002 
01003    }
01004 
01005   if(this->map_buffer.format == 0)
01006   {
01007       if(!strcmp(this->vch.name,"Webcam"))
01008       {
01009          this->SetHardwareWebCam();
01010       }  
01011       else
01012       {
01013          this->SetHardwareCaptureCard();
01014 
01015       }  
01016 
01017   }
01018 
01019 
01020 
01021 
01022    if(-1 == ioctl(this->fd, VIDIOCGTUNER,&this->vtuner))
01023    {
01024       printf(" > ERRO: V4L function VIDIOCGTUNER.\n");
01025    }
01026    else
01027    {
01028       if(-1 == ioctl(this->fd, VIDIOCSTUNER,&this->vtuner))
01029       {
01030          printf(" > ERRO: V4L function VIDIOCSTUNER.\n");
01031       }
01032       else
01033       {
01034 
01035          if(this->debug)
01036          {
01037             printf(" > V4L function VIDIOCSTUNER.\n");
01038             printf(" > Tuner          : %i\n", this->vtuner.tuner);
01039             printf(" > Name           : %s\n", this->vtuner.name);
01040             printf(" > Low frequency  : %i\n", this->vtuner.rangelow);
01041             printf(" > High frequency : %i\n", this->vtuner.rangehigh);
01042             printf(" > Flags          : %i\n", this->vtuner.flags);
01043             printf(" > Mode           : %i\n", this->vtuner.mode);
01044             printf(" > Signal         : %i\n", this->vtuner.signal);
01045          }
01046       }
01047 
01048    }
01049 
01050 
01051 
01052    if (-1==ioctl( this->fd, VIDIOCGPICT, &this->pic ))
01053    {
01054       printf(" > ERRO: V4L function VIDIOCGPICT.\n");
01055    }
01056    else
01057    {
01058       this->pic.palette = this->lintVideoFormat;
01059       this->pic.depth   = this->depth;
01060 
01061       if (-1==ioctl( this->fd, VIDIOCSPICT, &this->pic ))
01062       {
01063          printf(" > ERRO: V4L function VIDIOCSPICT.\n");
01064       }
01065       else
01066       {
01067          if (this->debug) 
01068          {
01069             printf(" > V4L function VIDIOCSPICT.\n");
01070             printf(" > Brightness        : %d \n", this->pic.brightness/256 );
01071             printf(" > Hue               : %d\n", this->pic.hue/256);
01072             printf(" > Colour            : %d\n", this->pic.colour/256 );
01073             printf(" > Contrast          : %d \n", this->pic.contrast/256 );
01074             printf(" > Whiteness         : %d\n", this->pic.whiteness/256 );
01075             printf(" > Depth             : %d\n", this->pic.depth );
01076             printf(" > Palette           : %d \n", this->pic.palette );
01077 
01078         } 
01079      }
01080    }
01081    if(this->AudioEnabled)
01082    {
01083       if (-1 == ioctl(this->fd,VIDIOCGAUDIO, &this->audio)) 
01084       { 
01085          printf(" > ERRO: V4L function VIDIOCGAUDIO.\n");
01086       }
01087       else
01088       {
01089          this->audio.flags  = VIDEO_AUDIO_VOLUME;
01090          this->audio.volume = 30000;
01091          if (-1 == ioctl(this->fd,VIDIOCSAUDIO, &this->audio)) 
01092          { 
01093             printf(" > ERRO: V4L function VIDIOCSAUDIO.\n");    
01094          }
01095       }
01096    }
01097   
01098    //fcntl(fd,F_SETFD,FD_CLOEXEC);
01099    if (-1 == ioctl(this->fd,VIDIOCGMBUF,&this->buffers)) 
01100    {
01101       printf(" > ERRO: V4L function VIDIOCGMBUF.\n");
01102       exit(-1);
01103    }
01104 
01105   
01106    if (this->debug) 
01107    {
01108       printf(" > V4L function VIDIOCGMBUF.\n");
01109       printf(" > Size          : %d\n",this->buffers.size);
01110       printf(" > Frames        : %d\n",this->buffers.frames);
01111    }
01112                 
01113    this->map = (unsigned char *)mmap(0,buffers.size,PROT_READ|PROT_WRITE,MAP_SHARED,this->fd,0);    
01114    if (this->map == NULL) 
01115    {
01116       printf(" > ERRO: Mmap is NULL.\n");
01117       exit(-1);
01118    }
01119    this->last_map = (unsigned char *)malloc(this->buffers.size);        
01120    this->v4l_convert_buf = (unsigned char *)malloc(this->buffers.size); 
01121    this->arqPPM = (char *)malloc((this->width*this->height*3)+15);
01122         
01123    this->map_buffer.width = this->width;
01124    this->map_buffer.height = this->height;
01125    this->map_buffer.format = this->pic.palette; 
01126    this->map_buffer.frame = 0;
01127    if (-1 == ioctl(this->fd, VIDIOCMCAPTURE, &map_buffer)) 
01128    { 
01129       printf(" > ERRO: Grabber chip error sync.\n");
01130       exit(-1);
01131    }
01132 
01133    if (this->debug)
01134    {
01135       printf(" > V4L function VIDIOCMCAPTURE.\n");
01136       printf(" > Width         : %d\n",this->map_buffer.width);
01137       printf(" > Height        : %d\n",this->map_buffer.height);
01138       printf(" > Format        : %d\n",this->map_buffer.format);
01139       printf(" > Frame         : %d\n",this->map_buffer.frame);
01140    }
01141 
01142 }

Here is the call graph for this function:

void PlayMPEG ( char *  name  ) 

Play MPEG video file.

Parameters:
name JPEG image file name. Example: video1.PlayMPEG("u2.mpg");

Definition at line 114 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::mpeg, update(), and CAPTURE::UseVideo.

Referenced by main(), and CAPTURE::WriteScreen().

00115 {
00116    this->mpeg = SMPEG_new(name, &this->info, 1);
00117    SMPEG_setdisplay(this->mpeg,  this->video_surface, NULL, update);
00118    SMPEG_play(this->mpeg);
00119    this->UseVideo = true;
00120 }

Here is the call graph for this function:

void Progress ( char *  lcharText,
int  lintPROGRESS,
int  lintTOTAL 
)

Draw progress bar.

Parameters:
lcharText String for information
lintPROGRESS value for progression
lintTOTAL max value Example: video1.Progress("Verificando",30,90);

Definition at line 1763 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::ClearSurface(), CAPTURE::colorFont, CAPTURE::left, CAPTURE::SetColorFont(), TEXTS, CAPTURE::top, CAPTURE::UseText, and CAPTURE::WriteText().

Referenced by CAPTURE::AdjustVideo(), CAPTURE::SelectAdjust(), CAPTURE::SelectBrightness(), CAPTURE::SelectColor(), CAPTURE::SelectContrast(), and CAPTURE::SelectHue().

01764 {
01765    int intTMPR, intTMPG, intTMPB;
01766 
01767    intTMPR = this->colorFont.r;
01768    intTMPG = this->colorFont.g;
01769    intTMPB = this->colorFont.b;
01770    this->SetColorFont(this->colorFontVideo.r,this->colorFontVideo.g,this->colorFontVideo.b);
01771 
01772    ClearSurface(TEXTS,this->left,this->top,this->width,this->height);
01773 
01774 
01775    if(this->RotateText!=0)
01776    {
01777      int lintY1 = this->top+10;
01778      int lintY2 = this->top+((lintPROGRESS*int(this->height -10))/lintTOTAL);
01779       WriteText(this->left+10,lintY1, lcharText, 30, true);
01780       this->UseText = false;
01781       boxRGBA(this->text_surface,this->left+43,lintY1-2,this->left+77,lintY2+2,0,0,0,255);
01782       boxRGBA(this->text_surface,this->left+45,lintY1,this->left+75,lintY2,255,255,255,255);
01783       this->UseText = true;
01784    }
01785    else
01786    {
01787       int lintX1 = this->left+10;
01788       int lintX2 = this->left+((lintPROGRESS*int(this->width -10))/lintTOTAL);
01789       WriteText(lintX1,this->top+10, lcharText, 30, true);
01790    
01791       this->UseText = false;
01792       boxRGBA(this->text_surface,lintX1-2,this->top+43,lintX2+2,this->top+77,0,0,0,255);
01793       boxRGBA(this->text_surface,lintX1,this->top+45,lintX2,this->top+75,255,255,255,255);
01794       this->UseText = true;
01795    }
01796 
01797    this->SetColorFont(intTMPR,intTMPG,intTMPB);
01798    
01799 }

Here is the call graph for this function:

void Rectangle ( int  lintx1,
int  linty1,
int  lintx2,
int  linty2,
int  lintR,
int  lintG,
int  lintB,
TypeSurface  lsurfaceScreen = TEXTS 
)

Draw rectangle over live video.

Parameters:
lintx1 position x1 in the screen.
linty1 position y1 in the screen.
lintx2 position x2 in the screen.
linty2 position y2 in the screen.
lintR Color red in RGB.
lintG Color red in RGB.
lintB Color red in RGB.
lsurfaceScreen The type surface for work. Example: video1.Rectangle(30,20,70,80,255,0,0);

Definition at line 1676 of file funcoesHAIRCAPTURE.cpp.

References DRAW, TEXTS, CAPTURE::UseDraw, CAPTURE::UseText, CAPTURE::UseVideo, CAPTURE::UseZoomOut, VIDEO, and ZOOM.

01677 {
01678    switch(lsurfaceScreen)
01679    {
01680    case TEXTS:
01681       {
01682          this->UseText = false;
01683          rectangleRGBA(this->text_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01684          this->UseText = true;
01685          break;
01686       }
01687    case DRAW:
01688       {
01689          this->UseDraw = false;
01690          rectangleRGBA(this->draw_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01691          this->UseDraw = true;
01692          break;
01693       }
01694    case ZOOM:
01695       {
01696          this->UseZoomOut = false;
01697          rectangleRGBA(this->zoomout_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01698          this->UseZoomOut = true;
01699          break;
01700       }
01701    case VIDEO:
01702       {
01703          this->UseVideo = false;
01704          rectangleRGBA(this->video_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01705          this->UseVideo = true;
01706          break;
01707       }
01708 
01709    }
01710 
01711 }

void RectangleFill ( int  lintx1,
int  linty1,
int  lintx2,
int  linty2,
int  lintR,
int  lintG,
int  lintB,
TypeSurface  lsurfaceScreen = TEXTS 
)

Draw rectangle fill over live video.

Parameters:
lintx1 position x1 in the screen.
linty1 position y1 in the screen.
lintx2 position x2 in the screen.
linty2 position y2 in the screen.
lintR Color red in RGB.
lintG Color red in RGB.
lintB Color red in RGB.
lsurfaceScreen The type surface for work. Example: video1.RectangelFill(20,30,60,80,255,0,0);

Definition at line 1721 of file funcoesHAIRCAPTURE.cpp.

References DRAW, TEXTS, CAPTURE::UseDraw, CAPTURE::UseText, CAPTURE::UseVideo, CAPTURE::UseZoomOut, VIDEO, and ZOOM.

01722 {
01723    switch(lsurfaceScreen)
01724    {
01725    case TEXTS:
01726       {
01727          this->UseText = false;
01728          boxRGBA(this->text_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01729          this->UseText = true;
01730          break;
01731       }
01732    case DRAW:
01733       {
01734          this->UseDraw = false;
01735          boxRGBA(this->draw_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01736          this->UseDraw = true;
01737          break;
01738       }
01739    case ZOOM:
01740       {
01741          this->UseZoomOut = false;
01742          boxRGBA(this->zoomout_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01743          this->UseZoomOut = true;
01744          break;
01745       }
01746    case VIDEO:
01747       {
01748          this->UseVideo = false;
01749          boxRGBA(this->video_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01750          this->UseVideo = true;
01751          break;
01752       }
01753    }
01754 }

void RectangleZoom ( int  lintx1,
int  linty1,
int  lintx2,
int  linty2,
int  lintR,
int  lintG,
int  lintB 
)

Draw rectangle over surface zoomout.

Parameters:
lintx1 position x1 in the screen.
linty1 position y1 in the screen.
lintx2 position x2 in the screen.
linty2 position y2 in the screen.
lintR Color red in RGB.
lintG Color red in RGB.
lintB Color red in RGB. Example: video1.RectangelZoom(20,50,70,10,255,0,0);

Definition at line 1659 of file funcoesHAIRCAPTURE.cpp.

01660 {
01661    //this->UseZoomOut  = false;
01662    rectangleRGBA(this->zoomout_surface,lintx1, linty1,lintx2,  linty2,  lintR, lintG, lintB, 255);
01663    //this->UseZoomOut  = true;
01664 
01665 }

void Resolution ( int  width,
int  height 
)

Define resolution video.

Parameters:
width Witdh of video source.
height Height of video source. Example: video1.Resolution(320,240);

Definition at line 225 of file funcoesHAIRCAPTURE.cpp.

00226 {
00227    this->width = width;
00228    this->height= height;
00229 }

void ResolutionWin ( int  width,
int  height 
)

Define window resolution.

Parameters:
width Witdh of window.
height Height of window. Example: video1.ResolutionWin(800,600);

Definition at line 241 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::heightWin, and CAPTURE::widthWin.

00242 {
00243    this->widthWin  = width;
00244    this->heightWin = height;
00245 }

bool SaveJPG ( char *  name,
bool  lboolFRAMEGRAY = false 
)

Save frame in JPEG format file.

Parameters:
name JPEG image file name.
lboolFRAMEGRAY Frame in grayscale. Example: video1.SaveJPG("/tmp/image.jpg");

Definition at line 416 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::convertYUV420PtoRGB(), imageRGB::data, FileExist(), CAPTURE::height, imageRGB::height, SAT(), CAPTURE::swap_rgb24(), CAPTURE::v4l_convert_buf, CAPTURE::width, imageRGB::width, and HAIR::write_JPEG_file().

Referenced by main(), and CAPTURE::VideoCapture().

00417 {
00418    bool lboolreturn = false;
00419 
00420  unlink(name);
00421 
00422    if (this->map_buffer.format==VIDEO_PALETTE_YUV420P)
00423    {
00424       this->convertYUV420PtoRGB(true);
00425    }
00426    else
00427       swap_rgb24();
00428 
00429    int   quality = 75;
00430    imageRGB img;
00431    img.data   =  this->v4l_convert_buf; //(unsigned char*)this->offscreen->pixels; // 
00432 
00433    img.width  = this->width;
00434    img.height = this->height;
00435 
00436    // adjust colors
00437    int w, h;
00438    for (w = 0; w < img.width; w++) 
00439    {
00440       for (h = 0; h < img.height; h++) 
00441       {
00442          uchar* pixel = &img.data[3*(w + img.width*h)];
00443          pixel[0] = SAT(pixel[0]+10);  // more RED
00444          pixel[1] = pixel[1];          // no change in GREEN
00445          pixel[2] = SAT(pixel[2]-10);  // less BLUE
00446       }
00447    }
00448 
00449   lboolreturn = write_JPEG_file (name, quality, img);
00450 
00451   if (this->debug)
00452   printf(" > SaveJPG(%s,%d)\n", name,lboolFRAMEGRAY);
00453 
00454   lboolreturn = FileExist(name);
00455   
00456   return lboolreturn;
00457 
00458 
00459 }

Here is the call graph for this function:

void SavePPM ( char *  name  ) 

Save frame in PPM format file.

Parameters:
name PPM image file name. Example: video1.SavePPM("/tmp/image.ppm");

Definition at line 665 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::convertYUV420PtoRGB(), CAPTURE::height, and CAPTURE::width.

Referenced by CAPTURE::VideoCapture(), and CAPTURE::WriteScreen().

00666 {
00667    int i=0;
00668    FILE *fp;
00669 
00670    this->convertYUV420PtoRGB(true);
00671    sprintf (this->arqPPM, "P6 %d %d 255 ", this->width, this->height);
00672 
00673    for (i=0; i<(this->width*this->height*3); i++) 
00674       this->arqPPM[i+15] = this->v4l_convert_buf[i];
00675 
00676    if ((fp=fopen(name, "w+")) == NULL) 
00677    {
00678       printf(" > Error: write image PPM!");
00679       exit(-1);
00680    }
00681    fwrite ((char*)this->arqPPM, (this->width*this->height * 3)+15, 1, fp);
00682    fclose (fp);
00683 }

Here is the call graph for this function:

void SelectAdjust ( int  lintMOVEMENT  ) 

Select Adjust video live.

Parameters:
lintMOVEMENT + or - Example: video1.SelectAdjust(DRAW)

Definition at line 2198 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::adjustVIDEO, and CAPTURE::Progress().

Referenced by CAPTURE::WriteScreen().

02199 {
02200    this->adjustVIDEO += lintMOVEMENT;
02201    
02202    if(this->adjustVIDEO>3)
02203    this->adjustVIDEO = 0;
02204 
02205    if(this->adjustVIDEO<0)
02206    this->adjustVIDEO = 3;
02207 
02208    switch(this->adjustVIDEO)
02209    {
02210    case 0:
02211       {
02212          Progress("Brightness",this->pic.brightness,65535);
02213          break;
02214       }
02215    case 1:
02216       {
02217          Progress("Hue",this->pic.hue,65500);
02218          break;
02219       }
02220   case 2:
02221       {
02222          Progress("Color",this->pic.colour,65535);
02223          break;
02224      }
02225   case 3:
02226       {
02227          Progress("Contrast",this->pic.contrast,65535);
02228          break;
02229       }
02230 
02231    }
02232 }

Here is the call graph for this function:

void SelectBrightness ( int  lintVALUE  ) 

Select the function brightness.

Parameters:
lintVALUE Value for brightness function

Definition at line 2140 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::pic, and CAPTURE::Progress().

02141 {
02142    this->pic.brightness = lintVALUE;
02143    if(this->pic.brightness>64500)
02144    this->pic.brightness=64500;
02145 
02146    Progress("Brightness",this->pic.brightness,64500);
02147 
02148    if (-1==ioctl( this->fd, VIDIOCSPICT, &this->pic ))
02149    printf(" > ERRO: V4L function ioctl VIDIOCSPICT.\n");
02150 
02151 }

Here is the call graph for this function:

void SelectColor ( int  lintVALUE  ) 

Select the function color.

Parameters:
lintVALUE Value for color function

Definition at line 2161 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::pic, and CAPTURE::Progress().

02162 {
02163 
02164 
02165    this->pic.colour = lintVALUE;
02166    if(this->pic.colour>64500)
02167    this->pic.colour=64500;
02168 
02169    Progress("Color",this->pic.colour,64500);
02170 
02171    if (-1==ioctl( this->fd, VIDIOCSPICT, &this->pic ))
02172    printf(" > ERRO: V4L function ioctl VIDIOCSPICT.\n");
02173 }

Here is the call graph for this function:

void SelectContrast ( int  lintVALUE  ) 

Select the function contrast.

Parameters:
lintVALUE Value for contrast function

Definition at line 2118 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::pic, and CAPTURE::Progress().

02119 {
02120    this->pic.contrast = lintVALUE;
02121    if(this->pic.contrast>64500)
02122    this->pic.contrast=64500;
02123 
02124    Progress("Contrast",this->pic.contrast,64500);
02125 
02126    if (-1==ioctl( this->fd, VIDIOCSPICT, &this->pic ))
02127    printf(" > ERRO: V4L function ioctl VIDIOCSPICT.\n");
02128 
02129 
02130 }

Here is the call graph for this function:

void SelectHue ( void   ) 

Select the function hue.

Definition at line 2183 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::adjustVIDEO, and CAPTURE::Progress().

02184 {
02185    this->adjustVIDEO = 1;
02186    Progress("Hue",this->pic.brightness,65535);
02187 }

Here is the call graph for this function:

void SetAngleText ( int  lintAngle  ) 

Define the angle for rotation text.

Parameters:
lintAngle Angle for rotation. Example: video1.SetAngleText(270);

Definition at line 256 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::RotateText.

00257 {
00258    this->RotateText  = lintAngle;
00259 }

void SetAngleVideo ( int  lintAngle  ) 

Define the angle for rotation text surface.

Parameters:
lintAngle Angle for rotation text surface. Example: video1.SetAngleVideo(270);

Definition at line 271 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::RotateVideo.

00272 {
00273    this->RotateVideo  = lintAngle;
00274 }

void SetColorFont ( int  lintR,
int  lintG,
int  lintB 
)

Define the color font.

Parameters:
lintR Color red in RGB.
lintG Color red in RGB.
lintB Color red in RGB. Example: video1.SetColorFont(255,0,255);

Definition at line 2315 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::colorFont.

Referenced by CAPTURE::Progress().

02316 {
02317    this->colorFont.r    = lintR;
02318    this->colorFont.g    = lintG;
02319    this->colorFont.b    = lintB;
02320 
02321 }

void SetDevice ( char *  lDevice  ) 

Define video device.

Parameters:
lDevice device name Example: video1.SetDevice("/dev/video1");

Definition at line 197 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::device.

00198 {
00199    this->device = lDevice;      
00200 }

void SetFont ( char *  lfontName  ) 

Define truetype model font.

Parameters:
lfontName TTF file name. Example: video1.SetFont("Mono.ttf");

Definition at line 168 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::fontName.

00169 {
00170    this->fontName = lfontName;  
00171 }

void SetFontSize ( int  lintSize  ) 

Define font size.

Parameters:
lintSize Font size. Example: video1.SetFontSize(30);

Definition at line 182 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::size_font.

00183 {
00184    this->size_font = lintSize;
00185 
00186 }

void SetFormatPalette ( int  lFormat  ) 

Define format video palete.

Parameters:
lFormat Format palete. Example: video1.SetFormatPalette(VIDEO_PALETTE_RGB24);

Definition at line 1861 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::lintVideoFormat, CAPTURE::map_buffer, and CAPTURE::pic.

01862 {
01863    this->lintVideoFormat = lFormat;   
01864    this->map_buffer.format = lFormat;
01865    this->pic.palette = lFormat;
01866 }

void SetHardwareCaptureCard ( void   ) 

Set the property for operation in Capture Card.

Definition at line 2435 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::lintVideoFormat, CAPTURE::map_buffer, and CAPTURE::pic.

Referenced by CAPTURE::Open().

02436 {
02437 
02438    this->map_buffer.format = VIDEO_PALETTE_RGB24;
02439    this->lintVideoFormat   = VIDEO_PALETTE_RGB24;
02440    this->pic.palette       = VIDEO_PALETTE_RGB24;
02441 
02442 }

void SetHardwareWebCam ( void   ) 

Set the property for operation in webcam.

Definition at line 2418 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::lintVideoFormat, CAPTURE::map_buffer, and CAPTURE::pic.

Referenced by CAPTURE::Open().

02419 {
02420 
02421    this->map_buffer.format = VIDEO_PALETTE_YUV420P;
02422    this->lintVideoFormat   = VIDEO_PALETTE_YUV420P;
02423    this->pic.palette       = VIDEO_PALETTE_YUV420P;
02424 
02425 }

void SetImageFile ( char *  lcharImageFile,
TypeImage  ltypeimageType 
)

Define image file and type.

Parameters:
lcharImageFile Name for image file.
ltypeimageType Type for image file. Example: video1.SetImageFile("/tmp/image.jpg",JPG);

Definition at line 2382 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::imageFile, and CAPTURE::typeImageFile.

02383 {
02384    this->imageFile = lcharImageFile;
02385    this->typeImageFile = ltypeimageType;
02386 }

void SetInputCamera ( int  lInput,
int  lVideoMode 
)

Define mode input camera.

Parameters:
lInput Index camera.
lVideoMode Video mode. Example video1.SetInputCamera(0,VIDEO_MODE_PALM);

Definition at line 1897 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::lintVideoMode, and CAPTURE::vch.

Referenced by CAPTURE::WriteScreen().

01898 {
01899    this->lintVideoMode = lVideoMode;
01900    vch.channel = lInput;
01901    vch.norm  = lVideoMode;
01902    vch.type  = VIDEO_TYPE_CAMERA;
01903 }

void SetInputChannel ( int  lintVALUE  ) 

Set input channel.

Parameters:
lintVALUE Value for channel

Definition at line 2452 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::vch.

02453 {
02454 
02455    this->vch.channel = lintVALUE;
02456 
02457    if (-1==ioctl( this->fd, VIDIOCGCHAN, &this->vch ))
02458    printf(" > ERRO: V4L function ioctl VDIOCGCHAN.\n");
02459 
02460    if (-1==ioctl( this->fd, VIDIOCSCHAN, &this->vch ))
02461    printf(" > ERRO: V4L function ioctl VIDIOCSCHAN.\n");
02462 
02463 }

void SetInputTelevision ( int  lVideoMode  ) 

Define mode input television.

Parameters:
lVideoMode Mode input television. Example: video1.SetInputTelevision(VIDEO_MODE_PALM);

Definition at line 1877 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::lintVideoMode, and CAPTURE::vch.

01878 {
01879    this->lintVideoMode = lVideoMode;
01880    vch.channel = 0;
01881    vch.norm = lVideoMode;
01882    vch.type = VIDEO_TYPE_TV;
01883    vch.flags = VIDEO_VC_TUNER |VIDEO_VC_AUDIO;  
01884    //vtuner.tuner = 77,25;
01885  
01886 }

void SetKeyFullScreeen ( SDLKey  Lkey  ) 

Define Full Screen key.

Parameters:
Lkey Key Full Screen. Example: video1.SetKeyFullScreen(SDLK_f)

Definition at line 1959 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::KeyFullScreeen.

01960 {
01961    this->KeyFullScreeen=Lkey;
01962 }

void SetKeyQuit ( SDLKey  Lkey  ) 

Define quit key.

Parameters:
Lkey Key quit. Example: video1.SetKeyQuit(SDLK_q);

Definition at line 1987 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::KeyQuit.

01988 {
01989    this->KeyQuit=Lkey;
01990 }

void SetKeySaveFrame ( SDLKey  Lkey  ) 

Define save frame key.

Parameters:
Lkey Key save frame. Example: video1.SetKeySaveFrame(SDLK_s);

Definition at line 1973 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::KeySaveFrame.

01974 {
01975    this->KeySaveFrame=Lkey;
01976 }

void SetKeyVideoOn ( SDLKey  Lkey  ) 

Set key for play mpeg video.

Parameters:
Lkey Key quit. Example: video1.SetKeyVideoOn(SDLK_v);

Definition at line 2001 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::KeyVideoOn.

02002 {
02003    this->KeyVideoOn=Lkey;
02004 }

void SetKeyZoomOutOff ( SDLKey  Lkey  ) 

Define function Off-ZoomOut key.

Parameters:
Lkey Key On-ZoomOut. Example: video1.SetKeyZoomOutOff(SDLK_c);

Definition at line 1945 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::KeyZoomOutOff.

01946 {
01947    this->KeyZoomOutOff=Lkey;
01948 }

void SetKeyZoomOutOn ( SDLKey  Lkey  ) 

Define function On-ZoomOut key.

Parameters:
Lkey Key On-ZoomOut. Example: video1.SetKeyZoomOutOn(SDLK_SPACE);

Definition at line 1931 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::KeyZoomOutOn.

01932 {
01933    this->KeyZoomOutOn=Lkey;
01934 }

void SetMaxTextTouch ( int  lintVALUE  ) 

Set the max lenght for input touchscreen.

Parameters:
lintVALUE Value for max character.

Definition at line 2499 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::MaxTextTouch.

02500 {
02501    this->MaxTextTouch = lintVALUE;
02502 }

void SetTransparent ( int  lintR,
int  lintG,
int  lintB 
)

Define transparent color.

Parameters:
lintR Color red in RGB.
lintG Color red in RGB.
lintB Color red in RGB. Example video1.SetTransparent(255,0,255)

Definition at line 1915 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::SRCcolorTransparent.

Referenced by main().

01916 {
01917    this->SRCcolorTransparent.r =lintR;
01918    this->SRCcolorTransparent.g =lintG;
01919    this->SRCcolorTransparent.b =lintB;
01920 }

void SetVideoPos ( int  x,
int  y 
)

Define video live position.

Parameters:
y define top of window video live.
x define left of window video live. Example: video1.SetVideoPos(160,120);

Definition at line 288 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::left, and CAPTURE::top.

00289 {
00290    this->top  = y;
00291    this->left = x;
00292 }

void Show ( void   ) 

Show live video.

Definition at line 1367 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::thread, and ThreadAoVivo().

Referenced by main(), and CAPTURE::VideoInicialize().

01368 {
01369    this->thread = new pthread_t();
01370    if (pthread_create(this->thread, NULL,  (void *(*)(void *))ThreadAoVivo, this)) 
01371    {
01372       printf(" > Error: creating the first thread\n");
01373       exit(-1);
01374    }
01375 
01376    if (this->debug) 
01377    {
01378       printf(" > Result of MultThread.\n");
01379       printf(" > Thread ok!\n");
01380    }
01381 }

Here is the call graph for this function:

void ShowMouse ( void   ) 

Hide mouse cursor.

Definition at line 2013 of file funcoesHAIRCAPTURE.cpp.

02014 {
02015    SDL_ShowCursor(SDL_ENABLE);
02016 }

void swap_rgb24 ( void   ) 

Convert map image to RGB.

Definition at line 386 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::map, and CAPTURE::v4l_convert_buf.

Referenced by CAPTURE::SaveJPG().

00387 {
00388    this->v4l_convert_buf = this->map;
00389 
00390    //this->last_map = this->v4l_convert_buf;
00391    /*unsigned char  c;
00392    unsigned char *p = this->v4l_convert_buf;
00393    int   i = (this->width*this->height) ;
00394    while (--i) 
00395    {
00396       c = p[0];
00397       p[0] = p[2];
00398       p[2] = c;
00399       p += 3;
00400    }*/
00401    //this->last_map = this->map;
00402 
00403 }

int TouchScreen ( bool  lboolSTATUS  ) 

On/Off Touch Screen Display.

Parameters:
lboolSTATUS Status touch screen Example: video1.TouchScreen(true);

Definition at line 2098 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::LastButton, and CAPTURE::ScanButtons.

02099 {
02100    if(!lboolSTATUS)
02101       this->ScanButtons = false;
02102    else
02103    {
02104       this->LastButton = -1;
02105       this->ScanButtons = true;
02106    }
02107 
02108 }

void VideoCapture ( void   ) 

Save frame in the disk.

Definition at line 2395 of file funcoesHAIRCAPTURE.cpp.

References JPG, PPM, CAPTURE::SaveJPG(), and CAPTURE::SavePPM().

02396 {
02397    switch(this->typeImageFile)
02398    {
02399    case PPM:
02400       {
02401          this->SavePPM((char*)this->imageFile.c_str());
02402       }
02403    case JPG:
02404       {
02405          this->SaveJPG((char*)this->imageFile.c_str());
02406       }
02407    }
02408 }

Here is the call graph for this function:

void VideoCreate ( void   ) 

Create device video.

Definition at line 1153 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::Open().

01154 {
01155    this->Open();
01156 
01157 }

Here is the call graph for this function:

void VideoInicialize ( void   ) 

Inicialize screen of the video capture.

Definition at line 1392 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::Show().

01393 {
01394     this->Show();
01395 }

Here is the call graph for this function:

void VideoTerminate ( void   ) 

Terminate screen video capture.

Definition at line 1169 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::audio.

Referenced by CAPTURE::WriteScreen().

01170 {
01171    if(this->AudioEnabled)
01172    {
01173       this->audio.flags  = VIDEO_AUDIO_MUTE;
01174       this->audio.volume = 0;
01175       ioctl(this->fd,VIDIOCSAUDIO, &this->audio);
01176    }
01177    close(this->fd);
01178    SDL_Quit();
01179    exit(0);
01180 
01181 }

void ViewLastMap ( int  lintX,
int  lintY,
float  lfloatSCALE,
TypeSurface  lsurfaceScreen = TEXTS 
)

Show the last frame saved.

Definition at line 587 of file funcoesHAIRCAPTURE.cpp.

References DRAW, CAPTURE::TempRectImage, TEXTS, CAPTURE::UseDraw, CAPTURE::UseText, CAPTURE::UseVideo, CAPTURE::UseZoomOut, VIDEO, and ZOOM.

00588 {
00589    SDL_Surface *LimageSmall;
00590    SDL_Surface *LimageLarge;
00591    
00592    if(this->debug)
00593    printf(" > Starting ViewLastMap.\n");
00594 
00595 
00596    LimageLarge = SDL_CreateRGBSurfaceFrom((void *)  this->last_map, this->width, this->height, this->depth,  this->width*3, 0xFF0000, 0x00FF00, 0x0000FF, 0x000000);
00597 
00598 
00599    LimageSmall = zoomSurface(LimageLarge, lfloatSCALE,lfloatSCALE, 1);
00600 
00601    this->TempRectImage.x = lintX;
00602    this->TempRectImage.y = lintY;
00603    this->TempRectImage.w = LimageSmall->w;
00604    this->TempRectImage.h = LimageSmall->h;
00605 
00606    switch(lsurfaceScreen)
00607    {
00608 
00609    case TEXTS:
00610       {
00611          this->UseText = false;
00612          SDL_BlitSurface(LimageSmall, NULL, this->text_surface, &TempRectImage);
00613          SDL_UpdateRect(this->text_surface, 0, 0, 0, 0);
00614          this->UseText = true;
00615          break; 
00616       }
00617    case DRAW:
00618       {
00619          this->UseDraw = false;
00620        SDL_BlitSurface(LimageSmall, NULL, this->draw_surface, &TempRectImage);
00621          SDL_UpdateRect(this->draw_surface, 0, 0, 0, 0);
00622          this->UseDraw = true;
00623          break;
00624       }
00625 
00626    case ZOOM:
00627       {
00628          this->UseZoomOut = false;
00629          SDL_BlitSurface(LimageSmall, NULL, this->zoomout_surface, &TempRectImage);
00630          SDL_UpdateRect(this->zoomout_surface, 0, 0, 0, 0);
00631          this->UseZoomOut = true;
00632          break;
00633       }
00634    case VIDEO:
00635       {
00636          this->UseVideo = false;
00637          SDL_BlitSurface(LimageSmall, NULL, this->video_surface, &TempRectImage);
00638          SDL_UpdateRect(this->video_surface, 0, 0, 0, 0);
00639          this->UseVideo = true;
00640          break;
00641       }
00642 
00643    }
00644 
00645    SDL_FreeSurface(LimageSmall);
00646    SDL_FreeSurface(LimageLarge);
00647 
00648    if(this->debug)
00649    printf(" > Finishing ViewLastMap.\n");
00650 
00651 
00652 
00653 }

void WaitForVideo ( void   ) 

Wait the ending thread (live video -Internal method ).

Definition at line 1406 of file funcoesHAIRCAPTURE.cpp.

Referenced by main().

01407 {
01408    pthread_join(*this->thread, 0);
01409 }

void WriteScreen ( unsigned char *  tmap  ) 

Write memory map in the screen.

Parameters:
tmap Memory map. Example: video1.WriteScreen(map+buffers.offsets[frame]);

Definition at line 694 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::AdjustVideo(), CAPTURE::ClearSurface(), CAPTURE::event, CAPTURE::FindButton(), CAPTURE::GrabZoom, CAPTURE::height, CAPTURE::key, CAPTURE::KeyFullScreeen, CAPTURE::KeyQuit, CAPTURE::KeySaveFrame, CAPTURE::KeyZoomOutOff, CAPTURE::LastButton, CAPTURE::Lastkey, CAPTURE::left, CAPTURE::lintTouchX, CAPTURE::lintTouchY, CAPTURE::offscreen, CAPTURE::offscreenOVL, CAPTURE::PlayMPEG(), CAPTURE::SavePPM(), CAPTURE::screen, CAPTURE::SelectAdjust(), CAPTURE::SetInputCamera(), CAPTURE::TempRect, TEXTS, CAPTURE::top, VIDEO, CAPTURE::VideoTerminate(), CAPTURE::width, ZOOM, and CAPTURE::ZoomOut().

Referenced by CAPTURE::Live().

00695 {
00696     int lintLoop = 0;
00697         
00698    // Convert palette for RGB
00699    if (this->map_buffer.format==VIDEO_PALETTE_YUV420P) 
00700    {
00701       unsigned int sizeY = this->width * this->height;
00702       unsigned int sizeUV = (this->width /2)* ( this->height / 2 );
00703 
00704       this->offscreen = SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_DOUBLEBUF, this->width, this->height, this->depth, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
00705 
00706       this->offscreenOVL = SDL_CreateYUVOverlay (this->width , this->height ,SDL_IYUV_OVERLAY,this->offscreen );
00707 
00708       SDL_LockYUVOverlay (this->offscreenOVL) ;
00709 
00710       memcpy( this-> offscreenOVL->pixels[ 0 ] , tmap , sizeY ) ;
00711       memcpy( this-> offscreenOVL->pixels[ 1 ] , tmap+sizeY , sizeUV ) ;
00712       memcpy( this->offscreenOVL->pixels[ 2 ] , tmap+sizeY+sizeUV , sizeUV ) ;
00713 
00714       SDL_UnlockYUVOverlay ( this->offscreenOVL ) ;
00715       this->TempRect.x = 0;
00716       this->TempRect.y = 0;
00717       this->TempRect.w = this->width ;
00718       this->TempRect.h = this->height ;
00719       SDL_DisplayYUVOverlay( this->offscreenOVL,&this->TempRect) ;
00720    }    
00721    else
00722    {
00723       this->offscreen = SDL_CreateRGBSurfaceFrom((void *) tmap, this->width, this->height, this->depth,  this->width*3, 0xFF0000, 0x00FF00, 0x0000FF, 0x000000);
00724    }
00725    this->TempRect.y = this->top;
00726    this->TempRect.x = this->left;
00727 
00728    if(this->RotateVideo!=0)
00729    {
00730          this->offscreen = rotozoomSurface(this->offscreen, this->RotateVideo, 1,SMOOTHING_ON);
00731          this->TempRect.w = this->height;
00732          this->TempRect.h = this->width;
00733    }
00734 
00735 
00736    //SDL_BlitSurface(this->offscreen, NULL, this->screen, NULL);
00737    SDL_BlitSurface(this->offscreen, NULL, this->screen, &this->TempRect);
00738 
00739    this->TempRect.x = this->left;
00740    this->TempRect.y = this->top;
00741 
00742    if(this->UseZoomOut)
00743    {
00744       //SDL_LockSurface( this->zoomout_surface);
00745       SDL_BlitSurface( this->zoomout_surface, NULL, this->screen, &this->TempRect);
00746       //SDL_UnlockSurface( this->zoomout_surface);
00747    }
00748 
00749    if(this->UseVideo)
00750    {  
00751       //SDL_LockSurface( this->video_surface);
00752       this->TempRect.y = this->top;
00753       this->TempRect.x = this->left+(this->width/2)+1;
00754       SDL_BlitSurface(this->video_surface, NULL, this->screen, &this->TempRect);
00755       if(SMPEG_status(this->mpeg) != SMPEG_PLAYING)
00756       {
00757          SMPEG_stop(this->mpeg);
00758          SMPEG_delete(this->mpeg);
00759          ClearSurface(VIDEO);
00760       }
00761       //SDL_UnlockSurface( this->video_surface);
00762    }
00763 
00764    this->TempRect.x = 0;
00765    if(this->GrabZoom)
00766    { 
00767       this->GrabZoom = false;
00768       this->ZoomOut(true);
00769    }
00770 
00771 
00772    if(this->UseDraw)
00773    {
00774       //SDL_LockSurface( this->draw_surface);
00775       SDL_BlitSurface( this->draw_surface, NULL, this->screen, NULL);
00776       //SDL_UnlockSurface( this->draw_surface);
00777    }
00778 
00779    if(this->UseText)
00780    {
00781       //SDL_LockSurface( this->text_surface);
00782       SDL_BlitSurface( this->text_surface,NULL,this->screen,NULL);
00783       //SDL_UnlockSurface( this->text_surface);
00784    }
00785  
00786    SDL_UpdateRect(this->screen, 0, 0, 0, 0);
00787 
00788  do
00789  {
00790       SDL_PollEvent(&this->event);
00791          if ((this->event.type == SDL_MOUSEBUTTONDOWN)) 
00792          {
00793             if((lintTouchX != this->event.motion.x) || (lintTouchY != this->event.motion.y))
00794             {
00795                if(this->debug)
00796                printf(" > Mouse pointer X:%d , Y:%d \n", this->event.motion.x, this->event.motion.y);
00797 
00798                lintTouchX = this->event.motion.x;
00799                lintTouchY = this->event.motion.y;
00800                if(this->ScanButtons)
00801                {
00802                   SDL_LockMutex(this->mutex);
00803                   this->LastButton = FindButton(this->event.motion.x, this->event.motion.y);
00804 
00805                   SDL_CondSignal(this->cond);
00806                   SDL_UnlockMutex(this->mutex);
00807                }
00808             }
00809          }
00810 
00811 
00812       if (this->event.type == SDL_KEYDOWN) 
00813       {
00814 
00815          this->key = this->event.key.keysym.sym;
00816          // Key SPACE: ZoomOut On
00817          if(this->key==this->KeyZoomOutOn)
00818          this->ZoomOut(true);
00819 
00820          if(this->key==this->KeyVideoOn)
00821          this->PlayMPEG(this->mpegName);
00822 
00823          // Key C: ZoomOut Off
00824          if(this->key==KeyZoomOutOff) 
00825          {  
00826             ClearSurface(TEXTS);
00827             ClearSurface(ZOOM);
00828             //this->ZoomOut(false);
00829          }
00830          // Key F: Fullscreen On/Off
00831          if(this->key==KeyFullScreeen)
00832          SDL_WM_ToggleFullScreen(this->screen);
00833 
00834          // Key S: Save screenshot : screenshot.ppm
00835          if(this->key==KeySaveFrame)
00836          this->SavePPM("screenshot.ppm");
00837 
00838          if(this->key == SDLK_RIGHT)
00839          {  
00840             AdjustVideo(+1);       
00841          }
00842 
00843          if(this->key == SDLK_LEFT)
00844          {  
00845             AdjustVideo(-1);
00846          }
00847 
00848          if(this->key == SDLK_UP)
00849          {  
00850             SelectAdjust(+1);
00851          }
00852 
00853          if(this->key == SDLK_DOWN)
00854          {  
00855             SelectAdjust(-1);
00856          }
00857 
00858          if((this->key>= SDLK_0) && (this->key<= SDLK_9) && (this->Lastkey!=this->key))
00859          { 
00860             this->Lastkey=this->key;
00861             this->SetInputCamera(this->key-SDLK_0,VIDEO_MODE_NTSC);
00862             ioctl(this->fd, VIDIOCSCHAN,&this->vch);
00863             if(this->debug)
00864             printf(" > Source %d selected\n",(this->key-SDLK_0)); 
00865          }
00866 
00867 
00868 
00869          // Key Q: Quit 
00870          if(this->key==KeyQuit)
00871          {
00872             this->VideoTerminate();
00873          }
00874       }
00875 
00876 
00877  } while(lintLoop++<10);
00878 
00879    if (this->map_buffer.format==VIDEO_PALETTE_YUV420P)
00880    SDL_FreeYUVOverlay(this->offscreenOVL);
00881 
00882    SDL_FreeSurface(this->offscreen);
00883 
00884 }

Here is the call graph for this function:

void WriteText ( int  lintx,
int  linty,
char *  lcharText 
)

Write text over live video.

Parameters:
lintx position x in the screen.
linty position y in the screen.
lcharText Message. Example: video1.WriteText(10,20,"NETi TECNOLOGIA");

Definition at line 1511 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::NameFont, CAPTURE::TempRect, CAPTURE::UseText, CAPTURE::xText, and CAPTURE::yText.

01512 { 
01513    this->UseText = false;
01514 
01515    if (this->debug) 
01516    {
01517       printf(" > WriteText(%d,%d,%s)\n",lintx, linty, lcharText);
01518    }
01519    TTF_Init();
01520 
01521    SDL_Surface *Limage;
01522    SDL_Surface *LimageR;
01523 
01524    this->NameFont= TTF_OpenFont( this->fontName, this->size_font );
01525    TTF_SetFontStyle(this->NameFont, TTF_STYLE_NORMAL);
01526    Limage = TTF_RenderText_Solid(this->NameFont,lcharText, this->colorFont);
01527    TTF_CloseFont( this->NameFont );
01528    TTF_Quit();
01529    
01530    this->xText   = lintx;
01531    this->yText   = linty;
01532 
01533    this->TempRect.x =this->xText;
01534    this->TempRect.y =this->yText;
01535    this->TempRect.w = Limage->w;
01536    this->TempRect.h = Limage->h;
01537    
01538    if(this->RotateText!=0)
01539    {
01540       LimageR = rotozoomSurface(Limage, this->RotateText, 1,SMOOTHING_ON);
01541 
01542       this->TempRect.w = LimageR->h;
01543       this->TempRect.h = LimageR->w;
01544 
01545       SDL_BlitSurface(LimageR,NULL,this->text_surface,&TempRect);
01546       SDL_FreeSurface(LimageR);
01547 
01548    }
01549    else
01550    {
01551       SDL_BlitSurface(Limage,NULL,this->text_surface,&TempRect);
01552    }
01553 
01554    SDL_UpdateRect(this->text_surface, 0, 0, 0, 0);
01555    SDL_FreeSurface(Limage);
01556 
01557    this->UseText = true;
01558 }

void WriteText ( int  lintx,
int  linty,
char *  lcharText,
int  lintSIZE,
bool  lboolSHADOW 
)

Write text over live video.

Parameters:
lintx position x in the screen.
linty position y in the screen.
lcharText Message.
lintSIZE Size font.
lboolSHADOW Enable/Disable shadow font (true/false). Example: video1.WriteText(10,20,"NETi TECNOLOGIA",30,true);

Definition at line 1420 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::NameFont, CAPTURE::TempRect, and CAPTURE::UseText.

Referenced by CAPTURE::GetTouch(), and CAPTURE::Progress().

01421 { 
01422    this->UseText = false;
01423 
01424    if (this->debug) 
01425    {
01426       printf(" > WriteText(%d,%d,%s,%d,%d)\n",lintx, linty, lcharText,lintSIZE,lboolSHADOW);
01427    }
01428         
01429    TTF_Init();
01430    SDL_Surface *Limage;  
01431    SDL_Surface *LimageShadow;
01432    SDL_Surface *LimageR;
01433 
01434    int intTMPR, intTMPG, intTMPB;
01435 
01436 
01437    this->NameFont= TTF_OpenFont( this->fontName,lintSIZE);
01438    TTF_SetFontStyle(this->NameFont, TTF_STYLE_NORMAL);
01439 
01440    if(lboolSHADOW)
01441    {
01442       //intTMPR = this->colorFont.r;
01443       //intTMPG = this->colorFont.g;
01444       //intTMPB = this->colorFont.b;
01445 
01446       //this->SetColorFont(1,1,1);
01447       LimageShadow = TTF_RenderText_Solid(this->NameFont,lcharText,(SDL_Color){1,1,1});
01448       //this->SetColorFont(intTMPR,intTMPG,intTMPB);
01449 
01450       this->TempRect.x = lintx+2;
01451       this->TempRect.y = linty+2;
01452       this->TempRect.w = LimageShadow->w;
01453       this->TempRect.h = LimageShadow->h;
01454    
01455       if(this->RotateText!=0)
01456       {
01457          LimageR = rotozoomSurface(LimageShadow, this->RotateText, 1,SMOOTHING_ON);
01458          this->TempRect.w = LimageR->h;
01459          this->TempRect.h = LimageR->w;
01460 
01461          SDL_BlitSurface(LimageR,NULL,this->text_surface,&TempRect);
01462       }
01463       else
01464       {
01465          SDL_BlitSurface(LimageShadow,NULL,this->text_surface,&TempRect);
01466       }
01467 
01468       SDL_FreeSurface(LimageShadow);
01469    }
01470 
01471          
01472    Limage = TTF_RenderText_Solid(this->NameFont,lcharText, this->colorFont);
01473    TTF_CloseFont( this->NameFont );
01474    TTF_Quit();
01475    
01476    this->xText   = lintx;
01477    this->yText   = linty;
01478 
01479    this->TempRect.x =this->xText;
01480    this->TempRect.y =this->yText;
01481    this->TempRect.w = Limage->w;
01482    this->TempRect.h = Limage->h;
01483 
01484    if(this->RotateText!=0)
01485    {
01486       LimageR = rotozoomSurface(Limage, this->RotateText, 1,SMOOTHING_ON);
01487       this->TempRect.w = LimageR->h;
01488       this->TempRect.h = LimageR->w;
01489 
01490       SDL_BlitSurface(LimageR,NULL,this->text_surface,&TempRect);
01491       SDL_FreeSurface(LimageR);
01492    }
01493    else
01494    {
01495       SDL_BlitSurface(Limage,NULL,this->text_surface,&TempRect);
01496    }
01497 
01498    SDL_UpdateRect(this->text_surface, 0, 0, 0, 0);
01499    SDL_FreeSurface(Limage);
01500    this->UseText = true;
01501 }

void ZoomOut ( bool  lboolStatus  ) 

On/Off show zoomout.

Parameters:
lboolStatus On/Off zoomout. Example: video1.ZoomOut(true);

Definition at line 1831 of file funcoesHAIRCAPTURE.cpp.

References CAPTURE::height, CAPTURE::TempRect, CAPTURE::UseZoomOut, and CAPTURE::width.

Referenced by CAPTURE::WriteScreen().

01832 {
01833         
01834    this->TempRect.x=1;
01835    this->TempRect.y=1;
01836    this->TempRect.w=this->width/2;
01837    this->TempRect.h =this->height/2;
01838         
01839    this->UseZoomOut  = false;
01840    if(lboolStatus)
01841    {
01842       SDL_Surface *Limage;
01843       Limage = zoomSurface(this->offscreen, 0.5,0.5, 1);
01844 
01845       SDL_BlitSurface(Limage, NULL, this->zoomout_surface, NULL);
01846       SDL_UpdateRect(this->zoomout_surface, 0, 0, 0, 0);
01847       this->UseZoomOut  = true;
01848       SDL_FreeSurface(Limage);
01849    }
01850 }


Field Documentation

int adjustVIDEO [private]

Ajust Picture.

Definition at line 183 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::SelectAdjust(), and CAPTURE::SelectHue().

char* arqPPM [private]

PPM file name.

Definition at line 145 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::Open().

struct video_audio audio [private]

Audio properties.

Definition at line 78 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::Open(), and CAPTURE::VideoTerminate().

bool AudioEnabled

Enable audio.

Definition at line 204 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE().

struct video_mbuf buffers [private]

Capability of the buffer.

Definition at line 64 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::Open().

struct video_capability capability [private]

Capability of the video.

Definition at line 62 of file funcoesHAIRCAPTURE.h.

SDL_Color colorFont [private]

Color font.

Definition at line 127 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::Progress(), and CAPTURE::SetColorFont().

SDL_Color colorFontVideo [private]

Color font video.

Definition at line 130 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE().

Uint32 colorTransparent [private]

Transparent color video.

Definition at line 133 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::InicializeWin().

SDL_cond* cond [private]

Condicinal for GetLastButton function.

Definition at line 173 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::GetLastButton().

bool debug

Display debug msg.

Definition at line 202 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE().

int depth [private]

Definition at line 92 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::Open().

char* device [private]

Capture device name.

Definition at line 96 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::SetDevice().

SDL_Surface* draw_surface [private]

Surface of graphics BMP.

Definition at line 120 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::ClearSurface(), and CAPTURE::InicializeWin().

SDL_Event event [private]

Keyboard event.

Definition at line 112 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::Live(), and CAPTURE::WriteScreen().

struct video_buffer fbuffers [private]

Capability of the suport for Frame Buffer.

Definition at line 66 of file funcoesHAIRCAPTURE.h.

int fd

File device video.

Definition at line 200 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE().

char* fontName [private]

Font file name.

Definition at line 147 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::SetFont().

SDL_Rect gButtons[MAX_BUTTON] [private]

Position virtual buttons.

Definition at line 169 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::DefinePositionButton().

bool GrabZoom

Function GrabZoom.

Definition at line 214 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::WriteScreen().

int height [private]

Height of video source.

Definition at line 86 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::convertYUV420PtoGray(), CAPTURE::convertYUV420PtoRGB(), CAPTURE::InicializeWin(), CAPTURE::Open(), CAPTURE::SaveJPG(), CAPTURE::SavePPM(), CAPTURE::WriteScreen(), and CAPTURE::ZoomOut().

int heightWin [private]

Height of Windows.

Definition at line 82 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::InicializeWin(), CAPTURE::MaxHeight(), and CAPTURE::ResolutionWin().

bool imageAdjust [private]

Flag for imageAdjust.

Definition at line 185 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::AdjustVideo(), and CAPTURE::CAPTURE().

std::string imageFile

IMAGE file name.

Definition at line 218 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::SetImageFile().

SMPEG_Info info [private]

Information mpeg file.

Definition at line 167 of file funcoesHAIRCAPTURE.h.

bool Invert [private]

Inverte show video.

Definition at line 187 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE().

SDLKey key [private]

Code keyboard.

Definition at line 114 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::Live(), and CAPTURE::WriteScreen().

SDLKey KeyFullScreeen [private]

Action FullScreen.

Definition at line 157 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::SetKeyFullScreeen(), and CAPTURE::WriteScreen().

SDLKey KeyInvert [private]

Action invert video.

Definition at line 165 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE().

SDLKey KeyQuit [private]

Action exit.

Definition at line 161 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::SetKeyQuit(), and CAPTURE::WriteScreen().

SDLKey KeySaveFrame [private]

Action SaveFrame.

Definition at line 159 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::SetKeySaveFrame(), and CAPTURE::WriteScreen().

SDLKey KeyVideoOn [private]

Action Play Mpeg Video.

Definition at line 155 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::SetKeyVideoOn().

SDLKey KeyZoomOutOff [private]

Action ZoomOutOff.

Definition at line 153 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::SetKeyZoomOutOff(), and CAPTURE::WriteScreen().

SDLKey KeyZoomOutOn [private]

Action ZoomOutOn.

Definition at line 151 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::SetKeyZoomOutOn().

unsigned char* last_map [private]

Definition at line 141 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::convertYUV420PtoGray(), and CAPTURE::Open().

int LastButton

LastButton code.

Definition at line 216 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::GetLastButton(), CAPTURE::GetTouch(), CAPTURE::TouchScreen(), and CAPTURE::WriteScreen().

int Lastkey [private]

Scan Keuboard.

Definition at line 179 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::WriteScreen().

int left [private]

Left of video source.

Definition at line 90 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::Progress(), CAPTURE::SetVideoPos(), and CAPTURE::WriteScreen().

int lintTouchX

Internal variable for conversion X and Y.

Definition at line 222 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::WriteScreen().

int lintTouchY

Definition at line 222 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::WriteScreen().

int lintVideoFormat [private]

Internal Format Video.

Definition at line 189 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::Open(), CAPTURE::SetFormatPalette(), CAPTURE::SetHardwareCaptureCard(), and CAPTURE::SetHardwareWebCam().

int lintVideoMode [private]

Internal Video Mode.

Definition at line 191 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::Open(), CAPTURE::SetInputCamera(), and CAPTURE::SetInputTelevision().

long llongTuners [private]

Internal Tuner Mode.

Definition at line 193 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::Open().

unsigned char* map [private]

Memory map.

Definition at line 140 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::convertYUV420PtoRGB(), CAPTURE::Open(), and CAPTURE::swap_rgb24().

struct video_mmap map_buffer [private]

Memory mapped buffer.

Definition at line 70 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::Live(), CAPTURE::Open(), CAPTURE::SetFormatPalette(), CAPTURE::SetHardwareCaptureCard(), and CAPTURE::SetHardwareWebCam().

int MaxTextTouch [private]

Max length for string input TouchScreen;.

Definition at line 195 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::GetTouch(), and CAPTURE::SetMaxTextTouch().

SMPEG* mpeg [private]

Mpeg video.

Definition at line 163 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::PlayMPEG().

char* mpegName [private]

MPEG video file name.

Definition at line 149 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE().

SDL_mutex* mutex [private]

Mutex for GetLastButton function.

Definition at line 171 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::GetLastButton().

TTF_Font* NameFont [private]

Truetype font name.

Definition at line 116 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::WriteText().

SDL_Surface* offscreen [private]

Surface offscreenRGB.

Definition at line 108 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::WriteScreen().

SDL_Overlay* offscreenOVL [private]

Surface offscreen YUV.

Definition at line 110 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::WriteScreen().

struct video_picture pic [private]

Image properties.

Definition at line 76 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::AdjustVideo(), CAPTURE::Open(), CAPTURE::SelectBrightness(), CAPTURE::SelectColor(), CAPTURE::SelectContrast(), CAPTURE::SetFormatPalette(), CAPTURE::SetHardwareCaptureCard(), and CAPTURE::SetHardwareWebCam().

int RotateText [private]

Angle for rotation text surface.

Definition at line 102 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::SetAngleText().

int RotateVideo [private]

Angle for rotation video live surface.

Definition at line 104 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::SetAngleVideo().

bool ScanButtons [private]

Scan Buttons.

Definition at line 181 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::TouchScreen().

SDL_Surface* screen [private]

Surface show screen.

Definition at line 106 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::InicializeWin(), and CAPTURE::WriteScreen().

int size_font [private]

Size font.

Definition at line 94 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::SetFontSize().

SDL_Color SRCcolorTransparent [private]

Transparent color video.

Definition at line 135 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::InicializeWin(), and CAPTURE::SetTransparent().

SDL_Color temp [private]

Definition at line 196 of file funcoesHAIRCAPTURE.h.

SDL_Rect TempRect [private]

Rect temp for work.

Definition at line 175 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::ClearSurface(), CAPTURE::InicializeWin(), CAPTURE::LoadJPG(), CAPTURE::WriteScreen(), CAPTURE::WriteText(), and CAPTURE::ZoomOut().

SDL_Rect TempRectImage [private]

Definition at line 176 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::ViewLastMap().

SDL_Surface* text_surface [private]

Suface of text and graphics.

Definition at line 118 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::ClearSurface(), and CAPTURE::InicializeWin().

pthread_t* thread [private]

Thread video live.

Definition at line 138 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::Show().

int top [private]

Top of video source.

Definition at line 88 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::Progress(), CAPTURE::SetVideoPos(), and CAPTURE::WriteScreen().

TypeImage typeImageFile

Type image file.

Definition at line 220 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::SetImageFile().

bool UseDraw

Show surface draw?

Definition at line 208 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::Circle(), CAPTURE::ClearSurface(), CAPTURE::Line(), CAPTURE::LoadBMP(), CAPTURE::LoadJPG(), CAPTURE::Rectangle(), CAPTURE::RectangleFill(), and CAPTURE::ViewLastMap().

bool UseText

Show surface text?

Definition at line 212 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::Circle(), CAPTURE::ClearSurface(), CAPTURE::Line(), CAPTURE::LoadJPG(), CAPTURE::Progress(), CAPTURE::Rectangle(), CAPTURE::RectangleFill(), CAPTURE::ViewLastMap(), and CAPTURE::WriteText().

bool UseVideo

Show surface video mpeg?

Definition at line 206 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::Circle(), CAPTURE::ClearSurface(), CAPTURE::Line(), CAPTURE::LoadJPG(), CAPTURE::PlayMPEG(), CAPTURE::Rectangle(), CAPTURE::RectangleFill(), and CAPTURE::ViewLastMap().

bool UseZoomOut

Show surface zoomout?

Definition at line 210 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::Circle(), CAPTURE::ClearSurface(), CAPTURE::Line(), CAPTURE::LoadJPG(), CAPTURE::Rectangle(), CAPTURE::RectangleFill(), CAPTURE::ViewLastMap(), and CAPTURE::ZoomOut().

unsigned char* v4l_convert_buf [private]

Map for convertion YUV.

Definition at line 143 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::convertYUV420PtoGray(), CAPTURE::convertYUV420PtoRGB(), CAPTURE::Open(), CAPTURE::SaveJPG(), and CAPTURE::swap_rgb24().

struct video_channel vch [private]

Video input channel.

Definition at line 72 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::Open(), CAPTURE::SetInputCamera(), CAPTURE::SetInputChannel(), and CAPTURE::SetInputTelevision().

SDL_Surface* video_surface [private]

Surface of mpeg.

Definition at line 124 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::ClearSurface(), and CAPTURE::InicializeWin().

struct video_window videowin [private]

Capability of the video windows.

Definition at line 68 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::Open().

struct video_tuner vtuner [private]

Tuner properties.

Definition at line 74 of file funcoesHAIRCAPTURE.h.

int width [private]

Witdh of video source.

Definition at line 84 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::convertYUV420PtoGray(), CAPTURE::convertYUV420PtoRGB(), CAPTURE::InicializeWin(), CAPTURE::Open(), CAPTURE::SaveJPG(), CAPTURE::SavePPM(), CAPTURE::WriteScreen(), and CAPTURE::ZoomOut().

int widthWin [private]

Witdh of Windows.

Definition at line 80 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), CAPTURE::InicializeWin(), CAPTURE::MaxWidth(), and CAPTURE::ResolutionWin().

int xText [private]

X position text.

Definition at line 98 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::WriteText().

int yText [private]

Y position text.

Definition at line 100 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::CAPTURE(), and CAPTURE::WriteText().

SDL_Surface* zoomout_surface [private]

Surface of ZoomOut.

Definition at line 122 of file funcoesHAIRCAPTURE.h.

Referenced by CAPTURE::ClearSurface(), and CAPTURE::InicializeWin().


The documentation for this class was generated from the following files:
Generated on Tue Apr 3 11:59:13 2007 for NETi TECNOLOGIA - libHAIRCAPTURE by  doxygen 1.5.0-1