diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-04-27 22:36:40 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-04-27 22:36:40 +0000 |
commit | 4bab78a009cbfc57426066ebb5070e7609d4be04 (patch) | |
tree | 016b6205dfafc5084da23be9467f2c092cea01a8 /pjmedia/include | |
parent | 76cf603ff005c45c996cbaf742913f418eb09910 (diff) |
Initial support for stereo codecs, and added L16 codecs. Also better handling for case remote media is restarted
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@411 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/include')
-rw-r--r-- | pjmedia/include/pjmedia-codec.h | 1 | ||||
-rw-r--r-- | pjmedia/include/pjmedia-codec/config.h | 8 | ||||
-rw-r--r-- | pjmedia/include/pjmedia-codec/l16.h | 53 | ||||
-rw-r--r-- | pjmedia/include/pjmedia-codec/types.h | 31 | ||||
-rw-r--r-- | pjmedia/include/pjmedia.h | 2 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/codec.h | 298 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/endpoint.h | 1 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/port.h | 16 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/sdp.h | 35 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/sdp_neg.h | 14 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/types.h | 107 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/wav_port.h (renamed from pjmedia/include/pjmedia/file_port.h) | 29 |
12 files changed, 431 insertions, 164 deletions
diff --git a/pjmedia/include/pjmedia-codec.h b/pjmedia/include/pjmedia-codec.h index 8b975839..f160edef 100644 --- a/pjmedia/include/pjmedia-codec.h +++ b/pjmedia/include/pjmedia-codec.h @@ -19,6 +19,7 @@ #ifndef __PJMEDIA_CODEC_PJMEDIA_CODEC_H__ #define __PJMEDIA_CODEC_PJMEDIA_CODEC_H__ +#include <pjmedia-codec/l16.h> #include <pjmedia-codec/gsm.h> #include <pjmedia-codec/speex.h> diff --git a/pjmedia/include/pjmedia-codec/config.h b/pjmedia/include/pjmedia-codec/config.h index a9cdbfaf..2006528d 100644 --- a/pjmedia/include/pjmedia-codec/config.h +++ b/pjmedia/include/pjmedia-codec/config.h @@ -23,6 +23,14 @@ /** + * Unless specified otherwise, L16 codec is included by default. + */ +#ifndef PJMEDIA_HAS_L16_CODEC +# define PJMEDIA_HAS_L16_CODEC 1 +#endif + + +/** * Unless specified otherwise, GSM codec is included by default. */ #ifndef PJMEDIA_HAS_GSM_CODEC diff --git a/pjmedia/include/pjmedia-codec/l16.h b/pjmedia/include/pjmedia-codec/l16.h new file mode 100644 index 00000000..be2bf26a --- /dev/null +++ b/pjmedia/include/pjmedia-codec/l16.h @@ -0,0 +1,53 @@ +/* $Id$ */ +/* + * Copyright (C)2003-2006 Benny Prijono <benny@prijono.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PJMEDIA_CODEC_L16_H__ +#define __PJMEDIA_CODEC_L16_H__ + +#include <pjmedia-codec/types.h> + + +PJ_BEGIN_DECL + + +/** + * Initialize and register L16 codec factory to pjmedia endpoint. + * + * @param endpt The pjmedia endpoint. + * @param options Must be zero for now. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_codec_l16_init( pjmedia_endpt *endpt, + unsigned options); + + + +/** + * Unregister L16 codec factory from pjmedia endpoint. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_codec_l16_deinit(void); + + +PJ_END_DECL + + +#endif /* __PJMEDIA_CODEC_L16_H__ */ + diff --git a/pjmedia/include/pjmedia-codec/types.h b/pjmedia/include/pjmedia-codec/types.h index af847543..c115a830 100644 --- a/pjmedia/include/pjmedia-codec/types.h +++ b/pjmedia/include/pjmedia-codec/types.h @@ -22,4 +22,35 @@ #include <pjmedia-codec/config.h> +/** + * These are the dynamic payload types that are used by codecs in + * this library. Also see the header file <pjmedia/codec.h> for list + * of static payload types. + */ +enum +{ + /* Telephone events must have pt=101, or otherwise some code needs + * to be updated (this would not affect outgoing pt). + */ + PJMEDIA_RTP_PT_TELEPHONE_EVENTS = 101, /**< telephone-events */ + + PJMEDIA_RTP_PT_SPEEX_NB, /**< Speex narrowband/8KHz */ + PJMEDIA_RTP_PT_SPEEX_WB, /**< Speex wideband/16KHz */ + PJMEDIA_RTP_PT_SPEEX_UWB, /**< Speex 32KHz */ + PJMEDIA_RTP_PT_L16_8KHZ_MONO, /**< L16 @ 8KHz, mono */ + PJMEDIA_RTP_PT_L16_8KHZ_STEREO, /**< L16 @ 8KHz, stereo */ + PJMEDIA_RTP_PT_L16_11KHZ_MONO, /**< L16 @ 11KHz, mono */ + PJMEDIA_RTP_PT_L16_11KHZ_STEREO, /**< L16 @ 11KHz, stereo */ + PJMEDIA_RTP_PT_L16_16KHZ_MONO, /**< L16 @ 16KHz, mono */ + PJMEDIA_RTP_PT_L16_16KHZ_STEREO, /**< L16 @ 16KHz, stereo */ + PJMEDIA_RTP_PT_L16_22KHZ_MONO, /**< L16 @ 22KHz, mono */ + PJMEDIA_RTP_PT_L16_22KHZ_STEREO, /**< L16 @ 22KHz, stereo */ + PJMEDIA_RTP_PT_L16_32KHZ_MONO, /**< L16 @ 32KHz, mono */ + PJMEDIA_RTP_PT_L16_32KHZ_STEREO, /**< L16 @ 32KHz, stereo */ + PJMEDIA_RTP_PT_L16_48KHZ_MONO, /**< L16 @ 48KHz, mono */ + PJMEDIA_RTP_PT_L16_48KHZ_STEREO, /**< L16 @ 48KHz, stereo */ +}; + + + #endif /* __PJMEDIA_CODEC_TYPES_H__ */ diff --git a/pjmedia/include/pjmedia.h b/pjmedia/include/pjmedia.h index f65b2da9..d0728ff5 100644 --- a/pjmedia/include/pjmedia.h +++ b/pjmedia/include/pjmedia.h @@ -30,7 +30,6 @@ #include <pjmedia/conference.h> #include <pjmedia/endpoint.h> #include <pjmedia/errno.h> -#include <pjmedia/file_port.h> #include <pjmedia/g711.h> #include <pjmedia/jbuf.h> #include <pjmedia/master_port.h> @@ -45,6 +44,7 @@ #include <pjmedia/session.h> #include <pjmedia/sound.h> #include <pjmedia/sound_port.h> +#include <pjmedia/wav_port.h> #include <pjmedia/wave.h> #endif /* __PJMEDIA_H__ */ diff --git a/pjmedia/include/pjmedia/codec.h b/pjmedia/include/pjmedia/codec.h index bab0018c..fbef4175 100644 --- a/pjmedia/include/pjmedia/codec.h +++ b/pjmedia/include/pjmedia/codec.h @@ -48,6 +48,8 @@ PJ_BEGIN_DECL /** * Standard RTP static payload types, as defined by RFC 3551. + * The header file <pjmedia-codec/types.h> also declares dynamic payload + * types that are supported by pjmedia-codec library. */ enum pjmedia_rtp_pt { @@ -91,33 +93,52 @@ struct pjmedia_codec_info pjmedia_type type; /**< Media type. */ unsigned pt; /**< Payload type (can be dynamic). */ pj_str_t encoding_name; /**< Encoding name. */ - unsigned sample_rate; /**< Sampling rate. */ + unsigned clock_rate; /**< Sampling rate. */ + unsigned channel_cnt; /**< Channel count. */ }; +/** + * @see pjmedia_codec_info + */ +typedef struct pjmedia_codec_info pjmedia_codec_info; + + /** * Detailed codec attributes used both to configure a codec and to query * the capability of codec factories. */ struct pjmedia_codec_param { - pj_uint32_t sample_rate; /**< Sampling rate in Hz */ + unsigned clock_rate; /**< Sampling rate in Hz */ + unsigned channel_cnt; /**< Channel count. */ pj_uint32_t avg_bps; /**< Average bandwidth in bits/sec */ - pj_uint8_t pcm_bits_per_sample;/**< Bits/sample in the PCM side */ pj_uint16_t ptime; /**< Packet time in miliseconds */ + pj_uint8_t pcm_bits_per_sample;/**< Bits/sample in the PCM side */ unsigned pt:8; /**< Payload type. */ - unsigned vad_enabled:1; /**< Voice Activity Detector. */ - unsigned cng_enabled:1; /**< Comfort Noise Generator. */ - unsigned lpf_enabled:1; /**< Low pass filter */ - unsigned hpf_enabled:1; /**< High pass filter */ - unsigned penh_enabled:1; /**< Perceptual Enhancement */ - unsigned concl_enabled:1; /**< Packet loss concealment */ - unsigned reserved_bit:1; /**< Reserved, must be NULL. */ + unsigned vad:1; /**< Voice Activity Detector. */ + unsigned cng:1; /**< Comfort Noise Generator. */ + unsigned lpf:1; /**< Low pass filter */ + unsigned hpf:1; /**< High pass filter */ + unsigned penh:1; /**< Perceptual Enhancement */ + unsigned concl:1; /**< Packet loss concealment */ + unsigned reserved:1; /**< Reserved, must be NULL. */ }; +/** + * @see pjmedia_codec_param + */ +typedef struct pjmedia_codec_param pjmedia_codec_param; + + +/** + * @see pjmedia_codec + */ +typedef struct pjmedia_codec pjmedia_codec; + /** * This structure describes codec operations. Each codec MUST implement @@ -126,17 +147,6 @@ struct pjmedia_codec_param struct pjmedia_codec_op { /** - * Get default attributes for this codec. - * - * @param codec The codec instance. - * @param attr Pointer to receive default codec attributes. - * - * @return PJ_SUCCESS on success. - */ - pj_status_t (*default_attr)(pjmedia_codec *codec, - pjmedia_codec_param *attr); - - /** * Initialize codec using the specified attribute. * * @param codec The codec instance. @@ -225,6 +235,18 @@ struct pjmedia_codec_op /** + * Codec operation. + */ +typedef struct pjmedia_codec_op pjmedia_codec_op; + + +/** + * @see pjmedia_codec_factory + */ +typedef struct pjmedia_codec_factory pjmedia_codec_factory; + + +/** * This structure describes a codec instance. */ struct pjmedia_codec @@ -233,16 +255,17 @@ struct pjmedia_codec PJ_DECL_LIST_MEMBER(struct pjmedia_codec); /** Codec's private data. */ - void *codec_data; + void *codec_data; /** Codec factory where this codec was allocated. */ - pjmedia_codec_factory *factory; + pjmedia_codec_factory *factory; /** Operations to codec. */ - pjmedia_codec_op *op; + pjmedia_codec_op *op; }; + /** * This structure describes operations that must be supported by codec * factories. @@ -273,8 +296,8 @@ struct pjmedia_codec_factory_op * @return PJ_SUCCESS if success. */ pj_status_t (*default_attr)(pjmedia_codec_factory *factory, - const pjmedia_codec_info *info, - pjmedia_codec_param *attr ); + const pjmedia_codec_info *info, + pjmedia_codec_param *attr ); /** * Enumerate supported codecs that can be created using this factory. @@ -322,6 +345,12 @@ struct pjmedia_codec_factory_op /** + * @see pjmedia_codec_factory_op + */ +typedef struct pjmedia_codec_factory_op pjmedia_codec_factory_op; + + +/** * Codec factory describes a module that is able to create codec with specific * capabilities. These capabilities can be queried by codec manager to create * instances of codec. @@ -339,30 +368,108 @@ struct pjmedia_codec_factory }; + /** * Declare maximum codecs */ #define PJMEDIA_CODEC_MGR_MAX_CODECS 32 + /** - * Codec manager maintains codec factory etc. + * Specify these values to set the codec priority, by calling + * #pjmedia_codec_mgr_set_codec_priority(). + */ +enum pjmedia_codec_priority +{ + /** + * This priority makes the codec the highest in the order. + * The last codec specified with this priority will get the + * highest place in the order, and will change the priority + * of previously highest priority codec to NEXT_HIGHER. + */ + PJMEDIA_CODEC_PRIO_HIGHEST, + + /** + * This priority will put the codec as the next codec after + * codecs with this same priority. + */ + PJMEDIA_CODEC_PRIO_NEXT_HIGHER, + + /** + * This is the initial codec priority when it is registered to + * codec manager by codec factory. + */ + PJMEDIA_CODEC_PRIO_NORMAL, + + /** + * This priority makes the codec the lowest in the order. + * The last codec specified with this priority will be put + * in the last place in the order. + */ + PJMEDIA_CODEC_PRIO_LOWEST, + + /** + * This priority will prevent the codec from being listed in the + * SDP created by media endpoint, thus should prevent the codec + * from being used in the sessions. However, the codec will still + * be listed by #pjmedia_codec_mgr_enum_codecs() and other codec + * query functions. + */ + PJMEDIA_CODEC_PRIO_DISABLED, +}; + + +/** + * @see pjmedia_codec_priority + */ +typedef enum pjmedia_codec_priority pjmedia_codec_priority; + + +/** Fully qualified codec name (e.g. "pcmu/8000/1") */ +typedef char pjmedia_codec_id[32]; + + +/** + * Codec manager maintains array of these structs for each supported + * codec. + */ +struct pjmedia_codec_desc +{ + pjmedia_codec_info info; /**< Codec info. */ + pjmedia_codec_id id; /**< Fully qualified name */ + pjmedia_codec_priority prio; /**< Priority. */ + pjmedia_codec_factory *factory; /**< The factory. */ +}; + + +/** + * The declaration for codec manager. Application doesn't normally need + * to see this declaration, but nevertheless this declaration is needed + * by media endpoint to instantiate the codec manager. */ struct pjmedia_codec_mgr { /** List of codec factories registered to codec manager. */ - pjmedia_codec_factory factory_list; + pjmedia_codec_factory factory_list; /** Number of supported codesc. */ - unsigned codec_cnt; + unsigned codec_cnt; - /** Array of codec info. */ - pjmedia_codec_info codecs[PJMEDIA_CODEC_MGR_MAX_CODECS]; + /** Array of codec descriptor. */ + struct pjmedia_codec_desc codec_desc[PJMEDIA_CODEC_MGR_MAX_CODECS]; }; +/** + * @see pjmedia_codec_mgr + */ +typedef struct pjmedia_codec_mgr pjmedia_codec_mgr; + + /** - * Initialize codec manager. + * Initialize codec manager. Normally this function is called by pjmedia + * endpoint's initialization code. * * @param mgr Codec manager instance. * @@ -372,9 +479,11 @@ PJ_DECL(pj_status_t) pjmedia_codec_mgr_init(pjmedia_codec_mgr *mgr); /** - * Register codec factory to codec manager. + * Register codec factory to codec manager. This will also register + * all supported codecs in the factory to the codec manager. * - * @param mgr The codec manager. + * @param mgr The codec manager instance. Application can get the + * instance by calling #pjmedia_endpt_get_codec_mgr(). * @param factory The codec factory to be registered. * * @return PJ_SUCCESS on success. @@ -384,9 +493,12 @@ pjmedia_codec_mgr_register_factory( pjmedia_codec_mgr *mgr, pjmedia_codec_factory *factory); /** - * Unregister codec factory from the codec manager. + * Unregister codec factory from the codec manager. This will also + * remove all the codecs registered by the codec factory from the + * codec manager's list of supported codecs. * - * @param mgr The codec manager. + * @param mgr The codec manager instance. Application can get the + * instance by calling #pjmedia_endpt_get_codec_mgr(). * @param factory The codec factory to be unregistered. * * @return PJ_SUCCESS on success. @@ -396,39 +508,111 @@ pjmedia_codec_mgr_unregister_factory( pjmedia_codec_mgr *mgr, pjmedia_codec_factory *factory); /** - * Enumerate all supported codec. + * Enumerate all supported codecs that have been registered to the + * codec manager by codec factories. * - * @param mgr The codec manager. + * @param mgr The codec manager instance. Application can get the + * instance by calling #pjmedia_endpt_get_codec_mgr(). * @param count On input, specifies the number of elements in * the array. On output, the value will be set to * the number of elements that have been initialized * by this function. * @param info The codec info array, which contents will be * initialized upon return. + * @param prio Optional pointer to receive array of codec priorities. * * @return PJ_SUCCESS on success. */ PJ_DECL(pj_status_t) pjmedia_codec_mgr_enum_codecs( pjmedia_codec_mgr *mgr, unsigned *count, - pjmedia_codec_info info[]); + pjmedia_codec_info info[], + unsigned *prio); /** - * Get codec info for the specified static payload type. + * Get codec info for the specified static payload type. Note that + * this can only find codec with static payload types. This function can + * be used to find codec info for a payload type inside SDP which doesn't + * have the corresponding rtpmap attribute. * - * @param mgr The codec manager. + * @param mgr The codec manager instance. Application can get the + * instance by calling #pjmedia_endpt_get_codec_mgr(). * @param pt Static payload type/number. * @param inf Pointer to receive codec info. * * @return PJ_SUCCESS on success. */ -PJ_DECL(pj_status_t) pjmedia_codec_mgr_get_codec_info(pjmedia_codec_mgr *mgr, - unsigned pt, - pjmedia_codec_info *inf); +PJ_DECL(pj_status_t) +pjmedia_codec_mgr_get_codec_info( pjmedia_codec_mgr *mgr, + unsigned pt, + const pjmedia_codec_info **inf); + +/** + * Convert codec info struct into a unique codec identifier. + * A codec identifier looks something like "L16/44100/2". + * + * @param info The codec info + * @param id Buffer to put the codec info string. + * @param max_len The length of the buffer. + * + * @return The null terminated codec info string, or NULL if + * the buffer is not long enough. + */ +PJ_DECL(char*) pjmedia_codec_info_to_id(const pjmedia_codec_info *info, + char *id, unsigned max_len ); + + +/** + * Find codecs by the unique codec identifier. This function will find + * all codecs that match the codec identifier prefix. For example, if + * "L16" is specified, then it will find "L16/8000/1", "L16/16000/1", + * and so on, up to the maximum count specified in the argument. + * + * @param mgr The codec manager instance. Application can get the + * instance by calling #pjmedia_endpt_get_codec_mgr(). + * @param codec_id The full codec ID or codec ID prefix. If an empty + * string is given, it will match all codecs. + * @param count Maximum number of codecs to find. On return, it + * contains the actual number of codecs found. + * @param p_info Array of pointer to codec info to be filled. This + * argument may be NULL, which in this case, only + * codec count will be returned. + * @param prio Optional array of codec priorities. + * + * @return PJ_SUCCESS if at least one codec info is found. + */ +PJ_DECL(pj_status_t) +pjmedia_codec_mgr_find_codecs_by_id( pjmedia_codec_mgr *mgr, + const pj_str_t *codec_id, + unsigned *count, + const pjmedia_codec_info *p_info[], + unsigned prio[]); + + +/** + * Set codec priority. The codec priority determines the order of + * the codec in the SDP created by the endpoint. If more than one codecs + * are found with the same codec_id prefix, then the function sets the + * priorities of all those codecs. + * + * @param mgr The codec manager instance. Application can get the + * instance by calling #pjmedia_endpt_get_codec_mgr(). + * @param codec_id The full codec ID or codec ID prefix. If an empty + * string is given, it will match all codecs. + * @param prio Priority to be set. + * + * @return PJ_SUCCESS if at least one codec info is found. + */ +PJ_DECL(pj_status_t) +pjmedia_codec_mgr_set_codec_priority(pjmedia_codec_mgr *mgr, + const pj_str_t *codec_id, + pjmedia_codec_priority prio); + /** * Get default codec param for the specified codec info. * - * @param mgr The codec manager. + * @param mgr The codec manager instance. Application can get the + * instance by calling #pjmedia_endpt_get_codec_mgr(). * @param info The codec info, which default parameter's is being * queried. * @param param On return, will be filled with the default codec @@ -436,30 +620,34 @@ PJ_DECL(pj_status_t) pjmedia_codec_mgr_get_codec_info(pjmedia_codec_mgr *mgr, * * @return PJ_SUCCESS on success. */ -PJ_DECL(pj_status_t) pjmedia_codec_mgr_get_default_param(pjmedia_codec_mgr *mgr, - const pjmedia_codec_info *info, - pjmedia_codec_param *param ); +PJ_DECL(pj_status_t) +pjmedia_codec_mgr_get_default_param( pjmedia_codec_mgr *mgr, + const pjmedia_codec_info *info, + pjmedia_codec_param *param ); /** * Request the codec manager to allocate one instance of codec with the * specified codec info. The codec will enumerate all codec factories * until it finds factory that is able to create the specified codec. * - * @param mgr The codec manager. + * @param mgr The codec manager instance. Application can get the + * instance by calling #pjmedia_endpt_get_codec_mgr(). * @param info The information about the codec to be created. * @param p_codec Pointer to receive the codec instance. * * @return PJ_SUCCESS on success. */ -PJ_DECL(pj_status_t) pjmedia_codec_mgr_alloc_codec(pjmedia_codec_mgr *mgr, - const pjmedia_codec_info *info, - pjmedia_codec **p_codec); +PJ_DECL(pj_status_t) +pjmedia_codec_mgr_alloc_codec( pjmedia_codec_mgr *mgr, + const pjmedia_codec_info *info, + pjmedia_codec **p_codec); /** * Deallocate the specified codec instance. The codec manager will return * the instance of the codec back to its factory. * - * @param mgr The codec manager. + * @param mgr The codec manager instance. Application can get the + * instance by calling #pjmedia_endpt_get_codec_mgr(). * @param codec The codec instance. * * @return PJ_SUCESS on success. @@ -467,6 +655,10 @@ PJ_DECL(pj_status_t) pjmedia_codec_mgr_alloc_codec(pjmedia_codec_mgr *mgr, PJ_DECL(pj_status_t) pjmedia_codec_mgr_dealloc_codec(pjmedia_codec_mgr *mgr, pjmedia_codec *codec); + + + + /** * @} */ diff --git a/pjmedia/include/pjmedia/endpoint.h b/pjmedia/include/pjmedia/endpoint.h index d4dca351..f90915fa 100644 --- a/pjmedia/include/pjmedia/endpoint.h +++ b/pjmedia/include/pjmedia/endpoint.h @@ -39,6 +39,7 @@ #include <pjmedia/sound.h> #include <pjmedia/codec.h> +#include <pjmedia/sdp.h> PJ_BEGIN_DECL diff --git a/pjmedia/include/pjmedia/port.h b/pjmedia/include/pjmedia/port.h index 196e7139..fbc58552 100644 --- a/pjmedia/include/pjmedia/port.h +++ b/pjmedia/include/pjmedia/port.h @@ -77,7 +77,7 @@ struct pjmedia_port_info pj_bool_t need_info; /**< Need info on connect? */ unsigned pt; /**< Payload type (can be dynamic). */ pj_str_t encoding_name; /**< Encoding name. */ - unsigned sample_rate; /**< Sampling rate. */ + unsigned clock_rate; /**< Sampling rate. */ unsigned channel_count; /**< Number of channels. */ unsigned bits_per_sample; /**< Bits/sample */ unsigned samples_per_frame; /**< No of samples per frame. */ @@ -101,6 +101,13 @@ enum pjmedia_frame_type }; + +/** + * @see pjmedia_frame_type + */ +typedef enum pjmedia_frame_type pjmedia_frame_type; + + /** * This structure describes a media frame. */ @@ -112,6 +119,13 @@ struct pjmedia_frame pj_timestamp timestamp; /**< Frame timestamp. */ }; + +/** + * @see pjmedia_frame + */ +typedef struct pjmedia_frame pjmedia_frame; + + /** * For future graph. */ diff --git a/pjmedia/include/pjmedia/sdp.h b/pjmedia/include/pjmedia/sdp.h index 9aaefc6e..d144885a 100644 --- a/pjmedia/include/pjmedia/sdp.h +++ b/pjmedia/include/pjmedia/sdp.h @@ -78,6 +78,11 @@ struct pjmedia_sdp_attr pj_str_t value; /**< Attribute value. */ }; +/** + * @see pjmedia_sdp_attr + */ +typedef struct pjmedia_sdp_attr pjmedia_sdp_attr; + /** * Create SDP attribute. @@ -202,6 +207,11 @@ struct pjmedia_sdp_rtpmap pj_str_t param; /**< Parameter. */ }; +/** + * @see pjmedia_sdp_rtpmap + */ +typedef struct pjmedia_sdp_rtpmap pjmedia_sdp_rtpmap; + /** * Convert generic attribute to SDP \a rtpmap. This function allocates @@ -264,6 +274,13 @@ struct pjmedia_sdp_fmtp /** + * @see pjmedia_sdp_fmtp + */ +typedef struct pjmedia_sdp_fmtp pjmedia_sdp_fmtp; + + + +/** * Get the fmtp representation of the same SDP attribute. * * @param attr Generic attribute to be converted to fmtp, which @@ -292,6 +309,12 @@ struct pjmedia_sdp_conn }; +/** + * @see pjmedia_sdp_conn + */ +typedef struct pjmedia_sdp_conn pjmedia_sdp_conn; + + /** * Clone connection info. * @@ -335,6 +358,12 @@ struct pjmedia_sdp_media }; +/** + * @see pjmedia_sdp_media + */ +typedef struct pjmedia_sdp_media pjmedia_sdp_media; + + /** * Clone SDP media description. * @@ -481,6 +510,12 @@ struct pjmedia_sdp_session }; +/** + * @see pjmedia_sdp_session + */ +typedef struct pjmedia_sdp_session pjmedia_sdp_session; + + /** * Parse SDP message. diff --git a/pjmedia/include/pjmedia/sdp_neg.h b/pjmedia/include/pjmedia/sdp_neg.h index c3cb14e7..55c74401 100644 --- a/pjmedia/include/pjmedia/sdp_neg.h +++ b/pjmedia/include/pjmedia/sdp_neg.h @@ -233,7 +233,7 @@ * */ -#include <pjmedia/types.h> +#include <pjmedia/sdp.h> PJ_BEGIN_DECL @@ -276,6 +276,18 @@ enum pjmedia_sdp_neg_state /** + * @see pjmedia_sdp_neg_state + */ +typedef enum pjmedia_sdp_neg_state pjmedia_sdp_neg_state; + + +/** + * Opaque declaration of SDP negotiator. + */ +typedef struct pjmedia_sdp_neg pjmedia_sdp_neg; + + +/** * Get the state string description of the specified state. * * @param state Negotiator state. diff --git a/pjmedia/include/pjmedia/types.h b/pjmedia/include/pjmedia/types.h index 8166b7cb..297e2f8f 100644 --- a/pjmedia/include/pjmedia/types.h +++ b/pjmedia/include/pjmedia/types.h @@ -43,6 +43,12 @@ enum pjmedia_type }; +/** + * @see pjmedia_type + */ +typedef enum pjmedia_type pjmedia_type; + + /** * Media direction. @@ -63,6 +69,12 @@ enum pjmedia_dir }; +/** + * @see pjmedia_dir + */ +typedef enum pjmedia_dir pjmedia_dir; + + /* Alternate names for media direction: */ /** @@ -81,61 +93,6 @@ enum pjmedia_dir #define PJMEDIA_DIR_CAPTURE_PLAYBACK PJMEDIA_DIR_ENCODING_DECODING -/** - * Top level media type. - */ -typedef enum pjmedia_type pjmedia_type; - -/** - * Media direction. - */ -typedef enum pjmedia_dir pjmedia_dir; - -/** - * Codec info. - */ -typedef struct pjmedia_codec_info pjmedia_codec_info; - -/** - * Codec initialization parameter. - */ -typedef struct pjmedia_codec_param pjmedia_codec_param; - -/** - * Types of media frames. - */ -typedef enum pjmedia_frame_type pjmedia_frame_type; - -/** - * This structure describes a media frame. - */ -typedef struct pjmedia_frame pjmedia_frame; - -/** - * Codec instance. - */ -typedef struct pjmedia_codec pjmedia_codec; - -/** - * Codec factory. - */ -typedef struct pjmedia_codec_factory pjmedia_codec_factory; - -/** - * Codec operation. - */ -typedef struct pjmedia_codec_op pjmedia_codec_op; - -/** - * Codec factory operation. - */ -typedef struct pjmedia_codec_factory_op pjmedia_codec_factory_op; - -/** - * Codec manager. - */ -typedef struct pjmedia_codec_mgr pjmedia_codec_mgr; - /** * Opague declaration of media endpoint. */ @@ -187,46 +144,6 @@ typedef struct pjmedia_session pjmedia_session; typedef struct pjmedia_session_info pjmedia_session_info; /** - * Forward declaration for SDP attribute (sdp.h) - */ -typedef struct pjmedia_sdp_attr pjmedia_sdp_attr; - -/** - * Forward declaration for SDP rtpmap attribute (sdp.h) - */ -typedef struct pjmedia_sdp_rtpmap pjmedia_sdp_rtpmap; - -/** - * Forward declaration for SDP fmtp attribute (sdp.h) - */ -typedef struct pjmedia_sdp_fmtp pjmedia_sdp_fmtp; - -/** - * Forward declaration for SDP connection info (sdp.h) - */ -typedef struct pjmedia_sdp_conn pjmedia_sdp_conn; - -/** - * Forward declaration for SDP media line (sdp.h) - */ -typedef struct pjmedia_sdp_media pjmedia_sdp_media; - -/** - * Forward declaration for SDP session (sdp.h) - */ -typedef struct pjmedia_sdp_session pjmedia_sdp_session; - -/** - * Forward declaration for SDP negotiator state (sdp_neg.h). - */ -typedef enum pjmedia_sdp_neg_state pjmedia_sdp_neg_state; - -/** - * Forward declaration for SDP negotiator (sdp_neg.h). - */ -typedef struct pjmedia_sdp_neg pjmedia_sdp_neg; - -/** * Types of frame returned from jitter buffer (jbuf.h). */ typedef enum pjmedia_jb_frame_type pjmedia_jb_frame_type; diff --git a/pjmedia/include/pjmedia/file_port.h b/pjmedia/include/pjmedia/wav_port.h index 363f94e0..5f6a015a 100644 --- a/pjmedia/include/pjmedia/file_port.h +++ b/pjmedia/include/pjmedia/wav_port.h @@ -16,12 +16,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __PJMEDIA_FILE_PORT_H__ -#define __PJMEDIA_FILE_PORT_H__ +#ifndef __PJMEDIA_WAV_PORT_H__ +#define __PJMEDIA_WAV_PORT_H__ /** - * @file file_port.h - * @brief File player and recorder. + * @file wav_port.h + * @brief WAV file player and writer. */ #include <pjmedia/port.h> @@ -35,6 +35,9 @@ PJ_BEGIN_DECL * * @param pool Pool to create memory buffers for this port. * @param filename File name to open. + * @param ptime The duration (in miliseconds) of each frame read + * from this port. If the value is zero, the default + * duration (20ms) will be used. * @param flags Port creation flags. * @param buf_size Buffer size to be allocated. If the value is zero or * negative, the port will use default buffer size (which @@ -44,13 +47,13 @@ PJ_BEGIN_DECL * * @return PJ_SUCCESS on success. */ -PJ_DECL(pj_status_t) pjmedia_file_player_port_create( pj_pool_t *pool, - const char *filename, - unsigned flags, - pj_ssize_t buff_size, - void *user_data, - pjmedia_port **p_port ); - +PJ_DECL(pj_status_t) pjmedia_wav_player_port_create( pj_pool_t *pool, + const char *filename, + unsigned ptime, + unsigned flags, + pj_ssize_t buff_size, + void *user_data, + pjmedia_port **p_port ); /** @@ -69,7 +72,7 @@ PJ_DECL(pj_status_t) pjmedia_file_player_port_create( pj_pool_t *pool, * * @return PJ_SUCCESS on success. */ -PJ_DECL(pj_status_t) pjmedia_file_writer_port_create( pj_pool_t *pool, +PJ_DECL(pj_status_t) pjmedia_wav_writer_port_create( pj_pool_t *pool, const char *filename, unsigned sampling_rate, unsigned channel_count, @@ -86,4 +89,4 @@ PJ_DECL(pj_status_t) pjmedia_file_writer_port_create( pj_pool_t *pool, PJ_END_DECL -#endif /* __PJMEDIA_FILE_PORT_H__ */ +#endif /* __PJMEDIA_WAV_PORT_H__ */ |