summaryrefslogtreecommitdiffstats
path: root/stream/stream_dvb.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_dvb.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_dvb.c')
-rw-r--r--stream/stream_dvb.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c
index cdf282d3ac..c1697ddebd 100644
--- a/stream/stream_dvb.c
+++ b/stream/stream_dvb.c
@@ -550,13 +550,26 @@ int dvb_step_channel(stream_t *stream, int dir)
return 0;
}
- new_current = (list->NUM_CHANNELS + list->current + (dir == DVB_CHANNEL_HIGHER ? 1 : -1)) % list->NUM_CHANNELS;
+ new_current = (list->NUM_CHANNELS + list->current + (dir >= 0 ? 1 : -1)) % list->NUM_CHANNELS;
return dvb_set_channel(stream, priv->card, new_current);
}
-
-
+static int dvbin_stream_control(struct stream *s, int cmd, void *arg)
+{
+ int r;
+ switch (cmd) {
+ case STREAM_CTRL_DVB_SET_CHANNEL: {
+ int *iarg = arg;
+ r = dvb_set_channel(s, iarg[1], iarg[0]);
+ return r ? STREAM_OK : STREAM_ERROR;
+ }
+ case STREAM_CTRL_DVB_STEP_CHANNEL:
+ r = dvb_step_channel(s, *(int *)arg);
+ return r ? STREAM_OK : STREAM_ERROR;
+ }
+ return STREAM_UNSUPPORTED;
+}
static void dvbin_close(stream_t *stream)
{
@@ -692,6 +705,7 @@ static int dvb_open(stream_t *stream)
stream->type = STREAMTYPE_DVB;
stream->fill_buffer = dvb_streaming_read;
stream->close = dvbin_close;
+ stream->control = dvbin_stream_control;
stream->demuxer = "lavf";
stream->lavf_type = "mpegts";