Skip to content

Commit

Permalink
Workaround to let work with kernel 2.6.38 and above where videodev.h …
Browse files Browse the repository at this point in the history
…has been removed.
  • Loading branch information
sackmotion committed May 9, 2011
1 parent f817acc commit 015d497
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 15 deletions.
4 changes: 2 additions & 2 deletions event.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static void event_sdl_put(struct context *cnt, int type ATTRIBUTE_UNUSED,
#endif


#if !defined(WITHOUT_V4L) && !defined(BSD)
#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(BSD)
static void event_vid_putpipe(struct context *cnt, int type ATTRIBUTE_UNUSED,
unsigned char *img, char *dummy ATTRIBUTE_UNUSED, void *devpipe,
struct tm *tm ATTRIBUTE_UNUSED)
Expand Down Expand Up @@ -833,7 +833,7 @@ struct event_handlers event_handlers[] = {
event_sdl_put
},
#endif
#if !defined(WITHOUT_V4L) && !defined(BSD)
#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(BSD)
{
EVENT_IMAGE,
event_vid_putpipe
Expand Down
2 changes: 1 addition & 1 deletion motion.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ static int motion_init(struct context *cnt)
/* create a reference frame */
alg_update_reference_frame(cnt, RESET_REF_FRAME);

#if !defined(WITHOUT_V4L) && !defined(BSD)
#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(BSD)
/* open video loopback devices if enabled */
if (cnt->conf.vidpipe) {
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Opening video loopback device for normal pictures");
Expand Down
6 changes: 3 additions & 3 deletions motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#include <stdint.h>

#define _LINUX_TIME_H 1
#if (!defined(WITHOUT_V4L)) && (!defined(BSD))
#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L)) && (!defined(BSD))
#include <linux/videodev.h>
#endif

Expand Down Expand Up @@ -102,8 +102,8 @@

#define CLEAR(x) memset(&(x), 0, sizeof(x))

#if defined(WITHOUT_V4L) || defined(BSD)
#if (!defined(HAVE_LINUX_VIDEODEV_H)) || defined(WITHOUT_V4L) || defined(BSD)

#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
Expand Down
10 changes: 5 additions & 5 deletions track.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <math.h>
#include "motion.h"

#ifndef WITHOUT_V4L
#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
#include "pwc-ioctl.h"
#endif

Expand Down Expand Up @@ -52,7 +52,7 @@ 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);

#ifndef WITHOUT_V4L
#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
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);
Expand Down Expand Up @@ -81,7 +81,7 @@ 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);
}
#ifndef WITHOUT_V4L
#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
else if (cnt->track.type == TRACK_TYPE_PWC)
return lqos_center(cnt, dev, xoff, yoff);
#ifdef MOTION_V4L2
Expand Down Expand Up @@ -112,7 +112,7 @@ 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);
#ifndef WITHOUT_V4L
#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
else if (cnt->track.type == TRACK_TYPE_PWC)
return lqos_move(cnt, dev, cent, imgs, manual);
#ifdef MOTION_V4L2
Expand Down Expand Up @@ -787,7 +787,7 @@ static unsigned int iomojo_move(struct context *cnt, int dev, struct coord *cent
Logitech QuickCam Orbit camera tracking code by [email protected]
******************************************************************************/
#ifndef WITHOUT_V4L
#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
static unsigned int lqos_center(struct context *cnt, int dev, int x_angle, int y_angle)
{
int reset = 3;
Expand Down
2 changes: 1 addition & 1 deletion video.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* See also the file 'COPYING'.
*
*/
#ifndef WITHOUT_V4L
#if (!defined(WITHOUT_V4L)) && (defined(HAVE_LINUX_VIDEODEV_H))

/* Common stuff: */
#include "rotate.h" /* already includes motion.h */
Expand Down
6 changes: 4 additions & 2 deletions video.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
#define _INCLUDE_VIDEO_H

#define _LINUX_TIME_H 1
#ifndef WITHOUT_V4L
#include <linux/videodev.h>
#include <sys/mman.h>


#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
#include <linux/videodev.h>
#include "vloopback_motion.h"
#include "pwc-ioctl.h"
#endif
Expand Down
5 changes: 5 additions & 0 deletions video_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ static int vid_v4lx_start(struct context *cnt)
dev->height = height;
#endif

#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
if (!v4l_start(dev, width, height, input, norm, frequency, tuner_number)) {
close(dev->fd);
pthread_mutexattr_destroy(&dev->attr);
Expand All @@ -786,6 +787,8 @@ static int vid_v4lx_start(struct context *cnt)
pthread_mutex_unlock(&vid_mutex);
return -1;
}
#endif

#ifdef MOTION_V4L2
dev->v4l2 = 0;
}
Expand Down Expand Up @@ -940,8 +943,10 @@ int vid_next(struct context *cnt, unsigned char *map)
ret = v4l2_next(cnt, dev, map, width, height);
} else {
#endif
#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
v4l_set_input(cnt, dev, map, width, height, conf);
ret = v4l_next(dev, map, width, height);
#endif
#ifdef MOTION_V4L2
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion vloopback_motion.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/
#include "vloopback_motion.h"
#ifndef BSD
#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L)) && (!defined(BSD))
#include <sys/utsname.h>
#include <dirent.h>

Expand Down

0 comments on commit 015d497

Please sign in to comment.