Lines Matching refs:metadata
59 radio_metadata_buffer_t *metadata = *metadata_ptr;
60 unsigned int index_offset = metadata->size_int - metadata->count - 1;
61 unsigned int data_offset = *((unsigned int *)metadata + index_offset);
69 req_size_int = data_offset + metadata->count + 1 + 1 + size_int;
72 if (req_size_int <= metadata->size_int) {
76 if (req_size_int > RADIO_METADATA_MAX_SIZE || metadata->size_int >= RADIO_METADATA_MAX_SIZE) {
80 new_size_int = metadata->size_int;
84 ALOGV("%s growing from %u to %u", __func__, metadata->size_int, new_size_int);
85 metadata = realloc(metadata, new_size_int * sizeof(unsigned int));
87 memmove((unsigned int *)metadata + new_size_int - (metadata->count + 1),
88 (unsigned int *)metadata + metadata->size_int - (metadata->count + 1),
89 (metadata->count + 1) * sizeof(unsigned int));
90 metadata->size_int = new_size_int;
92 *metadata_ptr = metadata;
108 radio_metadata_buffer_t *metadata = *metadata_ptr;
117 metadata = *metadata_ptr;
118 index_offset = metadata->size_int - metadata->count - 1;
119 data_offset = *((unsigned int *)metadata + index_offset);
121 entry = (radio_metadata_entry_t *)((unsigned int *)metadata + data_offset);
128 *((unsigned int *)metadata + index_offset -1) = data_offset;
129 metadata->count++;
134 const radio_metadata_buffer_t *metadata,
138 unsigned int index_offset = metadata->size_int - index - 1;
139 unsigned int data_offset = *((unsigned int *)metadata + index_offset);
142 if (index >= metadata->count) {
155 max_offset = metadata->size_int - metadata->count - 1 - min_entry_size_int;
160 return (radio_metadata_entry_t *)((unsigned int *)metadata + data_offset);
164 * metadata API functions
175 int radio_metadata_allocate(radio_metadata_t **metadata,
191 *metadata = (radio_metadata_t *)metadata_buf;
195 void radio_metadata_deallocate(radio_metadata_t *metadata)
197 free(metadata);
200 int radio_metadata_add_int(radio_metadata_t **metadata,
205 if (metadata == NULL || *metadata == NULL || type != RADIO_METADATA_TYPE_INT) {
208 return add_metadata((radio_metadata_buffer_t **)metadata,
212 int radio_metadata_add_text(radio_metadata_t **metadata,
217 if (metadata == NULL || *metadata == NULL || type != RADIO_METADATA_TYPE_TEXT ||
221 return add_metadata((radio_metadata_buffer_t **)metadata, key, type, value, strlen(value) + 1);
224 int radio_metadata_add_raw(radio_metadata_t **metadata,
230 if (metadata == NULL || *metadata == NULL || type != RADIO_METADATA_TYPE_RAW || value == NULL) {
233 return add_metadata((radio_metadata_buffer_t **)metadata, key, type, value, size);
236 int radio_metadata_add_clock(radio_metadata_t **metadata,
240 if (metadata == NULL || *metadata == NULL || type != RADIO_METADATA_TYPE_CLOCK ||
246 (radio_metadata_buffer_t **)metadata, key, type, clock, sizeof(radio_metadata_clock_t));
287 int radio_metadata_check(const radio_metadata_t *metadata)
290 (radio_metadata_buffer_t *)metadata;
336 size_t radio_metadata_get_size(const radio_metadata_t *metadata)
339 (radio_metadata_buffer_t *)metadata;
347 int radio_metadata_get_count(const radio_metadata_t *metadata)
350 (radio_metadata_buffer_t *)metadata;
358 int radio_metadata_get_at_index(const radio_metadata_t *metadata,
367 (radio_metadata_buffer_t *)metadata;
386 int radio_metadata_get_from_key(const radio_metadata_t *metadata,
395 (radio_metadata_buffer_t *)metadata;