Browse Source

MT#61630 stop media NG: move essential body to a function

Move part of the `call_stop_media_ng` function body
to a separate function, to let it be available
for external function calls not particularly related
to play media NG function call.

Change-Id: I278f7bc5a6663e9232e812d10f6902616c67c497
pull/1897/head
Donat Zenichev 12 months ago
parent
commit
de7d14bc0c
3 changed files with 15 additions and 5 deletions
  1. +1
    -5
      daemon/call_interfaces.c
  2. +13
    -0
      daemon/media_player.c
  3. +1
    -0
      include/media_player.h

+ 1
- 5
daemon/call_interfaces.c View File

@ -3635,11 +3635,7 @@ const char *call_stop_media_ng(ng_command_ctx_t *ctx) {
if (!monologue->player) if (!monologue->player)
return "Not currently playing media"; return "Not currently playing media";
last_frame_pos = media_player_stop(monologue->player);
// restore to non-mixing if needed
codec_update_all_source_handlers(monologue, NULL);
update_init_subscribers(monologue, OP_STOP_MEDIA);
last_frame_pos = call_stop_media_for_ml(monologue);
} }
parser->dict_add_int(ctx->resp, "last-frame-pos", last_frame_pos); parser->dict_add_int(ctx->resp, "last-frame-pos", last_frame_pos);


+ 13
- 0
daemon/media_player.c View File

@ -1221,6 +1221,19 @@ const char * call_play_media_for_ml(struct call_monologue *ml,
#endif #endif
} }
long long call_stop_media_for_ml(struct call_monologue *ml)
{
#ifdef WITH_TRANSCODING
long long ret = media_player_stop(ml->player);
/* restore to non-mixing if needed */
codec_update_all_source_handlers(ml, NULL);
update_init_subscribers(ml, OP_STOP_MEDIA);
return ret;
#else
return 0;
#endif
}
#ifdef WITH_TRANSCODING #ifdef WITH_TRANSCODING
static int __mp_avio_read_wrap(void *opaque, uint8_t *buf, int buf_size) { static int __mp_avio_read_wrap(void *opaque, uint8_t *buf, int buf_size) {
struct media_player_coder *c = opaque; struct media_player_coder *c = opaque;


+ 1
- 0
include/media_player.h View File

@ -134,6 +134,7 @@ void media_player_add_packet(struct media_player *mp, char *buf, size_t len,
const char * call_play_media_for_ml(struct call_monologue *ml, const char * call_play_media_for_ml(struct call_monologue *ml,
media_player_opts_t opts, sdp_ng_flags *flags); media_player_opts_t opts, sdp_ng_flags *flags);
long long call_stop_media_for_ml(struct call_monologue *ml);
void media_player_init(void); void media_player_init(void);
void media_player_free(void); void media_player_free(void);


Loading…
Cancel
Save