Right direction
This commit is contained in:
parent
44df4a830d
commit
d1bcb14629
|
@ -314,7 +314,7 @@ int cURLCamera::PostCapture()
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
int cURLCamera::CaptureAndRecord(Image &image, bool recording, char* event_directory, zm_packetqueue* packetqueue)
|
||||
int cURLCamera::CaptureAndRecord(Image &image, bool recording, char* event_directory)
|
||||
{
|
||||
Error("Capture and Record not implemented for the cURL camera type");
|
||||
// Nothing to do here
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
int PreCapture();
|
||||
int Capture( Image &image );
|
||||
int PostCapture();
|
||||
int CaptureAndRecord( Image &image, bool recording, char* event_directory, zm_packetqueue* packetqueue );
|
||||
int CaptureAndRecord( Image &image, bool 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);
|
||||
|
|
|
@ -509,7 +509,8 @@ void *FfmpegCamera::ReopenFfmpegThreadCallback(void *ctx){
|
|||
}
|
||||
|
||||
//Function to handle capture and store
|
||||
int FfmpegCamera::CaptureAndRecord( Image &image, bool recording, char* event_file, zm_packetqueue* packetqueue ){
|
||||
|
||||
int FfmpegCamera::CaptureAndRecord(Image &image, bool recording, char* event_file) {
|
||||
if (!mCanCapture){
|
||||
return -1;
|
||||
}
|
||||
|
@ -581,9 +582,9 @@ int FfmpegCamera::CaptureAndRecord( Image &image, bool recording, char* event_fi
|
|||
//Buffer video packets
|
||||
if (!recording) {
|
||||
if(packet.flags & AV_PKT_FLAG_KEY) {
|
||||
packetqueue->clearQueues();
|
||||
// packetqueue->clearQueues();
|
||||
}
|
||||
packetqueue->queueVideoPacket(&packet);
|
||||
// packetqueue->queueVideoPacket(&packet);
|
||||
}
|
||||
|
||||
//Video recording
|
||||
|
@ -617,13 +618,13 @@ int FfmpegCamera::CaptureAndRecord( Image &image, bool recording, char* event_fi
|
|||
}
|
||||
wasRecording = true;
|
||||
strcpy(oldDirectory, event_file);
|
||||
while (packetqueue->popVideoPacket(&queuedpacket)) {
|
||||
int ret = videoStore->writeVideoFramePacket(&packet, mFormatContext->streams[mVideoStreamId]); //, &lastKeyframePkt);
|
||||
if (ret < 0) {//Less than zero and we skipped a frame
|
||||
av_free_packet(&packet);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// while (packetqueue->popVideoPacket(&queuedpacket)) {
|
||||
// int ret = videoStore->writeVideoFramePacket(&packet, mFormatContext->streams[mVideoStreamId]); //, &lastKeyframePkt);
|
||||
// if (ret < 0) {//Less than zero and we skipped a frame
|
||||
// av_free_packet(&packet);
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
} else if ( ( ! recording ) && wasRecording && videoStore ) {
|
||||
Info("Deleting videoStore instance");
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
//#include "zm_utils.h"
|
||||
#include "zm_ffmpeg.h"
|
||||
#include "zm_videostore.h"
|
||||
#include "zm_packetqueue.h"
|
||||
|
||||
//
|
||||
// Class representing 'ffmpeg' cameras, i.e. those which are
|
||||
|
@ -88,7 +87,7 @@ public:
|
|||
int PrimeCapture();
|
||||
int PreCapture();
|
||||
int Capture( Image &image );
|
||||
int CaptureAndRecord( Image &image, bool recording, char* event_directory, zm_packetqueue* packetqueue );
|
||||
int CaptureAndRecord( Image &image, bool recording, char* event_directory );
|
||||
int PostCapture();
|
||||
};
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
int PreCapture();
|
||||
int Capture( Image &image );
|
||||
int PostCapture();
|
||||
int CaptureAndRecord( Image &image, bool recording, char* event_directory, zm_packetqueue* packetqueue ) {return(0);};
|
||||
int CaptureAndRecord( Image &image, bool recording, char* event_directory ) {return(0);};
|
||||
};
|
||||
|
||||
#endif // ZM_FILE_CAMERA_H
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
int PreCapture();
|
||||
int Capture( Image &image );
|
||||
int PostCapture();
|
||||
int CaptureAndRecord( Image &image, bool recording, char* event_directory, zm_packetqueue* packetqueue ) {return(0);};
|
||||
int CaptureAndRecord( Image &image, bool recording, char* event_directory ) {return(0);};
|
||||
|
||||
static bool GetCurrentSettings( const char *device, char *output, int version, bool verbose );
|
||||
};
|
||||
|
|
|
@ -304,9 +304,10 @@ Monitor::Monitor(
|
|||
bool p_track_motion,
|
||||
Rgb p_signal_check_colour,
|
||||
bool p_embed_exif,
|
||||
Purpose p_purpose,
|
||||
Purpose p_purpose,
|
||||
zm_packetqueue p_packetqueue,
|
||||
int p_n_zones,
|
||||
Zone *p_zones[]
|
||||
Zone *p_zones[]
|
||||
) : id( p_id ),
|
||||
server_id( p_server_id ),
|
||||
function( (Function)p_function ),
|
||||
|
@ -2254,7 +2255,8 @@ Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame );
|
|||
track_motion,
|
||||
signal_check_colour,
|
||||
embed_exif,
|
||||
purpose,
|
||||
purpose,
|
||||
packetqueue,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
@ -2441,7 +2443,8 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
|
|||
track_motion,
|
||||
RGB_WHITE,
|
||||
embed_exif,
|
||||
purpose,
|
||||
purpose,
|
||||
packetqueue,
|
||||
0,
|
||||
0
|
||||
|
||||
|
@ -3113,8 +3116,7 @@ int Monitor::Capture()
|
|||
if((GetOptVideoWriter() == 2) && camera->SupportsNativeVideo()) {
|
||||
captureResult = camera->CaptureAndRecord(*(next_buffer.image),
|
||||
video_store_data->recording,
|
||||
video_store_data->event_file,
|
||||
packetqueue);
|
||||
video_store_data->event_file);
|
||||
}else{
|
||||
captureResult = camera->Capture(*(next_buffer.image));
|
||||
}
|
||||
|
@ -3128,7 +3130,7 @@ int Monitor::Capture()
|
|||
//Check if FFMPEG camera
|
||||
if((GetOptVideoWriter() == 2) && camera->SupportsNativeVideo()){
|
||||
//Warning("ZMC: Recording: %d", video_store_data->recording);
|
||||
captureResult = camera->CaptureAndRecord(*capture_image, video_store_data->recording, video_store_data->event_file, packetqueue);
|
||||
captureResult = camera->CaptureAndRecord(*capture_image, video_store_data->recording, video_store_data->event_file);
|
||||
}else{
|
||||
/* Capture directly into image buffer, avoiding the need to memcpy() */
|
||||
captureResult = camera->Capture(*capture_image);
|
||||
|
|
|
@ -370,6 +370,7 @@ public:
|
|||
Rgb p_signal_check_colour,
|
||||
bool p_embed_exif,
|
||||
Purpose p_purpose,
|
||||
zm_packetqueue packetqueue,
|
||||
int p_n_zones=0,
|
||||
Zone *p_zones[]=0
|
||||
);
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
int PreCapture();
|
||||
int Capture( Image &image );
|
||||
int PostCapture();
|
||||
int CaptureAndRecord( Image &image, bool recording, char* event_directory, zm_packetqueue* packetqueue ) {return(0);};
|
||||
int CaptureAndRecord( Image &image, bool recording, char* event_directory ) {return(0);};
|
||||
};
|
||||
|
||||
#endif // ZM_REMOTE_CAMERA_HTTP_H
|
||||
|
|
Loading…
Reference in New Issue