1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-12 01:46:16 +00:00

stream_dvb: implement GET_METADATA and return program name.

Now title will be the current channel name also after channel switch.
This commit is contained in:
Oliver Freyermuth 2016-01-08 03:31:29 +01:00 committed by wm4
parent 16723d4bb1
commit 1e46bda0f8

View File

@ -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;