summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenry <henry@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-08-07 12:24:35 +0000
committerhenry <henry@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-08-07 12:24:35 +0000
commit7e38b1aefb5997932c1012a3ed8487a64800ffad (patch)
tree64d39e11b898533c04a9fd971f3a26a7bd7a6ab2
parente07e36bbe4e605aff64f68e28cefe7676308c83f (diff)
downloadmpv-7e38b1aefb5997932c1012a3ed8487a64800ffad.tar.bz2
mpv-7e38b1aefb5997932c1012a3ed8487a64800ffad.tar.xz
v4l2 support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10538 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--DOCS/en/mplayer.110
-rw-r--r--cfg-common.h3
-rwxr-xr-xconfigure29
-rw-r--r--libmpdemux/Makefile2
-rw-r--r--libmpdemux/ai_alsa.c2
-rw-r--r--libmpdemux/ai_alsa1x.c2
-rw-r--r--libmpdemux/ai_oss.c2
-rw-r--r--libmpdemux/audio_in.c2
-rw-r--r--libmpdemux/tv.c25
-rw-r--r--libmpdemux/tv.h5
10 files changed, 72 insertions, 10 deletions
diff --git a/DOCS/en/mplayer.1 b/DOCS/en/mplayer.1
index abbef46d72..b3552565c3 100644
--- a/DOCS/en/mplayer.1
+++ b/DOCS/en/mplayer.1
@@ -907,7 +907,7 @@ Available options are:
.IPs noaudio
no sound
.IPs driver=<value>
-available: dummy, v4l, bsdbt848
+available: dummy, v4l, v4l2, bsdbt848
.IPs device=<value>
Specify other device than the default /dev/\:video0.
.IPs input=<value>
@@ -927,7 +927,9 @@ framerate at which to capture video (frames per second)
.IPs buffersize=<value>
maximum size of the capture buffer in megabytes (default: dynamical)
.IPs norm=<value>
-available: PAL, SECAM, NTSC
+available: PAL, SECAM, NTSC. For v4l2 use the normid option below.
+.IPs normid=<value>
+v4l2 only. See MPlayer output for a list of available TV norms.
.IPs channel=<value>
Set tuner to <value> channel.
.IPs chanlist=<value>
@@ -977,8 +979,12 @@ hardware ID for ALSA
.IPs audioid=<value>
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=<bool>
A value of 0 means capture and buffer audio and video together
(default for MEncoder).
diff --git a/cfg-common.h b/cfg-common.h
index 1c21eda9aa..40adb9c4b6 100644
--- a/cfg-common.h
+++ b/cfg-common.h
@@ -291,6 +291,9 @@ struct config tvopts_conf[]={
{"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 --git a/configure b/configure
index 2294583dd4..497931b9c6 100755
--- a/configure
+++ b/configure
@@ -151,6 +151,7 @@ Optional features:
--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 @@ _dshow=yes
_select=yes
_tv=yes
_tv_v4l=auto
+_tv_v4l2=auto
_tv_bsdbt848=auto
_edl=yes
_network=yes
@@ -1271,6 +1273,8 @@ for ac_option do
--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 @@ fi
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 @@ $_def_edl
/* 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 --git a/libmpdemux/Makefile b/libmpdemux/Makefile
index 555cde8d53..06074416d1 100644
--- a/libmpdemux/Makefile
+++ b/libmpdemux/Makefile
@@ -3,7 +3,7 @@ LIBNAME = libmpdemux.a
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 --git a/libmpdemux/ai_alsa.c b/libmpdemux/ai_alsa.c
index 45abb14bc9..715c99a82e 100644
--- a/libmpdemux/ai_alsa.c
+++ b/libmpdemux/ai_alsa.c
@@ -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 <alsa/asoundlib.h>
#include "audio_in.h"
diff --git a/libmpdemux/ai_alsa1x.c b/libmpdemux/ai_alsa1x.c
index 45abb14bc9..715c99a82e 100644
--- a/libmpdemux/ai_alsa1x.c
+++ b/libmpdemux/ai_alsa1x.c
@@ -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 <alsa/asoundlib.h>
#include "audio_in.h"
diff --git a/libmpdemux/ai_oss.c b/libmpdemux/ai_oss.c
index 372005f66d..fb9402c28b 100644
--- a/libmpdemux/ai_oss.c
+++ b/libmpdemux/ai_oss.c
@@ -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 <string.h> /* strerror */
#include <fcntl.h>
diff --git a/libmpdemux/audio_in.c b/libmpdemux/audio_in.c
index 54ba446dfc..4c35df97d0 100644
--- a/libmpdemux/audio_in.c
+++ b/libmpdemux/audio_in.c
@@ -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 --git a/libmpdemux/tv.c b/libmpdemux/tv.c
index f212252581..b4d78e48cd 100644
--- a/libmpdemux/tv.c
+++ b/libmpdemux/tv.c
@@ -45,6 +45,9 @@ int tv_param_immediate = 0;
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 @@ int tv_param_input = 0; /* used in v4l and bttv */
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 @@ static int open_tv(tvi_handle_t *tvh)
/* 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 @@ static int open_tv(tvi_handle_t *tvh)
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 @@ int demux_close_tv(demuxer_t *demuxer)
/* ================== 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 @@ tvi_handle_t *tv_begin(void)
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 --git a/libmpdemux/tv.h b/libmpdemux/tv.h
index fcacf3adb3..a6627c0d9c 100644
--- a/libmpdemux/tv.h
+++ b/libmpdemux/tv.h
@@ -13,6 +13,9 @@ extern char *tv_param_freq;
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 char **tv_param_channels;
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;