diff options
author | George Joseph <gjoseph@digium.com> | 2017-02-27 08:51:26 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-02-27 08:51:26 -0600 |
commit | df22d297a64ee2ef53ea0296a353a5c90ae70ba2 (patch) | |
tree | a6245842eba6b053b38e467791b6d87093c767f2 /include | |
parent | 00d1c7ddd28557aa845c3522956852a60310df96 (diff) | |
parent | c07c6714f270b7689ddd904bd52f547c19b51555 (diff) |
Merge "channel: Add ast_read_stream function for reading frames from all streams."
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/channel.h | 49 | ||||
-rw-r--r-- | include/asterisk/frame.h | 2 |
2 files changed, 50 insertions, 1 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 80476a4e0..f6e09252f 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -664,9 +664,33 @@ struct ast_channel_tech { /*! \brief Answer the channel */ int (* const answer)(struct ast_channel *chan); - /*! \brief Read a frame, in standard format (see frame.h) */ + /*! + * \brief Read a frame (or chain of frames from the same stream), in standard format (see frame.h) + * + * \param chan channel to read frames from + * + * \retval non-NULL on success + * \retval NULL on failure + * + * \note Each media frame from this callback will have the stream_num of it changed to the default + * stream num based on the type of media returned. As a result a multistream capable channel + * should not implement this callback. + */ struct ast_frame * (* const read)(struct ast_channel *chan); + /*! + * \brief Read a frame (or chain of frames from the same stream), in standard format (see frame.h), with stream num + * + * \param chan channel to read frames from + * + * \retval non-NULL on success + * \retval NULL on failure + * + * \note Each media frame from this callback should contain a stream_num value which is set to the + * stream that the media frame originated from. + */ + struct ast_frame * (* const read_stream)(struct ast_channel *chan); + /*! \brief Write a frame, in standard format (see frame.h) */ int (* const write)(struct ast_channel *chan, struct ast_frame *frame); @@ -1926,14 +1950,37 @@ int ast_waitfor_n_fd(int *fds, int n, int *ms, int *exception); /*! * \brief Reads a frame + * * \param chan channel to read a frame from + * * \return Returns a frame, or NULL on error. If it returns NULL, you * best just stop reading frames and assume the channel has been * disconnected. + * + * \note This function will filter frames received from the channel so + * that only frames from the default stream for each media type + * are returned. All other media frames from other streams will + * be absorbed internally and a NULL frame returned instead. */ struct ast_frame *ast_read(struct ast_channel *chan); /*! + * \brief Reads a frame, but does not filter to just the default streams + * + * \param chan channel to read a frame from + * + * \return Returns a frame, or NULL on error. If it returns NULL, you + * best just stop reading frames and assume the channel has been + * disconnected. + * + * \note This function will not perform any filtering and will return + * media frames from all streams on the channel. To determine which + * stream a frame originated from the stream_num on it can be + * examined. + */ +struct ast_frame *ast_read_stream(struct ast_channel *chan); + +/*! * \brief Reads a frame, returning AST_FRAME_NULL frame if audio. * \param chan channel to read a frame from * \return Returns a frame, or NULL on error. If it returns NULL, you diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h index 90f8aa086..c56539af4 100644 --- a/include/asterisk/frame.h +++ b/include/asterisk/frame.h @@ -181,6 +181,8 @@ struct ast_frame { long len; /*! Sequence number */ int seqno; + /*! Stream number the frame originated from */ + int stream_num; }; /*! |