[RFC/RFT][patch] multimedia/mplayer with TV-V4L support (was: [FreeBSD 8/9] USB webcamd and video4bsd: Call for testing)

Andrey V. Elsukov bu7cher at yandex.ru
Wed Jan 27 11:27:53 UTC 2010


On 10.01.2010 16:37, Hans Petter Selasky wrote:
> Feedback and bug reports are welcome.
>
> Yes, I am working on getting this into ports!

Hi,

Thank you for your work. Now i can use my webcam almost out of the box :)
Webcam on ASUS EEEPC works with `pwcview -s vga` and i made patch for
multimedia/mplayer, so now i can use mplayer with my webcam :)

Can someone review these changes? Is it a correct way to use libv4l?

-- 
WBR, Andrey V. Elsukov
-------------- next part --------------
diff -burNp /usr/ports/multimedia/mplayer/Makefile mplayer/Makefile
--- /usr/ports/multimedia/mplayer/Makefile	2009-07-17 22:34:49.000000000 +0400
+++ mplayer/Makefile	2010-01-27 12:47:39.280345746 +0300
@@ -66,6 +66,7 @@ OPTIONS+=	LIBCDIO "Enable libcdio suppor
 OPTIONS+=	CDPARANOIA "Enable cdparanoia support" off
 OPTIONS+=	LIBLZO "Enable external liblzo library" off
 OPTIONS+=	JOYSTICK "Enable joystick support" off
+OPTIONS+=	V4L "Enable v4l driver support for TV" off
 
 MAN1=		mplayer.1
 MANCOMPRESSED=	no
@@ -222,12 +223,19 @@ DEFAULT_KERN_HZ=1024
 .endif
 
 .if defined(WITH_JOYSTICK)
-BUILD_DEPENDS+=	${LOCALBASE}/include/linux/joystick.h:${PORTSDIR}/devel/linux-js
+LIB_DEPENDS+=	${LOCALBASE}/include/linux/joystick.h:${PORTSDIR}/devel/linux-js
 CONFIGURE_ARGS+=--enable-joystick
 .else
 CONFIGURE_ARGS+=--disable-joystick
 .endif
 
+.if defined(WITH_V4L)
+BUILD_DEPENDS+= ${LOCALBASE}/lib/libv4l2.so:${PORTSDIR}/multimedia/libv4l
+CONFIGURE_ARGS+=--enable-tv-v4l1 --enable-tv-v4l2
+.else
+CONFIGURE_ARGS+=--disable-tv-v4l1 --disable-tv-v4l2
+.endif
+
 pre-everything::
 	@${ECHO_MSG} "N - O - T - E"
 	@${ECHO_MSG} ""
diff -burNp /usr/ports/multimedia/mplayer/Makefile.shared mplayer/Makefile.shared
--- /usr/ports/multimedia/mplayer/Makefile.shared	2009-05-21 15:55:56.000000000 +0400
+++ mplayer/Makefile.shared	2010-01-27 11:51:05.029688749 +0300
@@ -33,8 +33,6 @@ CONFIGURE_ARGS= --enable-png \
 		--enable-menu \
 		--disable-faad-external \
 		--disable-vidix-external \
-		--disable-tv-v4l1 \
-		--disable-tv-v4l2 \
 		--disable-dvdnav
 
 WANT_GNOME=	yes
diff -burNp /usr/ports/multimedia/mplayer/files/patch-tv-v4l mplayer/files/patch-tv-v4l
--- /usr/ports/multimedia/mplayer/files/patch-tv-v4l	1970-01-01 03:00:00.000000000 +0300
+++ mplayer/files/patch-tv-v4l	2010-01-27 13:48:38.204958790 +0300
@@ -0,0 +1,60 @@
+--- configure	2010-01-27 12:49:02.310984277 +0300
++++ configure	2010-01-27 13:33:45.902924872 +0300
+@@ -6786,6 +6786,7 @@ if test "$_tv_v4l1" = yes ; then
+   _def_tv_v4l='#define HAVE_TV_V4L 1'
+   _def_tv_v4l1='#define HAVE_TV_V4L1 1'
+   _inputmodules="tv-v4l $_inputmodules"
++  _ld_extra="$_ld_extra -lv4l1"
+ else
+   _noinputmodules="tv-v4l1 $_noinputmodules"
+   _def_tv_v4l='#undef HAVE_TV_V4L'
+@@ -6812,6 +6813,7 @@ if test "$_tv_v4l2" = yes ; then
+   _def_tv_v4l='#define HAVE_TV_V4L 1'
+   _def_tv_v4l2='#define HAVE_TV_V4L2 1'
+   _inputmodules="tv-v4l2 $_inputmodules"
++  _ld_extra="$_ld_extra -lv4l2"
+ else
+   _noinputmodules="tv-v4l2 $_noinputmodules"
+   _def_tv_v4l2='#undef HAVE_TV_V4L2'
+--- stream/tvi_v4l.c	2007-10-07 23:49:26.000000000 +0400
++++ stream/tvi_v4l.c	2010-01-27 13:42:17.781746063 +0300
+@@ -48,6 +48,14 @@
+ 
+ #include "audio_in.h"
+ 
++#include <libv4l1.h>
++#define open	v4l1_open
++#define close	v4l1_close
++#define dup	v4l1_dup
++#define ioctl	v4l1_ioctl
++#define mmap	v4l1_mmap
++#define munmap	v4l1_munmap
++
+ static tvi_handle_t *tvi_init_v4l(tv_param_t* tv_param);
+ 
+ tvi_info_t tvi_info_v4l = {
+--- stream/tvi_v4l2.c	2007-10-07 23:49:26.000000000 +0400
++++ stream/tvi_v4l2.c	2010-01-27 13:25:47.000000000 +0300
+@@ -38,7 +38,6 @@ known issues:
+ #ifdef HAVE_SYS_SYSINFO_H
+ #include <sys/sysinfo.h>
+ #endif
+-#include <linux/types.h>
+ #include <linux/videodev2.h>
+ #include "mp_msg.h"
+ #include "libmpcodecs/img_format.h"
+@@ -46,6 +46,14 @@ known issues:
+ #include "tv.h"
+ #include "audio_in.h"
+ 
++#include <libv4l2.h>
++#define open	v4l2_open
++#define close	v4l2_close
++#define dup	v4l2_dup
++#define ioctl	v4l2_ioctl
++#define mmap	v4l2_mmap
++#define munmap	v4l2_munmap
++
+ #define info tvi_info_v4l2
+ static tvi_handle_t *tvi_init_v4l2(tv_param_t* tv_param);
+ /* information about this file */


More information about the freebsd-multimedia mailing list