diff options
author | Oliver Freyermuth <o.freyermuth@googlemail.com> | 2016-01-08 03:31:29 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-01-14 00:36:53 +0100 |
commit | 1e46bda0f86d9d58c38135c7b9ddbb6dbb7c3572 (patch) | |
tree | 36d710fcc7604e7a4b6d885869d00d5b46ba7f5a /stream/stream_dvb.c | |
parent | 16723d4bb1e0fbb8fd15faf590890103bb9753a5 (diff) | |
download | mpv-1e46bda0f86d9d58c38135c7b9ddbb6dbb7c3572.tar.bz2 mpv-1e46bda0f86d9d58c38135c7b9ddbb6dbb7c3572.tar.xz |
stream_dvb: implement GET_METADATA and return program name.
Now title will be the current channel name also after channel switch.
Diffstat (limited to 'stream/stream_dvb.c')
-rw-r--r-- | stream/stream_dvb.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index 815fe4bed2..3f13828a5f 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -47,6 +47,7 @@ #include "misc/ctype.h" #include "stream.h" +#include "common/tags.h" #include "options/m_config.h" #include "options/m_option.h" #include "options/options.h" @@ -789,7 +790,7 @@ static int dvbin_stream_control(struct stream *s, int cmd, void *arg) } return STREAM_ERROR; } - case STREAM_CTRL_DVB_STEP_CHANNEL: + case STREAM_CTRL_DVB_STEP_CHANNEL: { r = dvb_step_channel(s, *(int *)arg); if (r) { // Stream will be pulled down after channel switch, @@ -801,6 +802,17 @@ static int dvbin_stream_control(struct stream *s, int cmd, void *arg) } return STREAM_ERROR; } + case STREAM_CTRL_GET_METADATA: { + struct mp_tags* metadata = talloc_zero(NULL, struct mp_tags); + dvb_priv_t *priv = (dvb_priv_t *) s->priv; + dvb_state_t* state = priv->state; + int current_channel = state->list->current; + char* progname = state->list->channels[current_channel].name; + mp_tags_set_str(metadata, "title", progname); + *(struct mp_tags **)arg = metadata; + return 1; + } + } return STREAM_UNSUPPORTED; } @@ -808,7 +820,6 @@ static void dvbin_close(stream_t *stream) { dvb_priv_t *priv = (dvb_priv_t *) stream->priv; dvb_state_t* state = priv->state; - if (state->switching_channel && state->is_on) { // Prevent state destruction, reset channel-switch. state->switching_channel = false; |