diff --git a/src/zm_curl_camera.cpp b/src/zm_curl_camera.cpp index da857227f..b8a97919a 100644 --- a/src/zm_curl_camera.cpp +++ b/src/zm_curl_camera.cpp @@ -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 diff --git a/src/zm_curl_camera.h b/src/zm_curl_camera.h index be2e9d167..6913dfed6 100644 --- a/src/zm_curl_camera.h +++ b/src/zm_curl_camera.h @@ -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); diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index 699ac6dea..682f23c69 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -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"); diff --git a/src/zm_ffmpeg_camera.h b/src/zm_ffmpeg_camera.h index 1e7931146..cb762254a 100644 --- a/src/zm_ffmpeg_camera.h +++ b/src/zm_ffmpeg_camera.h @@ -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(); }; diff --git a/src/zm_file_camera.h b/src/zm_file_camera.h index a49aafa3e..6c9bb7930 100644 --- a/src/zm_file_camera.h +++ b/src/zm_file_camera.h @@ -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 diff --git a/src/zm_local_camera.h b/src/zm_local_camera.h index 988deec53..11996e4b3 100644 --- a/src/zm_local_camera.h +++ b/src/zm_local_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 ); }; diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index c6ae82909..1515c7a8d 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -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); diff --git a/src/zm_monitor.h b/src/zm_monitor.h index b849175ea..a017509aa 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -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 ); diff --git a/src/zm_remote_camera_http.h b/src/zm_remote_camera_http.h index bbe37fb9e..df76c4faa 100644 --- a/src/zm_remote_camera_http.h +++ b/src/zm_remote_camera_http.h @@ -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