# HG changeset patch # User henry # Date 1060259075 0 # Node ID 31f12f99118b2d9759b7ff3e37075ec85fae2b3b # Parent 527e978cb0f85403d4d142bdf24b4c26ebaf0cf4 v4l2 support diff -r 527e978cb0f8 -r 31f12f99118b DOCS/en/mplayer.1 --- a/DOCS/en/mplayer.1 Thu Aug 07 12:18:04 2003 +0000 +++ b/DOCS/en/mplayer.1 Thu Aug 07 12:24:35 2003 +0000 @@ -907,7 +907,7 @@ .IPs noaudio no sound .IPs driver= -available: dummy, v4l, bsdbt848 +available: dummy, v4l, v4l2, bsdbt848 .IPs device= Specify other device than the default /dev/\:video0. .IPs input= @@ -927,7 +927,9 @@ .IPs buffersize= maximum size of the capture buffer in megabytes (default: dynamical) .IPs norm= -available: PAL, SECAM, NTSC +available: PAL, SECAM, NTSC. For v4l2 use the normid option below. +.IPs normid= +v4l2 only. See MPlayer output for a list of available TV norms. .IPs channel= Set tuner to channel. .IPs chanlist= @@ -977,8 +979,12 @@ .IPs audioid= choose an audio output of the capture card, if it has more of them .IPs [volume|bass|treble|balance]=<0\-65535> +.IPs [volume|bass|treble|balance]=<0\-100> These options set parameters of the mixer on the video capture card. They will have no effect, if your card doesn't have one. +For v4l1, 0-65535 is a valid range. For v4l2, the valid range is +0 to 100, and 50 maps to the default value of the control, as reported +by the driver. .IPs immediatemode= A value of 0 means capture and buffer audio and video together (default for MEncoder). diff -r 527e978cb0f8 -r 31f12f99118b cfg-common.h --- a/cfg-common.h Thu Aug 07 12:18:04 2003 +0000 +++ b/cfg-common.h Thu Aug 07 12:24:35 2003 +0000 @@ -291,6 +291,9 @@ {"channel", &tv_param_channel, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"chanlist", &tv_param_chanlist, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"norm", &tv_param_norm, CONF_TYPE_STRING, 0, 0, 0, NULL}, +#ifdef HAVE_TV_V4L2 + {"normid", &tv_param_normid, CONF_TYPE_INT, 0, 0, 0, NULL}, +#endif {"width", &tv_param_width, CONF_TYPE_INT, 0, 0, 4096, NULL}, {"height", &tv_param_height, CONF_TYPE_INT, 0, 0, 4096, NULL}, {"input", &tv_param_input, CONF_TYPE_INT, 0, 0, 20, NULL}, diff -r 527e978cb0f8 -r 31f12f99118b configure --- a/configure Thu Aug 07 12:18:04 2003 +0000 +++ b/configure Thu Aug 07 12:24:35 2003 +0000 @@ -151,6 +151,7 @@ --enable-joystick enable joystick support [disable] --disable-tv disable TV Interface (tv/dvb grabbers) [enable] --disable-tv-v4l disable Video4Linux TV Interface support [autodetect] + --disable-tv-v4l2 disable Video4Linux2 TV Interface support [autodetect] --disable-tv-bsdbt848 disable BSD BT848 Interface support [autodetect] --disable-edl disable EDL (edit decision list) support [enable] --disable-rtc disable RTC (/dev/rtc) on Linux [autodetect] @@ -1093,6 +1094,7 @@ _select=yes _tv=yes _tv_v4l=auto +_tv_v4l2=auto _tv_bsdbt848=auto _edl=yes _network=yes @@ -1271,6 +1273,8 @@ --disable-tv-bsdbt848) _tv_bsdbt848=no ;; --enable-tv-v4l) _tv_v4l=yes ;; --disable-tv-v4l) _tv_v4l=no ;; + --enable-tv-v4l2) _tv_v4l2=yes ;; + --disable-tv-v4l2) _tv_v4l2=no ;; --enable-fastmemcpy) _fastmemcpy=yes ;; --disable-fastmemcpy) _fastmemcpy=no ;; --enable-network) _network=yes ;; @@ -4902,6 +4906,28 @@ echores "$_tv_v4l" +echocheck "Video 4 Linux 2 TV interface" +if test "$_tv_v4l2" = auto ; then + _tv_v4l2=no + if test "$_tv" = yes && linux ; then + for I in /dev/video /dev/video? ; do + if test -c $I ; then + _tv_v4l2=yes + break + fi + done + fi +fi +if test "$_tv_v4l2" = yes ; then + _def_tv_v4l2='#define HAVE_TV_V4L2 1' + _inputmodules="tv-v4l2 $_inputmodules" +else + _noinputmodules="tv-v4l2 $_noinputmodules" + _def_tv_v4l='#undef HAVE_TV_V4L2' +fi +echores "$_tv_v4l2" + + echocheck "audio select()" if test "$_select" = no ; then _def_select='#undef HAVE_AUDIO_SELECT' @@ -5779,6 +5805,9 @@ /* Enable Video 4 Linux TV interface support */ $_def_tv_v4l +/* Enable Video 4 Linux 2 TV interface support */ +$_def_tv_v4l2 + /* Enable *BSD BrookTree TV interface support */ $_def_tv_bsdbt848 diff -r 527e978cb0f8 -r 31f12f99118b libmpdemux/Makefile --- a/libmpdemux/Makefile Thu Aug 07 12:18:04 2003 +0000 +++ b/libmpdemux/Makefile Thu Aug 07 12:24:35 2003 +0000 @@ -3,7 +3,7 @@ include ../config.mak -SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_ty.c demux_ty_osd.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c stream_file.c stream_netstream.c stream_vcd.c stream_null.c tv.c tvi_dummy.c tvi_v4l.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c cue_read.c extension.c demux_gif.c demux_ts.c demux_realaud.c +SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_ty.c demux_ty_osd.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c stream_file.c stream_netstream.c stream_vcd.c stream_null.c tv.c tvi_dummy.c tvi_v4l.c tvi_v4l2.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c cue_read.c extension.c demux_gif.c demux_ts.c demux_realaud.c ifeq ($(XMMS_PLUGINS),yes) SRCS += demux_xmms.c endif diff -r 527e978cb0f8 -r 31f12f99118b libmpdemux/ai_alsa.c --- a/libmpdemux/ai_alsa.c Thu Aug 07 12:18:04 2003 +0000 +++ b/libmpdemux/ai_alsa.c Thu Aug 07 12:24:35 2003 +0000 @@ -4,7 +4,7 @@ #include "config.h" -#if defined(USE_TV) && defined(HAVE_TV_V4L) && defined(HAVE_ALSA9) +#if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2)) && defined(HAVE_ALSA9) #include #include "audio_in.h" diff -r 527e978cb0f8 -r 31f12f99118b libmpdemux/ai_alsa1x.c --- a/libmpdemux/ai_alsa1x.c Thu Aug 07 12:18:04 2003 +0000 +++ b/libmpdemux/ai_alsa1x.c Thu Aug 07 12:24:35 2003 +0000 @@ -4,7 +4,7 @@ #include "config.h" -#if defined(USE_TV) && defined(HAVE_TV_V4L) && defined(HAVE_ALSA9) +#if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2)) && defined(HAVE_ALSA9) #include #include "audio_in.h" diff -r 527e978cb0f8 -r 31f12f99118b libmpdemux/ai_oss.c --- a/libmpdemux/ai_oss.c Thu Aug 07 12:18:04 2003 +0000 +++ b/libmpdemux/ai_oss.c Thu Aug 07 12:24:35 2003 +0000 @@ -3,7 +3,7 @@ #include "config.h" -#if defined(USE_TV) && defined(HAVE_TV_V4L) && defined(USE_OSS_AUDIO) +#if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2)) && defined(USE_OSS_AUDIO) #include /* strerror */ #include diff -r 527e978cb0f8 -r 31f12f99118b libmpdemux/audio_in.c --- a/libmpdemux/audio_in.c Thu Aug 07 12:18:04 2003 +0000 +++ b/libmpdemux/audio_in.c Thu Aug 07 12:24:35 2003 +0000 @@ -4,7 +4,7 @@ #include "config.h" -#if defined(USE_TV) && defined(HAVE_TV_V4L) +#if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2)) #include "audio_in.h" #include "mp_msg.h" diff -r 527e978cb0f8 -r 31f12f99118b libmpdemux/tv.c --- a/libmpdemux/tv.c Thu Aug 07 12:18:04 2003 +0000 +++ b/libmpdemux/tv.c Thu Aug 07 12:24:35 2003 +0000 @@ -45,6 +45,9 @@ char *tv_param_freq = NULL; char *tv_param_channel = NULL; char *tv_param_norm = "pal"; +#ifdef HAVE_TV_V4L2 +int tv_param_normid = -1; +#endif char *tv_param_chanlist = "europe-east"; char *tv_param_device = NULL; char *tv_param_driver = "dummy"; @@ -54,7 +57,7 @@ char *tv_param_outfmt = "yv12"; float tv_param_fps = -1.0; char **tv_param_channels = NULL; -#ifdef HAVE_TV_V4L +#if defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2) int tv_param_amode = -1; int tv_param_audio_id = 0; int tv_param_volume = 60000; @@ -179,6 +182,9 @@ /* set some params got from cmdline */ funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input); +#ifdef HAVE_TV_V4L2 + if (strcmp(tv_param_driver, "v4l2") != 0) { +#endif /* select video norm */ tvh->norm = norm_from_string(tv_param_norm); @@ -187,7 +193,17 @@ mp_msg(MSGT_TV, MSGL_ERR, "Error: cannot set norm!\n"); return 0; } - +#ifdef HAVE_TV_V4L2 + } else { + if (tv_param_normid >= 0) { + mp_msg(MSGT_TV, MSGL_V, "Selected norm id: %d\n", tv_param_normid); + if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tv_param_normid) != TVI_CONTROL_TRUE) { + mp_msg(MSGT_TV, MSGL_ERR, "Error: cannot set norm!\n"); + return 0; + } + } + } +#endif #ifdef HAVE_TV_V4L if ( tv_param_mjpeg ) @@ -582,6 +598,7 @@ /* ================== STREAM_TV ===================== */ tvi_handle_t *tvi_init_dummy(char *device); tvi_handle_t *tvi_init_v4l(char *device, char *adevice); +tvi_handle_t *tvi_init_v4l2(char *device, char *adevice); tvi_handle_t *tvi_init_bsdbt848(char *device); tvi_handle_t *tv_begin(void) @@ -592,6 +609,10 @@ if (!strcmp(tv_param_driver, "v4l")) return tvi_init_v4l(tv_param_device, tv_param_adevice); #endif +#ifdef HAVE_TV_V4L2 + if (!strcmp(tv_param_driver, "v4l2")) + return tvi_init_v4l2(tv_param_device, tv_param_adevice); +#endif #ifdef HAVE_TV_BSDBT848 if (!strcmp(tv_param_driver, "bsdbt848")) return tvi_init_bsdbt848(tv_param_device); diff -r 527e978cb0f8 -r 31f12f99118b libmpdemux/tv.h --- a/libmpdemux/tv.h Thu Aug 07 12:18:04 2003 +0000 +++ b/libmpdemux/tv.h Thu Aug 07 12:24:35 2003 +0000 @@ -13,6 +13,9 @@ extern char *tv_param_channel; extern char *tv_param_chanlist; extern char *tv_param_norm; +#ifdef HAVE_TV_V4L2 +extern int tv_param_normid; +#endif extern char *tv_param_device; extern char *tv_param_driver; extern int tv_param_width; @@ -24,7 +27,7 @@ extern int tv_param_noaudio; extern int tv_param_immediate; extern int tv_param_audiorate; -#ifdef HAVE_TV_V4L +#if defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2) extern int tv_param_amode; extern int tv_param_audio_id; extern int tv_param_volume;