#include <v4l.h>
Inheritance diagram for GDKV4L:


Public Member Functions | |
| GDKV4L (GtkWidget *widget) | |
| virtual | ~GDKV4L () |
| void | startVideo () |
| void | startCapturing () |
| void | stopVideo () |
| void | stopCapturing () |
| void | draw () |
| void | capture (DvEncoder *) |
Public Attributes | |
| GtkWidget * | widget |
| bool | active |
| bool | capturing |
Private Attributes | |
| Displayer * | displayer |
| DisplayerInput | input |
Up to this point, the V4L classes have been independent of the presentation.
Definition at line 239 of file v4l.h.
|
|
Definition at line 943 of file v4l.cc. References displayer. 00943 : V4L(), active( false ), capturing( false ) 00944 { 00945 cout << "Starting GDKV4L" << endl; 00946 this->widget = widget; 00947 this->displayer = NULL; 00948 }
|
|
|
Definition at line 950 of file v4l.cc. References stopCapturing(), and stopVideo(). 00951 {
00952 cout << "Closing GDKV4L" << endl;
00953 stopCapturing();
00954 stopVideo();
00955 }
|
|
|
Definition at line 1043 of file v4l.cc. References count, DISPLAY_RGB, DISPLAY_YUV, displayer, DvEncoder::doneWithFrame(), ENCODE_YUV, Displayer::format(), V4L::frame, FindDisplayer::getDisplayer(), DvEncoder::getFrame(), V4L::getHeight(), V4L::getNextFrame(), V4L::getWidth(), V4L::initialiseCapture(), input, Displayer::put(), EncoderFrame::setVideo(), and widget. Referenced by gdkv4l_thread(). 01044 {
01045
01046 static int count = 0;
01047 void *f = NULL;
01048
01049 if ( displayer == NULL )
01050 {
01051 gdk_threads_enter();
01052 displayer = FindDisplayer::getDisplayer( widget, getWidth(), getHeight() );
01053
01054 if ( ENCODE_YUV )
01055 {
01056 input = DISPLAY_YUV; // Fake - YUV422P isn't supported by Displayer
01057 initialiseCapture( VIDEO_PALETTE_YUV422P );
01058 }
01059 else
01060 {
01061 input = DISPLAY_RGB; // Fake - YUV420P isn't supported by Displayer
01062 initialiseCapture( VIDEO_PALETTE_YUV420P );
01063 }
01064
01065 // skip the first frame
01066 f = getNextFrame();
01067
01068 gdk_threads_leave();
01069 }
01070
01071
01072 f = getNextFrame();
01073
01074 if ( f != NULL )
01075 {
01076 EncoderFrame * frame = encoder->getFrame();
01077 if ( frame != NULL )
01078 {
01079 frame->setVideo( f, getWidth(), getHeight() );
01080 encoder->doneWithFrame( frame );
01081 }
01082 else
01083 {
01084 cout << "No frames available..." << endl;
01085 }
01086 }
01087
01088 // TODO: Determine if playback is desirable during capture
01089
01090 if ( f != NULL && displayer->format() == input && ( ++ count ) % 25 == 0 )
01091 {
01092 gdk_threads_enter();
01093 displayer->put( input, f, getWidth(), getHeight() );
01094 gdk_flush();
01095 gdk_threads_leave();
01096 }
01097 }
|
|
|
Definition at line 1004 of file v4l.cc. References DISPLAY_BGR, DISPLAY_RGB, DISPLAY_RGB16, DISPLAY_YUV, displayer, Displayer::format(), FindDisplayer::getDisplayer(), V4L::getHeight(), V4L::getNextFrame(), V4L::getWidth(), V4L::initialiseCapture(), input, Displayer::put(), and widget. Referenced by gdkv4l_thread(). 01005 {
01006
01007 if ( displayer == NULL )
01008 {
01009 gdk_threads_enter();
01010 displayer = FindDisplayer::getDisplayer( widget, getWidth(), getHeight() );
01011
01012 switch ( displayer->format() )
01013 {
01014 case DISPLAY_YUV:
01015 input = DISPLAY_YUV;
01016 initialiseCapture( VIDEO_PALETTE_YUV422 );
01017 break;
01018 case DISPLAY_RGB:
01019 input = DISPLAY_BGR;
01020 initialiseCapture( VIDEO_PALETTE_RGB24 );
01021 break;
01022 case DISPLAY_RGB16:
01023 input = DISPLAY_RGB16;
01024 initialiseCapture( VIDEO_PALETTE_RGB565 );
01025 break;
01026 default:
01027 break;
01028 }
01029 gdk_threads_leave();
01030 }
01031
01032 void *f = getNextFrame();
01033
01034 if ( f != NULL )
01035 {
01036 gdk_threads_enter();
01037 displayer->put( input, f, getWidth(), getHeight() );
01038 gdk_flush();
01039 gdk_threads_leave();
01040 }
01041 }
|
|
|
Definition at line 966 of file v4l.cc. References capturing, startVideo(), and stopVideo(). Referenced by PageBttv::startCapture(). 00967 {
00968 if ( !capturing )
00969 {
00970 stopVideo();
00971 capturing = true;
00972 startVideo();
00973 }
00974 }
|
|
|
Definition at line 957 of file v4l.cc. References active, gdkv4l_thread(), and v4lthread. Referenced by PageBttv::start(), startCapturing(), stopCapturing(), and PageBttv::videoPlay(). 00958 {
00959 cout << ">>> Starting video" << endl;
00960 if ( !active )
00961 {
00962 pthread_create( &v4lthread, NULL, gdkv4l_thread, this );
00963 }
00964 }
|
|
|
Definition at line 994 of file v4l.cc. References capturing, startVideo(), and stopVideo(). Referenced by PageBttv::stopCapture(), and ~GDKV4L(). 00995 {
00996 if ( capturing )
00997 {
00998 stopVideo();
00999 capturing = false;
01000 startVideo();
01001 }
01002 }
|
|
|
Definition at line 976 of file v4l.cc. References active, displayer, V4L::stopCapture(), and v4lthread. Referenced by PageBttv::clean(), startCapturing(), stopCapturing(), PageBttv::videoStop(), and ~GDKV4L(). 00977 {
00978 cout << ">>> Stopping video" << endl;
00979 if ( active )
00980 {
00981 active = false;
00982 gdk_threads_leave();
00983 pthread_join( v4lthread, NULL );
00984 gdk_threads_enter();
00985 this->stopCapture();
00986 }
00987 if ( displayer != NULL )
00988 {
00989 delete displayer;
00990 displayer = NULL;
00991 }
00992 }
|
|
|
Definition at line 256 of file v4l.h. Referenced by gdkv4l_thread(), startVideo(), and stopVideo(). |
|
|
Definition at line 257 of file v4l.h. Referenced by gdkv4l_thread(), startCapturing(), and stopCapturing(). |
|
|
Definition at line 243 of file v4l.h. Referenced by capture(), draw(), GDKV4L(), and stopVideo(). |
|
|
Reimplemented from V4L. |
|
|
Definition at line 247 of file v4l.h. Referenced by capture(), draw(), and gdkv4l_thread(). |
1.4.2