summaryrefslogtreecommitdiff
path: root/include/asterisk/channel.h
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-02-23 19:03:15 +0000
committerGeorge Joseph <gjoseph@digium.com>2017-02-24 10:20:33 -0600
commitc07c6714f270b7689ddd904bd52f547c19b51555 (patch)
treea517a0508a8c5f9fe1fc4554205aae051eef10e7 /include/asterisk/channel.h
parent6cc890b880a6d50b3236860c3ab89e26ba59a7d3 (diff)
channel: Add ast_read_stream function for reading frames from all streams.
This change introduces an ast_read_stream function and callback in the channel technology which allows reading frames from all streams and not just the default streams. The stream number has also been added to frames. This is to allow the case where frames are queued onto the channel instead of being read directly from the driver. This change does impose a restriction on reading though: a chain of frames can only contain frames from the same stream. ASTERISK-26816 Change-Id: I5d7dc35e86694df91fd025126f6cfe0453aa38ce
Diffstat (limited to 'include/asterisk/channel.h')
-rw-r--r--include/asterisk/channel.h49
1 files changed, 48 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