mirror of
https://github.com/Motion-Project/motion.git
synced 2026-01-31 18:11:41 -05:00
Preview timestamp set to the time when frame was shot (Dag)
This commit is contained in:
@@ -12,8 +12,9 @@ Bugfixes
|
||||
http://www.lavrsen.dk/twiki/bin/view/Motion/MjpegToYUV420pPatch
|
||||
(Marius Rieder, Angel Carpintero).
|
||||
* Fixed a problem with locate and fixed mask overlay (Dag Erlandsson).
|
||||
* Preview pictures get the timestamp of moment they were captured (Dag Erlandsson).
|
||||
|
||||
|
||||
|
||||
3.2.8 Formal Release - Summary of Changes
|
||||
|
||||
Features
|
||||
|
||||
1
CREDITS
1
CREDITS
@@ -386,6 +386,7 @@ Dag Erlandsson
|
||||
* Fixed a problem with locate and fixed mask overlay
|
||||
* Added preview center feature.
|
||||
http://www.lavrsen.dk/twiki/bin/view/Motion/PreviewCenter
|
||||
* Fixed timestamp for preview pictures.
|
||||
|
||||
Stephen Farrugia
|
||||
* Fixing the division by zero problem.
|
||||
|
||||
2
ffmpeg.c
2
ffmpeg.c
@@ -127,7 +127,7 @@ static int mpeg1_write_trailer(AVFormatContext *s)
|
||||
void ffmpeg_init()
|
||||
{
|
||||
av_register_all();
|
||||
av_log_set_callback( (void *)ffmpeg_avcodec_log );
|
||||
// av_log_set_callback( (void *)ffmpeg_avcodec_log );
|
||||
|
||||
/* Copy the functions to use for the append file protocol from the standard
|
||||
* file protocol.
|
||||
|
||||
9
motion.c
9
motion.c
@@ -330,6 +330,9 @@ static void motion_detected(struct context *cnt, int diffs, int dev, unsigned ch
|
||||
memcpy(cnt->imgs.preview_buffer, newimg, cnt->imgs.size);
|
||||
cnt->preview_max = diffs;
|
||||
cnt->preview_cent_dist = distX*distX + distY*distY;
|
||||
cnt->preview_time = cnt->currenttime;
|
||||
cnt->preview_shots = cnt->shots;
|
||||
|
||||
/* We haven't yet draw the location on the image, do it if configured */
|
||||
if (cnt->locate == LOCATE_PREVIEW || cnt->locate == LOCATE_ON) {
|
||||
alg_draw_location(location, imgs, imgs->width, cnt->imgs.preview_buffer, LOCATE_NORMAL);
|
||||
@@ -362,6 +365,9 @@ static void motion_detected(struct context *cnt, int diffs, int dev, unsigned ch
|
||||
memcpy(cnt->imgs.preview_buffer, newimg, cnt->imgs.size);
|
||||
cnt->preview_max = diffs;
|
||||
cnt->preview_cent_dist = distX*distX + distY*distY;
|
||||
cnt->preview_time = cnt->currenttime;
|
||||
cnt->preview_shots = cnt->shots;
|
||||
|
||||
if (cnt->locate == LOCATE_PREVIEW) {
|
||||
alg_draw_location(location, imgs, imgs->width, cnt->imgs.preview_buffer, LOCATE_NORMAL);
|
||||
}
|
||||
@@ -377,6 +383,9 @@ static void motion_detected(struct context *cnt, int diffs, int dev, unsigned ch
|
||||
memcpy(cnt->imgs.preview_buffer, newimg, cnt->imgs.size);
|
||||
cnt->preview_max = diffs;
|
||||
cnt->preview_cent_dist = distance;
|
||||
cnt->preview_time = cnt->currenttime;
|
||||
cnt->preview_shots = cnt->shots;
|
||||
|
||||
if (cnt->locate == LOCATE_PREVIEW) {
|
||||
alg_draw_location(location, imgs, imgs->width, cnt->imgs.preview_buffer, LOCATE_NORMAL);
|
||||
}
|
||||
|
||||
3
motion.h
3
motion.h
@@ -272,6 +272,9 @@ struct context {
|
||||
/* Current preview frame, movement to img center distance
|
||||
* Note Dist is calculated distX*distX + distY*distY */
|
||||
unsigned long preview_cent_dist;
|
||||
time_t preview_time; /* Timestamp of preview image */
|
||||
int preview_shots; /* Shot of preview buffer image */
|
||||
|
||||
int locate;
|
||||
struct coord location; /* coordinates for center and size of last motion detection*/
|
||||
struct rotdata rotate_data; /* rotation data is thread-specific */
|
||||
|
||||
14
picture.c
14
picture.c
@@ -646,8 +646,10 @@ void preview_save(struct context *cnt)
|
||||
int use_jpegpath;
|
||||
#endif /* HAVE_FFMPEG */
|
||||
const char *jpegpath;
|
||||
char previewname[PATH_MAX];
|
||||
static char previewname[PATH_MAX];
|
||||
char filename[PATH_MAX];
|
||||
struct tm tmptime;
|
||||
int tmpshots;
|
||||
|
||||
if(cnt->preview_max){
|
||||
#ifdef HAVE_FFMPEG
|
||||
@@ -662,6 +664,11 @@ void preview_save(struct context *cnt)
|
||||
return;
|
||||
}
|
||||
#endif /* HAVE_FFMPEG */
|
||||
/* Save shots while processing preview image */
|
||||
tmpshots = cnt->shots;
|
||||
cnt->shots = cnt->preview_shots;
|
||||
localtime_r(&cnt->preview_time, &tmptime);
|
||||
|
||||
/* Save best preview-shot also when no movies are recorded or jpegpath
|
||||
is used. Filename has to be generated - nothing available to reuse! */
|
||||
//printf("preview_shot: different filename or picture only!\n");
|
||||
@@ -673,8 +680,11 @@ void preview_save(struct context *cnt)
|
||||
else
|
||||
jpegpath = (char *)DEF_JPEGPATH;
|
||||
|
||||
mystrftime(cnt, filename, sizeof(filename), jpegpath, cnt->currenttime_tm, NULL, 0);
|
||||
mystrftime(cnt, filename, sizeof(filename), jpegpath, &tmptime, NULL, 0);
|
||||
snprintf(previewname, PATH_MAX, "%s/%s.%s", cnt->conf.filepath, filename, imageext(cnt));
|
||||
put_picture(cnt, previewname, cnt->imgs.preview_buffer , FTYPE_IMAGE);
|
||||
|
||||
/* Restore shots */
|
||||
cnt->shots = tmpshots;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user