diff options
-rw-r--r-- | src/lrtp.h | 38 |
1 files changed, 37 insertions, 1 deletions
@@ -50,13 +50,31 @@ extern "C" { struct lrtp_t; +/** + * Initialise lrtp. + * @param key The key to be use in this session. + * @param ssrc The secure source to be used in the session. + * @return Returns the handle to the newly created session. + */ EXPORT struct lrtp_t *lrtp_init(const char *key, unsigned int ssrc); +/** + * Close session. + * @param lrtp The lrtp context handle to be closed. + */ EXPORT void lrtp_close(struct lrtp_t *lrtp); /** + * Create a new profile to be used in the lrtp_enqueue_frame and + * lrtp_dequeue_frame function calls. + * The profile is referenced byt ccsrc, so this must be unique to the active + * session. + * @param lrtp The lrtp context handle. + * @param profile_id See lrtp_profiles.h for possible values. + * @param csrc The csrc to be connected with this profile. + * @param ... Options for the profile. See lrtp_profiles.h for possible values. * @return 0 on success, 1 on error. */ EXPORT @@ -64,6 +82,11 @@ int lrtp_create_profile(struct lrtp_t *lrtp, lrtp_profile_id_t profile_id, unsigned int csrc, ...); +/** + * Free all resources connected with a profile. + * @param lrtp The lrtp context handle. + * @param csrc The csrc of the profile to be freed. + */ EXPORT void lrtp_destroy_profile(struct lrtp_t *lrtp, unsigned int csrc); @@ -111,10 +134,17 @@ typedef enum { UNPACK_MISSING_HANDLE = 1002, // Handle pointer NULL or not valid. UNPACK_MISSING_CSRC = 1003, // Exactly one csrc must be present. UNPACK_TOO_MANY_CSRCS = 1004, // Exactly one csrc must be present. - UNPACK_MISSING_PROFILE = 1005, // CSrc from packet could not be connected with a preofile.. + UNPACK_MISSING_PROFILE = 1005, // CSrc from packet could not be connected with a profile.. } lrtp_unpack_status_t; /** + * Dequeue a frame from the frame queue. + * @param lrtp The lrtp context handle. + * @param frame A pointer to a char buffer in which the frame will be written. + * @param maxsize The size of the char buffer stored in 'frame'. + * @param csrc The csrc of the dequeued frame is returned in this pointer. + * @param ts The timestamp of the dequeued frame is returned in this pointer. + * @return The size of the returned frame. -1 on error. */ EXPORT int lrtp_dequeue_frame(struct lrtp_t *lrtp, @@ -122,6 +152,12 @@ int lrtp_dequeue_frame(struct lrtp_t *lrtp, unsigned int *csrc, unsigned int *ts); /** + * Unpack packet from UDP stream. The packet will be cached, unpacked and (if a + * complete frame has been received) be pushed to the frame queue. + * @param lrtp The lrtp context handle. + * @param packet The packet data. + * @param size The size of the packet. + * @return 0 on success, error code (negative integer) on error. */ EXPORT int lrtp_unpack(struct lrtp_t *lrtp, const char *packet, size_t size); |