Add CaptureAndRecord to vlc, still need to make it record

This commit is contained in:
SteveGilvarry 2014-10-23 19:56:35 +11:00
parent ee90541370
commit 0e4156c095
3 changed files with 16 additions and 1 deletions

View File

@ -76,7 +76,7 @@ public:
int PrimeCapture(); int PrimeCapture();
int PreCapture(); int PreCapture();
int Capture( Image &image ); int Capture( Image &image );
int CaptureAndRecord( Image &image, bool recording, char* event_directory ); int CaptureAndRecord( Image &image, bool recording, char* event_directory );
int PostCapture(); int PostCapture();
}; };

View File

@ -211,6 +211,20 @@ int LibvlcCamera::Capture( Image &image )
return (0); return (0);
} }
// Should not return -1 as cancels capture. Always wait for image if available.
int LibvlcCamera::CaptureAndRecord( Image &image, bool recording, char* event_directory )
{
while(!mLibvlcData.newImage.getValueImmediate())
mLibvlcData.newImage.getUpdatedValue(1);
mLibvlcData.mutex.lock();
image.Assign(width, height, colours, subpixelorder, mLibvlcData.buffer, width * height * mBpp);
mLibvlcData.newImage.setValueImmediate(false);
mLibvlcData.mutex.unlock();
return (0);
}
int LibvlcCamera::PostCapture() int LibvlcCamera::PostCapture()
{ {
return(0); return(0);

View File

@ -70,6 +70,7 @@ public:
int PrimeCapture(); int PrimeCapture();
int PreCapture(); int PreCapture();
int Capture( Image &image ); int Capture( Image &image );
int CaptureAndRecord( Image &image, bool recording, char* event_directory );
int PostCapture(); int PostCapture();
}; };