Loop option implementation in conference member play
This commit is contained in:
parent
f2a7891f14
commit
b15ffd9e7b
|
@ -604,7 +604,20 @@ void conference_member_add_file_data(conference_member_t *member, int16_t *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_sample_len <= 0) {
|
if (file_sample_len <= 0) {
|
||||||
member->fnode->done++;
|
if (member->fnode->loops) {
|
||||||
|
if (--member->fnode->loops < 0) {
|
||||||
|
member->fnode->loops = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (member->fnode->loops) {
|
||||||
|
uint32_t pos = 0;
|
||||||
|
switch_core_file_seek(&member->fnode->fh, &pos, 0, SEEK_SET);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!member->fnode->loops) {
|
||||||
|
member->fnode->done++;
|
||||||
|
}
|
||||||
} else { /* there is file node data to mix into the frame */
|
} else { /* there is file node data to mix into the frame */
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
int32_t sample;
|
int32_t sample;
|
||||||
|
@ -1500,6 +1513,7 @@ switch_status_t conference_member_play_file(conference_member_t *member, char *f
|
||||||
|
|
||||||
if (fnode->fh.params) {
|
if (fnode->fh.params) {
|
||||||
const char *vol = switch_event_get_header(fnode->fh.params, "vol");
|
const char *vol = switch_event_get_header(fnode->fh.params, "vol");
|
||||||
|
const char *loopsstr = switch_event_get_header(fnode->fh.params, "loops");
|
||||||
const char *position = switch_event_get_header(fnode->fh.params, "position");
|
const char *position = switch_event_get_header(fnode->fh.params, "position");
|
||||||
|
|
||||||
if (!zstr(vol)) {
|
if (!zstr(vol)) {
|
||||||
|
@ -1507,6 +1521,14 @@ switch_status_t conference_member_play_file(conference_member_t *member, char *f
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG, "Set playback volume for file: %d\n",fnode->fh.vol);
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG, "Set playback volume for file: %d\n",fnode->fh.vol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (loopsstr) {
|
||||||
|
fnode->loops = atoi(loopsstr);
|
||||||
|
|
||||||
|
if (!strcasecmp(loopsstr, "inf") || !strcasecmp(loopsstr, "infinite")) {
|
||||||
|
fnode->loops = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!bad_params && !zstr(position) && member->conference->channels == 2) {
|
if (!bad_params && !zstr(position) && member->conference->channels == 2) {
|
||||||
fnode->al = conference_al_create(pool);
|
fnode->al = conference_al_create(pool);
|
||||||
if (conference_al_parse_position(fnode->al, position) != SWITCH_STATUS_SUCCESS) {
|
if (conference_al_parse_position(fnode->al, position) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
|
Loading…
Reference in New Issue