Merge motion-project/master

This commit is contained in:
MrDave
2016-12-14 22:12:37 -07:00
9 changed files with 26 additions and 39 deletions

4
conf.c
View File

@@ -102,7 +102,7 @@ struct config conf_template = {
.tuner_number = 0,
.timelapse = 0,
.timelapse_mode = DEF_TIMELAPSE_MODE,
#if (defined(__FreeBSD__))
#ifdef __FreeBSD__
tuner_device: NULL,
#endif
.video_device = VIDEO_DEVICE,
@@ -303,7 +303,7 @@ config_param config_params[] = {
copy_int,
print_int
},
#if (defined(__FreeBSD__))
#ifdef __FreeBSD__
{
"tunerdevice",
"# Tuner device to be used for capturing using tuner as source (default /dev/tuner0)\n"

2
conf.h
View File

@@ -86,7 +86,7 @@ struct config {
int tuner_number;
int timelapse;
const char *timelapse_mode;
#if (defined(BSD) || defined(__FreeBSD_kernel__))
#ifdef __FreeBSD__
const char *tuner_device;
#endif
const char *video_device;

View File

@@ -192,7 +192,7 @@ void motion_log(int level, unsigned int type, int errno_flag, const char *fmt, .
errno_save = errno;
char threadname[32] = "unknown";
#if (!defined(__FreeBSD__))
#if (!defined(BSD) || defined(__APPLE__))
pthread_getname_np(pthread_self(), threadname, sizeof(threadname));
#endif

View File

@@ -13,7 +13,7 @@
#include "video_freebsd.h"
#else
#include "video.h"
#endif /* BSD */
#endif
#include "conf.h"
#include "alg.h"
@@ -2477,11 +2477,11 @@ static void become_daemon(void)
MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, "%s: Could not change directory");
#if (defined(__FreeBSD__))
#if (defined(BSD) && !defined(__APPLE__))
setpgrp(0, getpid());
#else
setpgrp();
#endif /* __FreeBSD__ */
#endif
if ((i = open("/dev/tty", O_RDWR)) >= 0) {

View File

@@ -12,10 +12,6 @@
#include "config.h"
#if defined(__FreeBSD__) || defined(__NetBSD__)
#define BSD
#endif
/* Includes */
#ifdef HAVE_MYSQL
#include <mysql.h>
@@ -58,7 +54,7 @@
#ifdef __APPLE__
#define MOTION_PTHREAD_SETNAME(name) pthread_setname_np(name)
#elif defined(__FreeBSD__)
#elif defined(BSD)
#define MOTION_PTHREAD_SETNAME(name) pthread_set_name_np(pthread_self(), name)
#else
#define MOTION_PTHREAD_SETNAME(name) pthread_setname_np(pthread_self(), name)
@@ -406,9 +402,6 @@ struct context {
int missing_frame_counter; /* counts failed attempts to fetch picture frame from camera */
unsigned int lost_connection;
#if (defined(BSD))
int tuner_dev;
#endif
int video_dev;
int pipe;
int mpipe;

View File

@@ -463,10 +463,8 @@ static int netcam_rtsp_open_context(netcam_context_ptr netcam){
* desired name */
{
char newtname[16];
#if defined(__FreeBSD__)
char curtname[16] = "unknown";
#else
char curtname[16];
#if (!defined(BSD) || defined(__APPLE__))
pthread_getname_np(pthread_self(), curtname, sizeof(curtname));
#endif
snprintf(newtname, sizeof(newtname), "av%d%s%s",

View File

@@ -323,6 +323,6 @@ struct pwc_raw_frame {
__u8 rawframe[0]; /* frame_size = H/4*vbandlength */
} __attribute__ ((packed));
#endif /* MOTION_V4L2 && (! BSD ) */
#endif /* MOTION_V4L2 && __linux__ */
#endif

View File

@@ -34,9 +34,15 @@
#if defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define bswap_32(x) OSSwapInt32(x)
#elif defined(BSD)
#elif defined(__FreeBSD__)
#include <sys/endian.h>
#define bswap_32(x) bswap32(x)
#elif defined(__OpenBSD__)
#include <sys/types.h>
#define bswap_32(x) swap32(x)
#elif defined(__NetBSD__)
#include <sys/bswap.h>
#define bswap_32(x) bswap32(x)
#else
#include <byteswap.h>
#endif

28
track.c
View File

@@ -5,13 +5,11 @@
* Copyright 2000, Jeroen Vreeken
* This program is published under the GNU Public license
*/
#ifdef MOTION_V4L2
#include <linux/videodev2.h>
#endif /* MOTION_V4L2 */
#include <math.h>
#include "motion.h"
#if (defined(HAVE_LINUX_VIDEODEV_H) || defined(HAVE_SYS_VIDEOIO_H)) && (!defined(WITHOUT_V4L))
#ifdef MOTION_V4L2
#include <linux/videodev2.h>
#include "pwc-ioctl.h"
#endif
@@ -54,16 +52,14 @@ static unsigned int servo_move(struct context *cnt, struct coord *cent,
struct images *imgs, unsigned int manual);
static unsigned int iomojo_move(struct context *cnt, int dev, struct coord *cent, struct images *imgs);
#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
#ifdef MOTION_V4L2
static unsigned int lqos_center(struct context *cnt, int dev, int xoff, int yoff);
static unsigned int lqos_move(struct context *cnt, int dev, struct coord *cent,
struct images *imgs, unsigned int manual);
#ifdef MOTION_V4L2
static unsigned int uvc_center(struct context *cnt, int dev, int xoff, int yoff);
static unsigned int uvc_move(struct context *cnt, int dev, struct coord *cent,
struct images *imgs, unsigned int manual);
#endif /* MOTION_V4L2 */
#endif /* WITHOUT_V4L */
/* Add a call to your functions here: */
unsigned int track_center(struct context *cnt, int dev ATTRIBUTE_UNUSED,
@@ -83,14 +79,12 @@ unsigned int track_center(struct context *cnt, int dev ATTRIBUTE_UNUSED,
} else if (cnt->track.type == TRACK_TYPE_SERVO) {
return servo_center(cnt, xoff, yoff);
}
#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
#ifdef MOTION_V4L2
else if (cnt->track.type == TRACK_TYPE_PWC)
return lqos_center(cnt, dev, xoff, yoff);
#ifdef MOTION_V4L2
else if (cnt->track.type == TRACK_TYPE_UVC)
return uvc_center(cnt, dev, xoff, yoff);
#endif /* MOTION_V4L2 */
#endif /* WITHOUT_V4L */
#endif
else if (cnt->track.type == TRACK_TYPE_IOMOJO)
return iomojo_center(cnt, xoff, yoff);
else if (cnt->track.type == TRACK_TYPE_GENERIC)
@@ -114,14 +108,12 @@ unsigned int track_move(struct context *cnt, int dev, struct coord *cent, struct
return stepper_move(cnt, cent, imgs);
else if (cnt->track.type == TRACK_TYPE_SERVO)
return servo_move(cnt, cent, imgs, manual);
#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
#ifdef MOTION_V4L2
else if (cnt->track.type == TRACK_TYPE_PWC)
return lqos_move(cnt, dev, cent, imgs, manual);
#ifdef MOTION_V4L2
else if (cnt->track.type == TRACK_TYPE_UVC)
return uvc_move(cnt, dev, cent, imgs, manual);
#endif /* MOTION_V4L2 */
#endif /* WITHOUT_V4L */
#endif
else if (cnt->track.type == TRACK_TYPE_IOMOJO)
return iomojo_move(cnt, dev, cent, imgs);
else if (cnt->track.type == TRACK_TYPE_GENERIC)
@@ -788,7 +780,7 @@ static unsigned int iomojo_move(struct context *cnt, int dev, struct coord *cent
Logitech QuickCam Orbit camera tracking code by folkert@vanheusden.com
******************************************************************************/
#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
#ifdef MOTION_V4L2
static unsigned int lqos_center(struct context *cnt, int dev, int x_angle, int y_angle)
{
int reset = 3;
@@ -907,6 +899,7 @@ static unsigned int lqos_move(struct context *cnt, int dev, struct coord *cent,
return cnt->track.move_wait;
}
/******************************************************************************
Logitech QuickCam Sphere camera tracking code by oBi
@@ -915,8 +908,6 @@ static unsigned int lqos_move(struct context *cnt, int dev, struct coord *cent,
- for new API in uvcvideo
- add Trace-steps for investigation
******************************************************************************/
#ifdef MOTION_V4L2
static unsigned int uvc_center(struct context *cnt, int dev, int x_angle, int y_angle)
{
/* CALC ABSOLUTE MOVING : Act.Position +/- delta to request X and Y */
@@ -1229,4 +1220,3 @@ static unsigned int uvc_move(struct context *cnt, int dev, struct coord *cent,
return cnt->track.move_wait;
}
#endif /* MOTION_V4L2 */
#endif /* WITHOUT_V4L */