blah
This commit is contained in:
parent
0fbb473dd4
commit
3be40bcc99
|
@ -116,7 +116,7 @@ int cURLCamera::PreCapture() {
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
int cURLCamera::Capture( Image &image ) {
|
||||
ZMPacket * cURLCamera::Capture( Image &image ) {
|
||||
bool frameComplete = false;
|
||||
|
||||
/* MODE_STREAM specific variables */
|
||||
|
@ -144,7 +144,7 @@ int cURLCamera::Capture( Image &image ) {
|
|||
nRet = pthread_cond_wait(&data_available_cond,&shareddata_mutex);
|
||||
if(nRet != 0) {
|
||||
Error("Failed waiting for available data condition variable: %s",strerror(nRet));
|
||||
return -20;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ int cURLCamera::Capture( Image &image ) {
|
|||
nRet = pthread_cond_wait(&data_available_cond,&shareddata_mutex);
|
||||
if(nRet != 0) {
|
||||
Error("Failed waiting for available data condition variable: %s",strerror(nRet));
|
||||
return -18;
|
||||
return NULL;
|
||||
}
|
||||
need_more_data = false;
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ int cURLCamera::Capture( Image &image ) {
|
|||
nRet = pthread_cond_wait(&request_complete_cond,&shareddata_mutex);
|
||||
if(nRet != 0) {
|
||||
Error("Failed waiting for request complete condition variable: %s",strerror(nRet));
|
||||
return -19;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -295,9 +295,10 @@ int cURLCamera::Capture( Image &image ) {
|
|||
unlock();
|
||||
|
||||
if(!frameComplete)
|
||||
return -1;
|
||||
return NULL;
|
||||
|
||||
return 0;
|
||||
ZMPacket * packet = new ZMPacket( &image );
|
||||
return packet;
|
||||
}
|
||||
|
||||
int cURLCamera::PostCapture() {
|
||||
|
@ -305,12 +306,6 @@ int cURLCamera::PostCapture() {
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
int cURLCamera::CaptureAndRecord( Image &image, struct timeval recording, char* event_directory ) {
|
||||
Error("Capture and Record not implemented for the cURL camera type");
|
||||
// Nothing to do here
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
size_t cURLCamera::data_callback(void *buffer, size_t size, size_t nmemb, void *userdata) {
|
||||
lock();
|
||||
|
||||
|
|
|
@ -76,9 +76,8 @@ public:
|
|||
|
||||
int PrimeCapture();
|
||||
int PreCapture();
|
||||
int Capture( Image &image );
|
||||
ZMPacket * Capture( Image &image );
|
||||
int PostCapture();
|
||||
int CaptureAndRecord( Image &image, struct timeval recording, char* event_directory );
|
||||
|
||||
size_t data_callback(void *buffer, size_t size, size_t nmemb, void *userdata);
|
||||
size_t header_callback(void *buffer, size_t size, size_t nmemb, void *userdata);
|
||||
|
|
|
@ -140,6 +140,7 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string
|
|||
if ( symlink( time_path, id_file ) < 0 )
|
||||
Error( "Can't symlink %s -> %s: %s", id_file, path, strerror(errno));
|
||||
} else {
|
||||
// Shallow Storage
|
||||
snprintf( path, sizeof(path), "%s/%d/%d", storage->Path(), monitor->Id(), id );
|
||||
|
||||
errno = 0;
|
||||
|
@ -200,8 +201,8 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string
|
|||
} else {
|
||||
/* No video object */
|
||||
videowriter = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string &p_cause, const StringSetMap &p_noteSetMap, bool p_videoEvent )
|
||||
|
||||
|
|
|
@ -116,9 +116,9 @@ AVFrame *FFmpeg_Input::get_frame( int stream_id ) {
|
|||
if ( (stream_id < 0 ) || ( packet.stream_index == stream_id ) ) {
|
||||
Debug(1,"Packet is for our stream (%d)", packet.stream_index );
|
||||
|
||||
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
|
||||
AVCodecContext *context = streams[packet.stream_index].context;
|
||||
|
||||
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
|
||||
ret = avcodec_send_packet( context, &packet );
|
||||
if ( ret < 0 ) {
|
||||
av_strerror( ret, errbuf, AV_ERROR_MAX_STRING_SIZE );
|
||||
|
|
|
@ -192,14 +192,12 @@ int LibvlcCamera::PrimeCapture()
|
|||
return(0);
|
||||
}
|
||||
|
||||
int LibvlcCamera::PreCapture()
|
||||
{
|
||||
int LibvlcCamera::PreCapture() {
|
||||
return(0);
|
||||
}
|
||||
|
||||
// Should not return -1 as cancels capture. Always wait for image if available.
|
||||
int LibvlcCamera::Capture( Image &image )
|
||||
{
|
||||
ZMPacket * LibvlcCamera::Capture( Image &image ) {
|
||||
while(!mLibvlcData.newImage.getValueImmediate())
|
||||
mLibvlcData.newImage.getUpdatedValue(1);
|
||||
|
||||
|
@ -208,25 +206,10 @@ int LibvlcCamera::Capture( Image &image )
|
|||
mLibvlcData.newImage.setValueImmediate(false);
|
||||
mLibvlcData.mutex.unlock();
|
||||
|
||||
return (0);
|
||||
return new ZMPacket( &image );
|
||||
}
|
||||
|
||||
// Should not return -1 as cancels capture. Always wait for image if available.
|
||||
int LibvlcCamera::CaptureAndRecord(Image &image, timeval 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@
|
|||
#endif
|
||||
|
||||
// Used by libvlc callbacks
|
||||
struct LibvlcPrivateData
|
||||
{
|
||||
struct LibvlcPrivateData {
|
||||
uint8_t* buffer;
|
||||
uint8_t* prevBuffer;
|
||||
time_t prevTime;
|
||||
|
@ -41,8 +40,7 @@ struct LibvlcPrivateData
|
|||
ThreadData<bool> newImage;
|
||||
};
|
||||
|
||||
class LibvlcCamera : public Camera
|
||||
{
|
||||
class LibvlcCamera : public Camera {
|
||||
protected:
|
||||
std::string mPath;
|
||||
std::string mMethod;
|
||||
|
@ -69,8 +67,7 @@ public:
|
|||
|
||||
int PrimeCapture();
|
||||
int PreCapture();
|
||||
int Capture( Image &image );
|
||||
int CaptureAndRecord( Image &image, timeval recording, char* event_directory );
|
||||
ZMPacket *Capture( Image &image );
|
||||
int PostCapture();
|
||||
};
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ int ZMPacket::decode( AVCodecContext *ctx ) {
|
|||
|
||||
# else
|
||||
int frameComplete = 0;
|
||||
ret = zm_avcodec_decode_video( ctx, frame, &frameComplete, &packet );
|
||||
int ret = zm_avcodec_decode_video( ctx, frame, &frameComplete, &packet );
|
||||
if ( ret < 0 ) {
|
||||
Error( "Unable to decode frame at frame %s", av_make_error_string( ret ) );
|
||||
av_frame_free( &frame );
|
||||
|
|
Loading…
Reference in New Issue