Merge branch 'master' of github.com:ZoneMinder/zoneminder

pull/3750/head
Isaac Connor 2023-08-02 18:08:49 -04:00
commit 25f175e98f
5 changed files with 14 additions and 22 deletions

View File

@ -255,7 +255,7 @@ bool EventStream::loadEventData(uint64_t event_id) {
int id_diff = id - last_id;
Microseconds delta =
std::chrono::duration_cast<Microseconds>(id_diff ? (offset - last_offset) / id_diff : (offset - last_offset));
Debug(1, "New delta %f from id_diff %d = id %d - last_id %d offset %f - last)_offset %f",
Debug(4, "New delta %f from id_diff %d = id %d - last_id %d offset %f - last)_offset %f",
FPSeconds(delta).count(), id_diff, id, last_id, FPSeconds(offset).count(), FPSeconds(last_offset).count());
// Fill in data between bulk frames
@ -269,7 +269,7 @@ bool EventStream::loadEventData(uint64_t event_id) {
false
);
last_frame = &frame;
Debug(3, "Frame %d %d timestamp (%f s), offset (%f s) delta (%f s), in_db (%d)",
Debug(4, "Frame %d %d timestamp (%f s), offset (%f s) delta (%f s), in_db (%d)",
i, frame.id,
FPSeconds(frame.timestamp.time_since_epoch()).count(),
FPSeconds(frame.offset).count(),
@ -282,7 +282,7 @@ bool EventStream::loadEventData(uint64_t event_id) {
last_id = id;
last_offset = offset;
last_timestamp = timestamp;
Debug(3, "Frame %d timestamp (%f s), offset (%f s), delta(%f s), in_db(%d)",
Debug(4, "Frame %d timestamp (%f s), offset (%f s), delta(%f s), in_db(%d)",
id,
FPSeconds(frame.timestamp.time_since_epoch()).count(),
FPSeconds(frame.offset).count(),
@ -834,13 +834,13 @@ bool EventStream::sendFrame(Microseconds delta_us) {
if (!filepath.empty()) {
image = new Image(filepath.c_str());
} else if ( ffmpeg_input ) {
} else if (ffmpeg_input) {
// Get the frame from the mp4 input
const FrameData *frame_data = &event_data->frames[curr_frame_id-1];
AVFrame *frame =
ffmpeg_input->get_frame(ffmpeg_input->get_video_stream_id(), FPSeconds(frame_data->offset).count());
if (frame) {
image = new Image(frame);
image = new Image(frame, monitor->Width(), monitor->Height());
} else {
Error("Failed getting a frame.");
return false;

View File

@ -209,13 +209,7 @@ AVFrame *FFmpeg_Input::get_frame(int stream_id) {
} else {
zm_dump_frame(frame.get(), "resulting frame");
}
} // end while !frameComplete
if (is_video_stream(input_format_context->streams[packet->stream_index])) {
zm_dump_video_frame(frame.get(), "resulting video frame");
} else {
zm_dump_frame(frame.get(), "resulting frame");
}
return frame.get();
} // end AVFrame *FFmpeg_Input::get_frame
@ -299,7 +293,6 @@ AVFrame *FFmpeg_Input::get_frame(int stream_id, double at) {
return frame.get();
}
}
zm_dump_frame(frame, "frame->pts <= seek_target, got");
return frame.get();
}

View File

@ -235,7 +235,7 @@ Image::Image(int p_width, int p_linesize, int p_height, int p_colours, int p_sub
update_function_pointers();
}
Image::Image(const AVFrame *frame) :
Image::Image(const AVFrame *frame, int p_width, int p_height) :
colours(ZM_COLOUR_RGB32),
padding(0),
subpixelorder(ZM_SUBPIX_ORDER_RGBA),
@ -243,9 +243,9 @@ Image::Image(const AVFrame *frame) :
buffer(0),
holdbuffer(0)
{
width = frame->width;
height = frame->height;
pixels = width*height;
width = (p_width == -1 ? frame->width : p_width);
height = (p_height == -1 ? frame->height : p_height);
pixels = width * height;
zm_dump_video_frame(frame, "Image.Assign(frame)");
// FIXME

View File

@ -143,7 +143,7 @@ class Image {
Image(int p_width, int p_height, int p_colours, int p_subpixelorder, uint8_t *p_buffer=0, unsigned int padding=0);
Image(int p_width, int p_linesize, int p_height, int p_colours, int p_subpixelorder, uint8_t *p_buffer=0, unsigned int padding=0);
explicit Image(const Image &p_image);
explicit Image(const AVFrame *frame);
explicit Image(const AVFrame *frame, int p_width=-1, int p_height=-1);
~Image();

View File

@ -456,10 +456,6 @@ bool MonitorStream::sendFrame(Image *image, SystemTimePoint timestamp) {
} // end bool MonitorStream::sendFrame(Image *image, SystemTimePoint timestamp)
void MonitorStream::runStream() {
// Notify capture that we might want to view
monitor->setLastViewed();
if (type == STREAM_SINGLE) {
Debug(1, "Single");
if (!checkInitialised()) {
@ -468,6 +464,8 @@ void MonitorStream::runStream() {
} else if (monitor->Deleted()) {
sendTextFrame("Monitor has been deleted");
} else if (monitor->Capturing() == Monitor::CAPTURING_ONDEMAND) {
// Notify capture that we might want to view
monitor->setLastViewed();
sendTextFrame("Waiting for capture");
} else {
sendTextFrame("Unable to stream");
@ -563,7 +561,6 @@ void MonitorStream::runStream() {
}
now = std::chrono::steady_clock::now();
monitor->setLastViewed();
bool was_paused = paused;
if (!checkInitialised()) {
@ -577,6 +574,7 @@ void MonitorStream::runStream() {
zm_terminate = true;
continue;
} else if (monitor->Capturing() == Monitor::CAPTURING_ONDEMAND) {
monitor->setLastViewed();
if (!sendTextFrame("Waiting for capture")) return;
} else {
if (!sendTextFrame("Unable to stream")) {
@ -588,6 +586,7 @@ void MonitorStream::runStream() {
std::this_thread::sleep_for(MAX_SLEEP);
continue;
}
monitor->setLastViewed();
if (paused) {
if (!was_paused) {