Changeset 3664 for pjproject/trunk/pjmedia/include/pjmedia/clock.h
- Timestamp:
- Jul 19, 2011 3:42:28 AM (13 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk
- Property svn:mergeinfo changed
-
pjproject/trunk/pjmedia/include/pjmedia/clock.h
r3553 r3664 80 80 PJ_BEGIN_DECL 81 81 82 /** 83 * Media clock source. 84 */ 85 typedef struct pjmedia_clock_src 86 { 87 pjmedia_type media_type; /**< Media type. */ 88 unsigned clock_rate; /**< Clock rate. */ 89 unsigned ptime_usec; /**< Frame interval (in usec). */ 90 /** 91 * The timestamp field holds an increasing value in samples and its 92 * value is expected to be increased by clock_rate samples per second. 93 */ 94 pj_timestamp timestamp; 95 /** 96 * Timestamp's last update. The last_update field contains a value in 97 * ticks, and it is expected to be increased by pj_get_timestamp_freq() 98 * ticks per second. 99 */ 100 pj_timestamp last_update; 101 } pjmedia_clock_src; 102 103 /** 104 * This is an auxiliary function to initialize the media clock source. 105 * 106 * @param clocksrc The clock source to be initialized. 107 * @param media_type The media type. 108 * @param clock_rate The clock rate. 109 * @param ptime_usec Media frame interval (in usec). 110 * 111 * @return PJ_SUCCESS on success. 112 */ 113 PJ_DECL(pj_status_t) pjmedia_clock_src_init( pjmedia_clock_src *clocksrc, 114 pjmedia_type media_type, 115 unsigned clock_rate, 116 unsigned ptime_usec ); 117 118 /** 119 * This function updates the clock source's timestamp. Application should 120 * use this function instead of updating the timestamp directly since this 121 * function will also update the last_update field of the clock source. 122 * 123 * @param clocksrc The clock source to be updated. 124 * @param timestamp The new timestamp, can be NULL if the current 125 * timestamp does not change (in this case it 126 * will only update the last_update field). 127 * 128 * @return PJ_SUCCESS on success. 129 */ 130 PJ_DECL(pj_status_t) pjmedia_clock_src_update( pjmedia_clock_src *clocksrc, 131 const pj_timestamp *timestamp ); 132 133 /** 134 * This function gets the clock source's current timestamp. Application 135 * should use this function instead of accessing the timestamp directly 136 * since this function will calculate the predicted timestamp for current 137 * time, based on the values of timestamp, last_update, and clock_rate. 138 * 139 * @param clocksrc The clock source. 140 * @param timestamp Argument to receive the current timestamp 141 * 142 * @return PJ_SUCCESS on success. 143 */ 144 PJ_DECL(pj_status_t) 145 pjmedia_clock_src_get_current_timestamp( const pjmedia_clock_src *clocksrc, 146 pj_timestamp *timestamp); 147 148 /** 149 * This function gets the clock source's time in msec. 150 * 151 * @param clocksrc The clock source. 152 * 153 * @return The clock source's time (in msec). 154 */ 155 PJ_DECL(pj_uint32_t) 156 pjmedia_clock_src_get_time_msec( const pjmedia_clock_src *clocksrc ); 157 82 158 83 159 /** … … 106 182 107 183 184 typedef struct pjmedia_clock_param 185 { 186 /** 187 * The frame interval, in microseconds. 188 */ 189 unsigned usec_interval; 190 /** 191 * The media clock rate, to determine timestamp 192 * increment for each call. 193 */ 194 unsigned clock_rate; 195 } pjmedia_clock_param; 196 108 197 /** 109 198 * Type of media clock callback. … … 119 208 120 209 /** 121 * Create media clock. 210 * Create media clock. This creates a media clock object that will run 211 * periodically at an interval that is calculated from the audio parameters. 212 * Once created, application must call #pjmedia_clock_start() to actually 213 * start the clock. 214 * 215 * @see pjmedia_clock_create2() 122 216 * 123 217 * @param pool Pool to allocate memory. … … 144 238 pjmedia_clock **p_clock); 145 239 240 241 /** 242 * Create media clock. This creates a media clock object that will run 243 * periodically at the specified interval. Once created, application must 244 * call #pjmedia_clock_start() to actually start the clock. 245 * 246 * @param pool Pool to allocate memory. 247 * @param param The clock parameter. 248 * @param options Bitmask of pjmedia_clock_options. 249 * @param cb Callback to be called for each clock tick. 250 * @param user_data User data, which will be passed to the callback. 251 * @param p_clock Pointer to receive the clock instance. 252 * 253 * @return PJ_SUCCESS on success, or the appropriate error 254 * code. 255 */ 256 PJ_DECL(pj_status_t) pjmedia_clock_create2(pj_pool_t *pool, 257 const pjmedia_clock_param *param, 258 unsigned options, 259 pjmedia_clock_callback *cb, 260 void *user_data, 261 pjmedia_clock **p_clock); 262 146 263 /** 147 264 * Start the clock. For clock created with asynchronous flag set to TRUE, … … 165 282 PJ_DECL(pj_status_t) pjmedia_clock_stop(pjmedia_clock *clock); 166 283 284 285 /** 286 * Modify the clock's parameter. 287 * 288 * @param clock The media clock. 289 * @param param The clock's new parameter. 290 * @return PJ_SUCCES on success. 291 */ 292 PJ_DECL(pj_status_t) pjmedia_clock_modify(pjmedia_clock *clock, 293 const pjmedia_clock_param *param); 167 294 168 295
Note: See TracChangeset
for help on using the changeset viewer.