aboutsummaryrefslogtreecommitdiffhomepage
path: root/stream
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2015-05-23 15:26:55 +0200
committerGravatar wm4 <wm4@nowhere>2015-05-23 15:26:55 +0200
commit8054c034b883b23e68fd8c9ca64749e9776f9fcf (patch)
treecb390f74e4ac4ccdf750a1943e4e0c1c91a4dd05 /stream
parenta3f8d45fb6f70cc9d07105eeee8c843b9109bca6 (diff)
command: add protocol-list property
Fixes #1972.
Diffstat (limited to 'stream')
-rw-r--r--stream/stream.c27
-rw-r--r--stream/stream.h1
2 files changed, 22 insertions, 6 deletions
diff --git a/stream/stream.c b/stream/stream.c
index cfdf67be14..d6521586b5 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -1024,11 +1024,10 @@ int mp_cancel_get_fd(struct mp_cancel *c)
return c->wakeup_pipe[0];
}
-void stream_print_proto_list(struct mp_log *log)
+char **stream_get_proto_list(void)
{
- int count = 0;
-
- mp_info(log, "Protocols:\n\n");
+ char **list = NULL;
+ int num = 0;
for (int i = 0; stream_list[i]; i++) {
const stream_info_t *stream_info = stream_list[i];
@@ -1039,9 +1038,25 @@ void stream_print_proto_list(struct mp_log *log)
if (*stream_info->protocols[j] == '\0')
continue;
- mp_info(log, " %s://\n", stream_info->protocols[j]);
- count++;
+ MP_TARRAY_APPEND(NULL, list, num,
+ talloc_strdup(NULL, stream_info->protocols[j]));
}
}
+ MP_TARRAY_APPEND(NULL, list, num, NULL);
+ return list;
+}
+
+void stream_print_proto_list(struct mp_log *log)
+{
+ int count = 0;
+
+ mp_info(log, "Protocols:\n\n");
+ char **list = stream_get_proto_list();
+ for (int i = 0; list[i]; i++) {
+ mp_info(log, " %s://\n", list[i]);
+ count++;
+ talloc_free(list[i]);
+ }
+ talloc_free(list);
mp_info(log, "\nTotal: %d protocols\n", count);
}
diff --git a/stream/stream.h b/stream/stream.h
index 7b4751450c..cda5c7434e 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -289,5 +289,6 @@ void mp_setup_av_network_options(struct AVDictionary **dict,
struct MPOpts *opts);
void stream_print_proto_list(struct mp_log *log);
+char **stream_get_proto_list(void);
#endif /* MPLAYER_STREAM_H */