mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
stream: remove V4L TV input and V4L radio support
There are V4L2 drivers, and the old V4L stuff seems plain unnecessary.
This commit is contained in:
1
Makefile
1
Makefile
@@ -136,7 +136,6 @@ SRCS_COMMON-$(TV_DSHOW) += stream/tvi_dshow.c \
|
||||
loader/dshow/guids.c \
|
||||
loader/dshow/mediatype.c \
|
||||
|
||||
SRCS_COMMON-$(TV_V4L1) += stream/tvi_v4l.c stream/audio_in.c
|
||||
SRCS_COMMON-$(TV_V4L2) += stream/tvi_v4l2.c stream/audio_in.c
|
||||
SRCS_COMMON-$(VCD) += stream/stream_vcd.c
|
||||
SRCS_COMMON-$(VSTREAM) += stream/stream_vstream.c
|
||||
|
||||
@@ -121,12 +121,12 @@ const m_option_t tvopts_conf[]={
|
||||
{"hue", &stream_tv_defaults.hue, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
|
||||
{"saturation", &stream_tv_defaults.saturation, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
|
||||
{"gain", &stream_tv_defaults.gain, CONF_TYPE_INT, CONF_RANGE, -1, 100, NULL},
|
||||
#if defined(CONFIG_TV_V4L) || defined(CONFIG_TV_V4L2) || defined(CONFIG_TV_DSHOW)
|
||||
#if defined(CONFIG_TV_V4L2) || defined(CONFIG_TV_DSHOW)
|
||||
{"buffersize", &stream_tv_defaults.buffer_size, CONF_TYPE_INT, CONF_RANGE, 16, 1024, NULL},
|
||||
{"amode", &stream_tv_defaults.amode, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
|
||||
{"volume", &stream_tv_defaults.volume, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
|
||||
#endif
|
||||
#if defined(CONFIG_TV_V4L) || defined(CONFIG_TV_V4L2)
|
||||
#if defined(CONFIG_TV_V4L2)
|
||||
{"bass", &stream_tv_defaults.bass, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
|
||||
{"treble", &stream_tv_defaults.treble, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
|
||||
{"balance", &stream_tv_defaults.balance, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
|
||||
@@ -139,7 +139,7 @@ const m_option_t tvopts_conf[]={
|
||||
#ifdef CONFIG_ALSA
|
||||
{"alsa", &stream_tv_defaults.alsa, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
||||
#endif /* CONFIG_ALSA */
|
||||
#endif /* defined(CONFIG_TV_V4L) || defined(CONFIG_TV_V4L2) */
|
||||
#endif /* defined(CONFIG_TV_V4L2) */
|
||||
{"adevice", &stream_tv_defaults.adevice, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"tdevice", &stream_tv_defaults.teletext.device, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"tpage", &stream_tv_defaults.teletext.page, CONF_TYPE_INT, CONF_RANGE, 100, 899, NULL},
|
||||
|
||||
55
configure
vendored
55
configure
vendored
@@ -304,7 +304,6 @@ Optional features:
|
||||
--disable-radio-v4l2 disable Video4Linux2 radio interface [autodetect]
|
||||
--disable-radio-bsdbt848 disable BSD BT848 radio interface [autodetect]
|
||||
--disable-tv disable TV interface (TV/DVB grabbers) [enable]
|
||||
--disable-tv-v4l1 disable Video4Linux TV interface [autodetect]
|
||||
--disable-tv-v4l2 disable Video4Linux2 TV interface [autodetect]
|
||||
--disable-tv-bsdbt848 disable BSD BT848 interface [autodetect]
|
||||
--disable-pvr disable Video4Linux2 MPEG PVR [autodetect]
|
||||
@@ -508,11 +507,9 @@ _win32dll=no
|
||||
_select=yes
|
||||
_radio=no
|
||||
_radio_capture=no
|
||||
_radio_v4l=auto
|
||||
_radio_v4l2=auto
|
||||
_radio_bsdbt848=auto
|
||||
_tv=yes
|
||||
_tv_v4l1=auto
|
||||
_tv_v4l2=auto
|
||||
_tv_bsdbt848=auto
|
||||
_tv_dshow=auto
|
||||
@@ -772,8 +769,6 @@ for ac_option do
|
||||
--disable-tv) _tv=no ;;
|
||||
--enable-tv-bsdbt848) _tv_bsdbt848=yes ;;
|
||||
--disable-tv-bsdbt848) _tv_bsdbt848=no ;;
|
||||
--enable-tv-v4l1) _tv_v4l1=yes ;;
|
||||
--disable-tv-v4l1) _tv_v4l1=no ;;
|
||||
--enable-tv-v4l2) _tv_v4l2=yes ;;
|
||||
--disable-tv-v4l2) _tv_v4l2=no ;;
|
||||
--enable-tv-dshow) _tv_dshow=yes ;;
|
||||
@@ -782,8 +777,6 @@ for ac_option do
|
||||
--enable-radio-capture) _radio_capture=yes ;;
|
||||
--disable-radio-capture) _radio_capture=no ;;
|
||||
--disable-radio) _radio=no ;;
|
||||
--enable-radio-v4l) _radio_v4l=yes ;;
|
||||
--disable-radio-v4l) _radio_v4l=no ;;
|
||||
--enable-radio-v4l2) _radio_v4l2=yes ;;
|
||||
--disable-radio-v4l2) _radio_v4l2=no ;;
|
||||
--enable-radio-bsdbt848) _radio_bsdbt848=yes ;;
|
||||
@@ -1754,9 +1747,9 @@ if test "$_pthreads" = yes ; then
|
||||
def_threads='#define HAVE_THREADS 1'
|
||||
extra_cflags="$extra_cflags $THREAD_CFLAGS"
|
||||
else
|
||||
res_comment="v4l, v4l2, ao_nas, win32 loader disabled"
|
||||
res_comment="v4l2, ao_nas, win32 loader disabled"
|
||||
def_pthreads='#undef HAVE_PTHREADS'
|
||||
_nas=no ; _tv_v4l1=no ; _tv_v4l2=no
|
||||
_nas=no ; _tv_v4l2=no
|
||||
mingw32 || _win32dll=no
|
||||
fi
|
||||
echores "$_pthreads"
|
||||
@@ -3725,26 +3718,6 @@ fi
|
||||
echores "$_tv_dshow"
|
||||
|
||||
|
||||
echocheck "Video 4 Linux TV interface"
|
||||
if test "$_tv_v4l1" = auto ; then
|
||||
_tv_v4l1=no
|
||||
if test "$_tv" = yes && linux ; then
|
||||
header_check_broken sys/time.h linux/videodev.h && _tv_v4l1=yes
|
||||
fi
|
||||
fi
|
||||
if test "$_tv_v4l1" = yes ; then
|
||||
_audio_input=yes
|
||||
_tv_v4l=yes
|
||||
def_tv_v4l='#define CONFIG_TV_V4L 1'
|
||||
def_tv_v4l1='#define CONFIG_TV_V4L1 1'
|
||||
inputmodules="tv-v4l $inputmodules"
|
||||
else
|
||||
noinputmodules="tv-v4l1 $noinputmodules"
|
||||
def_tv_v4l='#undef CONFIG_TV_V4L'
|
||||
fi
|
||||
echores "$_tv_v4l1"
|
||||
|
||||
|
||||
echocheck "Video 4 Linux 2 TV interface"
|
||||
if test "$_tv_v4l2" = auto ; then
|
||||
_tv_v4l2=no
|
||||
@@ -3756,8 +3729,6 @@ if test "$_tv_v4l2" = auto ; then
|
||||
fi
|
||||
if test "$_tv_v4l2" = yes ; then
|
||||
_audio_input=yes
|
||||
_tv_v4l=yes
|
||||
def_tv_v4l='#define CONFIG_TV_V4L 1'
|
||||
def_tv_v4l2='#define CONFIG_TV_V4L2 1'
|
||||
inputmodules="tv-v4l2 $inputmodules"
|
||||
else
|
||||
@@ -3804,19 +3775,6 @@ else
|
||||
fi
|
||||
echores "$_radio_v4l2"
|
||||
|
||||
echocheck "Video 4 Linux Radio interface"
|
||||
if test "$_radio_v4l" = auto ; then
|
||||
_radio_v4l=no
|
||||
if test "$_radio" = yes && linux ; then
|
||||
header_check linux/videodev.h && _radio_v4l=yes
|
||||
fi
|
||||
fi
|
||||
if test "$_radio_v4l" = yes ; then
|
||||
def_radio_v4l='#define CONFIG_RADIO_V4L 1'
|
||||
else
|
||||
def_radio_v4l='#undef CONFIG_RADIO_V4L'
|
||||
fi
|
||||
echores "$_radio_v4l"
|
||||
|
||||
if freebsd || netbsd || openbsd || dragonfly &&
|
||||
test "$_radio" = yes && test "$_radio_bsdbt848" = auto ; then
|
||||
@@ -3840,9 +3798,9 @@ else
|
||||
def_radio_bsdbt848='#undef CONFIG_RADIO_BSDBT848'
|
||||
fi
|
||||
|
||||
if test "$_radio_v4l" = no && test "$_radio_v4l2" = no &&
|
||||
if test "$_radio_v4l2" = no &&
|
||||
test "$_radio_bsdbt848" = no && test "$_radio" = yes ; then
|
||||
die "Radio driver requires BSD BT848, V4L or V4L2!"
|
||||
die "Radio driver requires BSD BT848 or V4L2!"
|
||||
fi
|
||||
|
||||
echocheck "Video 4 Linux 2 MPEG PVR interface"
|
||||
@@ -4183,8 +4141,6 @@ TGA = $_tga
|
||||
TV = $_tv
|
||||
TV_BSDBT848 = $_tv_bsdbt848
|
||||
TV_DSHOW = $_tv_dshow
|
||||
TV_V4L = $_tv_v4l
|
||||
TV_V4L1 = $_tv_v4l1
|
||||
TV_V4L2 = $_tv_v4l2
|
||||
V4L2 = $_v4l2
|
||||
VCD = $_vcd
|
||||
@@ -4417,13 +4373,10 @@ $def_pvr
|
||||
$def_radio
|
||||
$def_radio_bsdbt848
|
||||
$def_radio_capture
|
||||
$def_radio_v4l
|
||||
$def_radio_v4l2
|
||||
$def_tv
|
||||
$def_tv_bsdbt848
|
||||
$def_tv_dshow
|
||||
$def_tv_v4l
|
||||
$def_tv_v4l1
|
||||
$def_tv_v4l2
|
||||
|
||||
|
||||
|
||||
@@ -49,10 +49,6 @@
|
||||
#include <linux/videodev2.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RADIO_V4L
|
||||
#include <linux/videodev.h>
|
||||
#endif
|
||||
|
||||
#endif // !IOCTL_BT848_H_NAME
|
||||
|
||||
|
||||
@@ -408,137 +404,6 @@ static const radio_driver_t radio_driver_v4l2={
|
||||
get_frequency_v4l2
|
||||
};
|
||||
#endif /* CONFIG_RADIO_V4L2 */
|
||||
#ifdef CONFIG_RADIO_V4L
|
||||
/*****************************************************************
|
||||
* \brief get fraction value for using in set_frequency and get_frequency
|
||||
* \return STREAM_OK if success, STREAM_ERROR otherwise
|
||||
*
|
||||
* V4L2_TUNER_CAP_LOW:
|
||||
* unit=62.5Hz
|
||||
* frac= 1MHz/unit=1000000/62.5 =16000
|
||||
*
|
||||
* otherwise:
|
||||
* unit=62500Hz
|
||||
* frac= 1MHz/unit=1000000/62500 =16
|
||||
*
|
||||
*/
|
||||
static int init_frac_v4l(radio_priv_t* priv){
|
||||
struct video_tuner tuner;
|
||||
memset(&tuner,0,sizeof(tuner));
|
||||
if (ioctl(priv->radio_fd, VIDIOCGTUNER, &tuner) <0){
|
||||
mp_tmsg(MSGT_RADIO,MSGL_WARN,"[radio] Warning: ioctl get tuner failed: %s. Setting frac to %d.\n",strerror(errno),priv->frac);
|
||||
return STREAM_ERROR;
|
||||
}
|
||||
if(tuner.flags & VIDEO_TUNER_LOW){
|
||||
priv->frac=16000;
|
||||
mp_tmsg(MSGT_RADIO,MSGL_DBG2,"[radio] tuner is low:yes frac=%d\n",priv->frac);
|
||||
}else{
|
||||
priv->frac=16;
|
||||
mp_tmsg(MSGT_RADIO,MSGL_DBG2,"[radio] tuner is low:no frac=%d\n",priv->frac);
|
||||
}
|
||||
|
||||
priv->rangelow=((float)tuner.rangelow)/priv->frac;
|
||||
priv->rangehigh=((float)tuner.rangehigh)/priv->frac;
|
||||
mp_tmsg(MSGT_RADIO,MSGL_V,"[radio] Allowed frequency range is %.2f-%.2f MHz.\n",priv->rangelow,priv->rangehigh);
|
||||
|
||||
return STREAM_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* \brief tune card to given frequency
|
||||
* \param frequency frequency in MHz
|
||||
* \return STREAM_OK if success, STREAM_ERROR otherwise
|
||||
*/
|
||||
static int set_frequency_v4l(radio_priv_t* priv,float frequency){
|
||||
__u32 freq;
|
||||
freq=frequency*priv->frac;
|
||||
if (ioctl(priv->radio_fd, VIDIOCSFREQ, &freq) < 0) {
|
||||
mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl set frequency 0x%x (%.2f) failed: %s\n",freq,frequency,strerror(errno));
|
||||
return STREAM_ERROR;
|
||||
}
|
||||
return STREAM_OK;
|
||||
}
|
||||
/*****************************************************************
|
||||
* \brief get current tuned frequency from card
|
||||
* \param frequency where to store frequency in MHz
|
||||
* \return STREAM_OK if success, STREAM_ERROR otherwise
|
||||
*/
|
||||
static int get_frequency_v4l(radio_priv_t* priv,float* frequency){
|
||||
__u32 freq;
|
||||
if (ioctl(priv->radio_fd, VIDIOCGFREQ, &freq) < 0) {
|
||||
mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl get frequency failed: %s\n",strerror(errno));
|
||||
return STREAM_ERROR;
|
||||
}
|
||||
*frequency=((float)freq)/priv->frac;
|
||||
return STREAM_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* \brief set volume on radio card
|
||||
* \param volume volume level (0..100)
|
||||
* \return STREAM_OK if success, STREAM_ERROR otherwise
|
||||
*/
|
||||
static void set_volume_v4l(radio_priv_t* priv,int volume){
|
||||
struct video_audio audio;
|
||||
|
||||
/*arg must be between 0 and 100*/
|
||||
if (volume > 100) volume = 100;
|
||||
if (volume < 0) volume = 0;
|
||||
|
||||
memset(&audio,0,sizeof(audio));
|
||||
audio.flags = (volume==0?VIDEO_AUDIO_MUTE:0);
|
||||
if (ioctl(priv->radio_fd, VIDIOCSAUDIO, &audio)<0){
|
||||
mp_tmsg(MSGT_RADIO,MSGL_WARN,"[radio] ioctl set mute failed: %s\n",strerror(errno));
|
||||
}
|
||||
|
||||
memset(&audio,0,sizeof(audio));
|
||||
audio.flags = VIDEO_AUDIO_VOLUME;
|
||||
audio.mode = VIDEO_SOUND_STEREO;
|
||||
audio.audio = 0;
|
||||
audio.volume = volume* (65535 / 100);
|
||||
|
||||
if (ioctl(priv->radio_fd, VIDIOCSAUDIO, &audio) < 0){
|
||||
mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl set volume failed: %s\n",strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* \brief get current volume from radio card
|
||||
* \param volume where to store volume level (0..100)
|
||||
* \return STREAM_OK if success, STREAM_ERROR otherwise
|
||||
*/
|
||||
static int get_volume_v4l(radio_priv_t* priv,int* volume){
|
||||
struct video_audio audio;
|
||||
|
||||
memset(&audio,0,sizeof(audio));
|
||||
audio.audio=0;
|
||||
if (ioctl(priv->radio_fd, VIDIOCGAUDIO, &audio) < 0){
|
||||
mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl get volume failed: %s\n",strerror(errno));
|
||||
return STREAM_ERROR;
|
||||
}
|
||||
|
||||
if (audio.flags & VIDEO_AUDIO_VOLUME){
|
||||
*volume=100*audio.volume/65535;
|
||||
/*arg must be between 0 and 100*/
|
||||
if (*volume > 100) *volume = 100;
|
||||
if (*volume < 0) *volume = 0;
|
||||
return STREAM_OK;
|
||||
}
|
||||
|
||||
return STREAM_ERROR;
|
||||
}
|
||||
|
||||
/* v4l driver info structure */
|
||||
static const radio_driver_t radio_driver_v4l={
|
||||
"v4l",
|
||||
_("[radio] Using V4Lv1 radio interface.\n"),
|
||||
init_frac_v4l,
|
||||
set_volume_v4l,
|
||||
get_volume_v4l,
|
||||
set_frequency_v4l,
|
||||
get_frequency_v4l
|
||||
};
|
||||
#endif /* CONFIG_RADIO_V4L */
|
||||
#ifdef CONFIG_RADIO_BSDBT848
|
||||
|
||||
/*****************************************************************
|
||||
@@ -1083,9 +948,6 @@ static const radio_driver_t* radio_drivers[]={
|
||||
#endif
|
||||
#ifdef CONFIG_RADIO_V4L2
|
||||
&radio_driver_v4l2,
|
||||
#endif
|
||||
#ifdef CONFIG_RADIO_V4L
|
||||
&radio_driver_v4l,
|
||||
#endif
|
||||
0
|
||||
};
|
||||
|
||||
24
stream/tv.c
24
stream/tv.c
@@ -58,7 +58,6 @@ char *tv_channel_last_real;
|
||||
/* enumerating drivers (like in stream.c) */
|
||||
extern const tvi_info_t tvi_info_dummy;
|
||||
extern const tvi_info_t tvi_info_dshow;
|
||||
extern const tvi_info_t tvi_info_v4l;
|
||||
extern const tvi_info_t tvi_info_v4l2;
|
||||
extern const tvi_info_t tvi_info_bsdbt848;
|
||||
|
||||
@@ -67,9 +66,6 @@ static const tvi_info_t* tvi_driver_list[]={
|
||||
#ifdef CONFIG_TV_V4L2
|
||||
&tvi_info_v4l2,
|
||||
#endif
|
||||
#ifdef CONFIG_TV_V4L1
|
||||
&tvi_info_v4l,
|
||||
#endif
|
||||
#ifdef CONFIG_TV_BSDBT848
|
||||
&tvi_info_bsdbt848,
|
||||
#endif
|
||||
@@ -478,26 +474,6 @@ static int open_tv(tvi_handle_t *tvh)
|
||||
#endif
|
||||
tv_set_norm(tvh,tvh->tv_param->norm);
|
||||
|
||||
#ifdef CONFIG_TV_V4L1
|
||||
if ( tvh->tv_param->mjpeg )
|
||||
{
|
||||
/* set width to expected value */
|
||||
if (tvh->tv_param->width == -1)
|
||||
{
|
||||
tvh->tv_param->width = 704/tvh->tv_param->decimation;
|
||||
}
|
||||
if (tvh->tv_param->height == -1)
|
||||
{
|
||||
if ( tvh->norm != TV_NORM_NTSC )
|
||||
tvh->tv_param->height = 576/tvh->tv_param->decimation;
|
||||
else
|
||||
tvh->tv_param->height = 480/tvh->tv_param->decimation;
|
||||
}
|
||||
mp_tmsg(MSGT_TV, MSGL_INFO,
|
||||
" MJP: width %d height %d\n", tvh->tv_param->width, tvh->tv_param->height);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* limits on w&h are norm-dependent -- JM */
|
||||
if (tvh->tv_param->width != -1 && tvh->tv_param->height != -1) {
|
||||
// first tell the driver both width and height, some drivers do not support setting them independently.
|
||||
|
||||
1910
stream/tvi_v4l.c
1910
stream/tvi_v4l.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user