Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PageBttv Class Reference

Video4Linux Capture page. More...

#include <page_bttv.h>

Inheritance diagram for PageBttv:

Inheritance graph
[legend]
Collaboration diagram for PageBttv:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PageBttv (KinoCommon *common)
virtual ~PageBttv ()
void start ()
void newFile ()
 Called when a new file operation is selected by the user.
gulong activate ()
void clean ()
void videoStartOfMovie ()
void videoPreviousScene ()
void videoRewind ()
void videoPlay ()
void videoStop ()
void videoFastForward ()
void videoBack ()
void videoForward ()
void videoNextScene ()
void videoEndOfMovie ()
void startCapture ()
void stopCapture ()
void saveFrame ()

Private Attributes

KinoCommoncommon
bool seeking
string lastPreferenceFilename
int channel
GDKV4Lv4l

Detailed Description

Video4Linux Capture page.

Totally disconnected from the rest of the app.

Curious if I can generate a Frame object to allow playback using FrameDisplayer but will require virtual methods on the base class... maybe withdrawn if no one is interested (or proves too difficult).

Silly behaviour - uses Rewind and Fast Forward as channel hopper, start/end of scene for large frequency jumps (+/- 100) and back/forward as fine tuning. Produces a report on the capability of your video capture card on stdout and then promptly ignores everything that it's found out about it ... yippee.

Only tested on hauppage BT878 - no idea about other cards, though will be able to test on an iomega buz at some point.

Definition at line 48 of file page_bttv.h.


Constructor & Destructor Documentation

PageBttv::PageBttv KinoCommon common  ) 
 

Definition at line 67 of file page_bttv.cc.

00067                                        : seeking( false ), lastPreferenceFilename( "" ), channel( 0 )
00068 {
00069     this->common = common;
00070 }

PageBttv::~PageBttv  )  [virtual]
 

Definition at line 72 of file page_bttv.cc.

00073 {}


Member Function Documentation

gulong PageBttv::activate  )  [virtual]
 

Reimplemented from Page.

Definition at line 115 of file page_bttv.cc.

References V4L::deviceAvailable(), v4l, VIDEO_BACK, VIDEO_END_OF_MOVIE, VIDEO_FAST_FORWARD, VIDEO_FORWARD, VIDEO_NEXT_SCENE, VIDEO_PLAY, VIDEO_REWIND, VIDEO_START_OF_MOVIE, VIDEO_START_OF_SCENE, and VIDEO_STOP.

00116 {
00117     if ( v4l->deviceAvailable() )
00118         return VIDEO_START_OF_MOVIE | VIDEO_START_OF_SCENE | VIDEO_REWIND | VIDEO_BACK |
00119                VIDEO_PLAY | VIDEO_STOP |
00120                VIDEO_FAST_FORWARD | VIDEO_FORWARD | VIDEO_NEXT_SCENE | VIDEO_END_OF_MOVIE;
00121     else
00122         return 0;
00123 }

void PageBttv::clean  )  [virtual]
 

Reimplemented from Page.

Definition at line 125 of file page_bttv.cc.

References V4L::deviceAvailable(), V4L::stopAudio(), GDKV4L::stopVideo(), and v4l.

00126 {
00127     std::cerr << ">> Leaving bttv" << std::endl;
00128     if ( v4l->deviceAvailable() )
00129     {
00130         v4l->stopVideo();
00131         v4l->stopAudio();
00132     }
00133     delete v4l;
00134     v4l = NULL;
00135     std::cerr << ">> Left bttv" << std::endl;
00136 }

void PageBttv::newFile  )  [virtual]
 

Called when a new file operation is selected by the user.

Reimplemented from Page.

Definition at line 141 of file page_bttv.cc.

References lastPreferenceFilename.

00142 {
00143     lastPreferenceFilename = "";
00144 }

void PageBttv::saveFrame  )  [virtual]
 

Reimplemented from Page.

Definition at line 260 of file page_bttv.cc.

00261 {
00262     std::cerr << "BTTV Save Frame Requested" << std::endl;
00263 }

void PageBttv::start  )  [virtual]
 

Reimplemented from Page.

Definition at line 75 of file page_bttv.cc.

References channel, common, Preferences::getInstance(), KinoCommon::getPlayList(), KinoCommon::getWidget(), lastPreferenceFilename, lookup_widget(), V4L::openDevice(), V4L::report(), V4L::setChannel(), V4L::setInfo(), V4L::setTuner(), V4L::startAudio(), GDKV4L::startVideo(), v4l, Preferences::v4lAudio, Preferences::v4lAudioDevice, Preferences::v4lInput, and Preferences::v4lVideoDevice.

00076 {
00077     std::cerr << ">>> Starting bttv" << std::endl;
00078     v4l = new GDKV4L( lookup_widget( common->getWidget(), "drawingarea3" ) );
00079     GtkEntry *fileEntry = GTK_ENTRY( lookup_widget( common->getWidget(), "entry_v4l_file" ) );
00080 
00081     // Determine the capture directory and file - rules are:
00082     // 1) if a full path is specified in the preferences, then use that
00083     // 2) if a non-full path is specified, then pick up the project directory and attach preference
00084 
00085     string capture_file_name = Preferences::getInstance().file;
00086     if ( capture_file_name[ 0 ] != '/' )
00087         capture_file_name = common->getPlayList( ) ->GetProjectDirectory( ) + "/" + capture_file_name;
00088 
00089     // If the preferences have changed, then update the filename
00090 
00091     if ( capture_file_name != lastPreferenceFilename )
00092     {
00093         lastPreferenceFilename = capture_file_name;
00094         gtk_entry_set_text( fileEntry, capture_file_name.c_str( ) );
00095     }
00096 
00097     Preferences &prefs = Preferences::getInstance();
00098     v4l->setInfo( prefs.v4lVideoDevice, prefs.v4lInput, prefs.v4lAudioDevice, atoi( prefs.v4lAudio ) );
00099 
00100     if ( v4l->openDevice() )
00101     {
00102         v4l->report();
00103         v4l->setChannel( channel );
00104         v4l->setTuner( 0 );
00105         v4l->startAudio();
00106         v4l->startVideo();
00107     }
00108     else
00109     {
00110         std::cerr << "unable to open video device" << std::endl;
00111     }
00112     gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( lookup_widget( common->getWidget(), "menuitem_v4l" ) ), TRUE );
00113 }

void PageBttv::startCapture  ) 
 

Definition at line 250 of file page_bttv.cc.

References GDKV4L::startCapturing(), and v4l.

00251 {
00252     v4l->startCapturing();
00253 }

void PageBttv::stopCapture  ) 
 

Definition at line 255 of file page_bttv.cc.

References GDKV4L::stopCapturing(), and v4l.

00256 {
00257     v4l->stopCapturing();
00258 }

void PageBttv::videoBack  ) 
 

Definition at line 229 of file page_bttv.cc.

References V4L::getFrequency(), V4L::setFrequency(), and v4l.

00230 {
00231     v4l->setFrequency( v4l->getFrequency() - 1 );
00232 }

void PageBttv::videoEndOfMovie  )  [virtual]
 

Reimplemented from Page.

Definition at line 244 of file page_bttv.cc.

References channel, V4L::getNumberOfChannels(), V4L::setChannel(), and v4l.

00245 {
00246     channel = ( channel + 1 ) % v4l->getNumberOfChannels( );
00247     v4l->setChannel( channel );
00248 }

void PageBttv::videoFastForward  )  [virtual]
 

Reimplemented from Page.

Definition at line 200 of file page_bttv.cc.

References V4L::getFrequency(), V4L::getSignal(), seeking, V4L::setFrequency(), and v4l.

00201 {
00202     if ( seeking == true )
00203         return ;
00204     seeking = true;
00205     do
00206     {
00207         if ( ( v4l->getFrequency() + 1 ) < 0xffff )
00208             v4l->setFrequency( v4l->getFrequency() + 1 );
00209         else
00210             break;
00211     }
00212     while ( v4l->getSignal() != 0 );
00213     do
00214     {
00215         if ( ( v4l->getFrequency() + 2 ) < 0xffff )
00216             v4l->setFrequency( v4l->getFrequency() + 2 );
00217         else
00218             break;
00219         std::cerr << "frequency = " << v4l->getFrequency() << std::endl;
00220         while ( gtk_events_pending() )
00221         {
00222             gtk_main_iteration();
00223         }
00224     }
00225     while ( v4l->getSignal() == 0 && seeking );
00226     seeking = false;
00227 }

void PageBttv::videoForward  ) 
 

Definition at line 234 of file page_bttv.cc.

References V4L::getFrequency(), V4L::setFrequency(), and v4l.

00235 {
00236     v4l->setFrequency( v4l->getFrequency() + 1 );
00237 }

void PageBttv::videoNextScene  )  [virtual]
 

Reimplemented from Page.

Definition at line 239 of file page_bttv.cc.

References V4L::getFrequency(), V4L::setFrequency(), and v4l.

00240 {
00241     v4l->setFrequency( v4l->getFrequency() + 100 );
00242 }

void PageBttv::videoPlay  )  [virtual]
 

Reimplemented from Page.

Definition at line 189 of file page_bttv.cc.

References GDKV4L::startVideo(), and v4l.

00190 {
00191     v4l->startVideo();
00192 }

void PageBttv::videoPreviousScene  )  [virtual]
 

Reimplemented from Page.

Definition at line 155 of file page_bttv.cc.

References V4L::getFrequency(), V4L::setFrequency(), and v4l.

00156 {
00157     v4l->setFrequency( v4l->getFrequency() - 100 );
00158 }

void PageBttv::videoRewind  )  [virtual]
 

Reimplemented from Page.

Definition at line 160 of file page_bttv.cc.

References V4L::getFrequency(), V4L::getSignal(), seeking, V4L::setFrequency(), and v4l.

00161 {
00162     if ( seeking == true )
00163         return ;
00164     seeking = true;
00165     do
00166     {
00167         if ( ( v4l->getFrequency() - 1 ) > 0 )
00168             v4l->setFrequency( v4l->getFrequency() - 1 );
00169         else
00170             break;
00171     }
00172     while ( v4l->getSignal() != 0 );
00173     do
00174     {
00175         if ( ( v4l->getFrequency() - 2 ) > 0 )
00176             v4l->setFrequency( v4l->getFrequency() - 2 );
00177         else
00178             break;
00179         std::cerr << "frequency = " << v4l->getFrequency() << std::endl;
00180         while ( gtk_events_pending() )
00181         {
00182             gtk_main_iteration();
00183         }
00184     }
00185     while ( v4l->getSignal() == 0 && seeking );
00186     seeking = false;
00187 }

void PageBttv::videoStartOfMovie  )  [virtual]
 

Reimplemented from Page.

Definition at line 147 of file page_bttv.cc.

References channel, V4L::getNumberOfChannels(), V4L::setChannel(), and v4l.

00148 {
00149     std::cerr << "channels = " << v4l->getNumberOfChannels( ) << " channel = " << channel;
00150     channel = ( channel - 1 ) % v4l->getNumberOfChannels( );
00151     v4l->setChannel( channel );
00152     std::cerr << " new channel = " << channel << std::endl;
00153 }

void PageBttv::videoStop  )  [virtual]
 

Reimplemented from Page.

Definition at line 194 of file page_bttv.cc.

References seeking, GDKV4L::stopVideo(), and v4l.

00195 {
00196     seeking = false;
00197     v4l->stopVideo();
00198 }


Member Data Documentation

int PageBttv::channel [private]
 

Definition at line 55 of file page_bttv.h.

Referenced by start(), videoEndOfMovie(), and videoStartOfMovie().

KinoCommon* PageBttv::common [private]
 

Definition at line 52 of file page_bttv.h.

Referenced by start().

string PageBttv::lastPreferenceFilename [private]
 

Definition at line 54 of file page_bttv.h.

Referenced by newFile(), and start().

bool PageBttv::seeking [private]
 

Definition at line 53 of file page_bttv.h.

Referenced by videoFastForward(), videoRewind(), and videoStop().

GDKV4L* PageBttv::v4l [private]
 

Definition at line 58 of file page_bttv.h.

Referenced by activate(), clean(), start(), startCapture(), stopCapture(), videoBack(), videoEndOfMovie(), videoFastForward(), videoForward(), videoNextScene(), videoPlay(), videoPreviousScene(), videoRewind(), videoStartOfMovie(), and videoStop().


The documentation for this class was generated from the following files:
Generated on Sun Mar 11 22:13:11 2007 for Kino by  doxygen 1.4.2