diff options
author | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-05-31 17:49:51 +0000 |
---|---|---|
committer | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-05-31 17:49:51 +0000 |
commit | eb5bf3b88e11054e30aaa34e713a4a61c167cc04 (patch) | |
tree | 61f2407f803d6bbb47f724b4fe14f6652f2dfc79 /stream/tvi_v4l.c | |
parent | d244fffa741baa4757c5385e53c93cee4224d599 (diff) | |
download | mpv-eb5bf3b88e11054e30aaa34e713a4a61c167cc04.tar.bz2 mpv-eb5bf3b88e11054e30aaa34e713a4a61c167cc04.tar.xz |
New "automute" tv:// option.
Will switch off sound and show blue screen instead of video with noise
when signal level (in 0-255 scale) is less than specified value.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23440 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream/tvi_v4l.c')
-rw-r--r-- | stream/tvi_v4l.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/stream/tvi_v4l.c b/stream/tvi_v4l.c index 30621b8e8f..3d19122868 100644 --- a/stream/tvi_v4l.c +++ b/stream/tvi_v4l.c @@ -1381,6 +1381,21 @@ static int control(priv_t *priv, int cmd, void *arg) return(TVI_CONTROL_UNKNOWN); } +static int set_mute(priv_t* priv,int value) +{ + if (!priv->capability.audios) { + return 0; + + if(value) + priv->audio[priv->audio_id].flags |=VIDEO_AUDIO_MUTE; + else + priv->audio[priv->audio_id].flags &= ~VIDEO_AUDIO_MUTE; + } + if(ioctl(priv->video_fd, VIDIOCSAUDIO, &priv->audio[priv->audio_id])<0) + return 0; + return 1; +} + // copies a video frame // for RGB (i.e. BGR in mplayer) flips the image upside down // for YV12 swaps the 2nd and 3rd plane @@ -1389,6 +1404,16 @@ static inline void copy_frame(priv_t *priv, unsigned char *dest, unsigned char * int i; unsigned char *sptr; + if(tv_param_automute>0){ + if (ioctl(priv->video_fd, VIDIOCGTUNER, &priv->tuner) >= 0) { + if(tv_param_automute<<8>priv->tuner.signal){ + fill_blank_frame(dest,priv->bytesperline * priv->height,priv->format); + set_mute(priv,1); + return; + } + } + set_mute(priv,0); + } // YV12 uses VIDEO_PALETTE_YUV420P, but the planes are swapped if (priv->format == IMGFMT_YV12) { memcpy(dest, source, priv->width * priv->height); |