summaryrefslogtreecommitdiffstats
path: root/stream/tv.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-06-09 23:38:28 +0200
committerwm4 <wm4@nowhere>2014-06-11 00:34:41 +0200
commite033f3c8bcf66de44b0cc25e543a85f19fc9f964 (patch)
tree08cfecb3736fd7b6cc0803a4f28cc8c42651b53f /stream/tv.c
parent9420eb5a073da434c31f5123dff93c22e5ba32fa (diff)
downloadmpv-e033f3c8bcf66de44b0cc25e543a85f19fc9f964.tar.bz2
mpv-e033f3c8bcf66de44b0cc25e543a85f19fc9f964.tar.xz
command: redo ancient TV/DVB/PVR commands
Convert all these commands to properties. (Except tv_last_channel, not sure what to do with this.) Also, internally, don't access stream details directly, but dispatch commands with stream ctrls. Many of the new properties are a bit strange, because they're write- only. Also remove some OSD output these commands produced, because I couldn't be bothered to port these. In general, this makes everything much cleaner, and will also make it easier to e.g. move the demuxer to its own thread. Don't bother updating input.conf, but changes.rst documents how old commands map to the new ones. Mostly untested, due to lack of hardware.
Diffstat (limited to 'stream/tv.c')
-rw-r--r--stream/tv.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/stream/tv.c b/stream/tv.c
index c7017f4471..c42a81fde1 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -1087,9 +1087,58 @@ int tv_step_norm(tvi_handle_t *tvh)
return 1;
}
-int tv_step_chanlist(tvi_handle_t *tvh)
+static int tv_stream_control(tvi_handle_t *tvh, int cmd, void *arg)
{
- return 1;
+ switch (cmd) {
+ case STREAM_CTRL_TV_SET_SCAN:
+ tv_start_scan(tvh, *(int *)arg);
+ return STREAM_OK;
+ case STREAM_CTRL_SET_TV_FREQ:
+ tv_set_freq(tvh, *(float *)arg * 16.0f);
+ return STREAM_OK;
+ case STREAM_CTRL_GET_TV_FREQ: {
+ unsigned long tmp = 0;
+ tv_get_freq(tvh, &tmp);
+ *(float *)arg = tmp / 16.0f;
+ return STREAM_OK;
+ }
+ case STREAM_CTRL_SET_TV_COLORS:
+ tv_set_color_options(tvh, ((int *)arg)[0], ((int *)arg)[1]);
+ return STREAM_OK;
+ case STREAM_CTRL_GET_TV_COLORS:
+ tv_get_color_options(tvh, ((int *)arg)[0], &((int *)arg)[1]);
+ return STREAM_OK;
+ case STREAM_CTRL_TV_SET_NORM:
+ tv_set_norm(tvh, (char *)arg);
+ return STREAM_OK;
+ case STREAM_CTRL_TV_STEP_NORM:
+ tv_step_norm(tvh);
+ return STREAM_OK;
+ case STREAM_CTRL_TV_SET_CHAN:
+ tv_set_channel(tvh, (char *)arg);
+ return STREAM_OK;
+ case STREAM_CTRL_TV_STEP_CHAN:
+ if (*(int *)arg >= 0) {
+ tv_step_channel(tvh, TV_CHANNEL_HIGHER);
+ } else {
+ tv_step_channel(tvh, TV_CHANNEL_LOWER);
+ }
+ return STREAM_OK;
+ case STREAM_CTRL_TV_LAST_CHAN:
+ tv_last_channel(tvh);
+ return STREAM_OK;
+ }
+ return STREAM_UNSUPPORTED;
+}
+
+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 DEMUXER_CTRL_NOTIMPL;
+ struct demux_ctrl_stream_ctrl *ctrl = arg;
+ ctrl->res = tv_stream_control(tvh, ctrl->ctrl, ctrl->arg);
+ return DEMUXER_CTRL_OK;
}
demuxer_desc_t demuxer_desc_tv = {
@@ -1097,6 +1146,7 @@ demuxer_desc_t demuxer_desc_tv = {
.desc = "TV card demuxer",
.type = DEMUXER_TYPE_TV,
.fill_buffer = demux_tv_fill_buffer,
+ .control = demux_tv_control,
.open = demux_open_tv,
.close = demux_close_tv,
};