diff --git a/recording-daemon/db.c b/recording-daemon/db.c index 7b183c4ba..444b32cdc 100644 --- a/recording-daemon/db.c +++ b/recording-daemon/db.c @@ -6,6 +6,7 @@ #include "types.h" #include "main.h" #include "log.h" +#include "tag.h" static MYSQL __thread *mysql_conn; @@ -286,8 +287,8 @@ void db_do_stream(metafile_t *mf, output_t *op, const char *type, stream_t *stre .buffer_length = sizeof(ssrc), .is_unsigned = 1, }; - if (stream && mf->tags->len > stream->tag) { - tag_t *tag = g_ptr_array_index(mf->tags, stream->tag); + if (stream) { + tag_t *tag = tag_get(mf, stream->tag); my_cstr(&b[9], tag->label ? : ""); } else diff --git a/recording-daemon/tag.c b/recording-daemon/tag.c index 1f4bf7437..c7664d97c 100644 --- a/recording-daemon/tag.c +++ b/recording-daemon/tag.c @@ -2,7 +2,7 @@ // XXX copied from stream.c - unify? -static tag_t *tag_get(metafile_t *mf, unsigned long id) { +tag_t *tag_get(metafile_t *mf, unsigned long id) { if (mf->tags->len <= id) g_ptr_array_set_size(mf->tags, id + 1); tag_t *ret = g_ptr_array_index(mf->tags, id); diff --git a/recording-daemon/tag.h b/recording-daemon/tag.h index c55528aa6..ffec554cf 100644 --- a/recording-daemon/tag.h +++ b/recording-daemon/tag.h @@ -3,6 +3,7 @@ #include "types.h" +tag_t *tag_get(metafile_t *mf, unsigned long id); void tag_name(metafile_t *mf, unsigned long t, const char *); void tag_label(metafile_t *mf, unsigned long t, const char *); void tag_free(tag_t *);