| clock.h | | clock.h | |
|
| /* $Id: clock.h 3553 2011-05-05 06:14:19Z nanang $ */ | | /* $Id: clock.h 3664 2011-07-19 03:42:28Z nanang $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 81 | |
| * (the default behavior) or <b>synchronously</b>. When it is run | | * (the default behavior) or <b>synchronously</b>. When it is run | |
| * asynchronously, it will call the application's callback every time | | * asynchronously, it will call the application's callback every time | |
| * the clock <b>tick</b> expires. When it is run synchronously, | | * the clock <b>tick</b> expires. When it is run synchronously, | |
| * application must continuously polls the clock generator to synchronize | | * application must continuously polls the clock generator to synchronize | |
| * the timing. | | * the timing. | |
| */ | | */ | |
| | | | |
| PJ_BEGIN_DECL | | PJ_BEGIN_DECL | |
| | | | |
| /** | | /** | |
|
| | | * Media clock source. | |
| | | */ | |
| | | typedef struct pjmedia_clock_src | |
| | | { | |
| | | pjmedia_type media_type; /**< Media type. */ | |
| | | unsigned clock_rate; /**< Clock rate. */ | |
| | | unsigned ptime_usec; /**< Frame interval (in usec). */ | |
| | | /** | |
| | | * The timestamp field holds an increasing value in samples and its | |
| | | * value is expected to be increased by clock_rate samples per second. | |
| | | */ | |
| | | pj_timestamp timestamp; | |
| | | /** | |
| | | * Timestamp's last update. The last_update field contains a value in | |
| | | * ticks, and it is expected to be increased by pj_get_timestamp_freq() | |
| | | * ticks per second. | |
| | | */ | |
| | | pj_timestamp last_update; | |
| | | } pjmedia_clock_src; | |
| | | | |
| | | /** | |
| | | * This is an auxiliary function to initialize the media clock source. | |
| | | * | |
| | | * @param clocksrc The clock source to be initialized. | |
| | | * @param media_type The media type. | |
| | | * @param clock_rate The clock rate. | |
| | | * @param ptime_usec Media frame interval (in usec). | |
| | | * | |
| | | * @return PJ_SUCCESS on success. | |
| | | */ | |
| | | PJ_DECL(pj_status_t) pjmedia_clock_src_init( pjmedia_clock_src *clocksrc, | |
| | | pjmedia_type media_type, | |
| | | unsigned clock_rate, | |
| | | unsigned ptime_usec ); | |
| | | | |
| | | /** | |
| | | * This function updates the clock source's timestamp. Application should | |
| | | * use this function instead of updating the timestamp directly since this | |
| | | * function will also update the last_update field of the clock source. | |
| | | * | |
| | | * @param clocksrc The clock source to be updated. | |
| | | * @param timestamp The new timestamp, can be NULL if the current | |
| | | * timestamp does not change (in this case it | |
| | | * will only update the last_update field). | |
| | | * | |
| | | * @return PJ_SUCCESS on success. | |
| | | */ | |
| | | PJ_DECL(pj_status_t) pjmedia_clock_src_update( pjmedia_clock_src *clocksrc, | |
| | | const pj_timestamp *timestam | |
| | | p ); | |
| | | | |
| | | /** | |
| | | * This function gets the clock source's current timestamp. Application | |
| | | * should use this function instead of accessing the timestamp directly | |
| | | * since this function will calculate the predicted timestamp for current | |
| | | * time, based on the values of timestamp, last_update, and clock_rate. | |
| | | * | |
| | | * @param clocksrc The clock source. | |
| | | * @param timestamp Argument to receive the current timestamp | |
| | | * | |
| | | * @return PJ_SUCCESS on success. | |
| | | */ | |
| | | PJ_DECL(pj_status_t) | |
| | | pjmedia_clock_src_get_current_timestamp( const pjmedia_clock_src *clocksrc, | |
| | | pj_timestamp *timestamp); | |
| | | | |
| | | /** | |
| | | * This function gets the clock source's time in msec. | |
| | | * | |
| | | * @param clocksrc The clock source. | |
| | | * | |
| | | * @return The clock source's time (in msec). | |
| | | */ | |
| | | PJ_DECL(pj_uint32_t) | |
| | | pjmedia_clock_src_get_time_msec( const pjmedia_clock_src *clocksrc ); | |
| | | | |
| | | /** | |
| * Opaque declaration for media clock. | | * Opaque declaration for media clock. | |
| */ | | */ | |
| typedef struct pjmedia_clock pjmedia_clock; | | typedef struct pjmedia_clock pjmedia_clock; | |
| | | | |
| /** | | /** | |
| * Options when creating the clock. | | * Options when creating the clock. | |
| */ | | */ | |
| enum pjmedia_clock_options | | enum pjmedia_clock_options | |
| { | | { | |
| /** | | /** | |
| | | | |
| skipping to change at line 103 | | skipping to change at line 179 | |
| * #pjmedia_clock_wait() in order to synchronize timing. | | * #pjmedia_clock_wait() in order to synchronize timing. | |
| */ | | */ | |
| PJMEDIA_CLOCK_NO_ASYNC = 1, | | PJMEDIA_CLOCK_NO_ASYNC = 1, | |
| | | | |
| /** | | /** | |
| * Prevent the clock from setting it's thread to highest priority. | | * Prevent the clock from setting it's thread to highest priority. | |
| */ | | */ | |
| PJMEDIA_CLOCK_NO_HIGHEST_PRIO = 2 | | PJMEDIA_CLOCK_NO_HIGHEST_PRIO = 2 | |
| }; | | }; | |
| | | | |
|
| | | typedef struct pjmedia_clock_param | |
| | | { | |
| | | /** | |
| | | * The frame interval, in microseconds. | |
| | | */ | |
| | | unsigned usec_interval; | |
| | | /** | |
| | | * The media clock rate, to determine timestamp | |
| | | * increment for each call. | |
| | | */ | |
| | | unsigned clock_rate; | |
| | | } pjmedia_clock_param; | |
| | | | |
| /** | | /** | |
| * Type of media clock callback. | | * Type of media clock callback. | |
| * | | * | |
| * @param ts Current timestamp, in samples. | | * @param ts Current timestamp, in samples. | |
| * @param user_data Application data that is passed when | | * @param user_data Application data that is passed when | |
| * the clock was created. | | * the clock was created. | |
| */ | | */ | |
| typedef void pjmedia_clock_callback(const pj_timestamp *ts, | | typedef void pjmedia_clock_callback(const pj_timestamp *ts, | |
| void *user_data); | | void *user_data); | |
| | | | |
| /** | | /** | |
|
| * Create media clock. | | * Create media clock. This creates a media clock object that will run | |
| | | * periodically at an interval that is calculated from the audio parameters | |
| | | . | |
| | | * Once created, application must call #pjmedia_clock_start() to actually | |
| | | * start the clock. | |
| | | * | |
| | | * @see pjmedia_clock_create2() | |
| * | | * | |
| * @param pool Pool to allocate memory. | | * @param pool Pool to allocate memory. | |
| * @param clock_rate Number of samples per second. | | * @param clock_rate Number of samples per second. | |
| * @param channel_count Number of channel. | | * @param channel_count Number of channel. | |
| * @param samples_per_frame Number of samples per frame. This argument | | * @param samples_per_frame Number of samples per frame. This argument | |
| * along with clock_rate and channel_count, specifi
es | | * along with clock_rate and channel_count, specifi
es | |
| * the interval of each clock run (or clock ticks). | | * the interval of each clock run (or clock ticks). | |
| * @param options Bitmask of pjmedia_clock_options. | | * @param options Bitmask of pjmedia_clock_options. | |
| * @param cb Callback to be called for each clock tick. | | * @param cb Callback to be called for each clock tick. | |
| * @param user_data User data, which will be passed to the callback. | | * @param user_data User data, which will be passed to the callback. | |
| | | | |
| skipping to change at line 140 | | skipping to change at line 234 | |
| PJ_DECL(pj_status_t) pjmedia_clock_create( pj_pool_t *pool, | | PJ_DECL(pj_status_t) pjmedia_clock_create( pj_pool_t *pool, | |
| unsigned clock_rate, | | unsigned clock_rate, | |
| unsigned channel_count, | | unsigned channel_count, | |
| unsigned samples_per_frame, | | unsigned samples_per_frame, | |
| unsigned options, | | unsigned options, | |
| pjmedia_clock_callback *cb, | | pjmedia_clock_callback *cb, | |
| void *user_data, | | void *user_data, | |
| pjmedia_clock **p_clock); | | pjmedia_clock **p_clock); | |
| | | | |
| /** | | /** | |
|
| | | * Create media clock. This creates a media clock object that will run | |
| | | * periodically at the specified interval. Once created, application must | |
| | | * call #pjmedia_clock_start() to actually start the clock. | |
| | | * | |
| | | * @param pool Pool to allocate memory. | |
| | | * @param param The clock parameter. | |
| | | * @param options Bitmask of pjmedia_clock_options. | |
| | | * @param cb Callback to be called for each clock tick. | |
| | | * @param user_data User data, which will be passed to the callback. | |
| | | * @param p_clock Pointer to receive the clock instance. | |
| | | * | |
| | | * @return PJ_SUCCESS on success, or the appropriate error | |
| | | * code. | |
| | | */ | |
| | | PJ_DECL(pj_status_t) pjmedia_clock_create2(pj_pool_t *pool, | |
| | | const pjmedia_clock_param *param | |
| | | , | |
| | | unsigned options, | |
| | | pjmedia_clock_callback *cb, | |
| | | void *user_data, | |
| | | pjmedia_clock **p_clock); | |
| | | | |
| | | /** | |
| * Start the clock. For clock created with asynchronous flag set to TRUE, | | * Start the clock. For clock created with asynchronous flag set to TRUE, | |
| * this may start a worker thread for the clock (depending on the | | * this may start a worker thread for the clock (depending on the | |
| * backend clock implementation being used). | | * backend clock implementation being used). | |
| * | | * | |
| * @param clock The media clock. | | * @param clock The media clock. | |
| * | | * | |
| * @return PJ_SUCCES on success. | | * @return PJ_SUCCES on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_clock_start(pjmedia_clock *clock); | | PJ_DECL(pj_status_t) pjmedia_clock_start(pjmedia_clock *clock); | |
| | | | |
| /** | | /** | |
| * Stop the clock. | | * Stop the clock. | |
| * | | * | |
| * @param clock The media clock. | | * @param clock The media clock. | |
| * | | * | |
| * @return PJ_SUCCES on success. | | * @return PJ_SUCCES on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_clock_stop(pjmedia_clock *clock); | | PJ_DECL(pj_status_t) pjmedia_clock_stop(pjmedia_clock *clock); | |
| | | | |
| /** | | /** | |
|
| | | * Modify the clock's parameter. | |
| | | * | |
| | | * @param clock The media clock. | |
| | | * @param param The clock's new parameter. | |
| | | * @return PJ_SUCCES on success. | |
| | | */ | |
| | | PJ_DECL(pj_status_t) pjmedia_clock_modify(pjmedia_clock *clock, | |
| | | const pjmedia_clock_param *param) | |
| | | ; | |
| | | | |
| | | /** | |
| * Poll the media clock, and execute the callback when the clock tick has | | * Poll the media clock, and execute the callback when the clock tick has | |
| * elapsed. This operation is only valid if the clock is created with async | | * elapsed. This operation is only valid if the clock is created with async | |
| * flag set to FALSE. | | * flag set to FALSE. | |
| * | | * | |
| * @param clock The media clock. | | * @param clock The media clock. | |
| * @param wait If non-zero, then the function will block until | | * @param wait If non-zero, then the function will block until | |
| * a clock tick elapsed and callback has been calle
d. | | * a clock tick elapsed and callback has been calle
d. | |
| * @param ts Optional argument to receive the current | | * @param ts Optional argument to receive the current | |
| * timestamp. | | * timestamp. | |
| * | | * | |
| | | | |
End of changes. 6 change blocks. |
| 2 lines changed or deleted | | 132 lines changed or added | |
|
| codec.h | | codec.h | |
|
| /* $Id: codec.h 4329 2013-01-23 02:57:30Z nanang $ */ | | /* $Id: codec.h 3664 2011-07-19 03:42:28Z nanang $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| */ | | */ | |
| #ifndef __PJMEDIA_CODEC_H__ | | #ifndef __PJMEDIA_CODEC_H__ | |
| #define __PJMEDIA_CODEC_H__ | | #define __PJMEDIA_CODEC_H__ | |
| | | | |
| /** | | /** | |
| * @file codec.h | | * @file codec.h | |
| * @brief Codec framework. | | * @brief Codec framework. | |
| */ | | */ | |
| | | | |
| #include <pjmedia/port.h> | | #include <pjmedia/port.h> | |
|
| | | #include <pj/errno.h> | |
| #include <pj/list.h> | | #include <pj/list.h> | |
| #include <pj/pool.h> | | #include <pj/pool.h> | |
| | | | |
| PJ_BEGIN_DECL | | PJ_BEGIN_DECL | |
| | | | |
| /** | | /** | |
| * @defgroup PJMEDIA_CODEC Codec Framework | | * @defgroup PJMEDIA_CODEC Codec Framework | |
| * @brief Media codec framework and management | | * @brief Media codec framework and management | |
| * @{ | | * @{ | |
| * | | * | |
| | | | |
| skipping to change at line 239 | | skipping to change at line 240 | |
| */ | | */ | |
| typedef struct pjmedia_codec_info | | typedef struct pjmedia_codec_info | |
| { | | { | |
| pjmedia_type type; /**< Media type. */ | | pjmedia_type type; /**< Media type. */ | |
| unsigned pt; /**< Payload type (can be dynamic). */ | | unsigned pt; /**< Payload type (can be dynamic). */ | |
| pj_str_t encoding_name; /**< Encoding name. */ | | pj_str_t encoding_name; /**< Encoding name. */ | |
| unsigned clock_rate; /**< Sampling rate. */ | | unsigned clock_rate; /**< Sampling rate. */ | |
| unsigned channel_cnt; /**< Channel count. */ | | unsigned channel_cnt; /**< Channel count. */ | |
| } pjmedia_codec_info; | | } pjmedia_codec_info; | |
| | | | |
|
| #define PJMEDIA_CODEC_MAX_FMTP_CNT 8 | | | |
| | | | |
| /** | | /** | |
| * Structure of codec specific parameters which contains name=value pairs. | | * Structure of codec specific parameters which contains name=value pairs. | |
| * The codec specific parameters are to be used with SDP according to | | * The codec specific parameters are to be used with SDP according to | |
| * the standards (e.g: RFC 3555) in SDP 'a=fmtp' attribute. | | * the standards (e.g: RFC 3555) in SDP 'a=fmtp' attribute. | |
| */ | | */ | |
| typedef struct pjmedia_codec_fmtp | | typedef struct pjmedia_codec_fmtp | |
| { | | { | |
| pj_uint8_t cnt; /**< Number of parameters. */ | | pj_uint8_t cnt; /**< Number of parameters. */ | |
| struct param { | | struct param { | |
| pj_str_t name; /**< Parameter name. */ | | pj_str_t name; /**< Parameter name. */ | |
| | | | |
| skipping to change at line 307 | | skipping to change at line 306 | |
| unsigned vad:1; /**< Voice Activity Detector. */ | | unsigned vad:1; /**< Voice Activity Detector. */ | |
| unsigned cng:1; /**< Comfort Noise Generator. */ | | unsigned cng:1; /**< Comfort Noise Generator. */ | |
| unsigned penh:1; /**< Perceptual Enhancement */ | | unsigned penh:1; /**< Perceptual Enhancement */ | |
| unsigned plc:1; /**< Packet loss concealment */ | | unsigned plc:1; /**< Packet loss concealment */ | |
| unsigned reserved:1; /**< Reserved, must be zero. */ | | unsigned reserved:1; /**< Reserved, must be zero. */ | |
| pjmedia_codec_fmtp enc_fmtp;/**< Encoder's fmtp params. */ | | pjmedia_codec_fmtp enc_fmtp;/**< Encoder's fmtp params. */ | |
| pjmedia_codec_fmtp dec_fmtp;/**< Decoder's fmtp params. */ | | pjmedia_codec_fmtp dec_fmtp;/**< Decoder's fmtp params. */ | |
| } setting; | | } setting; | |
| } pjmedia_codec_param; | | } pjmedia_codec_param; | |
| | | | |
|
| /** | | | |
| * Duplicate codec parameter. | | | |
| * | | | |
| * @param pool The pool. | | | |
| * @param src The codec parameter to be duplicated. | | | |
| * | | | |
| * @return Duplicated codec parameter. | | | |
| */ | | | |
| PJ_DECL(pjmedia_codec_param*) pjmedia_codec_param_clone( | | | |
| pj_pool_t *pool, | | | |
| const pjmedia_codec_param *src); | | | |
| | | | |
| /* | | /* | |
| * Forward declaration for pjmedia_codec. | | * Forward declaration for pjmedia_codec. | |
| */ | | */ | |
| typedef struct pjmedia_codec pjmedia_codec; | | typedef struct pjmedia_codec pjmedia_codec; | |
| | | | |
| /** | | /** | |
| * This structure describes codec operations. Each codec MUST implement | | * This structure describes codec operations. Each codec MUST implement | |
| * all of these functions. | | * all of these functions. | |
| */ | | */ | |
| typedef struct pjmedia_codec_op | | typedef struct pjmedia_codec_op | |
| { | | { | |
| /** | | /** | |
| * Initialize codec using the specified attribute. | | * Initialize codec using the specified attribute. | |
| * | | * | |
|
| | | * Application should call #pjmedia_codec_init() instead of | |
| | | * calling this function directly. | |
| | | * | |
| * @param codec The codec instance. | | * @param codec The codec instance. | |
| * @param pool Pool to use when the codec needs to allocate | | * @param pool Pool to use when the codec needs to allocate | |
| * some memory. | | * some memory. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| pj_status_t (*init)(pjmedia_codec *codec, | | pj_status_t (*init)(pjmedia_codec *codec, | |
| pj_pool_t *pool ); | | pj_pool_t *pool ); | |
| | | | |
| /** | | /** | |
| * Open the codec and initialize with the specified parameter. | | * Open the codec and initialize with the specified parameter. | |
| * Upon successful initialization, the codec may modify the parameter | | * Upon successful initialization, the codec may modify the parameter | |
| * and fills in the unspecified values (such as enc_ptime, when | | * and fills in the unspecified values (such as enc_ptime, when | |
| * encoder ptime is different than decoder ptime). | | * encoder ptime is different than decoder ptime). | |
| * | | * | |
|
| | | * Application should call #pjmedia_codec_open() instead of | |
| | | * calling this function directly. | |
| | | * | |
| * @param codec The codec instance. | | * @param codec The codec instance. | |
| * @param param Codec initialization parameter. | | * @param param Codec initialization parameter. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| pj_status_t (*open)(pjmedia_codec *codec, | | pj_status_t (*open)(pjmedia_codec *codec, | |
| pjmedia_codec_param *param ); | | pjmedia_codec_param *param ); | |
| | | | |
| /** | | /** | |
| * Close and shutdown codec, releasing all resources allocated by | | * Close and shutdown codec, releasing all resources allocated by | |
| * this codec, if any. | | * this codec, if any. | |
| * | | * | |
|
| | | * Application should call #pjmedia_codec_close() instead of | |
| | | * calling this function directly. | |
| | | * | |
| * @param codec The codec instance. | | * @param codec The codec instance. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| pj_status_t (*close)(pjmedia_codec *codec); | | pj_status_t (*close)(pjmedia_codec *codec); | |
| | | | |
| /** | | /** | |
| * Modify the codec parameter after the codec is open. | | * Modify the codec parameter after the codec is open. | |
| * Note that not all codec parameters can be modified during run-time. | | * Note that not all codec parameters can be modified during run-time. | |
| * When the parameter cannot be changed, this function will return | | * When the parameter cannot be changed, this function will return | |
| * non-PJ_SUCCESS, and the original parameters will not be changed. | | * non-PJ_SUCCESS, and the original parameters will not be changed. | |
| * | | * | |
| * Application can expect changing trivial codec settings such as | | * Application can expect changing trivial codec settings such as | |
| * changing VAD setting to succeed. | | * changing VAD setting to succeed. | |
| * | | * | |
|
| | | * Application should call #pjmedia_codec_modify() instead of | |
| | | * calling this function directly. | |
| | | * | |
| * @param codec The codec instance. | | * @param codec The codec instance. | |
| * @param param The new codec parameter. | | * @param param The new codec parameter. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| pj_status_t (*modify)(pjmedia_codec *codec, | | pj_status_t (*modify)(pjmedia_codec *codec, | |
| const pjmedia_codec_param *param ); | | const pjmedia_codec_param *param ); | |
| | | | |
| /** | | /** | |
| * Instruct the codec to inspect the specified payload/packet and | | * Instruct the codec to inspect the specified payload/packet and | |
| * split the packet into individual base frames. Each output frames wil
l | | * split the packet into individual base frames. Each output frames wil
l | |
| * have ptime that is equal to basic frame ptime (i.e. the value of | | * have ptime that is equal to basic frame ptime (i.e. the value of | |
| * info.frm_ptime in #pjmedia_codec_param). | | * info.frm_ptime in #pjmedia_codec_param). | |
| * | | * | |
|
| | | * Application should call #pjmedia_codec_parse() instead of | |
| | | * calling this function directly. | |
| | | * | |
| * @param codec The codec instance | | * @param codec The codec instance | |
| * @param pkt The input packet. | | * @param pkt The input packet. | |
| * @param pkt_size Size of the packet. | | * @param pkt_size Size of the packet. | |
| * @param timestamp The timestamp of the first sample in the pac
ket. | | * @param timestamp The timestamp of the first sample in the pac
ket. | |
| * @param frame_cnt On input, specifies the maximum number of fr
ames | | * @param frame_cnt On input, specifies the maximum number of fr
ames | |
| * in the array. On output, the codec must fill | | * in the array. On output, the codec must fill | |
| * with number of frames detected in the packet. | | * with number of frames detected in the packet. | |
| * @param frames On output, specifies the frames that have been | | * @param frames On output, specifies the frames that have been | |
| * detected in the packet. | | * detected in the packet. | |
| * | | * | |
| | | | |
| skipping to change at line 413 | | skipping to change at line 415 | |
| pj_size_t pkt_size, | | pj_size_t pkt_size, | |
| const pj_timestamp *timestamp, | | const pj_timestamp *timestamp, | |
| unsigned *frame_cnt, | | unsigned *frame_cnt, | |
| pjmedia_frame frames[]); | | pjmedia_frame frames[]); | |
| | | | |
| /** | | /** | |
| * Instruct the codec to encode the specified input frame. The input | | * Instruct the codec to encode the specified input frame. The input | |
| * PCM samples MUST have ptime that is multiplication of base frame | | * PCM samples MUST have ptime that is multiplication of base frame | |
| * ptime (i.e. the value of info.frm_ptime in #pjmedia_codec_param). | | * ptime (i.e. the value of info.frm_ptime in #pjmedia_codec_param). | |
| * | | * | |
|
| | | * Application should call #pjmedia_codec_encode() instead of | |
| | | * calling this function directly. | |
| | | * | |
| * @param codec The codec instance. | | * @param codec The codec instance. | |
| * @param input The input frame. | | * @param input The input frame. | |
| * @param out_size The length of buffer in the output frame. | | * @param out_size The length of buffer in the output frame. | |
| * @param output The output frame. | | * @param output The output frame. | |
| * | | * | |
| * @return PJ_SUCCESS on success; | | * @return PJ_SUCCESS on success; | |
| */ | | */ | |
| pj_status_t (*encode)(pjmedia_codec *codec, | | pj_status_t (*encode)(pjmedia_codec *codec, | |
| const struct pjmedia_frame *input, | | const struct pjmedia_frame *input, | |
| unsigned out_size, | | unsigned out_size, | |
| struct pjmedia_frame *output); | | struct pjmedia_frame *output); | |
| | | | |
| /** | | /** | |
| * Instruct the codec to decode the specified input frame. The input | | * Instruct the codec to decode the specified input frame. The input | |
| * frame MUST have ptime that is exactly equal to base frame | | * frame MUST have ptime that is exactly equal to base frame | |
| * ptime (i.e. the value of info.frm_ptime in #pjmedia_codec_param). | | * ptime (i.e. the value of info.frm_ptime in #pjmedia_codec_param). | |
| * Application can achieve this by parsing the packet into base | | * Application can achieve this by parsing the packet into base | |
| * frames before decoding each frame. | | * frames before decoding each frame. | |
| * | | * | |
|
| | | * Application should call #pjmedia_codec_decode() instead of | |
| | | * calling this function directly. | |
| | | * | |
| * @param codec The codec instance. | | * @param codec The codec instance. | |
| * @param input The input frame. | | * @param input The input frame. | |
| * @param out_size The length of buffer in the output frame. | | * @param out_size The length of buffer in the output frame. | |
| * @param output The output frame. | | * @param output The output frame. | |
| * | | * | |
| * @return PJ_SUCCESS on success; | | * @return PJ_SUCCESS on success; | |
| */ | | */ | |
| pj_status_t (*decode)(pjmedia_codec *codec, | | pj_status_t (*decode)(pjmedia_codec *codec, | |
| const struct pjmedia_frame *input, | | const struct pjmedia_frame *input, | |
| unsigned out_size, | | unsigned out_size, | |
| struct pjmedia_frame *output); | | struct pjmedia_frame *output); | |
| | | | |
| /** | | /** | |
| * Instruct the codec to recover a missing frame. | | * Instruct the codec to recover a missing frame. | |
| * | | * | |
|
| | | * Application should call #pjmedia_codec_recover() instead of | |
| | | * calling this function directly. | |
| | | * | |
| * @param codec The codec instance. | | * @param codec The codec instance. | |
| * @param out_size The length of buffer in the output frame. | | * @param out_size The length of buffer in the output frame. | |
| * @param output The output frame where generated signal | | * @param output The output frame where generated signal | |
| * will be placed. | | * will be placed. | |
| * | | * | |
| * @return PJ_SUCCESS on success; | | * @return PJ_SUCCESS on success; | |
| */ | | */ | |
| pj_status_t (*recover)(pjmedia_codec *codec, | | pj_status_t (*recover)(pjmedia_codec *codec, | |
| unsigned out_size, | | unsigned out_size, | |
| struct pjmedia_frame *output); | | struct pjmedia_frame *output); | |
| | | | |
| skipping to change at line 557 | | skipping to change at line 568 | |
| * instance of codec back to the codec factory. | | * instance of codec back to the codec factory. | |
| * | | * | |
| * @param factory The codec factory. | | * @param factory The codec factory. | |
| * @param codec The codec instance to be returned. | | * @param codec The codec instance to be returned. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| pj_status_t (*dealloc_codec)(pjmedia_codec_factory *factory, | | pj_status_t (*dealloc_codec)(pjmedia_codec_factory *factory, | |
| pjmedia_codec *codec ); | | pjmedia_codec *codec ); | |
| | | | |
|
| | | /** | |
| | | * This callback will be called to deinitialize and destroy this factor | |
| | | y. | |
| | | */ | |
| | | pj_status_t (*destroy)(void); | |
| | | | |
| } pjmedia_codec_factory_op; | | } pjmedia_codec_factory_op; | |
| | | | |
| /** | | /** | |
| * Codec factory describes a module that is able to create codec with speci
fic | | * Codec factory describes a module that is able to create codec with speci
fic | |
| * capabilities. These capabilities can be queried by codec manager to crea
te | | * capabilities. These capabilities can be queried by codec manager to crea
te | |
| * instances of codec. | | * instances of codec. | |
| */ | | */ | |
| struct pjmedia_codec_factory | | struct pjmedia_codec_factory | |
| { | | { | |
| /** Entries to put this structure in the codec manager list. */ | | /** Entries to put this structure in the codec manager list. */ | |
| | | | |
| skipping to change at line 717 | | skipping to change at line 733 | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) | | PJ_DECL(pj_status_t) | |
| pjmedia_codec_mgr_register_factory( pjmedia_codec_mgr *mgr, | | pjmedia_codec_mgr_register_factory( pjmedia_codec_mgr *mgr, | |
| pjmedia_codec_factory *factory); | | pjmedia_codec_factory *factory); | |
| | | | |
| /** | | /** | |
| * Unregister codec factory from the codec manager. This will also | | * Unregister codec factory from the codec manager. This will also | |
| * remove all the codecs registered by the codec factory from the | | * remove all the codecs registered by the codec factory from the | |
|
| * codec manager's list of supported codecs. | | * codec manager's list of supported codecs. This function should | |
| | | * only be called by the codec implementers and not by application. | |
| * | | * | |
|
| * @param mgr The codec manager instance. Application can get the | | * @param mgr The codec manager instance, use | |
| * instance by calling #pjmedia_endpt_get_codec_mgr(). | | * #pjmedia_endpt_get_codec_mgr(). | |
| * @param factory The codec factory to be unregistered. | | * @param factory The codec factory to be unregistered. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) | | PJ_DECL(pj_status_t) | |
| pjmedia_codec_mgr_unregister_factory( pjmedia_codec_mgr *mgr, | | pjmedia_codec_mgr_unregister_factory( pjmedia_codec_mgr *mgr, | |
| pjmedia_codec_factory *factory); | | pjmedia_codec_factory *factory); | |
| | | | |
| /** | | /** | |
| * Enumerate all supported codecs that have been registered to the | | * Enumerate all supported codecs that have been registered to the | |
| | | | |
| skipping to change at line 894 | | skipping to change at line 911 | |
| * @param mgr The codec manager instance. Application can get the | | * @param mgr The codec manager instance. Application can get the | |
| * instance by calling #pjmedia_endpt_get_codec_mgr(). | | * instance by calling #pjmedia_endpt_get_codec_mgr(). | |
| * @param codec The codec instance. | | * @param codec The codec instance. | |
| * | | * | |
| * @return PJ_SUCESS on success. | | * @return PJ_SUCESS on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_codec_mgr_dealloc_codec(pjmedia_codec_mgr *mgr
, | | PJ_DECL(pj_status_t) pjmedia_codec_mgr_dealloc_codec(pjmedia_codec_mgr *mgr
, | |
| pjmedia_codec *codec); | | pjmedia_codec *codec); | |
| | | | |
| /** | | /** | |
|
| | | * Initialize codec using the specified attribute. | |
| | | * | |
| | | * @param codec The codec instance. | |
| | | * @param pool Pool to use when the codec needs to allocate some memory | |
| | | . | |
| | | * | |
| | | * @return PJ_SUCCESS on success. | |
| | | */ | |
| | | PJ_INLINE(pj_status_t) pjmedia_codec_init( pjmedia_codec *codec, | |
| | | pj_pool_t *pool ) | |
| | | { | |
| | | return (*codec->op->init)(codec, pool); | |
| | | } | |
| | | | |
| | | /** | |
| | | * Open the codec and initialize with the specified parameter. | |
| | | * Upon successful initialization, the codec may modify the parameter | |
| | | * and fills in the unspecified values (such as enc_ptime, when | |
| | | * encoder ptime is different than decoder ptime). | |
| | | * | |
| | | * @param codec The codec instance. | |
| | | * @param param Codec initialization parameter. | |
| | | * | |
| | | * @return PJ_SUCCESS on success. | |
| | | */ | |
| | | PJ_INLINE(pj_status_t) pjmedia_codec_open( pjmedia_codec *codec, | |
| | | pjmedia_codec_param *param ) | |
| | | { | |
| | | return (*codec->op->open)(codec, param); | |
| | | } | |
| | | | |
| | | /** | |
| | | * Close and shutdown codec, releasing all resources allocated by | |
| | | * this codec, if any. | |
| | | * | |
| | | * @param codec The codec instance. | |
| | | * | |
| | | * @return PJ_SUCCESS on success. | |
| | | */ | |
| | | PJ_INLINE(pj_status_t) pjmedia_codec_close( pjmedia_codec *codec ) | |
| | | { | |
| | | return (*codec->op->close)(codec); | |
| | | } | |
| | | | |
| | | /** | |
| | | * Modify the codec parameter after the codec is open. | |
| | | * Note that not all codec parameters can be modified during run-time. | |
| | | * When the parameter cannot be changed, this function will return | |
| | | * non-PJ_SUCCESS, and the original parameters will not be changed. | |
| | | * | |
| | | * Application can expect changing trivial codec settings such as | |
| | | * changing VAD setting to succeed. | |
| | | * | |
| | | * @param codec The codec instance. | |
| | | * @param param The new codec parameter. | |
| | | * | |
| | | * @return PJ_SUCCESS on success. | |
| | | */ | |
| | | PJ_INLINE(pj_status_t) pjmedia_codec_modify(pjmedia_codec *codec, | |
| | | const pjmedia_codec_param *param | |
| | | ) | |
| | | { | |
| | | return (*codec->op->modify)(codec, param); | |
| | | } | |
| | | | |
| | | /** | |
| | | * Instruct the codec to inspect the specified payload/packet and | |
| | | * split the packet into individual base frames. Each output frames will | |
| | | * have ptime that is equal to basic frame ptime (i.e. the value of | |
| | | * info.frm_ptime in #pjmedia_codec_param). | |
| | | * | |
| | | * @param codec The codec instance | |
| | | * @param pkt The input packet. | |
| | | * @param pkt_size Size of the packet. | |
| | | * @param timestamp The timestamp of the first sample in the packet. | |
| | | * @param frame_cnt On input, specifies the maximum number of frames | |
| | | * in the array. On output, the codec must fill | |
| | | * with number of frames detected in the packet. | |
| | | * @param frames On output, specifies the frames that have been | |
| | | * detected in the packet. | |
| | | * | |
| | | * @return PJ_SUCCESS on success. | |
| | | */ | |
| | | PJ_INLINE(pj_status_t) pjmedia_codec_parse( pjmedia_codec *codec, | |
| | | void *pkt, | |
| | | pj_size_t pkt_size, | |
| | | const pj_timestamp *timestamp, | |
| | | unsigned *frame_cnt, | |
| | | pjmedia_frame frames[] ) | |
| | | { | |
| | | return (*codec->op->parse)(codec, pkt, pkt_size, timestamp, | |
| | | frame_cnt, frames); | |
| | | } | |
| | | | |
| | | /** | |
| | | * Instruct the codec to encode the specified input frame. The input | |
| | | * PCM samples MUST have ptime that is multiplication of base frame | |
| | | * ptime (i.e. the value of info.frm_ptime in #pjmedia_codec_param). | |
| | | * | |
| | | * @param codec The codec instance. | |
| | | * @param input The input frame. | |
| | | * @param out_size The length of buffer in the output frame. | |
| | | * @param output The output frame. | |
| | | * | |
| | | * @return PJ_SUCCESS on success; | |
| | | */ | |
| | | PJ_INLINE(pj_status_t) pjmedia_codec_encode( | |
| | | pjmedia_codec *codec, | |
| | | const struct pjmedia_frame *input, | |
| | | unsigned out_size, | |
| | | struct pjmedia_frame *output ) | |
| | | { | |
| | | return (*codec->op->encode)(codec, input, out_size, output); | |
| | | } | |
| | | | |
| | | /** | |
| | | * Instruct the codec to decode the specified input frame. The input | |
| | | * frame MUST have ptime that is exactly equal to base frame | |
| | | * ptime (i.e. the value of info.frm_ptime in #pjmedia_codec_param). | |
| | | * Application can achieve this by parsing the packet into base | |
| | | * frames before decoding each frame. | |
| | | * | |
| | | * @param codec The codec instance. | |
| | | * @param input The input frame. | |
| | | * @param out_size The length of buffer in the output frame. | |
| | | * @param output The output frame. | |
| | | * | |
| | | * @return PJ_SUCCESS on success; | |
| | | */ | |
| | | PJ_INLINE(pj_status_t) pjmedia_codec_decode( | |
| | | pjmedia_codec *codec, | |
| | | const struct pjmedia_frame *input, | |
| | | unsigned out_size, | |
| | | struct pjmedia_frame *output ) | |
| | | { | |
| | | return (*codec->op->decode)(codec, input, out_size, output); | |
| | | } | |
| | | | |
| | | /** | |
| | | * Instruct the codec to recover a missing frame. | |
| | | * | |
| | | * @param codec The codec instance. | |
| | | * @param out_size The length of buffer in the output frame. | |
| | | * @param output The output frame where generated signal | |
| | | * will be placed. | |
| | | * | |
| | | * @return PJ_SUCCESS on success; | |
| | | */ | |
| | | PJ_INLINE(pj_status_t) pjmedia_codec_recover( pjmedia_codec *codec, | |
| | | unsigned out_size, | |
| | | struct pjmedia_frame *output ) | |
| | | { | |
| | | if (codec->op && codec->op->recover) | |
| | | return (*codec->op->recover)(codec, out_size, output); | |
| | | else | |
| | | return PJ_ENOTSUP; | |
| | | } | |
| | | | |
| | | /** | |
| * @} | | * @} | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @defgroup PJMEDIA_CODEC_CODECS Supported codecs | | * @defgroup PJMEDIA_CODEC_CODECS Supported codecs | |
| * @ingroup PJMEDIA_CODEC | | * @ingroup PJMEDIA_CODEC | |
| * @brief Documentation about individual codec supported by PJMEDIA | | * @brief Documentation about individual codec supported by PJMEDIA | |
| * @{ | | * @{ | |
| * Please see the APIs provided by the individual codecs below. | | * Please see the APIs provided by the individual codecs below. | |
| */ | | */ | |
| | | | |
End of changes. 16 change blocks. |
| 18 lines changed or deleted | | 195 lines changed or added | |
|
| config.h | | config.h | |
|
| /* $Id: config.h 4429 2013-03-07 09:35:20Z nanang $ */ | | /* $Id: config.h 4139 2012-05-22 09:52:29Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 47 | |
| #elif defined(__MWERKS__) | | #elif defined(__MWERKS__) | |
| # include <pj/compat/cc_codew.h> | | # include <pj/compat/cc_codew.h> | |
| #elif defined(__GCCE__) | | #elif defined(__GCCE__) | |
| # include <pj/compat/cc_gcce.h> | | # include <pj/compat/cc_gcce.h> | |
| #elif defined(__ARMCC__) | | #elif defined(__ARMCC__) | |
| # include <pj/compat/cc_armcc.h> | | # include <pj/compat/cc_armcc.h> | |
| #else | | #else | |
| # error "Unknown compiler." | | # error "Unknown compiler." | |
| #endif | | #endif | |
| | | | |
|
| | | /* PJ_ALIGN_DATA is compiler specific directive to align data address */ | |
| | | #ifndef PJ_ALIGN_DATA | |
| | | # error "PJ_ALIGN_DATA is not defined!" | |
| | | #endif | |
| | | | |
| /******************************************************************** | | /******************************************************************** | |
| * Include target OS specific configuration. | | * Include target OS specific configuration. | |
| */ | | */ | |
| #if defined(PJ_AUTOCONF) | | #if defined(PJ_AUTOCONF) | |
| /* | | /* | |
| * Autoconf | | * Autoconf | |
| */ | | */ | |
| # include <pj/compat/os_auto.h> | | # include <pj/compat/os_auto.h> | |
| | | | |
| #elif defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0 | | #elif defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0 | |
| | | | |
| skipping to change at line 400 | | skipping to change at line 405 | |
| * If the value is set to NO, then the buffer will be taken from static | | * If the value is set to NO, then the buffer will be taken from static | |
| * buffer, which in this case will make the log function non-reentrant. | | * buffer, which in this case will make the log function non-reentrant. | |
| * | | * | |
| * Default: 1 | | * Default: 1 | |
| */ | | */ | |
| #ifndef PJ_LOG_USE_STACK_BUFFER | | #ifndef PJ_LOG_USE_STACK_BUFFER | |
| # define PJ_LOG_USE_STACK_BUFFER 1 | | # define PJ_LOG_USE_STACK_BUFFER 1 | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
|
| | | * Enable log indentation feature. | |
| | | * | |
| | | * Default: 1 | |
| | | */ | |
| | | #ifndef PJ_LOG_ENABLE_INDENT | |
| | | # define PJ_LOG_ENABLE_INDENT 1 | |
| | | #endif | |
| | | | |
| | | /** | |
| | | * Number of PJ_LOG_INDENT_CHAR to put every time pj_log_push_indent() | |
| | | * is called. | |
| | | * | |
| | | * Default: 1 | |
| | | */ | |
| | | #ifndef PJ_LOG_INDENT_SIZE | |
| | | # define PJ_LOG_INDENT_SIZE 1 | |
| | | #endif | |
| | | | |
| | | /** | |
| | | * Log indentation character. | |
| | | * | |
| | | * Default: space | |
| | | */ | |
| | | #ifndef PJ_LOG_INDENT_CHAR | |
| | | # define PJ_LOG_INDENT_CHAR '.' | |
| | | #endif | |
| | | | |
| | | /** | |
| * Colorfull terminal (for logging etc). | | * Colorfull terminal (for logging etc). | |
| * | | * | |
| * Default: 1 | | * Default: 1 | |
| */ | | */ | |
| #ifndef PJ_TERM_HAS_COLOR | | #ifndef PJ_TERM_HAS_COLOR | |
| # define PJ_TERM_HAS_COLOR 1 | | # define PJ_TERM_HAS_COLOR 1 | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * Set this flag to non-zero to enable various checking for pool | | * Set this flag to non-zero to enable various checking for pool | |
| | | | |
| skipping to change at line 1083 | | skipping to change at line 1116 | |
| # error "PJ_THREAD_SET_STACK_SIZE should be defined in compat/os_xx.h" | | # error "PJ_THREAD_SET_STACK_SIZE should be defined in compat/os_xx.h" | |
| #endif | | #endif | |
| | | | |
| #if !defined(PJ_THREAD_ALLOCATE_STACK) | | #if !defined(PJ_THREAD_ALLOCATE_STACK) | |
| # error "PJ_THREAD_ALLOCATE_STACK should be defined in compat/os_xx.h" | | # error "PJ_THREAD_ALLOCATE_STACK should be defined in compat/os_xx.h" | |
| #endif | | #endif | |
| | | | |
| PJ_BEGIN_DECL | | PJ_BEGIN_DECL | |
| | | | |
| /** PJLIB version major number. */ | | /** PJLIB version major number. */ | |
|
| #define PJ_VERSION_NUM_MAJOR 1 | | #define PJ_VERSION_NUM_MAJOR 2 | |
| | | | |
| /** PJLIB version minor number. */ | | /** PJLIB version minor number. */ | |
|
| #define PJ_VERSION_NUM_MINOR 16 | | #define PJ_VERSION_NUM_MINOR 0 | |
| | | | |
| /** PJLIB version revision number. */ | | /** PJLIB version revision number. */ | |
| #define PJ_VERSION_NUM_REV 0 | | #define PJ_VERSION_NUM_REV 0 | |
| | | | |
| /** | | /** | |
|
| * Extra suffix for the version (e.g. "-svn"), or empty for | | * Extra suffix for the version (e.g. "-trunk"), or empty for | |
| * web release version. | | * web release version. | |
| */ | | */ | |
| #define PJ_VERSION_NUM_EXTRA "" | | #define PJ_VERSION_NUM_EXTRA "" | |
| | | | |
| /** | | /** | |
| * PJLIB version number consists of three bytes with the following format: | | * PJLIB version number consists of three bytes with the following format: | |
| * 0xMMIIRR00, where MM: major number, II: minor number, RR: revision | | * 0xMMIIRR00, where MM: major number, II: minor number, RR: revision | |
| * number, 00: always zero for now. | | * number, 00: always zero for now. | |
| */ | | */ | |
| #define PJ_VERSION_NUM ((PJ_VERSION_NUM_MAJOR << 24) | \ | | #define PJ_VERSION_NUM ((PJ_VERSION_NUM_MAJOR << 24) | \ | |
| | | | |
End of changes. 6 change blocks. |
| 4 lines changed or deleted | | 37 lines changed or added | |
|
| endpoint.h | | endpoint.h | |
|
| /* $Id: endpoint.h 3988 2012-03-28 07:32:42Z nanang $ */ | | /* $Id: endpoint.h 3999 2012-03-30 07:10:13Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 41 | | skipping to change at line 41 | |
| * The media endpoint acts as placeholder for endpoint capabilities. Each | | * The media endpoint acts as placeholder for endpoint capabilities. Each | |
| * media endpoint will have a codec manager to manage list of codecs instal
led | | * media endpoint will have a codec manager to manage list of codecs instal
led | |
| * in the endpoint and a sound device factory. | | * in the endpoint and a sound device factory. | |
| * | | * | |
| * A reference to media endpoint instance is required when application want
s | | * A reference to media endpoint instance is required when application want
s | |
| * to create a media session (#pjmedia_session_create()). | | * to create a media session (#pjmedia_session_create()). | |
| */ | | */ | |
| | | | |
| #include <pjmedia/codec.h> | | #include <pjmedia/codec.h> | |
| #include <pjmedia/sdp.h> | | #include <pjmedia/sdp.h> | |
|
| | | #include <pjmedia/transport.h> | |
| | | | |
| PJ_BEGIN_DECL | | PJ_BEGIN_DECL | |
| | | | |
| /** | | /** | |
| * This enumeration describes various flags that can be set or retrieved in | | * This enumeration describes various flags that can be set or retrieved in | |
| * the media endpoint, by using pjmedia_endpt_set_flag() and | | * the media endpoint, by using pjmedia_endpt_set_flag() and | |
| * pjmedia_endpt_get_flag() respectively. | | * pjmedia_endpt_get_flag() respectively. | |
| */ | | */ | |
| typedef enum pjmedia_endpt_flag | | typedef enum pjmedia_endpt_flag | |
| { | | { | |
| | | | |
| skipping to change at line 181 | | skipping to change at line 182 | |
| | | | |
| /** | | /** | |
| * Create a SDP session description that describes the endpoint | | * Create a SDP session description that describes the endpoint | |
| * capability. | | * capability. | |
| * | | * | |
| * @param endpt The media endpoint. | | * @param endpt The media endpoint. | |
| * @param pool Pool to use to create the SDP descriptor. | | * @param pool Pool to use to create the SDP descriptor. | |
| * @param stream_cnt Number of elements in the sock_info array. This | | * @param stream_cnt Number of elements in the sock_info array. This | |
| * also denotes the maximum number of streams (i.e. | | * also denotes the maximum number of streams (i.e. | |
| * the "m=" lines) that will be created in the SDP. | | * the "m=" lines) that will be created in the SDP. | |
|
| | | * By convention, if this value is greater than one, | |
| | | * the first media will be audio and the remaining | |
| | | * media is video. | |
| * @param sock_info Array of socket transport information. One | | * @param sock_info Array of socket transport information. One | |
| * transport is needed for each media stream, and | | * transport is needed for each media stream, and | |
| * each transport consists of an RTP and RTCP socket | | * each transport consists of an RTP and RTCP socket | |
| * pair. | | * pair. | |
| * @param p_sdp Pointer to receive SDP session descriptor. | | * @param p_sdp Pointer to receive SDP session descriptor. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_endpt_create_sdp( pjmedia_endpt *endpt, | | PJ_DECL(pj_status_t) pjmedia_endpt_create_sdp( pjmedia_endpt *endpt, | |
| pj_pool_t *pool, | | pj_pool_t *pool, | |
| unsigned stream_cnt, | | unsigned stream_cnt, | |
| const pjmedia_sock_info sock_
info[], | | const pjmedia_sock_info sock_
info[], | |
| pjmedia_sdp_session **p_sdp )
; | | pjmedia_sdp_session **p_sdp )
; | |
| | | | |
| /** | | /** | |
|
| | | * Create a "blank" SDP session description. The SDP will contain basic SDP | |
| | | * fields such as origin, time, and name, but without any media lines. | |
| | | * | |
| | | * @param endpt The media endpoint. | |
| | | * @param pool Pool to allocate memory from. | |
| | | * @param sess_name Optional SDP session name, or NULL to use default | |
| | | * value. | |
| | | * @param origin Address to put in the origin field. | |
| | | * @param p_sdp Pointer to receive the created SDP session. | |
| | | * | |
| | | * @return PJ_SUCCESS on success, or the appropriate error code | |
| | | . | |
| | | */ | |
| | | PJ_DECL(pj_status_t) pjmedia_endpt_create_base_sdp(pjmedia_endpt *endpt, | |
| | | pj_pool_t *pool, | |
| | | const pj_str_t *sess_name | |
| | | , | |
| | | const pj_sockaddr *origin | |
| | | , | |
| | | pjmedia_sdp_session **p_s | |
| | | dp); | |
| | | | |
| | | /** | |
| | | * Create SDP media line for audio media. | |
| | | * | |
| | | * @param endpt The media endpoint. | |
| | | * @param pool Pool to allocate memory from. | |
| | | * @param si Socket information. | |
| | | * @param options Option flags, must be zero for now. | |
| | | * @param p_m Pointer to receive the created SDP media. | |
| | | * | |
| | | * @return PJ_SUCCESS on success, or the appropriate error code | |
| | | . | |
| | | */ | |
| | | PJ_DECL(pj_status_t) pjmedia_endpt_create_audio_sdp(pjmedia_endpt *endpt, | |
| | | pj_pool_t *pool, | |
| | | const pjmedia_sock_info | |
| | | *si, | |
| | | unsigned options, | |
| | | pjmedia_sdp_media **p_m | |
| | | ); | |
| | | | |
| | | /** | |
| | | * Create SDP media line for video media. | |
| | | * | |
| | | * @param endpt The media endpoint. | |
| | | * @param pool Pool to allocate memory from. | |
| | | * @param si Socket information. | |
| | | * @param options Option flags, must be zero for now. | |
| | | * @param p_m Pointer to receive the created SDP media. | |
| | | * | |
| | | * @return PJ_SUCCESS on success, or the appropriate error code | |
| | | . | |
| | | */ | |
| | | PJ_DECL(pj_status_t) pjmedia_endpt_create_video_sdp(pjmedia_endpt *endpt, | |
| | | pj_pool_t *pool, | |
| | | const pjmedia_sock_info | |
| | | *si, | |
| | | unsigned options, | |
| | | pjmedia_sdp_media **p_m | |
| | | ); | |
| | | | |
| | | /** | |
| * Dump media endpoint capabilities. | | * Dump media endpoint capabilities. | |
| * | | * | |
| * @param endpt The media endpoint. | | * @param endpt The media endpoint. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_endpt_dump(pjmedia_endpt *endpt); | | PJ_DECL(pj_status_t) pjmedia_endpt_dump(pjmedia_endpt *endpt); | |
| | | | |
| /** | | /** | |
| * Register cleanup function to be called by media endpoint when | | * Register cleanup function to be called by media endpoint when | |
| | | | |
End of changes. 4 change blocks. |
| 1 lines changed or deleted | | 68 lines changed or added | |
|
| hash.h | | hash.h | |
|
| /* $Id: hash.h 4385 2013-02-27 10:11:59Z nanang $ */ | | /* $Id: hash.h 3841 2011-10-24 09:28:13Z ming $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 77 | | skipping to change at line 77 | |
| * @return the hash value. | | * @return the hash value. | |
| */ | | */ | |
| PJ_DECL(pj_uint32_t) pj_hash_calc(pj_uint32_t hval, | | PJ_DECL(pj_uint32_t) pj_hash_calc(pj_uint32_t hval, | |
| const void *key, unsigned keylen); | | const void *key, unsigned keylen); | |
| | | | |
| /** | | /** | |
| * Convert the key to lowercase and calculate the hash value. The resulting | | * Convert the key to lowercase and calculate the hash value. The resulting | |
| * string is stored in \c result. | | * string is stored in \c result. | |
| * | | * | |
| * @param hval The initial hash value, normally zero. | | * @param hval The initial hash value, normally zero. | |
|
| * @param result Optional. Buffer to store the result, which must be eno | | * @param result Buffer to store the result, which must be enough to hol | |
| ugh | | d | |
| * to hold the string. | | * the string. | |
| * @param key The input key to be converted and calculated. | | * @param key The input key to be converted and calculated. | |
| * | | * | |
| * @return The hash value. | | * @return The hash value. | |
| */ | | */ | |
| PJ_DECL(pj_uint32_t) pj_hash_calc_tolower(pj_uint32_t hval, | | PJ_DECL(pj_uint32_t) pj_hash_calc_tolower(pj_uint32_t hval, | |
| char *result, | | char *result, | |
| const pj_str_t *key); | | const pj_str_t *key); | |
| | | | |
| /** | | /** | |
| * Create a hash table with the specified 'bucket' size. | | * Create a hash table with the specified 'bucket' size. | |
| | | | |
| skipping to change at line 116 | | skipping to change at line 116 | |
| * the argument is not NULL and the value is zero, it will | | * the argument is not NULL and the value is zero, it will | |
| * be filled with the computed hash upon return. | | * be filled with the computed hash upon return. | |
| * | | * | |
| * @return the value associated with the key, or NULL if the key is not fou
nd. | | * @return the value associated with the key, or NULL if the key is not fou
nd. | |
| */ | | */ | |
| PJ_DECL(void *) pj_hash_get( pj_hash_table_t *ht, | | PJ_DECL(void *) pj_hash_get( pj_hash_table_t *ht, | |
| const void *key, unsigned keylen, | | const void *key, unsigned keylen, | |
| pj_uint32_t *hval ); | | pj_uint32_t *hval ); | |
| | | | |
| /** | | /** | |
|
| * Variant of #pj_hash_get() with the key being converted to lowercase when | | | |
| * calculating the hash value. | | | |
| * | | | |
| * @see pj_hash_get() | | | |
| */ | | | |
| PJ_DECL(void *) pj_hash_get_lower( pj_hash_table_t *ht, | | | |
| const void *key, unsigned keylen, | | | |
| pj_uint32_t *hval ); | | | |
| | | | |
| /** | | | |
| * Associate/disassociate a value with the specified key. If value is not | | * Associate/disassociate a value with the specified key. If value is not | |
| * NULL and entry already exists, the entry's value will be overwritten. | | * NULL and entry already exists, the entry's value will be overwritten. | |
| * If value is not NULL and entry does not exist, a new one will be created | | * If value is not NULL and entry does not exist, a new one will be created | |
| * with the specified pool. Otherwise if value is NULL, entry will be | | * with the specified pool. Otherwise if value is NULL, entry will be | |
| * deleted if it exists. | | * deleted if it exists. | |
| * | | * | |
| * @param pool the pool to allocate the new entry if a new entry has to
be | | * @param pool the pool to allocate the new entry if a new entry has to
be | |
| * created. | | * created. | |
| * @param ht the hash table. | | * @param ht the hash table. | |
| * @param key the key. If pool is not specified, the key MUST point to | | * @param key the key. If pool is not specified, the key MUST point to | |
| | | | |
| skipping to change at line 151 | | skipping to change at line 141 | |
| * compute the key. This value can be obtained when calling | | * compute the key. This value can be obtained when calling | |
| * #pj_hash_get(). | | * #pj_hash_get(). | |
| * @param value value to be associated, or NULL to delete the en
try with | | * @param value value to be associated, or NULL to delete the en
try with | |
| * the specified key. | | * the specified key. | |
| */ | | */ | |
| PJ_DECL(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht, | | PJ_DECL(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht, | |
| const void *key, unsigned keylen, pj_uint32_t hva
l, | | const void *key, unsigned keylen, pj_uint32_t hva
l, | |
| void *value ); | | void *value ); | |
| | | | |
| /** | | /** | |
|
| * Variant of #pj_hash_set() with the key being converted to lowercase when | | | |
| * calculating the hash value. | | | |
| * | | | |
| * @see pj_hash_set() | | | |
| */ | | | |
| PJ_DECL(void) pj_hash_set_lower( pj_pool_t *pool, pj_hash_table_t *ht, | | | |
| const void *key, unsigned keylen, | | | |
| pj_uint32_t hval, void *value ); | | | |
| | | | |
| /** | | | |
| * Associate/disassociate a value with the specified key. This function wor
ks | | * Associate/disassociate a value with the specified key. This function wor
ks | |
| * like #pj_hash_set(), except that it doesn't use pool (hence the np -- no | | * like #pj_hash_set(), except that it doesn't use pool (hence the np -- no | |
| * pool suffix). If new entry needs to be allocated, it will use the entry_
buf. | | * pool suffix). If new entry needs to be allocated, it will use the entry_
buf. | |
| * | | * | |
| * @param ht the hash table. | | * @param ht the hash table. | |
| * @param key the key. | | * @param key the key. | |
| * @param keylen the length of the key, or PJ_HASH_KEY_STRING to use the | | * @param keylen the length of the key, or PJ_HASH_KEY_STRING to use the | |
| * string length of the key. | | * string length of the key. | |
| * @param hval if the value is not zero, then the hash table will use | | * @param hval if the value is not zero, then the hash table will use | |
| * this value to search the entry's index, otherwise it wil
l | | * this value to search the entry's index, otherwise it wil
l | |
| | | | |
| skipping to change at line 184 | | skipping to change at line 164 | |
| * to be created. | | * to be created. | |
| * @param value value to be associated, or NULL to delete the en
try with | | * @param value value to be associated, or NULL to delete the en
try with | |
| * the specified key. | | * the specified key. | |
| */ | | */ | |
| PJ_DECL(void) pj_hash_set_np(pj_hash_table_t *ht, | | PJ_DECL(void) pj_hash_set_np(pj_hash_table_t *ht, | |
| const void *key, unsigned keylen, | | const void *key, unsigned keylen, | |
| pj_uint32_t hval, pj_hash_entry_buf entry_buf, | | pj_uint32_t hval, pj_hash_entry_buf entry_buf, | |
| void *value); | | void *value); | |
| | | | |
| /** | | /** | |
|
| * Variant of #pj_hash_set_np() with the key being converted to lowercase | | | |
| * when calculating the hash value. | | | |
| * | | | |
| * @see pj_hash_set_np() | | | |
| */ | | | |
| PJ_DECL(void) pj_hash_set_np_lower(pj_hash_table_t *ht, | | | |
| const void *key, unsigned keylen, | | | |
| pj_uint32_t hval, | | | |
| pj_hash_entry_buf entry_buf, | | | |
| void *value); | | | |
| | | | |
| /** | | | |
| * Get the total number of entries in the hash table. | | * Get the total number of entries in the hash table. | |
| * | | * | |
| * @param ht the hash table. | | * @param ht the hash table. | |
| * | | * | |
| * @return the number of entries in the hash table. | | * @return the number of entries in the hash table. | |
| */ | | */ | |
| PJ_DECL(unsigned) pj_hash_count( pj_hash_table_t *ht ); | | PJ_DECL(unsigned) pj_hash_count( pj_hash_table_t *ht ); | |
| | | | |
| /** | | /** | |
| * Get the iterator to the first element in the hash table. | | * Get the iterator to the first element in the hash table. | |
| | | | |
End of changes. 5 change blocks. |
| 36 lines changed or deleted | | 4 lines changed or added | |
|
| jbuf.h | | jbuf.h | |
|
| /* $Id: jbuf.h 3814 2011-10-13 09:02:41Z nanang $ */ | | /* $Id: jbuf.h 3841 2011-10-24 09:28:13Z ming $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 273 | | skipping to change at line 273 | |
| * @param discarded Flag whether the frame is discarded by jitter buffer
. | | * @param discarded Flag whether the frame is discarded by jitter buffer
. | |
| */ | | */ | |
| PJ_DECL(void) pjmedia_jbuf_put_frame2( pjmedia_jbuf *jb, | | PJ_DECL(void) pjmedia_jbuf_put_frame2( pjmedia_jbuf *jb, | |
| const void *frame, | | const void *frame, | |
| pj_size_t size, | | pj_size_t size, | |
| pj_uint32_t bit_info, | | pj_uint32_t bit_info, | |
| int frame_seq, | | int frame_seq, | |
| pj_bool_t *discarded); | | pj_bool_t *discarded); | |
| | | | |
| /** | | /** | |
|
| | | * Put a frame to the jitter buffer. If the frame can be accepted (based | |
| | | * on the sequence number), the jitter buffer will copy the frame and put | |
| | | * it in the appropriate position in the buffer. | |
| | | * | |
| | | * Application MUST manage it's own synchronization when multiple threads | |
| | | * are accessing the jitter buffer at the same time. | |
| | | * | |
| | | * @param jb The jitter buffer. | |
| | | * @param frame Pointer to frame buffer to be stored in the | |
| | | jitter | |
| | | * buffer. | |
| | | * @param size The frame size. | |
| | | * @param bit_info Bit precise info of the frame, e.g: a frame may not | |
| | | * exactly start and end at the octet boundary, so this | |
| | | * field may be used for specifying start & end bit off | |
| | | set. | |
| | | * @param frame_seq The frame sequence number. | |
| | | * @param frame_ts The frame timestamp. | |
| | | * @param discarded Flag whether the frame is discarded by jitter buffer | |
| | | . | |
| | | */ | |
| | | PJ_DECL(void) pjmedia_jbuf_put_frame3( pjmedia_jbuf *jb, | |
| | | const void *frame, | |
| | | pj_size_t size, | |
| | | pj_uint32_t bit_info, | |
| | | int frame_seq, | |
| | | pj_uint32_t frame_ts, | |
| | | pj_bool_t *discarded); | |
| | | /** | |
| * Get a frame from the jitter buffer. The jitter buffer will return the | | * Get a frame from the jitter buffer. The jitter buffer will return the | |
| * oldest frame from it's buffer, when it is available. | | * oldest frame from it's buffer, when it is available. | |
| * | | * | |
| * Application MUST manage it's own synchronization when multiple threads | | * Application MUST manage it's own synchronization when multiple threads | |
| * are accessing the jitter buffer at the same time. | | * are accessing the jitter buffer at the same time. | |
| * | | * | |
| * @param jb The jitter buffer. | | * @param jb The jitter buffer. | |
| * @param frame Buffer to receive the payload from the jitte
r buffer. | | * @param frame Buffer to receive the payload from the jitte
r buffer. | |
| * Application MUST make sure that the buffer has | | * Application MUST make sure that the buffer has | |
| * appropriate size (i.e. not less than the frame size, | | * appropriate size (i.e. not less than the frame size, | |
| | | | |
| skipping to change at line 322 | | skipping to change at line 348 | |
| * exactly start and end at the octet boundary, so this | | * exactly start and end at the octet boundary, so this | |
| * field may be used for specifying start & end bit off
set. | | * field may be used for specifying start & end bit off
set. | |
| */ | | */ | |
| PJ_DECL(void) pjmedia_jbuf_get_frame2(pjmedia_jbuf *jb, | | PJ_DECL(void) pjmedia_jbuf_get_frame2(pjmedia_jbuf *jb, | |
| void *frame, | | void *frame, | |
| pj_size_t *size, | | pj_size_t *size, | |
| char *p_frm_type, | | char *p_frm_type, | |
| pj_uint32_t *bit_info); | | pj_uint32_t *bit_info); | |
| | | | |
| /** | | /** | |
|
| | | * Get a frame from the jitter buffer. The jitter buffer will return the | |
| | | * oldest frame from it's buffer, when it is available. | |
| | | * | |
| | | * @param jb The jitter buffer. | |
| | | * @param frame Buffer to receive the payload from the jitte | |
| | | r buffer. | |
| | | * @see pjmedia_jbuf_get_frame(). | |
| | | * @param size Pointer to receive frame size. | |
| | | * @param p_frm_type Pointer to receive frame type. | |
| | | * @see pjmedia_jbuf_get_frame(). | |
| | | * @param bit_info Bit precise info of the frame, e.g: a frame may not | |
| | | * exactly start and end at the octet boundary, so this | |
| | | * field may be used for specifying start & end bit off | |
| | | set. | |
| | | * @param ts Frame timestamp. | |
| | | * @param seq Frame sequence number. | |
| | | */ | |
| | | PJ_DECL(void) pjmedia_jbuf_get_frame3(pjmedia_jbuf *jb, | |
| | | void *frame, | |
| | | pj_size_t *size, | |
| | | char *p_frm_type, | |
| | | pj_uint32_t *bit_info, | |
| | | pj_uint32_t *ts, | |
| | | int *seq); | |
| | | | |
| | | /** | |
| | | * Peek a frame from the jitter buffer. The jitter buffer state will not be | |
| | | * modified. | |
| | | * | |
| | | * @param jb The jitter buffer. | |
| | | * @param offset Offset from the oldest frame to be peeked. | |
| | | * @param frame Buffer to receive the payload from the jitte | |
| | | r buffer. | |
| | | * @see pjmedia_jbuf_get_frame(). | |
| | | * @param size Pointer to receive frame size. | |
| | | * @param p_frm_type Pointer to receive frame type. | |
| | | * @see pjmedia_jbuf_get_frame(). | |
| | | * @param bit_info Bit precise info of the frame, e.g: a frame may not | |
| | | * exactly start and end at the octet boundary, so this | |
| | | * field may be used for specifying start & end bit off | |
| | | set. | |
| | | * @param ts Frame timestamp. | |
| | | * @param seq Frame sequence number. | |
| | | */ | |
| | | PJ_DECL(void) pjmedia_jbuf_peek_frame(pjmedia_jbuf *jb, | |
| | | unsigned offset, | |
| | | const void **frame, | |
| | | pj_size_t *size, | |
| | | char *p_frm_type, | |
| | | pj_uint32_t *bit_info, | |
| | | pj_uint32_t *ts, | |
| | | int *seq); | |
| | | | |
| | | /** | |
| | | * Remove frames from the jitter buffer. | |
| | | * | |
| | | * @param jb The jitter buffer. | |
| | | * @param frame_cnt Number of frames to be removed. | |
| | | * | |
| | | * @return The number of frame successfully removed. | |
| | | */ | |
| | | PJ_DECL(unsigned) pjmedia_jbuf_remove_frame(pjmedia_jbuf *jb, | |
| | | unsigned frame_cnt); | |
| | | | |
| | | /** | |
| | | * Check if the jitter buffer is full. | |
| | | * | |
| | | * @param jb The jitter buffer. | |
| | | * | |
| | | * @return PJ_TRUE if it is full. | |
| | | */ | |
| | | PJ_DECL(pj_bool_t) pjmedia_jbuf_is_full(const pjmedia_jbuf *jb); | |
| | | | |
| | | /** | |
| * Get jitter buffer current state/settings. | | * Get jitter buffer current state/settings. | |
| * | | * | |
| * @param jb The jitter buffer. | | * @param jb The jitter buffer. | |
| * @param state Buffer to receive jitter buffer state. | | * @param state Buffer to receive jitter buffer state. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_jbuf_get_state( const pjmedia_jbuf *jb, | | PJ_DECL(pj_status_t) pjmedia_jbuf_get_state( const pjmedia_jbuf *jb, | |
| pjmedia_jb_state *state ); | | pjmedia_jb_state *state ); | |
| | | | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 104 lines changed or added | |
|
| log.h | | log.h | |
|
| /* $Id: log.h 3553 2011-05-05 06:14:19Z nanang $ */ | | /* $Id: log.h 3752 2011-09-18 14:38:46Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 84 | | skipping to change at line 84 | |
| PJ_LOG_HAS_MONTH = 4, /**< Include month [no]
*/ | | PJ_LOG_HAS_MONTH = 4, /**< Include month [no]
*/ | |
| PJ_LOG_HAS_DAY_OF_MON = 8, /**< Include day of month [no]
*/ | | PJ_LOG_HAS_DAY_OF_MON = 8, /**< Include day of month [no]
*/ | |
| PJ_LOG_HAS_TIME = 16, /**< Include time [yes]
*/ | | PJ_LOG_HAS_TIME = 16, /**< Include time [yes]
*/ | |
| PJ_LOG_HAS_MICRO_SEC = 32, /**< Include microseconds [yes]
*/ | | PJ_LOG_HAS_MICRO_SEC = 32, /**< Include microseconds [yes]
*/ | |
| PJ_LOG_HAS_SENDER = 64, /**< Include sender in the log [yes]
*/ | | PJ_LOG_HAS_SENDER = 64, /**< Include sender in the log [yes]
*/ | |
| PJ_LOG_HAS_NEWLINE = 128, /**< Terminate each call with newline [yes
] */ | | PJ_LOG_HAS_NEWLINE = 128, /**< Terminate each call with newline [yes
] */ | |
| PJ_LOG_HAS_CR = 256, /**< Include carriage return [no]
*/ | | PJ_LOG_HAS_CR = 256, /**< Include carriage return [no]
*/ | |
| PJ_LOG_HAS_SPACE = 512, /**< Include two spaces before log [yes]
*/ | | PJ_LOG_HAS_SPACE = 512, /**< Include two spaces before log [yes]
*/ | |
| PJ_LOG_HAS_COLOR = 1024, /**< Colorize logs [yes on win32]
*/ | | PJ_LOG_HAS_COLOR = 1024, /**< Colorize logs [yes on win32]
*/ | |
| PJ_LOG_HAS_LEVEL_TEXT = 2048, /**< Include level text string [no]
*/ | | PJ_LOG_HAS_LEVEL_TEXT = 2048, /**< Include level text string [no]
*/ | |
|
| PJ_LOG_HAS_THREAD_ID = 4096 /**< Include thread identification [no] | | PJ_LOG_HAS_THREAD_ID = 4096, /**< Include thread identification [no] | |
| */ | | */ | |
| | | PJ_LOG_HAS_THREAD_SWC = 8192, /**< Add mark when thread has switched [y | |
| | | es]*/ | |
| | | PJ_LOG_HAS_INDENT =16384 /**< Indentation. Say yes! [yes] | |
| | | */ | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Write log message. | | * Write log message. | |
| * This is the main macro used to write text to the logging backend. | | * This is the main macro used to write text to the logging backend. | |
| * | | * | |
| * @param level The logging verbosity level. Lower number indica
tes higher | | * @param level The logging verbosity level. Lower number indica
tes higher | |
| * importance, with level zero indicates fatal error. Only | | * importance, with level zero indicates fatal error. Only | |
| * numeral argument is permitted (e.g. not variable). | | * numeral argument is permitted (e.g. not variable). | |
| * @param arg Enclosed 'printf' like arguments, with the first | | * @param arg Enclosed 'printf' like arguments, with the first | |
| | | | |
| skipping to change at line 206 | | skipping to change at line 208 | |
| PJ_DECL(void) pj_log_set_decor(unsigned decor); | | PJ_DECL(void) pj_log_set_decor(unsigned decor); | |
| | | | |
| /** | | /** | |
| * Get current log decoration flag. | | * Get current log decoration flag. | |
| * | | * | |
| * @return Log decoration flag. | | * @return Log decoration flag. | |
| */ | | */ | |
| PJ_DECL(unsigned) pj_log_get_decor(void); | | PJ_DECL(unsigned) pj_log_get_decor(void); | |
| | | | |
| /** | | /** | |
|
| | | * Add indentation to log message. Indentation will add PJ_LOG_INDENT_CHAR | |
| | | * before the message, and is useful to show the depth of function calls. | |
| | | * | |
| | | * @param indent The indentation to add or substract. Positive value | |
| | | * adds current indent, negative value subtracts current | |
| | | * indent. | |
| | | */ | |
| | | PJ_DECL(void) pj_log_add_indent(int indent); | |
| | | | |
| | | /** | |
| | | * Push indentation to the right by default value (PJ_LOG_INDENT). | |
| | | */ | |
| | | PJ_DECL(void) pj_log_push_indent(void); | |
| | | | |
| | | /** | |
| | | * Pop indentation (to the left) by default value (PJ_LOG_INDENT). | |
| | | */ | |
| | | PJ_DECL(void) pj_log_pop_indent(void); | |
| | | | |
| | | /** | |
| * Set color of log messages. | | * Set color of log messages. | |
| * | | * | |
| * @param level Log level which color will be changed. | | * @param level Log level which color will be changed. | |
| * @param color Desired color. | | * @param color Desired color. | |
| */ | | */ | |
| PJ_DECL(void) pj_log_set_color(int level, pj_color_t color); | | PJ_DECL(void) pj_log_set_color(int level, pj_color_t color); | |
| | | | |
| /** | | /** | |
| * Get color of log messages. | | * Get color of log messages. | |
| * | | * | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 27 lines changed or added | |
|
| pjmedia.h | | pjmedia.h | |
|
| /* $Id: pjmedia.h 3553 2011-05-05 06:14:19Z nanang $ */ | | /* $Id: pjmedia.h 3664 2011-07-19 03:42:28Z nanang $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| * along with this program; if not, write to the Free Software | | * along with this program; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A | |
| */ | | */ | |
| #ifndef __PJMEDIA_H__ | | #ifndef __PJMEDIA_H__ | |
| #define __PJMEDIA_H__ | | #define __PJMEDIA_H__ | |
| | | | |
| /** | | /** | |
| * @file pjmedia.h | | * @file pjmedia.h | |
| * @brief PJMEDIA main header file. | | * @brief PJMEDIA main header file. | |
| */ | | */ | |
|
| | | | |
| #include <pjmedia/types.h> | | | |
| #include <pjmedia/alaw_ulaw.h> | | #include <pjmedia/alaw_ulaw.h> | |
|
| | | #include <pjmedia/avi_stream.h> | |
| #include <pjmedia/bidirectional.h> | | #include <pjmedia/bidirectional.h> | |
| #include <pjmedia/circbuf.h> | | #include <pjmedia/circbuf.h> | |
| #include <pjmedia/clock.h> | | #include <pjmedia/clock.h> | |
| #include <pjmedia/codec.h> | | #include <pjmedia/codec.h> | |
| #include <pjmedia/conference.h> | | #include <pjmedia/conference.h> | |
|
| | | #include <pjmedia/converter.h> | |
| #include <pjmedia/delaybuf.h> | | #include <pjmedia/delaybuf.h> | |
| #include <pjmedia/echo.h> | | #include <pjmedia/echo.h> | |
| #include <pjmedia/echo_port.h> | | #include <pjmedia/echo_port.h> | |
|
| #include <pjmedia/errno.h> | | | |
| #include <pjmedia/endpoint.h> | | #include <pjmedia/endpoint.h> | |
|
| | | #include <pjmedia/errno.h> | |
| | | #include <pjmedia/event.h> | |
| | | #include <pjmedia/frame.h> | |
| | | #include <pjmedia/format.h> | |
| #include <pjmedia/g711.h> | | #include <pjmedia/g711.h> | |
| #include <pjmedia/jbuf.h> | | #include <pjmedia/jbuf.h> | |
| #include <pjmedia/master_port.h> | | #include <pjmedia/master_port.h> | |
| #include <pjmedia/mem_port.h> | | #include <pjmedia/mem_port.h> | |
| #include <pjmedia/null_port.h> | | #include <pjmedia/null_port.h> | |
| #include <pjmedia/plc.h> | | #include <pjmedia/plc.h> | |
| #include <pjmedia/port.h> | | #include <pjmedia/port.h> | |
| #include <pjmedia/resample.h> | | #include <pjmedia/resample.h> | |
| #include <pjmedia/rtcp.h> | | #include <pjmedia/rtcp.h> | |
| #include <pjmedia/rtcp_xr.h> | | #include <pjmedia/rtcp_xr.h> | |
| #include <pjmedia/rtp.h> | | #include <pjmedia/rtp.h> | |
| #include <pjmedia/sdp.h> | | #include <pjmedia/sdp.h> | |
| #include <pjmedia/sdp_neg.h> | | #include <pjmedia/sdp_neg.h> | |
|
| #include <pjmedia/session.h> | | //#include <pjmedia/session.h> | |
| #include <pjmedia/silencedet.h> | | #include <pjmedia/silencedet.h> | |
| #include <pjmedia/sound.h> | | #include <pjmedia/sound.h> | |
| #include <pjmedia/sound_port.h> | | #include <pjmedia/sound_port.h> | |
| #include <pjmedia/splitcomb.h> | | #include <pjmedia/splitcomb.h> | |
| #include <pjmedia/stereo.h> | | #include <pjmedia/stereo.h> | |
| #include <pjmedia/stream.h> | | #include <pjmedia/stream.h> | |
|
| | | #include <pjmedia/stream_common.h> | |
| #include <pjmedia/tonegen.h> | | #include <pjmedia/tonegen.h> | |
| #include <pjmedia/transport.h> | | #include <pjmedia/transport.h> | |
| #include <pjmedia/transport_adapter_sample.h> | | #include <pjmedia/transport_adapter_sample.h> | |
| #include <pjmedia/transport_ice.h> | | #include <pjmedia/transport_ice.h> | |
| #include <pjmedia/transport_loop.h> | | #include <pjmedia/transport_loop.h> | |
| #include <pjmedia/transport_srtp.h> | | #include <pjmedia/transport_srtp.h> | |
| #include <pjmedia/transport_udp.h> | | #include <pjmedia/transport_udp.h> | |
|
| | | #include <pjmedia/vid_port.h> | |
| | | #include <pjmedia/vid_codec.h> | |
| | | #include <pjmedia/vid_stream.h> | |
| | | #include <pjmedia/vid_tee.h> | |
| #include <pjmedia/wav_playlist.h> | | #include <pjmedia/wav_playlist.h> | |
| #include <pjmedia/wav_port.h> | | #include <pjmedia/wav_port.h> | |
| #include <pjmedia/wave.h> | | #include <pjmedia/wave.h> | |
| #include <pjmedia/wsola.h> | | #include <pjmedia/wsola.h> | |
| | | | |
| #endif /* __PJMEDIA_H__ */ | | #endif /* __PJMEDIA_H__ */ | |
| | | | |
End of changes. 9 change blocks. |
| 5 lines changed or deleted | | 13 lines changed or added | |
|
| pjsua_internal.h | | pjsua_internal.h | |
|
| /* $Id: pjsua_internal.h 4389 2013-02-27 10:44:04Z ming $ */ | | /* $Id: pjsua_internal.h 4099 2012-04-26 16:46:27Z nanang $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| #ifndef __PJSUA_INTERNAL_H__ | | #ifndef __PJSUA_INTERNAL_H__ | |
| #define __PJSUA_INTERNAL_H__ | | #define __PJSUA_INTERNAL_H__ | |
| | | | |
| /** | | /** | |
| * This is the private header used by pjsua library implementation. | | * This is the private header used by pjsua library implementation. | |
| * Applications should not include this file. | | * Applications should not include this file. | |
| */ | | */ | |
| | | | |
| PJ_BEGIN_DECL | | PJ_BEGIN_DECL | |
| | | | |
|
| | | /** Forward decl of pjsua call */ | |
| | | typedef struct pjsua_call pjsua_call; | |
| | | | |
| | | /** Forward decl of pjsua call media */ | |
| | | typedef struct pjsua_call_media pjsua_call_media; | |
| | | | |
| /** | | /** | |
|
| * Media transport state. | | * Call's media stream. | |
| */ | | */ | |
|
| typedef enum pjsua_med_tp_st | | struct pjsua_call_media | |
| { | | { | |
|
| /** Not initialized */ | | pjsua_call *call; /**< Parent call. | |
| PJSUA_MED_TP_IDLE, | | */ | |
| | | pjmedia_type type; /**< Media type. | |
| | | */ | |
| | | unsigned idx; /**< This media index in parent call. | |
| | | */ | |
| | | pjsua_call_media_status state; /**< Media state. | |
| | | */ | |
| | | pjsua_call_media_status prev_state;/**< Previous media state. | |
| | | */ | |
| | | pjmedia_dir dir; /**< Media direction. | |
| | | */ | |
| | | | |
| | | /** The stream */ | |
| | | struct { | |
| | | /** Audio stream */ | |
| | | struct { | |
| | | pjmedia_stream *stream; /**< The audio stream. | |
| | | */ | |
| | | int conf_slot; /**< Slot # in conference bridge. | |
| | | */ | |
| | | } a; | |
| | | | |
| | | /** Video stream */ | |
| | | struct { | |
| | | pjmedia_vid_stream *stream; /**< The video stream. | |
| | | */ | |
| | | pjsua_vid_win_id cap_win_id;/**< The video capture window | |
| | | */ | |
| | | pjsua_vid_win_id rdr_win_id;/**< The video render window | |
| | | */ | |
| | | pjmedia_vid_dev_index cap_dev; /**< The video capture device | |
| | | */ | |
| | | pjmedia_vid_dev_index rdr_dev; /**< The video-in render device | |
| | | */ | |
| | | } v; | |
| | | | |
| | | } strm; | |
| | | | |
| | | pj_uint32_t ssrc; /**< RTP SSRC | |
| | | */ | |
| | | pj_uint32_t rtp_tx_ts; /**< Initial RTP timestamp for s | |
| | | ender. */ | |
| | | pj_uint16_t rtp_tx_seq;/**< Initial RTP sequence for se | |
| | | nder. */ | |
| | | pj_uint8_t rtp_tx_seq_ts_set; | |
| | | /**< Bitmask flags if initial RTP sequen | |
| | | ce | |
| | | and/or timestamp for sender are set | |
| | | . | |
| | | bit 0/LSB : sequence flag | |
| | | bit 1 : timestamp flag | |
| | | */ | |
| | | | |
|
| /** Initialized (media_create() has been called) */ | | pjmedia_transport *tp; /**< Current media transport (can be 0) | |
| PJSUA_MED_TP_INIT, | | */ | |
| | | pj_status_t tp_ready; /**< Media transport status. | |
| | | */ | |
| | | pj_status_t tp_result; /**< Media transport creation re | |
| | | sult. */ | |
| | | pjmedia_transport *tp_orig; /**< Original media transport | |
| | | */ | |
| | | pj_bool_t tp_auto_del; /**< May delete media transport | |
| | | */ | |
| | | pjsua_med_tp_st tp_st; /**< Media transport state | |
| | | */ | |
| | | pj_bool_t use_custom_med_tp;/**< Use custom media transport? | |
| | | */ | |
| | | pj_sockaddr rtp_addr; /**< Current RTP source address | |
| | | (used to update ICE default | |
| | | address) | |
| | | */ | |
| | | pjmedia_srtp_use rem_srtp_use; /**< Remote's SRTP usage policy. | |
| | | */ | |
| | | pj_timestamp last_req_keyframe;/**< Last TX keyframe request. | |
| | | */ | |
| | | | |
|
| /** Running (media_start() has been called) */ | | pjsua_med_tp_state_cb med_init_cb;/**< Media transport | |
| PJSUA_MED_TP_RUNNING | | initialization callback. | |
| | | */ | |
| | | | |
|
| } pjsua_med_tp_st; | | /** Media transport creation callback. */ | |
| | | pj_status_t (*med_create_cb)(pjsua_call_media *call_med, | |
| | | pj_status_t status, int security_level, | |
| | | int *sip_err_code); | |
| | | }; | |
| | | | |
| | | /** | |
| | | * Maximum number of SDP "m=" lines to be supported. | |
| | | */ | |
| | | #define PJSUA_MAX_CALL_MEDIA PJMEDIA_MAX_SDP_MEDIA | |
| | | | |
| | | /* Call answer's list. */ | |
| | | typedef struct call_answer | |
| | | { | |
| | | PJ_DECL_LIST_MEMBER(struct call_answer); | |
| | | pjsua_msg_data *msg_data; /**< Answer's headers list. */ | |
| | | pj_str_t *reason; /**< Answer's reason phrase. */ | |
| | | unsigned code; /**< Answer's status code. */ | |
| | | } call_answer; | |
| | | | |
| /** | | /** | |
| * Structure to be attached to invite dialog. | | * Structure to be attached to invite dialog. | |
| * Given a dialog "dlg", application can retrieve this structure | | * Given a dialog "dlg", application can retrieve this structure | |
| * by accessing dlg->mod_data[pjsua.mod.id]. | | * by accessing dlg->mod_data[pjsua.mod.id]. | |
| */ | | */ | |
|
| typedef struct pjsua_call | | struct pjsua_call | |
| { | | { | |
| unsigned index; /**< Index in pjsua array.
*/ | | unsigned index; /**< Index in pjsua array.
*/ | |
|
| | | pjsua_call_setting opt; /**< Call setting.
*/ | |
| pjsip_inv_session *inv; /**< The invite session.
*/ | | pjsip_inv_session *inv; /**< The invite session.
*/ | |
| void *user_data; /**< User/application data.
*/ | | void *user_data; /**< User/application data.
*/ | |
| pjsip_status_code last_code; /**< Last status code seen.
*/ | | pjsip_status_code last_code; /**< Last status code seen.
*/ | |
| pj_str_t last_text; /**< Last status text seen.
*/ | | pj_str_t last_text; /**< Last status text seen.
*/ | |
| pj_time_val start_time;/**< First INVITE sent/received.
*/ | | pj_time_val start_time;/**< First INVITE sent/received.
*/ | |
| pj_time_val res_time; /**< First response sent/receive
d. */ | | pj_time_val res_time; /**< First response sent/receive
d. */ | |
| pj_time_val conn_time; /**< Connected/confirmed time.
*/ | | pj_time_val conn_time; /**< Connected/confirmed time.
*/ | |
| pj_time_val dis_time; /**< Disconnect time.
*/ | | pj_time_val dis_time; /**< Disconnect time.
*/ | |
| pjsua_acc_id acc_id; /**< Account index being used.
*/ | | pjsua_acc_id acc_id; /**< Account index being used.
*/ | |
| int secure_level;/**< Signaling security level.
*/ | | int secure_level;/**< Signaling security level.
*/ | |
| pjsua_call_hold_type call_hold_type; /**< How to do call hold.
*/ | | pjsua_call_hold_type call_hold_type; /**< How to do call hold.
*/ | |
| pj_bool_t local_hold;/**< Flag for call-hold by local.
*/ | | pj_bool_t local_hold;/**< Flag for call-hold by local.
*/ | |
| void *hold_msg; /**< Outgoing hold tx_data.
*/ | | void *hold_msg; /**< Outgoing hold tx_data.
*/ | |
|
| pjsua_call_media_status media_st;/**< Media state. | | | |
| */ | | unsigned med_cnt; /**< Number of media in SDP. | |
| pjmedia_dir media_dir; /**< Media direction. | | */ | |
| */ | | pjsua_call_media media[PJSUA_MAX_CALL_MEDIA]; /**< Array of media | |
| pjmedia_session *session; /**< The media session. | | */ | |
| */ | | unsigned med_prov_cnt;/**< Number of provisional media. | |
| int audio_idx; /**< Index of m=audio in SDP. | | */ | |
| */ | | pjsua_call_media media_prov[PJSUA_MAX_CALL_MEDIA]; | |
| pj_uint32_t ssrc; /**< RTP SSRC | | /**< Array of provisional media. | |
| */ | | */ | |
| pj_uint32_t rtp_tx_ts; /**< Initial RTP timestamp for s | | | |
| ender. */ | | int audio_idx; /**< First active audio media. | |
| pj_uint16_t rtp_tx_seq;/**< Initial RTP sequence for se | | */ | |
| nder. */ | | pj_mutex_t *med_ch_mutex;/**< Media channel callback's mutex. | |
| pj_uint8_t rtp_tx_seq_ts_set; | | */ | |
| /**< Bitmask flags if initial RTP sequen | | pjsua_med_tp_state_cb med_ch_cb;/**< Media channel callback. | |
| ce | | */ | |
| and/or timestamp for sender are set | | pjsua_med_tp_state_info med_ch_info;/**< Media channel info. | |
| . | | */ | |
| bit 0/LSB : sequence flag | | | |
| bit 1 : timestamp flag | | | |
| */ | | | |
| int conf_slot; /**< Slot # in conference bridge | | | |
| . */ | | | |
| pjsip_evsub *xfer_sub; /**< Xfer server subscription, i
f this | | pjsip_evsub *xfer_sub; /**< Xfer server subscription, i
f this | |
| call was triggered by xfer.
*/ | | call was triggered by xfer.
*/ | |
|
| pjmedia_transport *med_tp; /**< Current media transport. | | | |
| */ | | | |
| pj_status_t med_tp_ready;/**< Media transport status. | | | |
| */ | | | |
| pjmedia_transport *med_orig; /**< Original media transport | | | |
| */ | | | |
| pj_bool_t med_tp_auto_del; /**< May delete media transport | | | |
| */ | | | |
| pjsua_med_tp_st med_tp_st; /**< Media transport state | | | |
| */ | | | |
| pj_sockaddr med_rtp_addr; /**< Current RTP source addre | | | |
| ss | | | |
| (used to update ICE default | | | |
| address) | | | |
| */ | | | |
| pj_stun_nat_type rem_nat_type; /**< NAT type of remote endpoint.
*/ | | pj_stun_nat_type rem_nat_type; /**< NAT type of remote endpoint.
*/ | |
|
| pjmedia_srtp_use rem_srtp_use; /**< Remote's SRTP usage policy.
*/ | | | |
| | | | |
| char last_text_buf_[128]; /**< Buffer for last_text.
*/ | | char last_text_buf_[128]; /**< Buffer for last_text.
*/ | |
| | | | |
| struct { | | struct { | |
| pj_timer_entry reinv_timer;/**< Reinvite retry timer.
*/ | | pj_timer_entry reinv_timer;/**< Reinvite retry timer.
*/ | |
| pj_uint32_t sdp_ver; /**< SDP version of the bad answer
*/ | | pj_uint32_t sdp_ver; /**< SDP version of the bad answer
*/ | |
| int retry_cnt; /**< Retry count.
*/ | | int retry_cnt; /**< Retry count.
*/ | |
| pj_bool_t pending; /**< Pending until CONFIRMED state
*/ | | pj_bool_t pending; /**< Pending until CONFIRMED state
*/ | |
| } lock_codec; /**< Data for codec locking when answer | | } lock_codec; /**< Data for codec locking when answer | |
| contains multiple codecs.
*/ | | contains multiple codecs.
*/ | |
| | | | |
|
| } pjsua_call; | | struct { | |
| | | pjsip_dialog *dlg; /**< Call dialog. | |
| | | */ | |
| | | pjmedia_sdp_session *rem_sdp;/**< Remote SDP. | |
| | | */ | |
| | | pj_pool_t *pool_prov;/**< Provisional pool. | |
| | | */ | |
| | | pj_bool_t med_ch_deinit;/**< Media channel de-init-ed? | |
| | | */ | |
| | | union { | |
| | | struct { | |
| | | pjsua_msg_data *msg_data;/**< Headers for outgoing INVITE. | |
| | | */ | |
| | | } out_call; | |
| | | struct { | |
| | | call_answer answers;/**< A list of call answers. | |
| | | */ | |
| | | } inc_call; | |
| | | } call_var; | |
| | | } async_call; /**< Temporary storage for async | |
| | | outgoing/incoming call. | |
| | | */ | |
| | | | |
| | | pj_bool_t rem_offerer; /**< Was remote SDP offerer? | |
| | | */ | |
| | | unsigned rem_aud_cnt; /**< No of active audio in last remot | |
| | | e | |
| | | offer. | |
| | | */ | |
| | | unsigned rem_vid_cnt; /**< No of active video in last remot | |
| | | e | |
| | | offer. | |
| | | */ | |
| | | }; | |
| | | | |
| /** | | /** | |
| * Server presence subscription list head. | | * Server presence subscription list head. | |
| */ | | */ | |
| struct pjsua_srv_pres | | struct pjsua_srv_pres | |
| { | | { | |
| PJ_DECL_LIST_MEMBER(struct pjsua_srv_pres); | | PJ_DECL_LIST_MEMBER(struct pjsua_srv_pres); | |
| pjsip_evsub *sub; /**< The evsub.
*/ | | pjsip_evsub *sub; /**< The evsub.
*/ | |
| char *remote; /**< Remote URI.
*/ | | char *remote; /**< Remote URI.
*/ | |
| int acc_id; /**< Account ID.
*/ | | int acc_id; /**< Account ID.
*/ | |
| | | | |
| skipping to change at line 247 | | skipping to change at line 325 | |
| unsigned channel_count; | | unsigned channel_count; | |
| unsigned samples_per_frame; | | unsigned samples_per_frame; | |
| unsigned bits_per_sample; | | unsigned bits_per_sample; | |
| } pjsua_conf_setting; | | } pjsua_conf_setting; | |
| | | | |
| typedef struct pjsua_stun_resolve | | typedef struct pjsua_stun_resolve | |
| { | | { | |
| PJ_DECL_LIST_MEMBER(struct pjsua_stun_resolve); | | PJ_DECL_LIST_MEMBER(struct pjsua_stun_resolve); | |
| | | | |
| pj_pool_t *pool; /**< Pool */ | | pj_pool_t *pool; /**< Pool */ | |
|
| int ref_cnt; /**< Reference count */ | | | |
| pj_bool_t destroy_flag; /**< To be destroyed */ | | | |
| pj_bool_t has_result; | | | |
| unsigned count; /**< # of entries */ | | unsigned count; /**< # of entries */ | |
| pj_str_t *srv; /**< Array of entries */ | | pj_str_t *srv; /**< Array of entries */ | |
| unsigned idx; /**< Current index */ | | unsigned idx; /**< Current index */ | |
| void *token; /**< App token */ | | void *token; /**< App token */ | |
| pj_stun_resolve_cb cb; /**< App callback */ | | pj_stun_resolve_cb cb; /**< App callback */ | |
| pj_bool_t blocking; /**< Blocking? */ | | pj_bool_t blocking; /**< Blocking? */ | |
| pj_status_t status; /**< Session status */ | | pj_status_t status; /**< Session status */ | |
| pj_sockaddr addr; /**< Result */ | | pj_sockaddr addr; /**< Result */ | |
| pj_stun_sock *stun_sock; /**< Testing STUN sock */ | | pj_stun_sock *stun_sock; /**< Testing STUN sock */ | |
| } pjsua_stun_resolve; | | } pjsua_stun_resolve; | |
| | | | |
|
| | | /* See also pjsua_vid_win_type_name() */ | |
| | | typedef enum pjsua_vid_win_type | |
| | | { | |
| | | PJSUA_WND_TYPE_NONE, | |
| | | PJSUA_WND_TYPE_PREVIEW, | |
| | | PJSUA_WND_TYPE_STREAM | |
| | | } pjsua_vid_win_type; | |
| | | | |
| | | typedef struct pjsua_vid_win | |
| | | { | |
| | | pjsua_vid_win_type type; /**< Type. */ | |
| | | pj_pool_t *pool; /**< Own pool. */ | |
| | | unsigned ref_cnt; /**< Reference counter. */ | |
| | | pjmedia_vid_port *vp_cap; /**< Capture vidport. */ | |
| | | pjmedia_vid_port *vp_rend; /**< Renderer vidport */ | |
| | | pjmedia_port *tee; /**< Video tee */ | |
| | | pjmedia_vid_dev_index preview_cap_id;/**< Capture dev id */ | |
| | | pj_bool_t preview_running;/**< Preview is started*/ | |
| | | pj_bool_t is_native; /**< Preview is by dev */ | |
| | | } pjsua_vid_win; | |
| | | | |
| | | typedef struct pjsua_timer_list | |
| | | { | |
| | | PJ_DECL_LIST_MEMBER(struct pjsua_timer_list); | |
| | | pj_timer_entry entry; | |
| | | void (*cb)(void *user_data); | |
| | | void *user_data; | |
| | | } pjsua_timer_list; | |
| | | | |
| /** | | /** | |
| * Global pjsua application data. | | * Global pjsua application data. | |
| */ | | */ | |
| struct pjsua_data | | struct pjsua_data | |
| { | | { | |
| | | | |
| /* Control: */ | | /* Control: */ | |
| pj_caching_pool cp; /**< Global pool factory. */ | | pj_caching_pool cp; /**< Global pool factory. */ | |
| pj_pool_t *pool; /**< pjsua's private pool. */ | | pj_pool_t *pool; /**< pjsua's private pool. */ | |
| pj_mutex_t *mutex; /**< Mutex protection for this data */ | | pj_mutex_t *mutex; /**< Mutex protection for this data */ | |
|
| | | unsigned mutex_nesting_level; /**< Mutex nesting level. */ | |
| | | pj_thread_t *mutex_owner; /**< Mutex owner. | |
| | | */ | |
| | | pjsua_state state; /**< Library state. | |
| | | */ | |
| | | | |
| /* Logging: */ | | /* Logging: */ | |
| pjsua_logging_config log_cfg; /**< Current logging config. */ | | pjsua_logging_config log_cfg; /**< Current logging config. */ | |
| pj_oshandle_t log_file; /**<Output log file handle */ | | pj_oshandle_t log_file; /**<Output log file handle */ | |
| | | | |
| /* SIP: */ | | /* SIP: */ | |
| pjsip_endpoint *endpt; /**< Global endpoint. */ | | pjsip_endpoint *endpt; /**< Global endpoint. */ | |
| pjsip_module mod; /**< pjsua's PJSIP module. */ | | pjsip_module mod; /**< pjsua's PJSIP module. */ | |
| pjsua_transport_data tpdata[8]; /**< Array of transports. */ | | pjsua_transport_data tpdata[8]; /**< Array of transports. */ | |
| pjsip_tp_state_callback old_tp_cb; /**< Old transport callback. */ | | pjsip_tp_state_callback old_tp_cb; /**< Old transport callback. */ | |
| | | | |
| skipping to change at line 340 | | skipping to change at line 447 | |
| pjmedia_aud_dev_index play_dev; /**< Playback device ID. */ | | pjmedia_aud_dev_index play_dev; /**< Playback device ID. */ | |
| pj_uint32_t aud_svmask;/**< Which settings to save
*/ | | pj_uint32_t aud_svmask;/**< Which settings to save
*/ | |
| pjmedia_aud_param aud_param; /**< User settings to sound dev */ | | pjmedia_aud_param aud_param; /**< User settings to sound dev */ | |
| pj_bool_t aud_open_cnt;/**< How many # device is opened */ | | pj_bool_t aud_open_cnt;/**< How many # device is opened */ | |
| pj_bool_t no_snd; /**< No sound (app will manage it) */ | | pj_bool_t no_snd; /**< No sound (app will manage it) */ | |
| pj_pool_t *snd_pool; /**< Sound's private pool. */ | | pj_pool_t *snd_pool; /**< Sound's private pool. */ | |
| pjmedia_snd_port *snd_port; /**< Sound port. */ | | pjmedia_snd_port *snd_port; /**< Sound port. */ | |
| pj_timer_entry snd_idle_timer;/**< Sound device idle timer. */ | | pj_timer_entry snd_idle_timer;/**< Sound device idle timer. */ | |
| pjmedia_master_port *null_snd; /**< Master port for null sound.
*/ | | pjmedia_master_port *null_snd; /**< Master port for null sound.
*/ | |
| pjmedia_port *null_port; /**< Null port. */ | | pjmedia_port *null_port; /**< Null port. */ | |
|
| | | pj_bool_t snd_is_on; /**< Media flow is currently active */ | |
| | | | |
| | | /* Video device */ | |
| | | pjmedia_vid_dev_index vcap_dev; /**< Capture device ID. */ | |
| | | pjmedia_vid_dev_index vrdr_dev; /**< Playback device ID. */ | |
| | | | |
| /* File players: */ | | /* File players: */ | |
| unsigned player_cnt;/**< Number of file players. */ | | unsigned player_cnt;/**< Number of file players. */ | |
| pjsua_file_data player[PJSUA_MAX_PLAYERS];/**< Array of players.*/ | | pjsua_file_data player[PJSUA_MAX_PLAYERS];/**< Array of players.*/ | |
| | | | |
| /* File recorders: */ | | /* File recorders: */ | |
| unsigned rec_cnt; /**< Number of file recorders. */ | | unsigned rec_cnt; /**< Number of file recorders. */ | |
| pjsua_file_data recorder[PJSUA_MAX_RECORDERS];/**< Array of recs.*/ | | pjsua_file_data recorder[PJSUA_MAX_RECORDERS];/**< Array of recs.*/ | |
|
| | | | |
| | | /* Video windows */ | |
| | | #if PJSUA_HAS_VIDEO | |
| | | pjsua_vid_win win[PJSUA_MAX_VID_WINS]; /**< Array of windows */ | |
| | | #endif | |
| | | | |
| | | /* Timer entry list */ | |
| | | pjsua_timer_list timer_list; | |
| | | pj_mutex_t *timer_mutex; | |
| }; | | }; | |
| | | | |
| extern struct pjsua_data pjsua_var; | | extern struct pjsua_data pjsua_var; | |
| | | | |
| /** | | /** | |
| * Get the instance of pjsua | | * Get the instance of pjsua | |
| */ | | */ | |
| PJ_DECL(struct pjsua_data*) pjsua_get_var(void); | | PJ_DECL(struct pjsua_data*) pjsua_get_var(void); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 369 | | skipping to change at line 490 | |
| */ | | */ | |
| typedef struct pjsua_im_data | | typedef struct pjsua_im_data | |
| { | | { | |
| pjsua_acc_id acc_id; | | pjsua_acc_id acc_id; | |
| pjsua_call_id call_id; | | pjsua_call_id call_id; | |
| pj_str_t to; | | pj_str_t to; | |
| pj_str_t body; | | pj_str_t body; | |
| void *user_data; | | void *user_data; | |
| } pjsua_im_data; | | } pjsua_im_data; | |
| | | | |
|
| | | pj_status_t pjsua_media_apply_xml_control(pjsua_call_id call_id, | |
| | | const pj_str_t *xml_st); | |
| | | | |
| /** | | /** | |
| * Duplicate IM data. | | * Duplicate IM data. | |
| */ | | */ | |
| PJ_INLINE(pjsua_im_data*) pjsua_im_data_dup(pj_pool_t *pool, | | PJ_INLINE(pjsua_im_data*) pjsua_im_data_dup(pj_pool_t *pool, | |
| const pjsua_im_data *src) | | const pjsua_im_data *src) | |
| { | | { | |
| pjsua_im_data *dst; | | pjsua_im_data *dst; | |
| | | | |
| dst = (pjsua_im_data*) pj_pool_alloc(pool, sizeof(*dst)); | | dst = (pjsua_im_data*) pj_pool_alloc(pool, sizeof(*dst)); | |
| dst->acc_id = src->acc_id; | | dst->acc_id = src->acc_id; | |
| dst->call_id = src->call_id; | | dst->call_id = src->call_id; | |
| pj_strdup_with_null(pool, &dst->to, &src->to); | | pj_strdup_with_null(pool, &dst->to, &src->to); | |
| dst->user_data = src->user_data; | | dst->user_data = src->user_data; | |
| pj_strdup_with_null(pool, &dst->body, &src->body); | | pj_strdup_with_null(pool, &dst->body, &src->body); | |
| | | | |
| return dst; | | return dst; | |
| } | | } | |
| | | | |
| #if 1 | | #if 1 | |
|
| #define PJSUA_LOCK() pj_mutex_lock(pjsua_var.mutex) | | | |
| #define PJSUA_TRY_LOCK() pj_mutex_trylock(pjsua_var.mutex) | | PJ_INLINE(void) PJSUA_LOCK() | |
| #define PJSUA_UNLOCK() pj_mutex_unlock(pjsua_var.mutex) | | { | |
| | | pj_mutex_lock(pjsua_var.mutex); | |
| | | pjsua_var.mutex_owner = pj_thread_this(); | |
| | | ++pjsua_var.mutex_nesting_level; | |
| | | } | |
| | | | |
| | | PJ_INLINE(void) PJSUA_UNLOCK() | |
| | | { | |
| | | if (--pjsua_var.mutex_nesting_level == 0) | |
| | | pjsua_var.mutex_owner = NULL; | |
| | | pj_mutex_unlock(pjsua_var.mutex); | |
| | | } | |
| | | | |
| | | PJ_INLINE(pj_status_t) PJSUA_TRY_LOCK() | |
| | | { | |
| | | pj_status_t status; | |
| | | status = pj_mutex_trylock(pjsua_var.mutex); | |
| | | if (status == PJ_SUCCESS) { | |
| | | pjsua_var.mutex_owner = pj_thread_this(); | |
| | | ++pjsua_var.mutex_nesting_level; | |
| | | } | |
| | | return status; | |
| | | } | |
| | | | |
| | | PJ_INLINE(pj_bool_t) PJSUA_LOCK_IS_LOCKED() | |
| | | { | |
| | | return pjsua_var.mutex_owner == pj_thread_this(); | |
| | | } | |
| | | | |
| #else | | #else | |
| #define PJSUA_LOCK() | | #define PJSUA_LOCK() | |
|
| #define PJSUA_TRY_LOCK() PJ_SUCCESS | | #define PJSUA_TRY_LOCK() PJ_SUCCESS | |
| #define PJSUA_UNLOCK() | | #define PJSUA_UNLOCK() | |
|
| | | #define PJSUA_LOCK_IS_LOCKED() PJ_TRUE | |
| #endif | | #endif | |
| | | | |
|
| | | /* Core */ | |
| | | void pjsua_set_state(pjsua_state new_state); | |
| | | | |
| /****** | | /****** | |
| * STUN resolution | | * STUN resolution | |
| */ | | */ | |
| /* Resolve the STUN server */ | | /* Resolve the STUN server */ | |
| pj_status_t resolve_stun_server(pj_bool_t wait); | | pj_status_t resolve_stun_server(pj_bool_t wait); | |
| | | | |
| /** | | /** | |
| * Normalize route URI (check for ";lr" and append one if it doesn't | | * Normalize route URI (check for ";lr" and append one if it doesn't | |
| * exist and pjsua_config.force_lr is set. | | * exist and pjsua_config.force_lr is set. | |
| */ | | */ | |
| | | | |
| skipping to change at line 422 | | skipping to change at line 578 | |
| pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata); | | pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata); | |
| | | | |
| /* | | /* | |
| * Media channel. | | * Media channel. | |
| */ | | */ | |
| pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, | | pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, | |
| pjsip_role_e role, | | pjsip_role_e role, | |
| int security_level, | | int security_level, | |
| pj_pool_t *tmp_pool, | | pj_pool_t *tmp_pool, | |
| const pjmedia_sdp_session *rem_sdp, | | const pjmedia_sdp_session *rem_sdp, | |
|
| int *sip_err_code); | | int *sip_err_code, | |
| | | pj_bool_t async, | |
| | | pjsua_med_tp_state_cb cb); | |
| pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id, | | pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id, | |
| pj_pool_t *pool, | | pj_pool_t *pool, | |
| const pjmedia_sdp_session *rem_sd
p, | | const pjmedia_sdp_session *rem_sd
p, | |
| pjmedia_sdp_session **p_sdp, | | pjmedia_sdp_session **p_sdp, | |
| int *sip_err_code); | | int *sip_err_code); | |
| pj_status_t pjsua_media_channel_update(pjsua_call_id call_id, | | pj_status_t pjsua_media_channel_update(pjsua_call_id call_id, | |
| const pjmedia_sdp_session *local_sdp, | | const pjmedia_sdp_session *local_sdp, | |
| const pjmedia_sdp_session *remote_sdp
); | | const pjmedia_sdp_session *remote_sdp
); | |
| pj_status_t pjsua_media_channel_deinit(pjsua_call_id call_id); | | pj_status_t pjsua_media_channel_deinit(pjsua_call_id call_id); | |
| | | | |
|
| | | pj_status_t pjsua_call_media_init(pjsua_call_media *call_med, | |
| | | pjmedia_type type, | |
| | | const pjsua_transport_config *tcfg, | |
| | | int security_level, | |
| | | int *sip_err_code, | |
| | | pj_bool_t async, | |
| | | pjsua_med_tp_state_cb cb); | |
| | | void pjsua_set_media_tp_state(pjsua_call_media *call_med, pjsua_med_tp_st t | |
| | | p_st); | |
| | | | |
| | | void pjsua_media_prov_clean_up(pjsua_call_id call_id); | |
| | | | |
| | | /* Callback to receive media events */ | |
| | | pj_status_t call_media_on_event(pjmedia_event *event, | |
| | | void *user_data); | |
| | | | |
| /** | | /** | |
| * Init presence. | | * Init presence. | |
| */ | | */ | |
| pj_status_t pjsua_pres_init(); | | pj_status_t pjsua_pres_init(); | |
| | | | |
| /* | | /* | |
| * Start presence subsystem. | | * Start presence subsystem. | |
| */ | | */ | |
| pj_status_t pjsua_pres_start(void); | | pj_status_t pjsua_pres_start(void); | |
| | | | |
| | | | |
| skipping to change at line 569 | | skipping to change at line 742 | |
| pjsip_dialog* on_dlg_forked(pjsip_dialog *first_set, pjsip_rx_data *res); | | pjsip_dialog* on_dlg_forked(pjsip_dialog *first_set, pjsip_rx_data *res); | |
| pj_status_t acquire_call(const char *title, | | pj_status_t acquire_call(const char *title, | |
| pjsua_call_id call_id, | | pjsua_call_id call_id, | |
| pjsua_call **p_call, | | pjsua_call **p_call, | |
| pjsip_dialog **p_dlg); | | pjsip_dialog **p_dlg); | |
| const char *good_number(char *buf, pj_int32_t val); | | const char *good_number(char *buf, pj_int32_t val); | |
| void print_call(const char *title, | | void print_call(const char *title, | |
| int call_id, | | int call_id, | |
| char *buf, pj_size_t size); | | char *buf, pj_size_t size); | |
| | | | |
|
| | | /* | |
| | | * Audio | |
| | | */ | |
| | | pj_status_t pjsua_aud_subsys_init(void); | |
| | | pj_status_t pjsua_aud_subsys_start(void); | |
| | | pj_status_t pjsua_aud_subsys_destroy(void); | |
| | | void pjsua_aud_stop_stream(pjsua_call_media *call_med); | |
| | | pj_status_t pjsua_aud_channel_update(pjsua_call_media *call_med, | |
| | | pj_pool_t *tmp_pool, | |
| | | pjmedia_stream_info *si, | |
| | | const pjmedia_sdp_session *local_sdp, | |
| | | const pjmedia_sdp_session *remote_sdp); | |
| | | | |
| | | /* | |
| | | * Video | |
| | | */ | |
| | | pj_status_t pjsua_vid_subsys_init(void); | |
| | | pj_status_t pjsua_vid_subsys_start(void); | |
| | | pj_status_t pjsua_vid_subsys_destroy(void); | |
| | | void pjsua_vid_stop_stream(pjsua_call_media *call_med); | |
| | | pj_status_t pjsua_vid_channel_init(pjsua_call_media *call_med); | |
| | | pj_status_t pjsua_vid_channel_update(pjsua_call_media *call_med, | |
| | | pj_pool_t *tmp_pool, | |
| | | pjmedia_vid_stream_info *si, | |
| | | const pjmedia_sdp_session *local_sdp, | |
| | | const pjmedia_sdp_session *remote_sdp); | |
| | | | |
| | | #if PJSUA_HAS_VIDEO | |
| | | PJ_DECL(void) pjsua_vid_win_reset(pjsua_vid_win_id wid); | |
| | | #else | |
| | | # define pjsua_vid_win_reset(wid) | |
| | | #endif | |
| | | | |
| PJ_END_DECL | | PJ_END_DECL | |
| | | | |
| #endif /* __PJSUA_INTERNAL_H__ */ | | #endif /* __PJSUA_INTERNAL_H__ */ | |
| | | | |
End of changes. 27 change blocks. |
| 60 lines changed or deleted | | 301 lines changed or added | |
|
| port.h | | port.h | |
|
| /* $Id: port.h 3553 2011-05-05 06:14:19Z nanang $ */ | | /* $Id: port.h 3893 2011-12-01 10:49:07Z ming $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| * along with this program; if not, write to the Free Software | | * along with this program; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A | |
| */ | | */ | |
| #ifndef __PJMEDIA_PORT_H__ | | #ifndef __PJMEDIA_PORT_H__ | |
| #define __PJMEDIA_PORT_H__ | | #define __PJMEDIA_PORT_H__ | |
| | | | |
| /** | | /** | |
| * @file port.h | | * @file port.h | |
| * @brief Port interface declaration | | * @brief Port interface declaration | |
| */ | | */ | |
|
| #include <pjmedia/types.h> | | #include <pjmedia/clock.h> | |
| | | #include <pjmedia/event.h> | |
| | | #include <pjmedia/format.h> | |
| | | #include <pjmedia/frame.h> | |
| | | #include <pjmedia/signatures.h> | |
| #include <pj/assert.h> | | #include <pj/assert.h> | |
| #include <pj/os.h> | | #include <pj/os.h> | |
| | | | |
| /** | | /** | |
| @addtogroup PJMEDIA_PORT Media Ports Framework | | @addtogroup PJMEDIA_PORT Media Ports Framework | |
| @{ | | @{ | |
| | | | |
| @section media_port_intro Media Port Concepts | | @section media_port_intro Media Port Concepts | |
| | | | |
| @subsection The Media Port | | @subsection The Media Port | |
| | | | |
| skipping to change at line 181 | | skipping to change at line 185 | |
| @subsection media_port_autom Automating Media Flow | | @subsection media_port_autom Automating Media Flow | |
| | | | |
| PJMEDIA provides few mechanisms to make media flows automatically | | PJMEDIA provides few mechanisms to make media flows automatically | |
| among media ports. This concept is described in @ref PJMEDIA_PORT_CLOCK | | among media ports. This concept is described in @ref PJMEDIA_PORT_CLOCK | |
| section. | | section. | |
| */ | | */ | |
| | | | |
| PJ_BEGIN_DECL | | PJ_BEGIN_DECL | |
| | | | |
| /** | | /** | |
|
| | | * Create 32bit port signature from ASCII characters. | |
| | | */ | |
| | | #define PJMEDIA_PORT_SIG(a,b,c,d) PJMEDIA_OBJ_SIG(a,b,c,d) | |
| | | | |
| | | /** | |
| * Port operation setting. | | * Port operation setting. | |
| */ | | */ | |
| typedef enum pjmedia_port_op | | typedef enum pjmedia_port_op | |
| { | | { | |
| /** | | /** | |
| * No change to the port TX or RX settings. | | * No change to the port TX or RX settings. | |
| */ | | */ | |
| PJMEDIA_PORT_NO_CHANGE, | | PJMEDIA_PORT_NO_CHANGE, | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 216 | | skipping to change at line 225 | |
| | | | |
| } pjmedia_port_op; | | } pjmedia_port_op; | |
| | | | |
| /** | | /** | |
| * Port info. | | * Port info. | |
| */ | | */ | |
| typedef struct pjmedia_port_info | | typedef struct pjmedia_port_info | |
| { | | { | |
| pj_str_t name; /**< Port name.
*/ | | pj_str_t name; /**< Port name.
*/ | |
| pj_uint32_t signature; /**< Port signature.
*/ | | pj_uint32_t signature; /**< Port signature.
*/ | |
|
| pjmedia_type type; /**< Media type. | | pjmedia_dir dir; /**< Port direction. | |
| */ | | */ | |
| pj_bool_t has_info; /**< Has info? | | pjmedia_format fmt; /**< Format. | |
| */ | | */ | |
| pj_bool_t need_info; /**< Need info on connect? | | | |
| */ | | | |
| unsigned pt; /**< Payload type (can be dynamic). | | | |
| */ | | | |
| pjmedia_format format; /**< Format. | | | |
| */ | | | |
| pj_str_t encoding_name; /**< Encoding name. | | | |
| */ | | | |
| 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. | | | |
| */ | | | |
| unsigned bytes_per_frame; /**< No of bytes per frame. | | | |
| */ | | | |
| } pjmedia_port_info; | | } pjmedia_port_info; | |
| | | | |
| /** | | /** | |
|
| | | * Utility to retrieve audio clock rate/sampling rate value from | |
| | | * pjmedia_port_info. | |
| | | * | |
| | | * @param pia Pointer to port info containing audio format. | |
| | | * @return Audio clock rate. | |
| | | */ | |
| | | PJ_INLINE(unsigned) PJMEDIA_PIA_SRATE(const pjmedia_port_info *pia) | |
| | | { | |
| | | pj_assert(pia->fmt.type==PJMEDIA_TYPE_AUDIO && | |
| | | pia->fmt.detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO); | |
| | | return pia->fmt.det.aud.clock_rate; | |
| | | } | |
| | | | |
| | | /** | |
| | | * Utility to retrieve audio channel count value from pjmedia_port_info. | |
| | | * | |
| | | * @param pia Pointer to port info containing audio format. | |
| | | * @return Audio channel count. | |
| | | */ | |
| | | PJ_INLINE(unsigned) PJMEDIA_PIA_CCNT(const pjmedia_port_info *pia) | |
| | | { | |
| | | pj_assert(pia->fmt.type==PJMEDIA_TYPE_AUDIO && | |
| | | pia->fmt.detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO); | |
| | | return pia->fmt.det.aud.channel_count; | |
| | | } | |
| | | | |
| | | /** | |
| | | * Utility to retrieve audio bits per sample value from pjmedia_port_info. | |
| | | * | |
| | | * @param pia Pointer to port info containing audio format. | |
| | | * @return Number of bits per sample. | |
| | | */ | |
| | | PJ_INLINE(unsigned) PJMEDIA_PIA_BITS(const pjmedia_port_info *pia) | |
| | | { | |
| | | pj_assert(pia->fmt.type==PJMEDIA_TYPE_AUDIO && | |
| | | pia->fmt.detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO); | |
| | | return pia->fmt.det.aud.bits_per_sample; | |
| | | } | |
| | | | |
| | | /** | |
| | | * Utility to retrieve audio frame interval (ptime) value from | |
| | | * pjmedia_port_info. | |
| | | * | |
| | | * @param pia Pointer to port info containing audio format. | |
| | | * @return Frame interval in msec. | |
| | | */ | |
| | | PJ_INLINE(unsigned) PJMEDIA_PIA_PTIME(const pjmedia_port_info *pia) | |
| | | { | |
| | | pj_assert(pia->fmt.type==PJMEDIA_TYPE_AUDIO && | |
| | | pia->fmt.detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO); | |
| | | return pia->fmt.det.aud.frame_time_usec / 1000; | |
| | | } | |
| | | | |
| | | /** | |
| | | * This is a utility routine to retrieve the audio samples_per_frame value | |
| | | * from port info. | |
| | | * | |
| | | * @param pia Pointer to port info containing audio format. | |
| | | * @return Samples per frame value. | |
| | | */ | |
| | | PJ_INLINE(unsigned) PJMEDIA_PIA_SPF(const pjmedia_port_info *pia) | |
| | | { | |
| | | pj_assert(pia->fmt.type==PJMEDIA_TYPE_AUDIO && | |
| | | pia->fmt.detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO); | |
| | | return PJMEDIA_AFD_SPF(&pia->fmt.det.aud); | |
| | | } | |
| | | | |
| | | /** | |
| | | * This is a utility routine to retrieve the average bitrate value | |
| | | * from port info. | |
| | | * | |
| | | * @param pia Pointer to port info containing audio format. | |
| | | * @return Bitrate, in bits per second. | |
| | | */ | |
| | | PJ_INLINE(unsigned) PJMEDIA_PIA_AVG_BPS(const pjmedia_port_info *pia) | |
| | | { | |
| | | pj_assert(pia->fmt.type==PJMEDIA_TYPE_AUDIO && | |
| | | pia->fmt.detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO); | |
| | | return pia->fmt.det.aud.avg_bps; | |
| | | } | |
| | | | |
| | | /** | |
| | | * This is a utility routine to retrieve the maximum bitrate value | |
| | | * from port info. | |
| | | * | |
| | | * @param pia Pointer to port info containing audio format. | |
| | | * @return Bitrate, in bits per second. | |
| | | */ | |
| | | PJ_INLINE(unsigned) PJMEDIA_PIA_MAX_BPS(const pjmedia_port_info *pia) | |
| | | { | |
| | | pj_assert(pia->fmt.type==PJMEDIA_TYPE_AUDIO && | |
| | | pia->fmt.detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO); | |
| | | return pia->fmt.det.aud.max_bps; | |
| | | } | |
| | | | |
| | | /** | |
| | | * This is a utility routine to retrieve the average audio frame size value | |
| | | * from pjmedia_port_info. | |
| | | * | |
| | | * @param pia Pointer to port info containing audio format. | |
| | | * @return Frame size in bytes. | |
| | | */ | |
| | | PJ_INLINE(unsigned) PJMEDIA_PIA_AVG_FSZ(const pjmedia_port_info *pia) | |
| | | { | |
| | | pj_assert(pia->fmt.type==PJMEDIA_TYPE_AUDIO && | |
| | | pia->fmt.detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO); | |
| | | return PJMEDIA_AFD_AVG_FSZ(&pia->fmt.det.aud); | |
| | | } | |
| | | | |
| | | /** | |
| | | * Utility to retrieve audio frame size from maximum bitrate from | |
| | | * pjmedia_port_info. | |
| | | * | |
| | | * @param pia Pointer to port info containing audio format. | |
| | | * @return Frame size in bytes. | |
| | | */ | |
| | | PJ_INLINE(unsigned) PJMEDIA_PIA_MAX_FSZ(const pjmedia_port_info *pia) | |
| | | { | |
| | | pj_assert(pia->fmt.type==PJMEDIA_TYPE_AUDIO && | |
| | | pia->fmt.detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO); | |
| | | return PJMEDIA_AFD_MAX_FSZ(&pia->fmt.det.aud); | |
| | | } | |
| | | | |
| | | /** | |
| * Port interface. | | * Port interface. | |
| */ | | */ | |
| typedef struct pjmedia_port | | typedef struct pjmedia_port | |
| { | | { | |
| pjmedia_port_info info; /**< Port information. */ | | pjmedia_port_info info; /**< Port information. */ | |
| | | | |
| /** Port data can be used by the port creator to attach arbitrary | | /** Port data can be used by the port creator to attach arbitrary | |
| * value to be associated with the port. | | * value to be associated with the port. | |
| */ | | */ | |
| struct port_data { | | struct port_data { | |
| void *pdata; /**< Pointer data. */ | | void *pdata; /**< Pointer data. */ | |
| long ldata; /**< Long data. */ | | long ldata; /**< Long data. */ | |
| } port_data; | | } port_data; | |
| | | | |
| /** | | /** | |
|
| | | * Get clock source. | |
| | | * This should only be called by #pjmedia_port_get_clock_src(). | |
| | | */ | |
| | | pjmedia_clock_src* (*get_clock_src)(struct pjmedia_port *this_port, | |
| | | pjmedia_dir dir); | |
| | | | |
| | | /** | |
| * Sink interface. | | * Sink interface. | |
| * This should only be called by #pjmedia_port_put_frame(). | | * This should only be called by #pjmedia_port_put_frame(). | |
| */ | | */ | |
| pj_status_t (*put_frame)(struct pjmedia_port *this_port, | | pj_status_t (*put_frame)(struct pjmedia_port *this_port, | |
|
| const pjmedia_frame *frame); | | pjmedia_frame *frame); | |
| | | | |
| /** | | /** | |
| * Source interface. | | * Source interface. | |
| * This should only be called by #pjmedia_port_get_frame(). | | * This should only be called by #pjmedia_port_get_frame(). | |
| */ | | */ | |
| pj_status_t (*get_frame)(struct pjmedia_port *this_port, | | pj_status_t (*get_frame)(struct pjmedia_port *this_port, | |
| pjmedia_frame *frame); | | pjmedia_frame *frame); | |
| | | | |
| /** | | /** | |
| * Called to destroy this port. | | * Called to destroy this port. | |
| | | | |
| skipping to change at line 288 | | skipping to change at line 419 | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_port_info_init( pjmedia_port_info *info, | | PJ_DECL(pj_status_t) pjmedia_port_info_init( pjmedia_port_info *info, | |
| const pj_str_t *name, | | const pj_str_t *name, | |
| unsigned signature, | | unsigned signature, | |
| unsigned clock_rate, | | unsigned clock_rate, | |
| unsigned channel_count, | | unsigned channel_count, | |
| unsigned bits_per_sample, | | unsigned bits_per_sample, | |
| unsigned samples_per_frame); | | unsigned samples_per_frame); | |
| | | | |
| /** | | /** | |
|
| | | * This is an auxiliary function to initialize port info for | |
| | | * ports which deal with PCM audio. | |
| | | * | |
| | | * @param info The port info to be initialized. | |
| | | * @param name Port name. | |
| | | * @param signature Port signature. | |
| | | * @param dir Port's direction. | |
| | | * @param fmt Port's media format. | |
| | | * | |
| | | * @return PJ_SUCCESS on success. | |
| | | */ | |
| | | PJ_DECL(pj_status_t) pjmedia_port_info_init2(pjmedia_port_info *info, | |
| | | const pj_str_t *name, | |
| | | unsigned signature, | |
| | | pjmedia_dir dir, | |
| | | const pjmedia_format *fmt); | |
| | | | |
| | | /** | |
| | | * Get a clock source from the port. | |
| | | * | |
| | | * @param port The media port. | |
| | | * @param dir Media port's direction. | |
| | | * | |
| | | * @return The clock source or NULL if clock source is not present | |
| | | * in the port. | |
| | | */ | |
| | | PJ_DECL(pjmedia_clock_src *) pjmedia_port_get_clock_src( pjmedia_port *port | |
| | | , | |
| | | pjmedia_dir dir ); | |
| | | | |
| | | /** | |
| * Get a frame from the port (and subsequent downstream ports). | | * Get a frame from the port (and subsequent downstream ports). | |
| * | | * | |
| * @param port The media port. | | * @param port The media port. | |
| * @param frame Frame to store samples. | | * @param frame Frame to store samples. | |
| * | | * | |
| * @return PJ_SUCCESS on success, or the appropriate error code. | | * @return PJ_SUCCESS on success, or the appropriate error code. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_port_get_frame( pjmedia_port *port, | | PJ_DECL(pj_status_t) pjmedia_port_get_frame( pjmedia_port *port, | |
| pjmedia_frame *frame ); | | pjmedia_frame *frame ); | |
| | | | |
| /** | | /** | |
| * Put a frame to the port (and subsequent downstream ports). | | * Put a frame to the port (and subsequent downstream ports). | |
| * | | * | |
| * @param port The media port. | | * @param port The media port. | |
| * @param frame Frame to the put to the port. | | * @param frame Frame to the put to the port. | |
| * | | * | |
| * @return PJ_SUCCESS on success, or the appropriate error code. | | * @return PJ_SUCCESS on success, or the appropriate error code. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_port_put_frame( pjmedia_port *port, | | PJ_DECL(pj_status_t) pjmedia_port_put_frame( pjmedia_port *port, | |
|
| const pjmedia_frame *frame ); | | pjmedia_frame *frame ); | |
| | | | |
| /** | | /** | |
| * Destroy port (and subsequent downstream ports) | | * Destroy port (and subsequent downstream ports) | |
| * | | * | |
| * @param port The media port. | | * @param port The media port. | |
| * | | * | |
| * @return PJ_SUCCESS on success, or the appropriate error code. | | * @return PJ_SUCCESS on success, or the appropriate error code. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_port_destroy( pjmedia_port *port ); | | PJ_DECL(pj_status_t) pjmedia_port_destroy( pjmedia_port *port ); | |
| | | | |
| | | | |
End of changes. 9 change blocks. |
| 26 lines changed or deleted | | 179 lines changed or added | |
|
| sdp.h | | sdp.h | |
|
| /* $Id: sdp.h 3553 2011-05-05 06:14:19Z nanang $ */ | | /* $Id: sdp.h 3945 2012-01-27 09:12:59Z nanang $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A | |
| */ | | */ | |
| #ifndef __PJMEDIA_SDP_H__ | | #ifndef __PJMEDIA_SDP_H__ | |
| #define __PJMEDIA_SDP_H__ | | #define __PJMEDIA_SDP_H__ | |
| | | | |
| /** | | /** | |
| * @file sdp.h | | * @file sdp.h | |
| * @brief SDP header file. | | * @brief SDP header file. | |
| */ | | */ | |
| #include <pjmedia/types.h> | | #include <pjmedia/types.h> | |
|
| | | #include <pj/sock.h> | |
| | | | |
| /** | | /** | |
| * @defgroup PJMEDIA_SDP SDP Parsing and Data Structure | | * @defgroup PJMEDIA_SDP SDP Parsing and Data Structure | |
| * @ingroup PJMEDIA_SESSION | | * @ingroup PJMEDIA_SESSION | |
| * @brief SDP data structure representation and parsing | | * @brief SDP data structure representation and parsing | |
| * @{ | | * @{ | |
| * | | * | |
| * The basic SDP session descriptor and elements are described in header | | * The basic SDP session descriptor and elements are described in header | |
| * file <b><pjmedia/sdp.h></b>. This file contains declaration for | | * file <b><pjmedia/sdp.h></b>. This file contains declaration for | |
| * SDP session descriptor and SDP media descriptor, along with their | | * SDP session descriptor and SDP media descriptor, along with their | |
| | | | |
| skipping to change at line 269 | | skipping to change at line 270 | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) | | PJ_DECL(pj_status_t) | |
| pjmedia_sdp_rtpmap_to_attr( pj_pool_t *pool, | | pjmedia_sdp_rtpmap_to_attr( pj_pool_t *pool, | |
| const pjmedia_sdp_rtpmap *rtpmap, | | const pjmedia_sdp_rtpmap *rtpmap, | |
| pjmedia_sdp_attr **p_attr); | | pjmedia_sdp_attr **p_attr); | |
| | | | |
| /** | | /** | |
| * This structure describes SDP \a fmtp attribute. | | * This structure describes SDP \a fmtp attribute. | |
| */ | | */ | |
|
| struct pjmedia_sdp_fmtp | | typedef struct pjmedia_sdp_fmtp | |
| { | | { | |
| pj_str_t fmt; /**< Format type. */ | | pj_str_t fmt; /**< Format type. */ | |
| pj_str_t fmt_param; /**< Format specific parameter. */ | | pj_str_t fmt_param; /**< Format specific parameter. */ | |
|
| }; | | } pjmedia_sdp_fmtp; | |
| | | | |
| /** | | | |
| * @see pjmedia_sdp_fmtp | | | |
| */ | | | |
| typedef struct pjmedia_sdp_fmtp pjmedia_sdp_fmtp; | | | |
| | | | |
| /** | | /** | |
| * Get the fmtp representation of the same SDP attribute. | | * Get the fmtp representation of the same SDP attribute. | |
| * | | * | |
| * @param attr Generic attribute to be converted to fmtp, which | | * @param attr Generic attribute to be converted to fmtp, which | |
| * name must be "fmtp". | | * name must be "fmtp". | |
| * @param fmtp SDP fmtp attribute to be initialized. | | * @param fmtp SDP fmtp attribute to be initialized. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| | | | |
| skipping to change at line 357 | | skipping to change at line 353 | |
| * Clone connection info. | | * Clone connection info. | |
| * | | * | |
| * @param pool Pool to allocate memory for the new connection info. | | * @param pool Pool to allocate memory for the new connection info. | |
| * @param rhs The connection into to clone. | | * @param rhs The connection into to clone. | |
| * | | * | |
| * @return The new connection info. | | * @return The new connection info. | |
| */ | | */ | |
| PJ_DECL(pjmedia_sdp_conn*) pjmedia_sdp_conn_clone(pj_pool_t *pool, | | PJ_DECL(pjmedia_sdp_conn*) pjmedia_sdp_conn_clone(pj_pool_t *pool, | |
| const pjmedia_sdp_conn *rh
s); | | const pjmedia_sdp_conn *rh
s); | |
| | | | |
|
| | | /** | |
| | | * Compare connection info. | |
| | | * | |
| | | * @param conn1 The first connection info to compare. | |
| | | * @param conn1 The second connection info to compare. | |
| | | * @param option Comparison option, which should be zero for now. | |
| | | * | |
| | | * @return PJ_SUCCESS when both connection info are equal, otherwis | |
| | | e | |
| | | * returns PJMEDIA_SDP_ECONNNOTEQUAL. | |
| | | */ | |
| | | PJ_DECL(pj_status_t) pjmedia_sdp_conn_cmp(const pjmedia_sdp_conn *conn1, | |
| | | const pjmedia_sdp_conn *conn2, | |
| | | unsigned option); | |
| | | | |
| /* ************************************************************************
** | | /* ************************************************************************
** | |
| * SDP BANDWIDTH INFO | | * SDP BANDWIDTH INFO | |
| **************************************************************************
** | | **************************************************************************
** | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * This structure describes SDP bandwidth info ("b=" line). | | * This structure describes SDP bandwidth info ("b=" line). | |
| */ | | */ | |
| typedef struct pjmedia_sdp_bandw | | typedef struct pjmedia_sdp_bandw | |
| { | | { | |
| | | | |
| skipping to change at line 576 | | skipping to change at line 586 | |
| struct | | struct | |
| { | | { | |
| pj_str_t user; /**< User */ | | pj_str_t user; /**< User */ | |
| pj_uint32_t id; /**< Session ID */ | | pj_uint32_t id; /**< Session ID */ | |
| pj_uint32_t version; /**< Session version */ | | pj_uint32_t version; /**< Session version */ | |
| pj_str_t net_type; /**< Network type ("IN") */ | | pj_str_t net_type; /**< Network type ("IN") */ | |
| pj_str_t addr_type; /**< Address type ("IP4", "IP6") */ | | pj_str_t addr_type; /**< Address type ("IP4", "IP6") */ | |
| pj_str_t addr; /**< The address. */ | | pj_str_t addr; /**< The address. */ | |
| } origin; | | } origin; | |
| | | | |
|
| pj_str_t name; /**< Subject line (s=) */ | | pj_str_t name; /**< Subject line (s=) */ | |
| pjmedia_sdp_conn *conn; /**< Connection line (c=) */ | | pjmedia_sdp_conn *conn; /**< Connection line (c=) */ | |
| | | unsigned bandw_count; /**< Number of bandwidth info (b=) */ | |
| | | pjmedia_sdp_bandw *bandw[PJMEDIA_MAX_SDP_BANDW]; | |
| | | /**< Bandwidth info array (b=) */ | |
| | | | |
| /** Session time (t= line) */ | | /** Session time (t= line) */ | |
| struct | | struct | |
| { | | { | |
| pj_uint32_t start; /**< Start time. */ | | pj_uint32_t start; /**< Start time. */ | |
| pj_uint32_t stop; /**< Stop time. */ | | pj_uint32_t stop; /**< Stop time. */ | |
| } time; | | } time; | |
| | | | |
| unsigned attr_count; /**< Number of attributes.
*/ | | unsigned attr_count; /**< Number of attributes.
*/ | |
| pjmedia_sdp_attr *attr[PJMEDIA_MAX_SDP_ATTR]; /**< Attributes array.
*/ | | pjmedia_sdp_attr *attr[PJMEDIA_MAX_SDP_ATTR]; /**< Attributes array.
*/ | |
| | | | |
End of changes. 6 change blocks. |
| 10 lines changed or deleted | | 24 lines changed or added | |
|
| sdp_neg.h | | sdp_neg.h | |
|
| /* $Id: sdp_neg.h 3553 2011-05-05 06:14:19Z nanang $ */ | | /* $Id: sdp_neg.h 3664 2011-07-19 03:42:28Z nanang $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 649 | | skipping to change at line 649 | |
| * @param allow_asym Should be zero. | | * @param allow_asym Should be zero. | |
| * | | * | |
| * @return PJ_SUCCESS when there is at least one media | | * @return PJ_SUCCESS when there is at least one media | |
| * is actuve common in both offer and answer, or | | * is actuve common in both offer and answer, or | |
| * failure code when negotiation has failed. | | * failure code when negotiation has failed. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_sdp_neg_negotiate( pj_pool_t *pool, | | PJ_DECL(pj_status_t) pjmedia_sdp_neg_negotiate( pj_pool_t *pool, | |
| pjmedia_sdp_neg *neg, | | pjmedia_sdp_neg *neg, | |
| pj_bool_t allow_asym); | | pj_bool_t allow_asym); | |
| | | | |
|
| | | /** | |
| | | * Enumeration of customized SDP format matching option flags. See | |
| | | * #pjmedia_sdp_neg_register_fmt_match_cb() for more info. | |
| | | */ | |
| | | typedef enum pjmedia_sdp_neg_fmt_match_flag | |
| | | { | |
| | | /** | |
| | | * In generating answer, the SDP fmtp in the answer candidate may need | |
| | | * to be modified by the customized SDP format matching callback to | |
| | | * achieve flexible SDP negotiation, e.g: AMR fmtp 'octet-align' field | |
| | | * can be adjusted with the offer when the codec implementation support | |
| | | * both packetization modes octet-aligned and bandwidth-efficient. | |
| | | */ | |
| | | PJMEDIA_SDP_NEG_FMT_MATCH_ALLOW_MODIFY_ANSWER = 1, | |
| | | | |
| | | } pjmedia_sdp_neg_fmt_match_flag; | |
| | | | |
| | | /** | |
| | | * The declaration of customized SDP format matching callback. See | |
| | | * #pjmedia_sdp_neg_register_fmt_match_cb() for more info. | |
| | | * | |
| | | * @param pool The memory pool. | |
| | | * @param offer The SDP media offer. | |
| | | * @param o_fmt_idx Index of the format in the SDP media offer. | |
| | | * @param answer The SDP media answer. | |
| | | * @param a_fmt_idx Index of the format in the SDP media answer. | |
| | | * @param option The format matching option, see | |
| | | * #pjmedia_sdp_neg_fmt_match_flag. | |
| | | * | |
| | | * @return PJ_SUCCESS when the formats in offer and answer matc | |
| | | h. | |
| | | */ | |
| | | typedef pj_status_t (*pjmedia_sdp_neg_fmt_match_cb)(pj_pool_t *pool, | |
| | | pjmedia_sdp_media *offer | |
| | | , | |
| | | unsigned o_fmt_idx, | |
| | | pjmedia_sdp_media *answe | |
| | | r, | |
| | | unsigned a_fmt_idx, | |
| | | unsigned option); | |
| | | | |
| | | /** | |
| | | * Register customized SDP format matching callback function for the specif | |
| | | ied | |
| | | * format. The customized SDP format matching is needed when the format | |
| | | * identification in a media stream session cannot be simply determined by | |
| | | * encoding name and clock rate, but also involves one or more format speci | |
| | | fic | |
| | | * parameters, which are specified in SDP fmtp attribute. For example, | |
| | | * an H.264 video stream is also identified by profile, level, and | |
| | | * packetization-mode parameters. As those parameters are format specifics, | |
| | | * the negotiation must be done by the format or codec implementation. | |
| | | * | |
| | | * To unregister the callback of specific format, just call this function w | |
| | | ith | |
| | | * parameter #cb set to NULL. | |
| | | * | |
| | | * @param fmt_name The format name, e.g: "H.264", "AMR", "G7221". Note | |
| | | * that the string buffer must remain valid until the | |
| | | * callback is unregistered. | |
| | | * @param cb The customized SDP format negotiation callback or | |
| | | * NULL to unregister the specified format callback. | |
| | | * | |
| | | * @return PJ_SUCCESS on success. | |
| | | */ | |
| | | PJ_DECL(pj_status_t) pjmedia_sdp_neg_register_fmt_match_cb( | |
| | | const pj_str_t *fmt_name, | |
| | | pjmedia_sdp_neg_fmt_match_cb cb); | |
| | | | |
| | | /** | |
| | | * Match format in the SDP media offer and answer. The matching mechanism | |
| | | * will be done by comparing the encoding name and clock rate, and if the | |
| | | * custom format matching callback for the specified format is registered, | |
| | | * see #pjmedia_sdp_neg_register_fmt_match_cb(), it will be called for more | |
| | | * detail verification, e.g: format parameters specified in SDP fmtp. | |
| | | * | |
| | | * @param pool The memory pool. | |
| | | * @param offer The SDP media offer. | |
| | | * @param o_fmt_idx Index of the format in the SDP media offer. | |
| | | * @param answer The SDP media answer. | |
| | | * @param a_fmt_idx Index of the format in the SDP media answer. | |
| | | * @param option The format matching option, see | |
| | | * #pjmedia_sdp_neg_fmt_match_flag. | |
| | | * | |
| | | * @return PJ_SUCCESS when the formats in offer and answer matc | |
| | | h. | |
| | | */ | |
| | | PJ_DECL(pj_status_t) pjmedia_sdp_neg_fmt_match( pj_pool_t *pool, | |
| | | pjmedia_sdp_media *offer, | |
| | | unsigned o_fmt_idx, | |
| | | pjmedia_sdp_media *answer, | |
| | | unsigned a_fmt_idx, | |
| | | unsigned option); | |
| | | | |
| PJ_END_DECL | | PJ_END_DECL | |
| | | | |
| /** | | /** | |
| * @} | | * @} | |
| */ | | */ | |
| | | | |
| #endif /* __PJMEDIA_SDP_NEG_H__ */ | | #endif /* __PJMEDIA_SDP_NEG_H__ */ | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 95 lines changed or added | |
|
| stream.h | | stream.h | |
|
| /* $Id: stream.h 3571 2011-05-19 08:05:23Z ming $ */ | | /* $Id: stream.h 3841 2011-10-24 09:28:13Z ming $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| * @file stream.h | | * @file stream.h | |
| * @brief Media Stream. | | * @brief Media Stream. | |
| */ | | */ | |
| | | | |
| #include <pjmedia/codec.h> | | #include <pjmedia/codec.h> | |
| #include <pjmedia/endpoint.h> | | #include <pjmedia/endpoint.h> | |
| #include <pjmedia/jbuf.h> | | #include <pjmedia/jbuf.h> | |
| #include <pjmedia/port.h> | | #include <pjmedia/port.h> | |
| #include <pjmedia/rtcp.h> | | #include <pjmedia/rtcp.h> | |
| #include <pjmedia/transport.h> | | #include <pjmedia/transport.h> | |
|
| | | #include <pjmedia/vid_codec.h> | |
| #include <pj/sock.h> | | #include <pj/sock.h> | |
| | | | |
| PJ_BEGIN_DECL | | PJ_BEGIN_DECL | |
| | | | |
| /** | | /** | |
| * @defgroup PJMED_STRM Streams | | * @defgroup PJMED_STRM Streams | |
| * @ingroup PJMEDIA_PORT | | * @ingroup PJMEDIA_PORT | |
| * @brief Communicating with remote peer via the network | | * @brief Communicating with remote peer via the network | |
| * @{ | | * @{ | |
| * | | * | |
| | | | |
| skipping to change at line 88 | | skipping to change at line 89 | |
| * Media channel is unidirectional flow of media from sender to | | * Media channel is unidirectional flow of media from sender to | |
| * receiver. | | * receiver. | |
| */ | | */ | |
| typedef struct pjmedia_channel pjmedia_channel; | | typedef struct pjmedia_channel pjmedia_channel; | |
| | | | |
| /** | | /** | |
| * This structure describes media stream information. Each media stream | | * This structure describes media stream information. Each media stream | |
| * corresponds to one "m=" line in SDP session descriptor, and it has | | * corresponds to one "m=" line in SDP session descriptor, and it has | |
| * its own RTP/RTCP socket pair. | | * its own RTP/RTCP socket pair. | |
| */ | | */ | |
|
| struct pjmedia_stream_info | | typedef struct pjmedia_stream_info | |
| { | | { | |
| pjmedia_type type; /**< Media type (audio, video)
*/ | | pjmedia_type type; /**< Media type (audio, video)
*/ | |
| pjmedia_tp_proto proto; /**< Transport protocol (RTP/AVP, etc.)
*/ | | pjmedia_tp_proto proto; /**< Transport protocol (RTP/AVP, etc.)
*/ | |
| pjmedia_dir dir; /**< Media direction.
*/ | | pjmedia_dir dir; /**< Media direction.
*/ | |
| pj_sockaddr rem_addr; /**< Remote RTP address
*/ | | pj_sockaddr rem_addr; /**< Remote RTP address
*/ | |
| pj_sockaddr rem_rtcp; /**< Optional remote RTCP addres
s. If | | pj_sockaddr rem_rtcp; /**< Optional remote RTCP addres
s. If | |
| sin_family is zero, the RTP address | | sin_family is zero, the RTP address | |
| will be calculated from RTP.
*/ | | will be calculated from RTP.
*/ | |
| #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0) | | #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0) | |
| pj_bool_t rtcp_xr_enabled; | | pj_bool_t rtcp_xr_enabled; | |
| | | | |
| skipping to change at line 110 | | skipping to change at line 111 | |
| pj_uint32_t rtcp_xr_interval; /**< RTCP XR interval.
*/ | | pj_uint32_t rtcp_xr_interval; /**< RTCP XR interval.
*/ | |
| pj_sockaddr rtcp_xr_dest;/**<Additional remote RTCP XR a
ddress. | | pj_sockaddr rtcp_xr_dest;/**<Additional remote RTCP XR a
ddress. | |
| This is useful for third-party (e.g
: | | This is useful for third-party (e.g
: | |
| network monitor) to monitor the | | network monitor) to monitor the | |
| stream. If sin_family is zero, | | stream. If sin_family is zero, | |
| this will be ignored.
*/ | | this will be ignored.
*/ | |
| #endif | | #endif | |
| pjmedia_codec_info fmt; /**< Incoming codec format info.
*/ | | pjmedia_codec_info fmt; /**< Incoming codec format info.
*/ | |
| pjmedia_codec_param *param; /**< Optional codec param.
*/ | | pjmedia_codec_param *param; /**< Optional codec param.
*/ | |
| unsigned tx_pt; /**< Outgoing codec paylaod type.
*/ | | unsigned tx_pt; /**< Outgoing codec paylaod type.
*/ | |
|
| | | unsigned rx_pt; /**< Incoming codec paylaod type.
*/ | |
| unsigned tx_maxptime;/**< Outgoing codec max ptime.
*/ | | unsigned tx_maxptime;/**< Outgoing codec max ptime.
*/ | |
| int tx_event_pt;/**< Outgoing pt for telephone-e
vents. */ | | int tx_event_pt;/**< Outgoing pt for telephone-e
vents. */ | |
| int rx_event_pt;/**< Incoming pt for telephone-e
vents. */ | | int rx_event_pt;/**< Incoming pt for telephone-e
vents. */ | |
| pj_uint32_t ssrc; /**< RTP SSRC.
*/ | | pj_uint32_t ssrc; /**< RTP SSRC.
*/ | |
| pj_uint32_t rtp_ts; /**< Initial RTP timestamp.
*/ | | pj_uint32_t rtp_ts; /**< Initial RTP timestamp.
*/ | |
| pj_uint16_t rtp_seq; /**< Initial RTP sequence number
. */ | | pj_uint16_t rtp_seq; /**< Initial RTP sequence number
. */ | |
| pj_uint8_t rtp_seq_ts_set; | | pj_uint8_t rtp_seq_ts_set; | |
| /**< Bitmask flags if initial RTP sequen
ce | | /**< Bitmask flags if initial RTP sequen
ce | |
| and/or timestamp for sender are set
. | | and/or timestamp for sender are set
. | |
| bit 0/LSB : sequence flag | | bit 0/LSB : sequence flag | |
| | | | |
| skipping to change at line 137 | | skipping to change at line 139 | |
| int jb_max; /**< Jitter buffer max delay in
msec. */ | | int jb_max; /**< Jitter buffer max delay in
msec. */ | |
| | | | |
| #if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA!=0 | | #if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA!=0 | |
| pj_bool_t use_ka; /**< Stream keep-alive and NAT hole punc
h | | pj_bool_t use_ka; /**< Stream keep-alive and NAT hole punc
h | |
| (see #PJMEDIA_STREAM_ENABLE_KA) | | (see #PJMEDIA_STREAM_ENABLE_KA) | |
| is enabled?
*/ | | is enabled?
*/ | |
| #endif | | #endif | |
| pj_bool_t rtcp_sdes_bye_disabled; | | pj_bool_t rtcp_sdes_bye_disabled; | |
| /**< Disable automatic sending of RTCP | | /**< Disable automatic sending of RTCP | |
| SDES and BYE.
*/ | | SDES and BYE.
*/ | |
|
| }; | | } pjmedia_stream_info; | |
| | | | |
| /** | | /** | |
|
| * @see pjmedia_stream_info. | | * This function will initialize the stream info based on information | |
| */ | | * in both SDP session descriptors for the specified stream index. | |
| typedef struct pjmedia_stream_info pjmedia_stream_info; | | * The remaining information will be taken from default codec parameters. | |
| | | * If socket info array is specified, the socket will be copied to the | |
| | | * session info as well. | |
| | | * | |
| | | * @param si Stream info structure to be initialized. | |
| | | * @param pool Pool to allocate memory. | |
| | | * @param endpt PJMEDIA endpoint instance. | |
| | | * @param local Local SDP session descriptor. | |
| | | * @param remote Remote SDP session descriptor. | |
| | | * @param stream_idx Media stream index in the session descriptor. | |
| | | * | |
| | | * @return PJ_SUCCESS if stream info is successfully initialize | |
| | | d. | |
| | | */ | |
| | | PJ_DECL(pj_status_t) | |
| | | pjmedia_stream_info_from_sdp( pjmedia_stream_info *si, | |
| | | pj_pool_t *pool, | |
| | | pjmedia_endpt *endpt, | |
| | | const pjmedia_sdp_session *local, | |
| | | const pjmedia_sdp_session *remote, | |
| | | unsigned stream_idx); | |
| | | | |
| /** | | /** | |
| * Create a media stream based on the specified parameter. After the stream | | * Create a media stream based on the specified parameter. After the stream | |
| * has been created, application normally would want to get the media port | | * has been created, application normally would want to get the media port | |
| * interface of the streams, by calling pjmedia_stream_get_port(). The | | * interface of the streams, by calling pjmedia_stream_get_port(). The | |
| * media port interface exports put_frame() and get_frame() function, used | | * media port interface exports put_frame() and get_frame() function, used | |
| * to transmit and receive media frames from the stream. | | * to transmit and receive media frames from the stream. | |
| * | | * | |
| * Without application calling put_frame() and get_frame(), there will be | | * Without application calling put_frame() and get_frame(), there will be | |
| * no media frames transmitted or received by the stream. | | * no media frames transmitted or received by the stream. | |
| | | | |
| skipping to change at line 227 | | skipping to change at line 248 | |
| * in the media stream, depending on the media direction that was set | | * in the media stream, depending on the media direction that was set | |
| * when the stream was created. | | * when the stream was created. | |
| * | | * | |
| * @param stream The media stream. | | * @param stream The media stream. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_stream_start(pjmedia_stream *stream); | | PJ_DECL(pj_status_t) pjmedia_stream_start(pjmedia_stream *stream); | |
| | | | |
| /** | | /** | |
|
| | | * Get the stream info. | |
| | | * | |
| | | * @param stream The media stream. | |
| | | * @param info Stream info. | |
| | | * | |
| | | * @return PJ_SUCCESS on success. | |
| | | */ | |
| | | PJ_DECL(pj_status_t) pjmedia_stream_get_info( const pjmedia_stream *stream, | |
| | | pjmedia_stream_info *info); | |
| | | | |
| | | /** | |
| * Get the stream statistics. See also | | * Get the stream statistics. See also | |
| * #pjmedia_stream_get_stat_jbuf() | | * #pjmedia_stream_get_stat_jbuf() | |
| * | | * | |
| * @param stream The media stream. | | * @param stream The media stream. | |
| * @param stat Media stream statistics. | | * @param stat Media stream statistics. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_stream_get_stat( const pjmedia_stream *stream, | | PJ_DECL(pj_status_t) pjmedia_stream_get_stat( const pjmedia_stream *stream, | |
| pjmedia_rtcp_stat *stat); | | pjmedia_rtcp_stat *stat); | |
| | | | |
End of changes. 7 change blocks. |
| 6 lines changed or deleted | | 39 lines changed or added | |
|
| transport.h | | transport.h | |
|
| /* $Id: transport.h 4346 2013-02-13 08:20:33Z nanang $ */ | | /* $Id: transport.h 3664 2011-07-19 03:42:28Z nanang $ */ | |
| /* | | /* | |
| * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |
| * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * 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 | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| #ifndef __PJMEDIA_TRANSPORT_H__ | | #ifndef __PJMEDIA_TRANSPORT_H__ | |
| #define __PJMEDIA_TRANSPORT_H__ | | #define __PJMEDIA_TRANSPORT_H__ | |
| | | | |
| /** | | /** | |
| * @file transport.h Media Transport Interface | | * @file transport.h Media Transport Interface | |
| * @brief Transport interface. | | * @brief Transport interface. | |
| */ | | */ | |
| | | | |
| #include <pjmedia/types.h> | | #include <pjmedia/types.h> | |
| #include <pjmedia/errno.h> | | #include <pjmedia/errno.h> | |
|
| | | #include <pj/string.h> | |
| | | | |
| /** | | /** | |
| * @defgroup PJMEDIA_TRANSPORT Media Transport | | * @defgroup PJMEDIA_TRANSPORT Media Transport | |
| * @brief Transports. | | * @brief Transports. | |
| * @{ | | * @{ | |
| * The media transport (#pjmedia_transport) is the object to send and | | * The media transport (#pjmedia_transport) is the object to send and | |
| * receive media packets over the network. The media transport interface | | * receive media packets over the network. The media transport interface | |
| * allows the library to be extended to support different types of | | * allows the library to be extended to support different types of | |
| * transports to send and receive packets. | | * transports to send and receive packets. | |
| * | | * | |
| | | | |
| skipping to change at line 255 | | skipping to change at line 256 | |
| * transport validation, this is useful when transport is stacked with | | * transport validation, this is useful when transport is stacked with | |
| * other transport, for example when transport UDP is stacked under | | * other transport, for example when transport UDP is stacked under | |
| * transport SRTP, media transport validation only need to be done by | | * transport SRTP, media transport validation only need to be done by | |
| * transport SRTP. | | * transport SRTP. | |
| */ | | */ | |
| PJMEDIA_TPMED_NO_TRANSPORT_CHECKING = 1 | | PJMEDIA_TPMED_NO_TRANSPORT_CHECKING = 1 | |
| | | | |
| } pjmedia_tranport_media_option; | | } pjmedia_tranport_media_option; | |
| | | | |
| /** | | /** | |
|
| | | * Media socket info is used to describe the underlying sockets | |
| | | * to be used as media transport. | |
| | | */ | |
| | | typedef struct pjmedia_sock_info | |
| | | { | |
| | | /** The RTP socket handle */ | |
| | | pj_sock_t rtp_sock; | |
| | | | |
| | | /** Address to be advertised as the local address for the RTP | |
| | | * socket, which does not need to be equal as the bound | |
| | | * address (for example, this address can be the address resolved | |
| | | * with STUN). | |
| | | */ | |
| | | pj_sockaddr rtp_addr_name; | |
| | | | |
| | | /** The RTCP socket handle. */ | |
| | | pj_sock_t rtcp_sock; | |
| | | | |
| | | /** Address to be advertised as the local address for the RTCP | |
| | | * socket, which does not need to be equal as the bound | |
| | | * address (for example, this address can be the address resolved | |
| | | * with STUN). | |
| | | */ | |
| | | pj_sockaddr rtcp_addr_name; | |
| | | | |
| | | } pjmedia_sock_info; | |
| | | | |
| | | /** | |
| * This structure describes the operations for the stream transport. | | * This structure describes the operations for the stream transport. | |
| */ | | */ | |
| struct pjmedia_transport_op | | struct pjmedia_transport_op | |
| { | | { | |
| /** | | /** | |
| * Get media socket info from the specified transport. | | * Get media socket info from the specified transport. | |
| * | | * | |
| * Application should call #pjmedia_transport_get_info() instead | | * Application should call #pjmedia_transport_get_info() instead | |
| */ | | */ | |
| pj_status_t (*get_info)(pjmedia_transport *tp, | | pj_status_t (*get_info)(pjmedia_transport *tp, | |
| | | | |
| skipping to change at line 448 | | skipping to change at line 477 | |
| struct pjmedia_transport | | struct pjmedia_transport | |
| { | | { | |
| /** Transport name (for logging purpose). */ | | /** Transport name (for logging purpose). */ | |
| char name[PJ_MAX_OBJ_NAME]; | | char name[PJ_MAX_OBJ_NAME]; | |
| | | | |
| /** Transport type. */ | | /** Transport type. */ | |
| pjmedia_transport_type type; | | pjmedia_transport_type type; | |
| | | | |
| /** Transport's "virtual" function table. */ | | /** Transport's "virtual" function table. */ | |
| pjmedia_transport_op *op; | | pjmedia_transport_op *op; | |
|
| | | | |
| | | /** Application/user data */ | |
| | | void *user_data; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * This structure describes storage buffer of transport specific info. | | * This structure describes storage buffer of transport specific info. | |
| * The actual transport specific info contents will be defined by transport | | * The actual transport specific info contents will be defined by transport | |
| * implementation. Note that some transport implementations do not need to | | * implementation. Note that some transport implementations do not need to | |
| * provide specific info, since the general socket info is enough. | | * provide specific info, since the general socket info is enough. | |
| */ | | */ | |
| typedef struct pjmedia_transport_specific_info | | typedef struct pjmedia_transport_specific_info | |
| { | | { | |
| | | | |
| skipping to change at line 525 | | skipping to change at line 557 | |
| info->specific_info_cnt = 0; | | info->specific_info_cnt = 0; | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Get media transport info from the specified transport and all underlying | | * Get media transport info from the specified transport and all underlying | |
| * transports if any. The transport also contains information about socket
info | | * transports if any. The transport also contains information about socket
info | |
| * which describes the local address of the transport, and would be needed | | * which describes the local address of the transport, and would be needed | |
| * for example to fill in the "c=" and "m=" line of local SDP. | | * for example to fill in the "c=" and "m=" line of local SDP. | |
| * | | * | |
| * @param tp The transport. | | * @param tp The transport. | |
|
| * @param info Media transport info to be initialized. | | * @param info Media socket info to be initialized. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| PJ_INLINE(pj_status_t) pjmedia_transport_get_info(pjmedia_transport *tp, | | PJ_INLINE(pj_status_t) pjmedia_transport_get_info(pjmedia_transport *tp, | |
| pjmedia_transport_info *in
fo) | | pjmedia_transport_info *in
fo) | |
| { | | { | |
| if (tp && tp->op && tp->op->get_info) | | if (tp && tp->op && tp->op->get_info) | |
| return (*tp->op->get_info)(tp, info); | | return (*tp->op->get_info)(tp, info); | |
| | | | |
| return PJ_ENOTSUP; | | return PJ_ENOTSUP; | |
| } | | } | |
| | | | |
| /** | | /** | |
|
| * Utility API to get transport type specific info from the specified media | | | |
| * transport info. | | | |
| * | | | |
| * @param info Media transport info. | | | |
| * @param type Media transport type. | | | |
| * | | | |
| * @return Pointer to media transport specific info, or NULL if | | | |
| * specific info for the transport type is not found. | | | |
| */ | | | |
| PJ_INLINE(void*) pjmedia_transport_info_get_spc_info( | | | |
| pjmedia_transport_info *info | | | |
| , | | | |
| pjmedia_transport_type type) | | | |
| { | | | |
| unsigned i; | | | |
| for (i = 0; i < info->specific_info_cnt; ++i) { | | | |
| if (info->spc_info[i].type == type) | | | |
| return (void*)info->spc_info[i].buffer; | | | |
| } | | | |
| return NULL; | | | |
| } | | | |
| | | | |
| /** | | | |
| * Attach callbacks to be called on receipt of incoming RTP/RTCP packets. | | * Attach callbacks to be called on receipt of incoming RTP/RTCP packets. | |
| * This is just a simple wrapper which calls <tt>attach()</tt> member of | | * This is just a simple wrapper which calls <tt>attach()</tt> member of | |
| * the transport. | | * the transport. | |
| * | | * | |
| * @param tp The media transport. | | * @param tp The media transport. | |
| * @param user_data Arbitrary user data to be set when the callbacks are | | * @param user_data Arbitrary user data to be set when the callbacks are | |
| * called. | | * called. | |
| * @param rem_addr Remote RTP address to send RTP packet to. | | * @param rem_addr Remote RTP address to send RTP packet to. | |
| * @param rem_rtcp Optional remote RTCP address. If the argument is NULL | | * @param rem_rtcp Optional remote RTCP address. If the argument is NULL | |
| * or if the address is zero, the RTCP address will be | | * or if the address is zero, the RTCP address will be | |
| | | | |
End of changes. 6 change blocks. |
| 25 lines changed or deleted | | 34 lines changed or added | |
|