summaryrefslogtreecommitdiffstats
path: root/stream/stream_pvr.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/stream_pvr.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/stream_pvr.c')
-rw-r--r--stream/stream_pvr.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/stream/stream_pvr.c b/stream/stream_pvr.c
index e45c9005a1..c19e9f05cb 100644
--- a/stream/stream_pvr.c
+++ b/stream/stream_pvr.c
@@ -142,6 +142,8 @@ struct pvr_t {
int stream_type;
};
+static int pvr_stream_control(struct stream *s, int cmd, void *arg);
+
static struct pvr_t *
pvr_init (void)
{
@@ -1608,6 +1610,7 @@ pvr_stream_open (stream_t *stream)
stream->type = STREAMTYPE_PVR;
stream->fill_buffer = pvr_stream_read;
stream->close = pvr_stream_close;
+ stream->control = pvr_stream_control;
return STREAM_OK;
}
@@ -1698,6 +1701,28 @@ pvr_force_freq_step (stream_t *stream, int step)
return force_freq_step (pvr, step);
}
+static int pvr_stream_control(struct stream *s, int cmd, void *arg)
+{
+ switch (cmd) {
+ case STREAM_CTRL_SET_TV_FREQ:
+ pvr_set_freq(s, (int)(*(float *)arg + 0.5f));
+ return STREAM_OK;
+ case STREAM_CTRL_GET_TV_FREQ:
+ *(float *)arg = pvr_get_current_frequency(s);
+ return STREAM_OK;
+ case STREAM_CTRL_TV_SET_CHAN:
+ pvr_set_channel(s, (char *)arg);
+ return STREAM_OK;
+ case STREAM_CTRL_TV_STEP_CHAN:
+ pvr_set_channel_step(s, *(int *)arg);
+ return STREAM_OK;
+ case STREAM_CTRL_TV_LAST_CHAN:
+ pvr_set_lastchannel(s);
+ return STREAM_OK;
+ }
+ return STREAM_UNSUPPORTED;
+}
+
const stream_info_t stream_info_pvr = {
.name = "pvr",
.open = pvr_stream_open,