MT#61822 add list player cache

Change-Id: If40ab9218354b95ef2b4fba47cd5e38ab318a325
pull/1897/head
Richard Fuchs 11 months ago
parent bce0b8fc43
commit 601abd2e5b

@ -112,6 +112,7 @@ static void cli_incoming_tag_detdtmf(str *instr, struct cli_writer *cw, const cl
static void cli_incoming_media_list_files(str *instr, struct cli_writer *cw, const cli_handler_t *); static void cli_incoming_media_list_files(str *instr, struct cli_writer *cw, const cli_handler_t *);
static void cli_incoming_media_list_dbs(str *instr, struct cli_writer *cw, const cli_handler_t *); static void cli_incoming_media_list_dbs(str *instr, struct cli_writer *cw, const cli_handler_t *);
static void cli_incoming_media_list_caches(str *instr, struct cli_writer *cw, const cli_handler_t *); static void cli_incoming_media_list_caches(str *instr, struct cli_writer *cw, const cli_handler_t *);
static void cli_incoming_media_list_players(str *instr, struct cli_writer *cw, const cli_handler_t *);
static void cli_incoming_media_reload_file(str *instr, struct cli_writer *cw, const cli_handler_t *); static void cli_incoming_media_reload_file(str *instr, struct cli_writer *cw, const cli_handler_t *);
static void cli_incoming_media_reload_files(str *instr, struct cli_writer *cw, const cli_handler_t *); static void cli_incoming_media_reload_files(str *instr, struct cli_writer *cw, const cli_handler_t *);
@ -207,6 +208,7 @@ static const cli_handler_t cli_media_list_handlers[] = {
{ "files", cli_incoming_media_list_files, NULL }, { "files", cli_incoming_media_list_files, NULL },
{ "dbs", cli_incoming_media_list_dbs, NULL }, { "dbs", cli_incoming_media_list_dbs, NULL },
{ "caches", cli_incoming_media_list_caches, NULL }, { "caches", cli_incoming_media_list_caches, NULL },
{ "players", cli_incoming_media_list_players, NULL },
{ NULL, }, { NULL, },
}; };
static const cli_handler_t cli_media_add_handlers[] = { static const cli_handler_t cli_media_add_handlers[] = {
@ -2002,6 +2004,15 @@ static void cli_incoming_media_list_caches(str *instr, struct cli_writer *cw, co
} }
} }
static void cli_incoming_media_list_players(str *instr, struct cli_writer *cw, const cli_handler_t *handler) {
charp_q list = media_player_list_player_cache();
while (list.head) {
char *s = t_queue_pop_head(&list);
cw->cw_printf(cw, "%s\n", s);
g_free(s);
}
}
static void cli_incoming_media_evict_cache(str *instr, struct cli_writer *cw, const cli_handler_t *handler) { static void cli_incoming_media_evict_cache(str *instr, struct cli_writer *cw, const cli_handler_t *handler) {
if (instr->len == 0) { if (instr->len == 0) {
cw->cw_printf(cw, "More parameters required.\n"); cw->cw_printf(cw, "More parameters required.\n");

@ -2616,3 +2616,19 @@ unsigned int media_player_reload_caches(void) {
media_player_iterate_db_cache(media_player_reload_caches_all, &ret); media_player_iterate_db_cache(media_player_reload_caches_all, &ret);
return ret; return ret;
} }
charp_q media_player_list_player_cache(void) {
charp_q ret = TYPED_GQUEUE_INIT;
#ifdef WITH_TRANSCODING
if (!t_hash_table_is_set(media_player_cache))
return ret;
media_player_cache_ht_iter iter;
LOCK(&media_player_cache_lock);
t_hash_table_iter_init(&iter, media_player_cache);
struct media_player_cache_entry *entry;
while (t_hash_table_iter_next(&iter, NULL, &entry))
t_queue_push_tail(&ret, g_strdup_printf("%s for PT " STR_FORMAT, entry->info_str,
STR_FMT(&entry->index.dst_pt.encoding_with_full_params)));
#endif
return ret;
}

@ -173,6 +173,7 @@ bool media_player_add_cache(unsigned long long);
bool media_player_reload_cache(unsigned long long); bool media_player_reload_cache(unsigned long long);
unsigned int media_player_reload_caches(void); unsigned int media_player_reload_caches(void);
enum thread_looper_action media_player_refresh_cache(void); enum thread_looper_action media_player_refresh_cache(void);
charp_q media_player_list_player_cache(void);
struct send_timer *send_timer_new(struct packet_stream *); struct send_timer *send_timer_new(struct packet_stream *);
void send_timer_push(struct send_timer *, struct codec_packet *); void send_timer_push(struct send_timer *, struct codec_packet *);

@ -168,6 +168,7 @@ sub showusage {
print " files : list media files currently in memory\n"; print " files : list media files currently in memory\n";
print " dbs : list database media entries currently in memory\n"; print " dbs : list database media entries currently in memory\n";
print " caches : list database media entries currently in file cache\n"; print " caches : list database media entries currently in file cache\n";
print " players : list contents of player cache\n";
print " reload <option>\n"; print " reload <option>\n";
print " file <file name> : reload one media file into memory\n"; print " file <file name> : reload one media file into memory\n";
print " files : reload all media files currently in memory\n"; print " files : reload all media files currently in memory\n";

Loading…
Cancel
Save