$NetBSD: patch-vdevicebuz_C,v 1.1.1.1 2010/02/02 02:01:54 phonohawk Exp $

--- cinelerra/vdevicebuz.C.orig	2010-02-01 08:26:23.000000000 +0000
+++ cinelerra/vdevicebuz.C
@@ -24,6 +24,8 @@
 #undef _LARGEFILE64_SOURCE
 #undef _FILE_OFFSET_BITS
 
+#include "config.h"
+
 #include "assets.h"
 #include "bcsignals.h"
 #include "channel.h"
@@ -43,9 +45,11 @@
 
 #include <errno.h>
 #include <stdint.h>
+#if defined(HAVE_LINUX_VIDEODEV_H)
 #include <linux/kernel.h>
 //#include <linux/videodev2.h>
 #include <linux/videodev.h>
+#endif
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
@@ -107,6 +111,7 @@ void VDeviceBUZInput::start()
 	Thread::start();
 }
 
+#if defined(HAVE_LINUX_VIDEODEV_H)
 void VDeviceBUZInput::run()
 {
     struct buz_sync bsync;
@@ -117,7 +122,7 @@ void VDeviceBUZInput::run()
 		Thread::enable_cancel();
 		if(ioctl(device->jvideo_fd, BUZIOC_SYNC, &bsync) < 0)
 		{
-			perror("VDeviceBUZInput::run BUZIOC_SYNC");
+			fprintf(stderr, "VDeviceBUZInput::run BUZIOC_SYNC\n");
 			if(done) return;
 			Thread::disable_cancel();
 		}
@@ -152,6 +157,11 @@ void VDeviceBUZInput::run()
 		}
 	}
 }
+#else
+void VDeviceBUZInput::run() {
+    fprintf(stderr, "VDeviceBUZInput::run (Warning: unavailable for this platform)\n");
+}
+#endif
 
 void VDeviceBUZInput::get_buffer(char **ptr, int *size)
 {
@@ -444,6 +454,7 @@ int VDeviceBUZ::set_picture(PictureConfi
 	return 0;
 }
 
+#if defined(HAVE_LINUX_VIDEODEV_H)
 int VDeviceBUZ::get_norm(int norm)
 {
 	switch(norm)
@@ -453,6 +464,11 @@ int VDeviceBUZ::get_norm(int norm)
 		case SECAM:         return VIDEO_MODE_SECAM;     break;
 	}
 }
+#else
+int VDeviceBUZ::get_norm(int norm) {
+    return -1;
+}
+#endif
 
 int VDeviceBUZ::read_buffer(VFrame *frame)
 {
@@ -500,6 +516,7 @@ int VDeviceBUZ::read_buffer(VFrame *fram
 	return 0;
 }
 
+#if defined(HAVE_LINUX_VIDEODEV_H)
 int VDeviceBUZ::open_input_core(Channel *channel)
 {
 	jvideo_fd = open(device->in_config->buz_in_device, O_RDONLY);
@@ -621,7 +638,15 @@ int VDeviceBUZ::open_input_core(Channel 
 //printf("VDeviceBUZ::open_input_core 2\n");
 	return 0;
 }
+#else
+int VDeviceBUZ::open_input_core(Channel *channel) {
+    fprintf(stderr, "VDeviceBUZ::open_input (Warning: unavailable feature on this platform)\n");
+    jvideo_fd = 0;
+    return 1;
+}
+#endif
 
+#if defined(HAVE_LINUX_VIDEODEV_H)
 int VDeviceBUZ::open_output_core(Channel *channel)
 {
 //printf("VDeviceBUZ::open_output 1\n");
@@ -677,9 +702,15 @@ int VDeviceBUZ::open_output_core(Channel
 //printf("VDeviceBUZ::open_output 2\n");
 	return 0;
 }
+#else
+int VDeviceBUZ::open_output_core(Channel *channel) {
+    fprintf(stderr, "VDeviceBUZ::open_output (Warning: unavailable feature on this platform)\n");
+    jvideo_fd = 0;
+    return 1;
+}
+#endif
 
-
-
+#if defined(HAVE_LINUX_VIDEODEV_H)
 int VDeviceBUZ::write_buffer(VFrame *frame, EDL *edl)
 {
 //printf("VDeviceBUZ::write_buffer 1\n");
@@ -753,6 +784,12 @@ int VDeviceBUZ::write_buffer(VFrame *fra
 
 	return 0;
 }
+#else
+int VDeviceBUZ::write_buffer(VFrame *frame, EDL *edl) {
+    fprintf(stderr, "VDeviceBUZ::write_buffer (Warning: unavailable feature on this platform)\n");
+    return 0;
+}
+#endif
 
 void VDeviceBUZ::new_output_buffer(VFrame *output,
 	int colormodel)
