MT#59038 separate player init/start functions

Change-Id: Ic65879e49995f6e7d7fc695b6fa33b9ae937c068
pull/1808/head
Richard Fuchs 2 years ago
parent 9223109d04
commit ed877868c1

@ -1009,6 +1009,12 @@ bool media_player_play_file(struct media_player *mp, const str *file, media_play
#endif
}
// call->master_lock held in W
bool media_player_init_file(struct media_player *mp, const str *file, media_player_opts_t opts) {
int ret = __media_player_init_file(mp, file, opts, NULL);
return ret == 0;
}
#ifdef WITH_TRANSCODING
static int __mp_avio_read_wrap(void *opaque, uint8_t *buf, int buf_size) {
@ -1139,6 +1145,12 @@ bool media_player_play_blob(struct media_player *mp, const str *blob, media_play
return true;
}
// call->master_lock held in W
bool media_player_init_blob(struct media_player *mp, const str *blob, media_player_opts_t opts) {
int ret = __media_player_init_blob_id(mp, blob, opts, -1, NULL);
return ret == 0;
}
static int __connect_db(void) {
if (mysql_conn) {
@ -1242,6 +1254,12 @@ bool media_player_play_db(struct media_player *mp, long long id, media_player_op
return true;
}
// call->master_lock held in W
bool media_player_init_db(struct media_player *mp, long long id, media_player_opts_t opts) {
int ret = __media_player_init_db(mp, id, opts, NULL);
return ret == 0;
}
static void media_player_run(void *ptr) {
struct media_player *mp = ptr;
@ -1341,6 +1359,24 @@ static void media_player_cache_entry_free(void *p) {
#endif
// call->master_lock held in W
bool media_player_start(struct media_player *mp) {
#ifdef WITH_TRANSCODING
if (!mp->coder.fmtctx) // initialised?
return false;
const rtp_payload_type *dst_pt = media_player_play_setup(mp);
if (!dst_pt)
return false;
media_player_play_start(mp, dst_pt);
return true;
#else
return false;
#endif
}
void media_player_init(void) {
#ifdef WITH_TRANSCODING
if (rtpe_config.player_cache) {

@ -116,6 +116,10 @@ void media_player_new(struct media_player **, struct call_monologue *);
bool media_player_play_file(struct media_player *, const str *, media_player_opts_t);
bool media_player_play_blob(struct media_player *, const str *, media_player_opts_t);
bool media_player_play_db(struct media_player *, long long, media_player_opts_t);
bool media_player_init_file(struct media_player *, const str *, media_player_opts_t);
bool media_player_init_blob(struct media_player *, const str *, media_player_opts_t);
bool media_player_init_db(struct media_player *, long long, media_player_opts_t);
bool media_player_start(struct media_player *);
long long media_player_stop(struct media_player *);
bool media_player_is_active(struct call_monologue *);

Loading…
Cancel
Save