[MPlayer-cvslog] r36524 - in trunk/stream: cache2.c stream.h stream_dvb.c stream_tv.c

ib subversion at mplayerhq.hu
Fri Nov 29 13:34:21 CET 2013


Author: ib
Date: Fri Nov 29 13:34:21 2013
New Revision: 36524

Log:
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.)

Modified:
   trunk/stream/cache2.c
   trunk/stream/stream.h
   trunk/stream/stream_dvb.c
   trunk/stream/stream_tv.c

Modified: trunk/stream/cache2.c
==============================================================================
--- trunk/stream/cache2.c	Fri Nov 29 01:26:17 2013	(r36523)
+++ trunk/stream/cache2.c	Fri Nov 29 13:34:21 2013	(r36524)
@@ -94,6 +94,7 @@ typedef struct {
   volatile int control;
   volatile uint64_t control_uint_arg;
   volatile double control_double_arg;
+  volatile char *control_char_p_arg;
   volatile struct stream_lang_req control_lang_arg;
   volatile int control_res;
   volatile double stream_time_length;
@@ -327,6 +328,9 @@ static int cache_execute_control(cache_v
     case STREAM_CTRL_GET_LANG:
       s->control_res = s->stream->control(s->stream, s->control, (void *)&s->control_lang_arg);
       break;
+    case STREAM_CTRL_GET_CURRENT_CHANNEL:
+      s->control_res = s->stream->control(s->stream, s->control, &s->control_char_p_arg);
+      break;
     default:
       s->control_res = STREAM_UNSUPPORTED;
       break;
@@ -654,6 +658,10 @@ int cache_do_control(stream_t *stream, i
     case -2:
       s->control = cmd;
       break;
+    case STREAM_CTRL_GET_CURRENT_CHANNEL:
+      s->control_char_p_arg = *(char **)arg;
+      s->control = cmd;
+      break;
     default:
       return STREAM_UNSUPPORTED;
   }
@@ -699,6 +707,9 @@ int cache_do_control(stream_t *stream, i
     case STREAM_CTRL_GET_LANG:
       *(struct stream_lang_req *)arg = s->control_lang_arg;
       break;
+    case STREAM_CTRL_GET_CURRENT_CHANNEL:
+      *(char **)arg = (char *)s->control_char_p_arg;
+      break;
   }
   return s->control_res;
 }

Modified: trunk/stream/stream.h
==============================================================================
--- trunk/stream/stream.h	Fri Nov 29 01:26:17 2013	(r36523)
+++ trunk/stream/stream.h	Fri Nov 29 13:34:21 2013	(r36524)
@@ -97,6 +97,7 @@
 #define STREAM_CTRL_GET_NUM_TITLES 12
 #define STREAM_CTRL_GET_LANG 13
 #define STREAM_CTRL_GET_CURRENT_TITLE 14
+#define STREAM_CTRL_GET_CURRENT_CHANNEL 15
 
 enum stream_ctrl_type {
 	stream_ctrl_audio,

Modified: trunk/stream/stream_dvb.c
==============================================================================
--- trunk/stream/stream_dvb.c	Fri Nov 29 01:26:17 2013	(r36523)
+++ trunk/stream/stream_dvb.c	Fri Nov 29 13:34:21 2013	(r36524)
@@ -656,6 +656,25 @@ static int dvb_streaming_start(stream_t 
 
 
 
+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 @@ static int dvb_open(stream_t *stream, in
 
 	stream->type = STREAMTYPE_DVB;
 	stream->fill_buffer = dvb_streaming_read;
+	stream->control = dvb_control;
 	stream->close = dvbin_close;
 	m_struct_free(&stream_opts, opts);
 

Modified: trunk/stream/stream_tv.c
==============================================================================
--- trunk/stream/stream_tv.c	Fri Nov 29 01:26:17 2013	(r36523)
+++ trunk/stream/stream_tv.c	Fri Nov 29 13:34:21 2013	(r36524)
@@ -106,12 +106,17 @@ tv_stream_close (stream_t *stream)
     m_struct_free(&stream_opts,stream->priv);
   stream->priv=NULL;
 }
+static int tv_stream_control(stream_t *stream, int cmd, void *arg)
+{
+    return STREAM_UNSUPPORTED;
+}
 static int
 tv_stream_open (stream_t *stream, int mode, void *opts, int *file_format)
 {
 
   stream->type = STREAMTYPE_TV;
   stream->priv = opts;
+  stream->control = tv_stream_control;
   stream->close=tv_stream_close;
   *file_format =  DEMUXER_TYPE_TV;
 


More information about the MPlayer-cvslog mailing list