MT#61630 media_player_opts_t: add file, blob and db_id

Pass file, blob and db_id via `media_player_opts_t`
structure members instead of using separate arguments
in `call_play_media_for_ml()`.

Change-Id: I8c3b9b7f5ab61238d35463c304246f31a922ac6f
pull/1897/head
Donat Zenichev 11 months ago
parent 1a8132691a
commit 83bed23013

@ -2756,6 +2756,9 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c
.start_pos = flags->start_pos,
.block_egress = !!flags->block_egress,
.codec_set = flags->codec_set,
.file = flags->file,
.blob = flags->blob,
.db_id = flags->db_id,
);
if (flags->file.len)
ret = media_player_init_file(ml->rec_player, &flags->file, opts);

@ -3595,9 +3595,12 @@ const char *call_play_media_ng(ng_command_ctx_t *ctx) {
.start_pos = flags.start_pos,
.block_egress = !!flags.block_egress,
.codec_set = flags.codec_set,
.file = flags.file,
.blob = flags.blob,
.db_id = flags.db_id,
);
err = call_play_media_for_ml(monologue, opts, &flags.file, &flags.blob, flags.db_id, &flags);
err = call_play_media_for_ml(monologue, opts, &flags);
if (err)
return err;

@ -1167,11 +1167,7 @@ bool media_player_init_file(struct media_player *mp, const str *file, media_play
}
const char * call_play_media_for_ml(struct call_monologue *ml,
media_player_opts_t opts,
const str * file,
const str * blob,
long long db_id,
sdp_ng_flags *flags)
media_player_opts_t opts, sdp_ng_flags *flags)
{
#ifdef WITH_TRANSCODING
/* if mixing is enabled, codec handlers of all sources must be updated */
@ -1183,16 +1179,16 @@ const char * call_play_media_for_ml(struct call_monologue *ml,
* TODO: player options can have changed if already exists */
media_player_new(&ml->player, ml);
if (file->len) {
if (!media_player_play_file(ml->player, file, opts))
if (opts.file.len) {
if (!media_player_play_file(ml->player, &opts.file, opts))
return "Failed to start media playback from file";
}
else if (blob->len) {
if (!media_player_play_blob(ml->player, blob, opts))
else if (opts.blob.len) {
if (!media_player_play_blob(ml->player, &opts.blob, opts))
return "Failed to start media playback from blob";
}
else if (db_id > 0) {
if (!media_player_play_db(ml->player, db_id, opts))
else if (opts.db_id > 0) {
if (!media_player_play_db(ml->player, opts.db_id, opts))
return "Failed to start media playback from database";
}
else

@ -22,6 +22,8 @@ typedef struct {
int repeat;
str_case_value_ht codec_set;
unsigned int block_egress:1;
str file, blob;
long long db_id;
} media_player_opts_t;
@ -136,11 +138,7 @@ void media_player_add_packet(struct media_player *mp, char *buf, size_t len,
long long us_dur, unsigned long long pts);
const char * call_play_media_for_ml(struct call_monologue *ml,
media_player_opts_t opts,
const str * file,
const str * blob,
long long db_id,
sdp_ng_flags *flags);
media_player_opts_t opts, sdp_ng_flags *flags);
void media_player_init(void);
void media_player_free(void);

Loading…
Cancel
Save