26 #ifndef _AST_STREAM_H_ 27 #define _AST_STREAM_H_ 40 #define _stream_maps_to_str(_mapname, _value) \ 42 const char *_rtn = ""; \ 43 if (ARRAY_IN_BOUNDS(_value, _mapname)) { \ 44 _rtn = _mapname[_value]; \ 116 #define ast_stream_state_to_str(stream_state) _stream_maps_to_str(ast_stream_state_map, stream_state) 244 #define ast_stream_codec_param_to_str(value) _stream_maps_to_str(ast_stream_codec_negotiation_params_map, value) 254 #define ast_stream_codec_prefer_to_str(value) _stream_maps_to_str(ast_stream_codec_negotiation_prefer_map, value) 264 #define ast_stream_codec_operation_to_str(value) _stream_maps_to_str(ast_stream_codec_negotiation_operation_map, value) 274 #define ast_stream_codec_keep_to_str(value) _stream_maps_to_str(ast_stream_codec_negotiation_keep_map, value) 284 #define ast_stream_codec_transcode_to_str(value) _stream_maps_to_str(ast_stream_codec_negotiation_transcode_map, value) 307 #define AST_STREAM_MAX_CODEC_PREFS_LENGTH (128) 360 struct ast_str **error_message);
487 #define ast_stream_to_stra(__stream) ast_str_tmp(128, ast_stream_to_str(__stream, &STR_TMP)) 658 struct ast_str **error_message);
921 struct ast_vector_int *types,
struct ast_vector_int *v0,
struct ast_vector_int *v1);
972 struct ast_str **error_message);
985 #define ast_stream_topology_to_stra(__topology) ast_str_tmp(256, ast_stream_topology_to_str(__topology, &STR_TMP)) struct ast_rtp_codecs * ast_stream_get_rtp_codecs(const struct ast_stream *stream)
Get rtp_codecs associated with the stream.
const char * ast_stream_to_str(const struct ast_stream *stream, struct ast_str **buf)
Get a string representing the stream for debugging/display purposes.
const char * ast_stream_codec_prefs_to_str(const struct ast_stream_codec_negotiation_prefs *prefs, struct ast_str **buf)
Return a string representing the codec preferences.
int ast_stream_get_group(const struct ast_stream *stream)
Get the stream group that a stream is part of.
struct ast_format_cap * ast_stream_topology_get_formats(struct ast_stream_topology *topology)
Create a format capabilities structure representing the topology.
enum ast_media_type ast_stream_get_type(const struct ast_stream *stream)
Get the media type of a stream.
enum ast_stream_codec_negotiation_prefs_operation_values operation
Structure for variables, used for configurations and for channel variables.
Set when the stream has been removed/declined.
enum ast_stream_codec_negotiation_prefs_prefer_values prefer
struct ast_stream_topology * ast_stream_topology_create_from_format_cap(struct ast_format_cap *cap)
A helper function that, given a format capabilities structure, creates a topology and separates the m...
int ast_stream_get_format_count(const struct ast_stream *stream)
Get the count of the current negotiated formats of a stream.
Set when the stream is not sending OR receiving media.
ast_stream_state
States that a stream may be in.
const char * ast_stream_codec_negotiation_keep_map[CODEC_NEGOTIATION_KEEP_END]
"keep" enum to string map
struct ast_stream * ast_stream_topology_get_stream(const struct ast_stream_topology *topology, unsigned int position)
Get a specific stream from the topology.
int ast_stream_topology_append_stream(struct ast_stream_topology *topology, struct ast_stream *stream)
Append a stream to the topology.
void ast_stream_set_formats(struct ast_stream *stream, struct ast_format_cap *caps)
Set the current negotiated formats of a stream.
int ast_stream_topology_set_stream(struct ast_stream_topology *topology, unsigned int position, struct ast_stream *stream)
Set a specific position in a topology.
struct ast_stream_topology * ast_stream_topology_create_resolved(struct ast_stream_topology *pending_topology, struct ast_stream_topology *validation_topology, struct ast_stream_codec_negotiation_prefs *prefs, struct ast_str **error_message)
Create a resolved stream topology from 2 topologies.
const char * ast_stream_codec_negotiation_transcode_map[CODEC_NEGOTIATION_TRANSCODE_END]
"transcode" state enum to string map
const char * ast_stream_topology_to_str(const struct ast_stream_topology *topology, struct ast_str **buf)
Get a string representing the topology for debugging/display purposes.
struct ast_stream * ast_stream_topology_get_first_stream_by_type(const struct ast_stream_topology *topology, enum ast_media_type type)
Gets the first active stream of a specific type from the topology.
const char * ast_stream_codec_negotiation_operation_map[CODEC_NEGOTIATION_OPERATION_END]
"operation" enum to string map
struct ast_variable * ast_stream_get_metadata_list(const struct ast_stream *stream)
Get all stream metadata keys.
enum ast_stream_state ast_stream_str2state(const char *str)
Convert a string to a stream state.
ast_stream_codec_negotiation_prefs_operation_values
The "operation" values.
const struct ast_format_cap * ast_stream_get_formats(const struct ast_stream *stream)
Get the current negotiated formats of a stream.
ast_stream_codec_negotiation_prefs_transcode_values
The "transcode" values.
ast_stream_codec_negotiation_params
Advanced Codec Negotiation Preferences.
enum ast_stream_codec_negotiation_prefs_keep_values keep
void ast_stream_set_group(struct ast_stream *stream, int group)
Set the stream group for a stream.
int ast_stream_codec_prefs_parse(const char *pref_string, struct ast_stream_codec_negotiation_prefs *prefs, struct ast_str **error_message)
Parses a string representing the codec prefs into a ast_stream_codec_negotiation_pref structure...
Set when the stream is sending and receiving media.
const char * ast_stream_codec_negotiation_prefer_map[CODEC_NEGOTIATION_PREFER_END]
"prefer" enum to string map
void ast_stream_set_type(struct ast_stream *stream, enum ast_media_type type)
Change the media type of a stream.
const char * ast_stream_state_map[AST_STREAM_STATE_END]
Stream state enum to string map.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
int ast_stream_topology_equal(const struct ast_stream_topology *left, const struct ast_stream_topology *right)
Compare two stream topologies to see if they are equal.
struct ast_stream_topology * ast_stream_topology_alloc(void)
Create a stream topology.
Set when the stream is sending media only.
struct ast_stream * ast_stream_create_resolved(struct ast_stream *pending_stream, struct ast_stream *configured_stream, struct ast_stream_codec_negotiation_prefs *prefs, struct ast_str **error_message)
Create a resolved stream from 2 streams.
void ast_stream_set_state(struct ast_stream *stream, enum ast_stream_state state)
Set the state of a stream.
Vector container support.
int ast_stream_topology_get_count(const struct ast_stream_topology *topology)
Get the number of streams in a topology.
void(* ast_stream_data_free_fn)(void *)
struct ast_stream_topology * ast_stream_topology_clone(const struct ast_stream_topology *topology)
Create a deep clone of an existing stream topology.
void ast_stream_free(struct ast_stream *stream)
Destroy a media stream representation.
struct ast_stream * ast_stream_alloc(const char *name, enum ast_media_type type)
Create a new media stream representation.
void ast_stream_set_rtp_codecs(struct ast_stream *stream, struct ast_rtp_codecs *rtp_codecs)
Set rtp_codecs associated with the stream.
struct ast_stream * ast_stream_clone(const struct ast_stream *stream, const char *name)
Create a deep clone of an existing stream.
enum ast_stream_codec_negotiation_prefs_transcode_values transcode
const char * ast_stream_state2str(enum ast_stream_state state)
Convert the state of a stream into a string.
int ast_stream_set_metadata(struct ast_stream *stream, const char *m_key, const char *value)
Set a stream metadata value.
const char * ast_stream_get_metadata(const struct ast_stream *stream, const char *m_key)
Get a stream metadata value.
ast_stream_codec_negotiation_prefs_prefer_values
The "prefer" values.
ast_media_type
Types of media.
void ast_stream_topology_map(const struct ast_stream_topology *topology, struct ast_vector_int *types, struct ast_vector_int *v0, struct ast_vector_int *v1)
Map a given topology's streams to the given types.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
int ast_stream_get_position(const struct ast_stream *stream)
Get the position of the stream in the topology.
const char * ast_stream_get_name(const struct ast_stream *stream)
Get the name of a stream.
int ast_stream_topology_get_active_count(const struct ast_stream_topology *topology)
Get the number of active (non-REMOVED) streams in a topology.
Set when the stream is receiving media only.
int ast_stream_topology_del_stream(struct ast_stream_topology *topology, unsigned int position)
Delete a specified stream from the given topology.
enum ast_stream_state ast_stream_get_state(const struct ast_stream *stream)
Get the current state of a stream.
unsigned int position
The position of the stream in the topology.
struct ast_format_cap * ast_stream_topology_get_formats_by_type(struct ast_stream_topology *topology, enum ast_media_type type)
Create a format capabilities structure containing all the formats from all the streams of a particula...
const char * ast_stream_codec_negotiation_params_map[CODEC_NEGOTIATION_PARAM_END]
Preference enum to string map.
ast_stream_codec_negotiation_prefs_keep_values
The "keep" values.