Add v4l webcam support

Submitted by:	raaf@zen.mooo.com
More info:	http://raaf.atspace.org/
This commit is contained in:
Michael Johnson 2007-10-03 20:55:50 +00:00
parent a8d6d47662
commit 9bf4130168
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=200746
2 changed files with 88 additions and 1 deletions

View file

@ -10,7 +10,7 @@
PORTNAME= vlc
DISTVERSION= 0.9.0.20070906
PORTREVISION= 0
PORTREVISION= 1
PORTEPOCH= 2
CATEGORIES= multimedia audio ipv6 net www
MASTER_SITES= http://nightlies.videolan.org/build/source/trunk-${DISTVERSION:S/0.9.0.//}-0029/
@ -24,6 +24,7 @@ DISTNAME= ${PORTNAME}-snapshot-${DISTVERSION:S/0.9.0.//}
MAINTAINER= multimedia@FreeBSD.org
COMMENT= Multimedia streaming server and player for various audio/video formats
BUILD_DEPENDS= ${LOCALBASE}/include/linux/videodev.h:${PORTSDIR}/multimedia/v4l_compat
LIB_DEPENDS= notify.1:${PORTSDIR}/devel/libnotify \
avcodec.1:${PORTSDIR}/multimedia/ffmpeg
RUN_DEPENDS= ${X11BASE}/lib/X11/fonts/bitstream-vera/Vera.ttf:${PORTSDIR}/x11-fonts/bitstream-vera

View file

@ -0,0 +1,86 @@
--- modules/access/v4l.c.orig Mon Jun 12 09:41:08 2006
+++ modules/access/v4l.c Mon Jun 12 10:19:59 2006
@@ -555,7 +555,7 @@
int i_noframe = -1;
ioctl( p_sys->fd_video, MJPIOC_QBUF_CAPT, &i_noframe );
}
-
+#if 0
if( p_sys->p_video_mmap && p_sys->p_video_mmap != MAP_FAILED )
{
if( p_sys->b_mjpeg )
@@ -564,7 +564,7 @@
else
munmap( p_sys->p_video_mmap, p_sys->vid_mbuf.size );
}
-
+#endif
free( p_sys );
}
@@ -1267,6 +1267,15 @@
}
else
{
+ struct video_window vid_win = { 0 };
+ vid_win.width = p_sys->i_width;
+ vid_win.height = p_sys->i_height;
+
+ if( ioctl( i_fd, VIDIOCSWIN, &vid_win ) < 0 )
+ {
+ msg_Err( p_demux, "cannot set win (%s)", strerror( errno ) );
+ goto vdev_failed;
+ }
/* Fill in picture_t fields */
vout_InitPicture( VLC_OBJECT(p_demux), &p_sys->pic, p_sys->i_fourcc,
p_sys->i_width, p_sys->i_height, p_sys->i_width *
@@ -1287,7 +1296,7 @@
p_sys->i_video_frame_size );
msg_Dbg( p_demux, "v4l device uses chroma: %4.4s",
(char*)&p_sys->i_fourcc );
-
+#if 0
/* Allocate mmap buffer */
if( ioctl( i_fd, VIDIOCGMBUF, &p_sys->vid_mbuf ) < 0 )
{
@@ -1316,6 +1325,7 @@
msg_Err( p_demux, "chroma selection failed" );
goto vdev_failed;
}
+#endif
}
return i_fd;
@@ -1577,18 +1587,15 @@
if( p_sys->i_video_pts + i_dur > mdate() ) return 0;
}
- if( p_sys->b_mjpeg ) p_frame = GrabMJPEG( p_demux );
- else p_frame = GrabCapture( p_demux );
-
- if( !p_frame ) return 0;
-
if( !( p_block = block_New( p_demux, p_sys->i_video_frame_size ) ) )
{
msg_Warn( p_demux, "cannot get block" );
return 0;
}
- memcpy( p_block->p_buffer, p_frame, p_sys->i_video_frame_size );
+ if(read(p_sys->fd_video, p_block->p_buffer, p_sys->i_video_frame_size) <= 0)
+ return 0;
+
p_sys->i_video_pts = p_block->i_pts = p_block->i_dts = mdate();
return p_block;
--- configure.orig Mon Jun 12 10:44:45 2006
+++ configure Mon Jun 12 10:46:11 2006
@@ -39400,7 +39400,7 @@
enableval="$enable_v4l"
fi
-if test "${enable_v4l}" = "yes"
+if true
then
# Check whether --with-v4l or --without-v4l was given.