switch_core_new_memory_pool(&pool);
output_component = switch_core_alloc(pool, sizeof(*output_component));
output_component = OUTPUT_COMPONENT(rayo_component_init((struct rayo_component *)output_component, pool, type, "output", NULL, actor, client_jid));
- if (!output_component) {
+ if (output_component) {
+ output_component->document = iks_copy(output);
+ output_component->start_offset_ms = iks_find_int_attrib(output, "start-offset");
+ output_component->repeat_interval_ms = iks_find_int_attrib(output, "repeat-interval");
+ output_component->repeat_times = iks_find_int_attrib(output, "repeat-times");
+ output_component->max_time_ms = iks_find_int_attrib(output, "max-time");
+ output_component->start_paused = iks_find_bool_attrib(output, "start-paused");
+ output_component->renderer = iks_find_attrib(output, "renderer");
+ } else {
switch_core_destroy_memory_pool(&pool);
- return NULL;
}
- output_component->document = iks_copy(output);
- output_component->start_offset_ms = iks_find_int_attrib(output, "start-offset");
- output_component->repeat_interval_ms = iks_find_int_attrib(output, "repeat-interval");
- output_component->repeat_times = iks_find_int_attrib(output, "repeat-times");
- output_component->max_time_ms = iks_find_int_attrib(output, "max-time");
- output_component->start_paused = iks_find_bool_attrib(output, "start-paused");
- output_component->renderer = iks_find_attrib(output, "renderer");
-
- return (struct rayo_component *)output_component;
+ return RAYO_COMPONENT(output_component);
}
/**
switch_core_new_memory_pool(&pool);
record_component = switch_core_alloc(pool, sizeof(*record_component));
- record_component = RECORD_COMPONENT(rayo_component_init(RAYO_COMPONENT(record_component), pool, type, "record", fs_file_path, actor, client_jid));
- if (!record_component) {
+ record_component = RECORD_COMPONENT(rayo_component_init(RAYO_COMPONENT(record_component), pool, type, "record", fs_file_path, actor, client_jid));\
+ if (record_component) {
+ record_component->max_duration = iks_find_int_attrib(record, "max-duration");
+ record_component->initial_timeout = iks_find_int_attrib(record, "initial-timeout");
+ record_component->final_timeout = iks_find_int_attrib(record, "final-timeout");
+ record_component->direction = switch_core_strdup(RAYO_POOL(record_component), iks_find_attrib_soft(record, "direction"));
+ record_component->mix = iks_find_bool_attrib(record, "mix");
+ record_component->start_beep = iks_find_bool_attrib(record, "start-beep");
+ record_component->stop_beep = iks_find_bool_attrib(record, "stop-beep");
+ record_component->start_time = start_paused ? 0 : switch_micro_time_now();
+ record_component->local_file_path = switch_core_strdup(RAYO_POOL(record_component), local_file_path);
+ } else {
switch_core_destroy_memory_pool(&pool);
- return NULL;
}
- record_component->max_duration = iks_find_int_attrib(record, "max-duration");
- record_component->initial_timeout = iks_find_int_attrib(record, "initial-timeout");
- record_component->final_timeout = iks_find_int_attrib(record, "final-timeout");
- record_component->direction = switch_core_strdup(RAYO_POOL(record_component), iks_find_attrib_soft(record, "direction"));
- record_component->mix = iks_find_bool_attrib(record, "mix");
- record_component->start_beep = iks_find_bool_attrib(record, "start-beep");
- record_component->stop_beep = iks_find_bool_attrib(record, "stop-beep");
- record_component->start_time = start_paused ? 0 : switch_micro_time_now();
- record_component->local_file_path = switch_core_strdup(RAYO_POOL(record_component), local_file_path);
-
switch_safe_free(local_file_path);
switch_safe_free(fs_file_path);