summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'command.c')
-rw-r--r--command.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/command.c b/command.c
index 4afc2104e4..1619206689 100644
--- a/command.c
+++ b/command.c
@@ -162,6 +162,8 @@ static int mp_property_playback_speed(m_option_t *prop, int action,
static int mp_property_path(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
+ if (!mpctx->filename)
+ return M_PROPERTY_UNAVAILABLE;
if (action == M_PROPERTY_GET) {
*(char **)arg = talloc_strdup(NULL, mpctx->filename);
return M_PROPERTY_OK;
@@ -169,6 +171,34 @@ static int mp_property_path(m_option_t *prop, int action, void *arg,
return M_PROPERTY_NOT_IMPLEMENTED;
}
+static int mp_property_media_title(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
+{
+ char *name = mpctx->filename;
+ if (mpctx->resolve_result)
+ name = mpctx->resolve_result->title;
+ if (!name)
+ return M_PROPERTY_UNAVAILABLE;
+ if (action == M_PROPERTY_GET) {
+ *(char **)arg = talloc_strdup(NULL, name);
+ return M_PROPERTY_OK;
+ }
+ return M_PROPERTY_NOT_IMPLEMENTED;
+}
+
+static int mp_property_stream_path(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
+{
+ struct stream *stream = mpctx->stream;
+ if (!stream || !stream->url)
+ return M_PROPERTY_UNAVAILABLE;
+ if (action == M_PROPERTY_GET) {
+ *(char **)arg = talloc_strdup(NULL, stream->url);
+ return M_PROPERTY_OK;
+ }
+ return M_PROPERTY_NOT_IMPLEMENTED;
+}
+
/// filename without path (RO)
static int mp_property_filename(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
@@ -1364,6 +1394,10 @@ static const m_option_t mp_properties[] = {
0, 0, 0, NULL },
{ "path", mp_property_path, CONF_TYPE_STRING,
0, 0, 0, NULL },
+ { "media-title", mp_property_media_title, CONF_TYPE_STRING,
+ 0, 0, 0, NULL },
+ { "stream-path", mp_property_stream_path, CONF_TYPE_STRING,
+ 0, 0, 0, NULL },
{ "demuxer", mp_property_demuxer, CONF_TYPE_STRING,
0, 0, 0, NULL },
{ "stream-pos", mp_property_stream_pos, CONF_TYPE_INT64,