Changeset 3667 for pjproject/trunk/pjmedia/src/pjmedia/format.c
- Timestamp:
- Jul 19, 2011 11:11:07 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/format.c
r3664 r3667 24 24 #include <pj/string.h> 25 25 26 27 PJ_DEF(void) pjmedia_format_init_audio( pjmedia_format *fmt, 28 pj_uint32_t fmt_id, 29 unsigned clock_rate, 30 unsigned channel_count, 31 unsigned bits_per_sample, 32 unsigned frame_time_usec, 33 pj_uint32_t avg_bps, 34 pj_uint32_t max_bps) 35 { 36 fmt->id = fmt_id; 37 fmt->type = PJMEDIA_TYPE_AUDIO; 38 fmt->detail_type = PJMEDIA_FORMAT_DETAIL_AUDIO; 39 40 fmt->det.aud.clock_rate = clock_rate; 41 fmt->det.aud.channel_count = channel_count; 42 fmt->det.aud.bits_per_sample = bits_per_sample; 43 fmt->det.aud.frame_time_usec = frame_time_usec; 44 fmt->det.aud.avg_bps = avg_bps; 45 fmt->det.aud.max_bps = max_bps; 46 } 47 48 49 PJ_DEF(pjmedia_audio_format_detail*) 50 pjmedia_format_get_audio_format_detail(const pjmedia_format *fmt, 51 pj_bool_t assert_valid) 52 { 53 if (fmt->detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO) { 54 return (pjmedia_audio_format_detail*) &fmt->det.aud; 55 } else { 56 pj_assert(!assert_valid || !"Invalid audio format detail"); 57 return NULL; 58 } 59 } 60 61 62 PJ_DEF(pjmedia_format*) pjmedia_format_copy(pjmedia_format *dst, 63 const pjmedia_format *src) 64 { 65 return (pjmedia_format*)pj_memcpy(dst, src, sizeof(*src)); 66 } 67 68 69 #if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0) 70 71 26 72 static pj_status_t apply_packed_fmt(const pjmedia_video_format_info *fi, 27 73 pjmedia_video_apply_fmt_param *aparam); … … 57 103 }; 58 104 59 60 PJ_DEF(void) pjmedia_format_init_audio( pjmedia_format *fmt,61 pj_uint32_t fmt_id,62 unsigned clock_rate,63 unsigned channel_count,64 unsigned bits_per_sample,65 unsigned frame_time_usec,66 pj_uint32_t avg_bps,67 pj_uint32_t max_bps)68 {69 fmt->id = fmt_id;70 fmt->type = PJMEDIA_TYPE_AUDIO;71 fmt->detail_type = PJMEDIA_FORMAT_DETAIL_AUDIO;72 73 fmt->det.aud.clock_rate = clock_rate;74 fmt->det.aud.channel_count = channel_count;75 fmt->det.aud.bits_per_sample = bits_per_sample;76 fmt->det.aud.frame_time_usec = frame_time_usec;77 fmt->det.aud.avg_bps = avg_bps;78 fmt->det.aud.max_bps = max_bps;79 }80 81 105 PJ_DEF(void) pjmedia_format_init_video( pjmedia_format *fmt, 82 106 pj_uint32_t fmt_id, … … 113 137 } 114 138 115 PJ_DEF(pjmedia_audio_format_detail*)116 pjmedia_format_get_audio_format_detail(const pjmedia_format *fmt,117 pj_bool_t assert_valid)118 {119 if (fmt->detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO) {120 return (pjmedia_audio_format_detail*) &fmt->det.aud;121 } else {122 pj_assert(!assert_valid || !"Invalid audio format detail");123 return NULL;124 }125 }126 127 139 PJ_DEF(pjmedia_video_format_detail*) 128 140 pjmedia_format_get_video_format_detail(const pjmedia_format *fmt, … … 135 147 return NULL; 136 148 } 137 }138 139 PJ_DEF(pjmedia_format*) pjmedia_format_copy(pjmedia_format *dst,140 const pjmedia_format *src)141 {142 return (pjmedia_format*)pj_memcpy(dst, src, sizeof(*src));143 149 } 144 150 … … 365 371 } 366 372 373 #endif /* PJMEDIA_HAS_VIDEO */
Note: See TracChangeset
for help on using the changeset viewer.