- Timestamp:
- Dec 10, 2010 11:04:30 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/port.c
r2394 r3392 22 22 #include <pj/assert.h> 23 23 #include <pj/log.h> 24 #include <pj/pool.h> 24 25 25 26 #define THIS_FILE "port.c" … … 38 39 unsigned samples_per_frame) 39 40 { 41 #define USEC_IN_SEC (pj_uint64_t)1000000 42 unsigned frame_time_usec, avg_bps; 43 40 44 pj_bzero(info, sizeof(*info)); 41 45 46 info->signature = signature; 47 info->dir = PJMEDIA_DIR_ENCODING_DECODING; 42 48 info->name = *name; 43 info->signature = signature; 44 info->type = PJMEDIA_TYPE_AUDIO; 45 info->has_info = PJ_TRUE; 46 info->need_info = PJ_FALSE; 47 info->pt = 0xFF; 48 info->encoding_name = pj_str("pcm"); 49 info->clock_rate = clock_rate; 50 info->channel_count = channel_count; 51 info->bits_per_sample = bits_per_sample; 52 info->samples_per_frame = samples_per_frame; 53 info->bytes_per_frame = samples_per_frame * bits_per_sample / 8; 49 50 frame_time_usec = (unsigned)(samples_per_frame * USEC_IN_SEC / 51 channel_count / clock_rate); 52 avg_bps = clock_rate * channel_count * bits_per_sample; 53 54 pjmedia_format_init_audio(&info->fmt, PJMEDIA_FORMAT_L16, clock_rate, 55 channel_count, bits_per_sample, frame_time_usec, 56 avg_bps, avg_bps); 54 57 55 58 return PJ_SUCCESS; 56 59 } 57 60 61 PJ_DEF(pj_status_t) pjmedia_port_info_init2( pjmedia_port_info *info, 62 const pj_str_t *name, 63 unsigned signature, 64 pjmedia_dir dir, 65 const pjmedia_format *fmt) 66 { 67 pj_bzero(info, sizeof(*info)); 68 info->signature = signature; 69 info->dir = dir; 70 info->name = *name; 71 72 pjmedia_format_copy(&info->fmt, fmt); 73 74 return PJ_SUCCESS; 75 } 58 76 59 77 /** … … 78 96 */ 79 97 PJ_DEF(pj_status_t) pjmedia_port_put_frame( pjmedia_port *port, 80 constpjmedia_frame *frame )98 pjmedia_frame *frame ) 81 99 { 82 100 PJ_ASSERT_RETURN(port && frame, PJ_EINVAL);
Note: See TracChangeset
for help on using the changeset viewer.