summaryrefslogtreecommitdiff
path: root/main/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/stream.c')
-rw-r--r--main/stream.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/main/stream.c b/main/stream.c
index 9d36dbf25..cf2633e1b 100644
--- a/main/stream.c
+++ b/main/stream.c
@@ -392,6 +392,32 @@ struct ast_stream_topology *ast_stream_topology_create_from_format_cap(
return topology;
}
+struct ast_format_cap *ast_format_cap_from_stream_topology(
+ struct ast_stream_topology *topology)
+{
+ struct ast_format_cap *caps;
+ int i;
+
+ ast_assert(topology != NULL);
+
+ caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+ if (!caps) {
+ return NULL;
+ }
+
+ for (i = 0; i < AST_VECTOR_SIZE(&topology->streams); i++) {
+ struct ast_stream *stream = AST_VECTOR_GET(&topology->streams, i);
+
+ if (!stream->formats) {
+ continue;
+ }
+
+ ast_format_cap_append_from_cap(caps, stream->formats, AST_MEDIA_TYPE_UNKNOWN);
+ }
+
+ return caps;
+}
+
struct ast_stream *ast_stream_topology_get_first_stream_by_type(
const struct ast_stream_topology *topology,
enum ast_media_type type)