From 465adf2bf165ad6b27cd2659ad731ff1d24dfed5 Mon Sep 17 00:00:00 2001 From: Matt O'Gorman Date: Mon, 18 Sep 2006 23:32:57 +0000 Subject: allow for packetization on rtp channel drivers, need to add option for setting our own packetization as apposed to just doing what is asked. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43243 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/frame.h | 28 ++++++++++++++++++++++++++++ include/asterisk/rtp.h | 6 ++++++ 2 files changed, 34 insertions(+) (limited to 'include/asterisk') diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h index 0160e3b95..bcc533a95 100644 --- a/include/asterisk/frame.h +++ b/include/asterisk/frame.h @@ -38,6 +38,7 @@ extern "C" { struct ast_codec_pref { char order[32]; + char framing[32]; }; /*! \page Def_Frame AST Multimedia and signalling frames @@ -281,6 +282,7 @@ enum ast_control_frame_type { }; #define AST_SMOOTHER_FLAG_G729 (1 << 0) +#define AST_SMOOTHER_FLAG_BE (1 << 1) /* Option identifiers and flags */ #define AST_OPTION_FLAG_REQUEST 0 @@ -346,6 +348,23 @@ struct ast_option_header { uint8_t data[0]; }; + +/*! \brief Definition of supported media formats (codecs) */ +struct ast_format_list { + int visible; /*!< Can we see this entry */ + int bits; /*!< bitmask value */ + char *name; /*!< short name */ + char *desc; /*!< Description */ + int fr_len; /*!< Single frame length in bytes */ + int min_ms; /*!< Min value */ + int max_ms; /*!< Max value */ + int inc_ms; /*!< Increment */ + int def_ms; /*!< Default value */ + unsigned int flags; /*!< Smoother flags */ + int cur_ms; /*!< Current value */ +}; + + /*! \brief Requests a frame to be allocated * * \param source @@ -436,6 +455,7 @@ struct ast_format_list *ast_get_format_list(size_t *size); struct ast_smoother *ast_smoother_new(int bytes); void ast_smoother_set_flags(struct ast_smoother *smoother, int flags); int ast_smoother_get_flags(struct ast_smoother *smoother); +int ast_smoother_test_flag(struct ast_smoother *s, int flag); void ast_smoother_free(struct ast_smoother *s); void ast_smoother_reset(struct ast_smoother *s, int bytes); int __ast_smoother_feed(struct ast_smoother *s, struct ast_frame *f, int swap); @@ -482,6 +502,14 @@ int ast_codec_pref_append(struct ast_codec_pref *pref, int format); the format list is selected, otherwise 0 is returned. */ int ast_codec_choose(struct ast_codec_pref *pref, int formats, int find_best); +/*! \brief Set packet size for codec +*/ +int ast_codec_pref_setsize(struct ast_codec_pref *pref, int format, int framems); + +/*! \brief Get packet size for codec +*/ +struct ast_format_list ast_codec_pref_getsize(struct ast_codec_pref *pref, int format); + /*! \brief Parse an "allow" or "deny" line in a channel or device configuration and update the capabilities mask and pref if provided. Video codecs are not added to codec preference lists, since we can not transcode diff --git a/include/asterisk/rtp.h b/include/asterisk/rtp.h index 6780c2adc..c332159ec 100644 --- a/include/asterisk/rtp.h +++ b/include/asterisk/rtp.h @@ -210,6 +210,12 @@ void ast_rtp_init(void); int ast_rtp_reload(void); +int ast_rtp_codec_setpref(struct ast_rtp *rtp, struct ast_codec_pref *prefs); + +struct ast_codec_pref *ast_rtp_codec_getpref(struct ast_rtp *rtp); + +int ast_rtp_codec_getformat(int pt); + #if defined(__cplusplus) || defined(c_plusplus) } #endif -- cgit v1.2.3