uint32_t flags, const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_core_codec_parse_fmtp(const char *codec_name, const char *fmtp, uint32_t rate, switch_codec_fmtp_t *codec_fmtp);
SWITCH_DECLARE(switch_status_t) switch_core_codec_reset(switch_codec_t *codec);
/*!
const char *rm_encoding;
uint32_t map_bit_rate = 0;
int codec_ms = 0;
+ switch_codec_fmtp_t codec_fmtp = { 0 };
if (x++ < skip) {
continue;
map_bit_rate = switch_known_bitrate(map->rm_pt);
- if (!codec_ms) {
- codec_ms = ptime;
+ if (!zstr(map->rm_fmtp)) {
+ if ((switch_core_codec_parse_fmtp(map->rm_encoding, map->rm_fmtp, map->rm_rate, &codec_fmtp)) == SWITCH_STATUS_SUCCESS) {
+ if (codec_fmtp.bits_per_second) {
+ map_bit_rate = codec_fmtp.bits_per_second;
+ }
+ if (codec_fmtp.microseconds_per_packet) {
+ ptime = (codec_fmtp.microseconds_per_packet / 1000);
+ }
+ }
}
+
+ codec_ms = ptime;
for (i = first; i < last && i < tech_pvt->num_codecs; i++) {
const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
}
+SWITCH_DECLARE(switch_status_t) switch_core_codec_parse_fmtp(const char *codec_name, const char *fmtp, uint32_t rate, switch_codec_fmtp_t *codec_fmtp)
+{
+ switch_codec_interface_t *codec_interface;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+
+ if (zstr(codec_name) || zstr(fmtp) || !codec_fmtp) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ memset(codec_fmtp, 0, sizeof(*codec_fmtp));
+
+ if ((codec_interface = switch_loadable_module_get_codec_interface(codec_name))) {
+ if (codec_interface->parse_fmtp) {
+ codec_fmtp->actual_samples_per_second = rate;
+ status = codec_interface->parse_fmtp(fmtp, codec_fmtp);
+ }
+
+ UNPROTECT_INTERFACE(codec_interface);
+ }
+
+ return status;
+}
SWITCH_DECLARE(switch_status_t) switch_core_codec_reset(switch_codec_t *codec)
{