summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-09-13 17:16:18 +0200
committerwm4 <wm4@nowhere>2019-09-13 17:32:19 +0200
commitb30e85508a305d668db8419556d295a65ab08707 (patch)
treefa48444a183c97fd5081aa0206c5adece43eaf32
parent162e0f5ad92116d1a4fb740d087da2a152686b73 (diff)
downloadmpv-b30e85508a305d668db8419556d295a65ab08707.tar.bz2
mpv-b30e85508a305d668db8419556d295a65ab08707.tar.xz
Remove classic Linux analog TV support, and DVB runtime controls
Linux analog TV support (via tv://) was excessively complex, and whenever I attempted to use it (cameras or loopback devices), it didn't work well, or would have required some major work to update it. It's very much stuck in the analog past (my favorite are the frequency tables in frequencies.c for analog TV channels which don't exist anymore). Especially cameras and such work fine with libavdevice and better than tv://, for example: mpv av://v4l2:/dev/video0 (adding --profile=low-latency --untimed even makes it mostly realtime) Adding a new input layer that targets such "modern" uses would be acceptable, if anyone is interested in it. The old TV code is just too focused on actual analog TV. DVB is rather obscure, but has an active maintainer, so don't remove it. However, the demux/stream ctrl layer must go, so remove controls for channel switching. Most of these could be reimplemented by using the normal method for option runtime changes.
-rw-r--r--DOCS/interface-changes.rst2
-rw-r--r--DOCS/man/input.rst15
-rw-r--r--DOCS/man/options.rst185
-rw-r--r--demux/demux.c4
-rw-r--r--demux/demux.h1
-rw-r--r--demux/demux_tv.c267
-rw-r--r--options/options.c3
-rw-r--r--options/options.h2
-rw-r--r--player/command.c185
-rw-r--r--stream/ai_alsa1x.c199
-rw-r--r--stream/ai_oss.c153
-rw-r--r--stream/ai_sndio.c52
-rw-r--r--stream/audio_in.c298
-rw-r--r--stream/audio_in.h118
-rw-r--r--stream/frequencies.c1212
-rw-r--r--stream/frequencies.h133
-rw-r--r--stream/stream.c4
-rw-r--r--stream/stream.h24
-rw-r--r--stream/stream_dvb.c5
-rw-r--r--stream/stream_tv.c52
-rw-r--r--stream/tv.c986
-rw-r--r--stream/tv.h285
-rw-r--r--stream/tvi_def.h93
-rw-r--r--stream/tvi_dummy.c126
-rw-r--r--stream/tvi_v4l2.c1786
-rw-r--r--wscript49
-rw-r--r--wscript_build.py10
27 files changed, 13 insertions, 6236 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index 8fccb23e29..c849a8f499 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -82,6 +82,8 @@ Interface changes
with the move to libplacebo as the back-end for vulkan rendering.
- Remove "disc-titles", "disc-title", "disc-title-list", and "angle"
properties. dvd:// does not support title ranges anymore.
+ - Remove all "tv-..." options and properties, along with the classic Linux
+ analog TV support.
--- mpv 0.29.0 ---
- drop --opensles-sample-rate, as --audio-samplerate should be used if desired
- drop deprecated --videotoolbox-format, --ff-aid, --ff-vid, --ff-sid,
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 43fb868db1..5065a90283 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -921,8 +921,7 @@ Input Commands that are Possibly Subject to Change
``--glsl-shader=file.glsl``.
-Undocumented commands: ``tv-last-channel`` (TV/DVB only),
-``ao-reload`` (experimental/internal).
+Undocumented commands: ``ao-reload`` (experimental/internal).
Hooks
~~~~~
@@ -1815,15 +1814,6 @@ Property list
``program`` (W)
Switch TS program (write-only).
-``dvb-channel`` (W)
- Pair of integers: card,channel of current DVB stream.
- Can be switched to switch to another channel on the same card.
-
-``dvb-channel-name`` (RW)
- Name of current DVB program.
- On write, a channel-switch to the named channel on the same
- card is performed. Can also be used for channel switching.
-
``sub-text``
Return the current subtitle text. Formatting is stripped. If a subtitle
is selected, but no text is currently visible, or the subtitle is not
@@ -1831,9 +1821,6 @@ Property list
This property is experimental and might be removed in the future.
-``tv-brightness``, ``tv-contrast``, ``tv-saturation``, ``tv-hue`` (RW)
- TV stuff.
-
``playlist-pos`` (RW)
Current position on playlist. The first entry is on position 0. Writing
to the property will restart playback at the written entry.
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index b7ffda9a8c..657235c161 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -3657,191 +3657,6 @@ Terminal
``--msg-time``
Prepend timing information to each console message.
-
-TV
---
-
-``--tv-...``
- These options tune various properties of the TV capture module. For
- watching TV with mpv, use ``tv://`` or ``tv://<channel_number>`` or
- even ``tv://<channel_name>`` (see option ``tv-channels`` for ``channel_name``
- below) as a media URL. You can also use ``tv:///<input_id>`` to start
- watching a video from a composite or S-Video input (see option ``input`` for
- details).
-
-``--tv-device=<value>``
- Specify TV device (default: ``/dev/video0``).
-
-``--tv-channel=<value>``
- Set tuner to <value> channel.
-
-``--no-tv-audio``
- no sound
-
-``--tv-automute=<0-255> (v4l and v4l2 only)``
- If signal strength reported by device is less than this value, audio
- and video will be muted. In most cases automute=100 will be enough.
- Default is 0 (automute disabled).
-
-``--tv-driver=<value>``
- See ``--tv=driver=help`` for a list of compiled-in TV input drivers.
- available: dummy, v4l2 (default: autodetect)
-
-``--tv-input=<value>``
- Specify input (default: 0 (TV), see console output for available
- inputs).
-
-``--tv-freq=<value>``
- Specify the frequency to set the tuner to (e.g. 511.250). Not
- compatible with the channels parameter.
-
-``--tv-outfmt=<value>``
- Specify the output format of the tuner with a preset value supported
- by the V4L driver (YV12, UYVY, YUY2, I420) or an arbitrary format given
- as hex value.
-
-``--tv-width=<value>``
- output window width
-
-``--tv-height=<value>``
- output window height
-
-``--tv-fps=<value>``
- framerate at which to capture video (frames per second)
-
-``--tv-buffersize=<value>``
- maximum size of the capture buffer in megabytes (default: dynamical)
-
-``--tv-norm=<value>``
- See the console output for a list of all available norms.
-
- See also: ``--tv-normid``.
-
-``--tv-normid=<value> (v4l2 only)``
- Sets the TV norm to the given numeric ID. The TV norm depends on the
- capture card. See the console output for a list of available TV norms.
-
-``--tv-chanlist=<value>``
- available: argentina, australia, china-bcast, europe-east,
- europe-west, france, ireland, italy, japan-bcast, japan-cable,
- newzealand, russia, southafrica, us-bcast, us-cable, us-cable-hrc
-
-``--tv-channels=<chan>-<name>[=<norm>],<chan>-<name>[=<norm>],...``
- Set names for channels.
-
- .. note::
-
- If <chan> is an integer greater than 1000, it will be treated as
- frequency (in kHz) rather than channel name from frequency table.
- Use _ for spaces in names (or play with quoting ;-) ). The channel
- names will then be written using OSD, and the input commands
- ``tv_step_channel``, ``tv_set_channel`` and ``tv_last_channel``
- will be usable for a remote control. Not compatible with
- the ``frequency`` parameter.
-
- .. note::
-
- The channel number will then be the position in the 'channels'
- list, beginning with 1.
-
- .. admonition:: Examples
-
- ``tv://1``, ``tv://TV1``, ``tv_set_channel 1``,
- ``tv_set_channel TV1``
-
-``--tv-[brightness|contrast|hue|saturation]=<-100-100>``
- Set the image equalizer on the card.
-
-``--tv-audiorate=<value>``
- Set input audio sample rate.
-
-``--tv-forceaudio``
- Capture audio even if there are no audio sources reported by v4l.
-
-``--tv-alsa``
- Capture from ALSA.
-
-``--tv-amode=<0-3>``
- Choose an audio mode:
-
- :0: mono
- :1: stereo
- :2: language 1
- :3: language 2
-
-``--tv-forcechan=<1-2>``
- By default, the count of recorded audio channels is determined
- automatically by querying the audio mode from the TV card. This option
- allows forcing stereo/mono recording regardless of the amode option
- and the values returned by v4l. This can be used for troubleshooting
- when the TV card is unable to report the current audio mode.
-
-``--tv-adevice=<value>``
- Set an audio device. <value> should be ``/dev/xxx`` for OSS and a
- hardware ID for ALSA. You must replace any ':' by a '.' in the
- hardware ID for ALSA.
-
-``--tv-audioid=<value>``
- Choose an audio output of the capture card, if it has more than one.
-
-``--tv-[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 does not have one. For v4l2 50
- maps to the default value of the control, as reported by the driver.
-
-``--tv-gain=<0-100>``
- Set gain control for video devices (usually webcams) to the desired
- value and switch off automatic control. A value of 0 enables automatic
- control. If this option is omitted, gain control will not be modified.
-
-``--tv-immediatemode=<bool>``
- A value of 0 means capture and buffer audio and video together. A
- value of 1 (default) means to do video capture only and let the audio
- go through a loopback cable from the TV card to the sound card.
-
-``--tv-mjpeg``
- Use hardware MJPEG compression (if the card supports it). When using
- this option, you do not need to specify the width and height of the
- output window, because mpv will determine it automatically from
- the decimation value (see below).
-
-``--tv-decimation=<1|2|4>``
- choose the size of the picture that will be compressed by hardware
- MJPEG compression:
-
- :1: full size
-
- - 704x576 PAL
- - 704x480 NTSC
-
- :2: medium size
-
- - 352x288 PAL
- - 352x240 NTSC
-
- :4: small size
-
- - 176x144 PAL
- - 176x120 NTSC
-
-``--tv-quality=<0-100>``
- Choose the quality of the JPEG compression (< 60 recommended for full
- size).
-
-``--tv-scan-autostart``
- Begin channel scanning immediately after startup (default: disabled).
-
-``--tv-scan-period=<0.1-2.0>``
- Specify delay in seconds before switching to next channel (default:
- 0.5). Lower values will cause faster scanning, but can detect inactive
- TV channels as active.
-
-``--tv-scan-threshold=<1-100>``
- Threshold value for the signal strength (in percent), as reported by
- the device (default: 50). A signal strength higher than this value will
- indicate that the currently scanning channel is active.
-
-
Cache
-----
diff --git a/demux/demux.c b/demux/demux.c
index b1f7ca0105..afb5fea2dd 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -52,7 +52,6 @@ extern const struct demuxer_desc demuxer_desc_edl;
extern const struct demuxer_desc demuxer_desc_cue;
extern const demuxer_desc_t demuxer_desc_rawaudio;
extern const demuxer_desc_t demuxer_desc_rawvideo;
-extern const demuxer_desc_t demuxer_desc_tv;
extern const demuxer_desc_t demuxer_desc_mf;
extern const demuxer_desc_t demuxer_desc_matroska;
extern const demuxer_desc_t demuxer_desc_lavf;
@@ -71,9 +70,6 @@ const demuxer_desc_t *const demuxer_list[] = {
&demuxer_desc_cue,
&demuxer_desc_rawaudio,
&demuxer_desc_rawvideo,
-#if HAVE_TV
- &demuxer_desc_tv,
-#endif
&demuxer_desc_matroska,
#if HAVE_LIBARCHIVE
&demuxer_desc_libarchive,
diff --git a/demux/demux.h b/demux/demux.h
index 2bb81526ab..838314bd4b 100644
--- a/demux/demux.h
+++ b/demux/demux.h
@@ -202,7 +202,6 @@ typedef struct demuxer {
bool fully_read;
bool is_network; // opened directly from a network stream
bool access_references; // allow opening other files/URLs
- bool extended_ctrls; // supports some of BD/DVD/DVB/TV controls
// Bitmask of DEMUX_EVENT_*
int events;
diff --git a/demux/demux_tv.c b/demux/demux_tv.c
deleted file mode 100644
index 79cff5d79d..0000000000
--- a/demux/demux_tv.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (C) 2001 Alex Beregszaszi
- *
- * Feb 19, 2002: Significant rewrites by Charles R. Henrich (henrich@msu.edu)
- * to add support for audio, and bktr *BSD support.
- *
- * This file is part of mpv.
- *
- * mpv is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpv is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with mpv. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <assert.h>
-
-#include "common/common.h"
-#include "common/msg.h"
-
-#include "options/m_option.h"
-#include "options/m_config.h"
-#include "options/options.h"
-
-#include "demux.h"
-#include "codec_tags.h"
-
-#include "audio/format.h"
-#include "osdep/endian.h"
-
-#include "stream/stream.h"
-#include "stream/tv.h"
-
-static int demux_open_tv(demuxer_t *demuxer, enum demux_check check)
-{
- tvi_handle_t *tvh;
- const tvi_functions_t *funcs;
-
- if (check > DEMUX_CHECK_REQUEST)
- return -1;
-
- if (!demuxer->stream->info || strcmp(demuxer->stream->info->name, "tv") != 0)
- return -1;
-
- tv_param_t *params = mp_get_config_group(demuxer, demuxer->global,
- &tv_params_conf);
- bstr urlparams = bstr0(demuxer->stream->path);
- bstr channel, input;
- bstr_split_tok(urlparams, "/", &channel, &input);
- if (channel.len) {
- talloc_free(params->channel);
- params->channel = bstrto0(NULL, channel);
- }
- if (input.len) {
- bstr r;
- params->input = bstrtoll(input, &r, 0);
- if (r.len) {
- MP_ERR(demuxer->stream, "invalid input: '%.*s'\n", BSTR_P(input));
- return -1;
- }
- }
-
- assert(demuxer->priv==NULL);
- if(!(tvh=tv_begin(params, demuxer->log))) return -1;
- if (!tvh->functions->init(tvh->priv)) return -1;
-
- tvh->demuxer = demuxer;
-
- if (!open_tv(tvh)){
- tv_uninit(tvh);
- return -1;
- }
- funcs = tvh->functions;
- demuxer->priv=tvh;
-
- struct sh_stream *sh_v = demux_alloc_sh_stream(STREAM_VIDEO);
-
- /* get IMAGE FORMAT */
- int fourcc;
- funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FORMAT, &fourcc);
- if (fourcc == MP_FOURCC_MJPEG || fourcc == MP_FOURCC_JPEG) {
- sh_v->codec->codec = "mjpeg";
- } else {
- sh_v->codec->codec = "rawvideo";
- sh_v->codec->codec_tag = fourcc;
- }
-
- /* set FPS and FRAMETIME */
-
- if(!sh_v->codec->fps)
- {
- float tmp;
- if (funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FPS, &tmp) != TVI_CONTROL_TRUE)
- sh_v->codec->fps = 25.0f; /* on PAL */
- else sh_v->codec->fps = tmp;
- }
-
- if (tvh->tv_param->fps != -1.0f)
- sh_v->codec->fps = tvh->tv_param->fps;
-
- /* If playback only mode, go to immediate mode, fail silently */
- if(tvh->tv_param->immediate == 1)
- {
- funcs->control(tvh->priv, TVI_CONTROL_IMMEDIATE, 0);
- tvh->tv_param->audio = 0;
- }
-
- /* set width */
- funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &sh_v->codec->disp_w);
-
- /* set height */
- funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &sh_v->codec->disp_h);
-
- demux_add_sh_stream(demuxer, sh_v);
-
- demuxer->seekable = 0;
-
- /* here comes audio init */
- if (tvh->tv_param->audio && funcs->control(tvh->priv, TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE)
- {
- int audio_format;
-
- /* yeah, audio is present */
-
- funcs->control(tvh->priv, TVI_CONTROL_AUD_SET_SAMPLERATE,
- &tvh->tv_param->audiorate);
-
- if (funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_FORMAT, &audio_format) != TVI_CONTROL_TRUE)
- goto no_audio;
-
- switch(audio_format)
- {
- // This is the only format any of the current inputs generate.
- case AF_FORMAT_S16:
- break;
- default:
- MP_ERR(tvh, "Audio type '%s' unsupported!\n",
- af_fmt_to_str(audio_format));
- goto no_audio;
- }
-
- struct sh_stream *sh_a = demux_alloc_sh_stream(STREAM_AUDIO);
-
- funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLERATE,
- &sh_a->codec->samplerate);
- int nchannels = sh_a->codec->channels.num;
- funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_CHANNELS,
- &nchannels);
- mp_chmap_from_channels(&sh_a->codec->channels, nchannels);
-
- // s16ne
- mp_set_pcm_codec(sh_a->codec, true, false, 16, BYTE_ORDER == BIG_ENDIAN);
-
- demux_add_sh_stream(demuxer, sh_a);
-
- MP_VERBOSE(tvh, " TV audio: %d channels, %d bits, %d Hz\n",
- nchannels, 16, sh_a->codec->samplerate);
- }
-no_audio:
-
- if(!(funcs->start(tvh->priv))){
- // start failed :(
- tv_uninit(tvh);
- return -1;
- }
-
- /* set color eq */
- tv_set_color_options(tvh, TV_COLOR_BRIGHTNESS, tvh->tv_param->brightness);
- tv_set_color_options(tvh, TV_COLOR_HUE, tvh->tv_param->hue);
- tv_set_color_options(tvh, TV_COLOR_SATURATION, tvh->tv_param->saturation);
- tv_set_color_options(tvh, TV_COLOR_CONTRAST, tvh->tv_param->contrast);
-
- if(tvh->tv_param->gain!=-1)
- if(funcs->control(tvh->priv,TVI_CONTROL_VID_SET_GAIN,&tvh->tv_param->gain)!=TVI_CONTROL_TRUE)
- MP_WARN(tvh, "Unable to set gain control!\n");
-
- demuxer->extended_ctrls = true;
-
- return 0;
-}
-
-static void demux_close_tv(demuxer_t *demuxer)
-{
- tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->priv);
- if (!tvh) return;
- tv_uninit(tvh);
- free(tvh);
- demuxer->priv=NULL;
-}
-
-static int demux_tv_fill_buffer(demuxer_t *demux)
-{
- tvi_handle_t *tvh=(tvi_handle_t*)(demux->priv);
- demux_packet_t* dp;
- unsigned int len=0;
- struct sh_stream *want_audio = NULL, *want_video = NULL;
-
- int num_streams = demux_get_num_stream(demux);
- for (int n = 0; n < num_streams; n++) {
- struct sh_stream *sh = demux_get_stream(demux, n);
- if (!demux_has_packet(sh) && demux_stream_is_selected(sh)) {
- if (sh->type == STREAM_AUDIO)
- want_audio = sh;
- if (sh->type == STREAM_VIDEO)
- want_video = sh;
- }
- }
-
- /* ================== ADD AUDIO PACKET =================== */
-
- if (want_audio && tvh->tv_param->audio &&
- tvh->functions->control(tvh->priv,
- TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE)
- {
- len = tvh->functions->get_audio_framesize(tvh->priv);
-
- dp=new_demux_packet(len);
- if (dp) {
- dp->keyframe = true;
- dp->pts=tvh->functions->grab_audio_frame(tvh->priv, dp->buffer,len);
- demux_add_packet(want_audio, dp);
- }
- }
-
- /* ================== ADD VIDEO PACKET =================== */
-
- if (want_video && tvh->functions->control(tvh->priv,
- TVI_CONTROL_IS_VIDEO, 0) == TVI_CONTROL_TRUE)
- {
- len = tvh->functions->get_video_framesize(tvh->priv);
- dp=new_demux_packet(len);
- if (dp) {
- dp->keyframe = true;
- dp->pts=tvh->functions->grab_video_frame(tvh->priv, dp->buffer, len);
- demux_add_packet(want_video, dp);
- }
- }
-
- if (tvh->tv_param->scan) tv_scan(tvh);
- return 1;
-}
-
-static int demux_tv_control(demuxer_t *demuxer, int cmd, void *arg)
-{
- tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->priv);
- if (cmd != DEMUXER_CTRL_STREAM_CTRL)
- return CONTROL_UNKNOWN;
- struct demux_ctrl_stream_ctrl *ctrl = arg;
- ctrl->res = tv_stream_control(tvh, ctrl->ctrl, ctrl->arg);
- return CONTROL_OK;
-}
-
-const demuxer_desc_t demuxer_desc_tv = {
- .name = "tv",
- .desc = "TV card demuxer",
- .fill_buffer = demux_tv_fill_buffer,
- .control = demux_tv_control,
- .open = demux_open_tv,
- .close = demux_close_tv,
-};
diff --git a/options/options.c b/options/options.c
index 962df9d34b..eef4ab8613 100644
--- a/options/options.c
+++ b/options/options.c
@@ -467,9 +467,6 @@ const m_option_t mp_opts[] = {
OPT_DOUBLE("mf-fps", mf_fps, 0),
OPT_STRING("mf-type", mf_type, 0),
-#if HAVE_TV
- OPT_SUBSTRUCT("tv", tv_params, tv_params_conf, 0),
-#endif /* HAVE_TV */
#if HAVE_DVBIN
OPT_SUBSTRUCT("dvbin", stream_dvb_opts, stream_dvb_conf, 0),
#endif
diff --git a/options/options.h b/options/options.h
index a6532b4458..d9dc5b6a08 100644
--- a/options/options.h
+++ b/options/options.h
@@ -284,8 +284,6 @@ typedef struct MPOpts {
int w32_priority;
- struct tv_params *tv_params;
- struct pvr_params *stream_pvr_opts;
struct cdda_params *stream_cdda_opts;
struct dvb_params *stream_dvb_opts;
struct stream_lavf_params *stream_lavf_opts;
diff --git a/player/command.c b/player/command.c
index 13b5fb74df..19b78e27c3 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2879,163 +2879,6 @@ static int mp_property_cursor_autohide(void *ctx, struct m_property *prop,
return r;
}
-static int prop_stream_ctrl(struct MPContext *mpctx, int ctrl, void *arg)
-{
- if (!mpctx->demuxer || !mpctx->demuxer->extended_ctrls)
- return M_PROPERTY_UNAVAILABLE;
- int r = demux_stream_control(mpctx->demuxer, ctrl, arg);
- switch (r) {
- case STREAM_OK: return M_PROPERTY_OK;
- case STREAM_UNSUPPORTED: return M_PROPERTY_UNAVAILABLE;
- default: return M_PROPERTY_ERROR;
- }
-}
-
-static int mp_property_tv_norm(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- switch (action) {
- case M_PROPERTY_SET:
- return prop_stream_ctrl(ctx, STREAM_CTRL_TV_SET_NORM, *(char **)arg);
- case M_PROPERTY_SWITCH:
- return prop_stream_ctrl(ctx, STREAM_CTRL_TV_STEP_NORM, NULL);
- case M_PROPERTY_GET_TYPE:
- *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING};
- return M_PROPERTY_OK;
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
-}
-
-static int mp_property_tv_scan(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- switch (action) {
- case M_PROPERTY_SET:
- return prop_stream_ctrl(ctx, STREAM_CTRL_TV_SET_SCAN, arg);
- case M_PROPERTY_GET_TYPE:
- *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_FLAG};
- return M_PROPERTY_OK;
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
-}
-
-/// TV color settings (RW)
-static int mp_property_tv_color(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- int req[2] = {(intptr_t)prop->priv};
- switch (action) {
- case M_PROPERTY_SET:
- req[1] = *(int *)arg;
- return prop_stream_ctrl(ctx, STREAM_CTRL_SET_TV_COLORS, req);
- case M_PROPERTY_GET: {
- int r = prop_stream_ctrl(ctx, STREAM_CTRL_GET_TV_COLORS, req);
- if (r == M_PROPERTY_OK)
- *(int *)arg = req[1];
- return r;
- }
- case M_PROPERTY_GET_TYPE:
- *(struct m_option *)arg = (struct m_option){
- .type = CONF_TYPE_INT,
- .flags = M_OPT_RANGE,
- .min = -100,
- .max = 100,
- };
- return M_PROPERTY_OK;
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
-}
-
-static int mp_property_tv_freq(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- switch (action) {
- case M_PROPERTY_SET:
- return prop_stream_ctrl(ctx, STREAM_CTRL_SET_TV_FREQ, arg);
- case M_PROPERTY_GET:
- return prop_stream_ctrl(ctx, STREAM_CTRL_GET_TV_FREQ, arg);
- case M_PROPERTY_GET_TYPE:
- *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_FLOAT};
- return M_PROPERTY_OK;
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
-}
-
-static int mp_property_tv_channel(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- switch (action) {
- case M_PROPERTY_GET_TYPE:
- *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING};
- return M_PROPERTY_OK;
- case M_PROPERTY_SET:
- return prop_stream_ctrl(ctx, STREAM_CTRL_TV_SET_CHAN, *(char **)arg);
- case M_PROPERTY_GET:
- return prop_stream_ctrl(ctx, STREAM_CTRL_TV_GET_CHAN, arg);
- case M_PROPERTY_SWITCH: {
- struct m_property_switch_arg *sa = arg;
- int dir = sa->inc >= 0 ? 1 : -1;
- return prop_stream_ctrl(ctx, STREAM_CTRL_TV_STEP_CHAN, &dir);
- }
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
-}
-
-static int mp_property_dvb_channel(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- int r;
- switch (action) {
- case M_PROPERTY_SET:
- r = prop_stream_ctrl(mpctx, STREAM_CTRL_DVB_SET_CHANNEL, arg);
- if (r == M_PROPERTY_OK && !mpctx->stop_play)
- mpctx->stop_play = PT_CURRENT_ENTRY;
- return r;
- case M_PROPERTY_SWITCH: {
- struct m_property_switch_arg *sa = arg;
- int dir = sa->inc >= 0 ? 1 : -1;
- r = prop_stream_ctrl(mpctx, STREAM_CTRL_DVB_STEP_CHANNEL, &dir);
- if (r == M_PROPERTY_OK && !mpctx->stop_play)
- mpctx->stop_play = PT_CURRENT_ENTRY;
- return r;
- }
- case M_PROPERTY_GET_TYPE:
- *(struct m_option *)arg = (struct m_option){.type = &m_option_type_intpair};
- return M_PROPERTY_OK;
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
-}
-
-static int mp_property_dvb_channel_name(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- int r;
- switch (action) {
- case M_PROPERTY_SET:
- r = prop_stream_ctrl(mpctx, STREAM_CTRL_DVB_SET_CHANNEL_NAME, arg);
- if (r == M_PROPERTY_OK && !mpctx->stop_play)
- mpctx->stop_play = PT_CURRENT_ENTRY;
- return r;
- case M_PROPERTY_SWITCH: {
- struct m_property_switch_arg *sa = arg;
- int dir = sa->inc >= 0 ? 1 : -1;
- r = prop_stream_ctrl(mpctx, STREAM_CTRL_DVB_STEP_CHANNEL, &dir);
- if (r == M_PROPERTY_OK && !mpctx->stop_play)
- mpctx->stop_play = PT_CURRENT_ENTRY;
- return r;
- }
- case M_PROPERTY_GET: {
- return prop_stream_ctrl(mpctx, STREAM_CTRL_DVB_GET_CHANNEL_NAME, arg);
- }
- case M_PROPERTY_GET_TYPE:
- *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING};
- return M_PROPERTY_OK;
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
-}
-
static int mp_property_playlist_pos_x(void *ctx, struct m_property *prop,
int action, void *arg, int base)
{
@@ -3749,19 +3592,6 @@ static const struct m_property mp_properties_base[] = {
PROPERTY_BITRATE("audio-bitrate", false, STREAM_AUDIO),
PROPERTY_BITRATE("sub-bitrate", false, STREAM_SUB),
-#define PROPERTY_TV_COLOR(name, type) \
- {name, mp_property_tv_color, (void *)(intptr_t)type}
- PROPERTY_TV_COLOR("tv-brightness", TV_COLOR_BRIGHTNESS),
- PROPERTY_TV_COLOR("tv-contrast", TV_COLOR_CONTRAST),
- PROPERTY_TV_COLOR("tv-saturation", TV_COLOR_SATURATION),
- PROPERTY_TV_COLOR("tv-hue", TV_COLOR_HUE),
- {"tv-freq", mp_property_tv_freq},
- {"tv-norm", mp_property_tv_norm},
- {"tv-scan", mp_property_tv_scan},
- {"tv-channel", mp_property_tv_channel},
- {"dvb-channel", mp_property_dvb_channel},
- {"dvb-channel-name", mp_property_dvb_channel_name},
-
{"cursor-autohide", mp_property_cursor_autohide},
{"window-minimized", mp_property_win_minimized},
@@ -5258,19 +5088,6 @@ static void cmd_show_progress(void *p)
mp_wakeup_core(mpctx);
}
-static void cmd_tv_last_channel(void *p)
-{
- struct mp_cmd_ctx *cmd = p;
- struct MPContext *mpctx = cmd->mpctx;