mirror of https://github.com/sipwise/rtpengine.git
closes #582 Change-Id: Ibc894e82b61e4231c99f9618685a6232f7e50da7changes/30/23830/5
parent
35764c5c63
commit
31023572a5
@ -0,0 +1,33 @@
|
||||
#include "tag.h"
|
||||
|
||||
|
||||
// XXX copied from stream.c - unify?
|
||||
static 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);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = g_slice_alloc0(sizeof(*ret));
|
||||
g_ptr_array_index(mf->tags, id) = ret;
|
||||
|
||||
ret->id = id;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void tag_name(metafile_t *mf, unsigned long t, const char *str) {
|
||||
tag_t *tag = tag_get(mf, t);
|
||||
tag->name = g_string_chunk_insert(mf->gsc, str);
|
||||
}
|
||||
|
||||
void tag_label(metafile_t *mf, unsigned long t, const char *str) {
|
||||
tag_t *tag = tag_get(mf, t);
|
||||
tag->label = g_string_chunk_insert(mf->gsc, str);
|
||||
}
|
||||
|
||||
void tag_free(tag_t *tag) {
|
||||
g_slice_free1(sizeof(*tag), tag);
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
#ifndef _TAG_H_
|
||||
#define _TAG_H_
|
||||
|
||||
#include "types.h"
|
||||
|
||||
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 *);
|
||||
|
||||
#endif
|
||||
Loading…
Reference in new issue