diff options
author | Joshua Colp <jcolp@digium.com> | 2017-04-24 15:59:44 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2017-04-27 10:39:46 +0000 |
commit | 2b22c3c84b8894c5663fec8655b0670b6bca4078 (patch) | |
tree | 119cd5ee07ec1d1ca60ff7c5765f6fd21cce1a28 /main/stream.c | |
parent | dc6654d969224129bdd7b4080eda6e027c6454b9 (diff) |
channel: Add ability to request an outgoing channel with stream topology.
This change extends the ast_request functionality by adding another
function and callback to create an outgoing channel with a requested
stream topology. Fallback is provided by either converting the
requested stream topology into a format capabilities structure if
the channel driver does not support streams or by converting the
requested format capabilities into a stream topology if the channel
driver does support streams.
The Dial application has also been updated to request an outgoing
channel with the stream topology of the calling channel.
ASTERISK-26959
Change-Id: Ifa9037a672ac21d42dd7125aa09816dc879a70e6
Diffstat (limited to 'main/stream.c')
-rw-r--r-- | main/stream.c | 26 |
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) |