diff stream/stream_dvb.c @ 36428:7766530caa76

Add new stream control command STREAM_CTRL_GET_CURRENT_CHANNEL. This provides the name of the currently selected DVB channel. (Unsupported for analog TV though.)
author ib
date Fri, 29 Nov 2013 12:34:21 +0000
parents e89214f37501
children
line wrap: on
line diff
--- a/stream/stream_dvb.c	Fri Nov 29 00:26:17 2013 +0000
+++ b/stream/stream_dvb.c	Fri Nov 29 12:34:21 2013 +0000
@@ -656,6 +656,25 @@
 
 
 
+static int dvb_control(stream_t *stream, int cmd, void *arg)
+{
+    dvb_priv_t *priv = stream->priv;
+    dvb_channels_list *list;
+
+    switch (cmd) {
+    case STREAM_CTRL_GET_CURRENT_CHANNEL:
+        if (priv) {
+            list = priv->list;
+            *(char **)arg = list->channels[list->current].name;
+            return STREAM_OK;
+        } else
+            return STREAM_ERROR;
+    }
+
+    return STREAM_UNSUPPORTED;
+}
+
+
 
 static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format)
 {
@@ -734,6 +753,7 @@
 
 	stream->type = STREAMTYPE_DVB;
 	stream->fill_buffer = dvb_streaming_read;
+	stream->control = dvb_control;
 	stream->close = dvbin_close;
 	m_struct_free(&stream_opts, opts);