Lines Matching refs:dst
266 camera_metadata_t *place_camera_metadata(void *dst, in place_camera_metadata() argument
270 if (dst == NULL) return NULL; in place_camera_metadata()
280 camera_metadata_t *metadata = (camera_metadata_t*)dst; in place_camera_metadata()
345 camera_metadata_t* copy_camera_metadata(void *dst, size_t dst_size, in copy_camera_metadata() argument
349 if (dst == NULL) return NULL; in copy_camera_metadata()
357 place_camera_metadata(dst, dst_size, src->entry_count, src->data_count); in copy_camera_metadata()
602 int append_camera_metadata(camera_metadata_t *dst, in append_camera_metadata() argument
604 if (dst == NULL || src == NULL ) return ERROR; in append_camera_metadata()
607 if (src->entry_count + dst->entry_count < src->entry_count) return ERROR; in append_camera_metadata()
608 if (src->data_count + dst->data_count < src->data_count) return ERROR; in append_camera_metadata()
610 if (dst->entry_capacity < src->entry_count + dst->entry_count) return ERROR; in append_camera_metadata()
611 if (dst->data_capacity < src->data_count + dst->data_count) return ERROR; in append_camera_metadata()
613 if ((dst->vendor_id != CAMERA_METADATA_INVALID_VENDOR_ID) && in append_camera_metadata()
615 if (dst->vendor_id != src->vendor_id) { in append_camera_metadata()
622 memcpy(get_entries(dst) + dst->entry_count, get_entries(src), in append_camera_metadata()
624 memcpy(get_data(dst) + dst->data_count, get_data(src), in append_camera_metadata()
626 if (dst->data_count != 0) { in append_camera_metadata()
627 camera_metadata_buffer_entry_t *entry = get_entries(dst) + dst->entry_count; in append_camera_metadata()
631 entry->data.offset += dst->data_count; in append_camera_metadata()
635 if (dst->entry_count == 0) { in append_camera_metadata()
637 dst->flags |= src->flags & FLAG_SORTED; in append_camera_metadata()
640 dst->flags &= ~FLAG_SORTED; in append_camera_metadata()
644 dst->entry_count += src->entry_count; in append_camera_metadata()
645 dst->data_count += src->data_count; in append_camera_metadata()
647 if (dst->vendor_id == CAMERA_METADATA_INVALID_VENDOR_ID) { in append_camera_metadata()
648 dst->vendor_id = src->vendor_id; in append_camera_metadata()
651 assert(validate_camera_metadata_structure(dst, NULL) == OK); in append_camera_metadata()
672 static int add_camera_metadata_entry_raw(camera_metadata_t *dst, in add_camera_metadata_entry_raw() argument
678 if (dst == NULL) return ERROR; in add_camera_metadata_entry_raw()
679 if (dst->entry_count == dst->entry_capacity) return ERROR; in add_camera_metadata_entry_raw()
684 if (data_bytes + dst->data_count > dst->data_capacity) return ERROR; in add_camera_metadata_entry_raw()
688 camera_metadata_buffer_entry_t *entry = get_entries(dst) + dst->entry_count; in add_camera_metadata_entry_raw()
698 entry->data.offset = dst->data_count; in add_camera_metadata_entry_raw()
699 memcpy(get_data(dst) + entry->data.offset, data, in add_camera_metadata_entry_raw()
701 dst->data_count += data_bytes; in add_camera_metadata_entry_raw()
703 dst->entry_count++; in add_camera_metadata_entry_raw()
704 dst->flags &= ~FLAG_SORTED; in add_camera_metadata_entry_raw()
705 assert(validate_camera_metadata_structure(dst, NULL) == OK); in add_camera_metadata_entry_raw()
709 int add_camera_metadata_entry(camera_metadata_t *dst, in add_camera_metadata_entry() argument
714 int type = get_local_camera_metadata_tag_type(tag, dst); in add_camera_metadata_entry()
720 return add_camera_metadata_entry_raw(dst, in add_camera_metadata_entry()
735 int sort_camera_metadata(camera_metadata_t *dst) { in sort_camera_metadata() argument
736 if (dst == NULL) return ERROR; in sort_camera_metadata()
737 if (dst->flags & FLAG_SORTED) return OK; in sort_camera_metadata()
739 qsort(get_entries(dst), dst->entry_count, in sort_camera_metadata()
742 dst->flags |= FLAG_SORTED; in sort_camera_metadata()
744 assert(validate_camera_metadata_structure(dst, NULL) == OK); in sort_camera_metadata()
817 int delete_camera_metadata_entry(camera_metadata_t *dst, in delete_camera_metadata_entry() argument
819 if (dst == NULL) return ERROR; in delete_camera_metadata_entry()
820 if (index >= dst->entry_count) return ERROR; in delete_camera_metadata_entry()
822 camera_metadata_buffer_entry_t *entry = get_entries(dst) + index; in delete_camera_metadata_entry()
828 uint8_t *start = get_data(dst) + entry->data.offset; in delete_camera_metadata_entry()
830 size_t length = dst->data_count - entry->data.offset - data_bytes; in delete_camera_metadata_entry()
834 camera_metadata_buffer_entry_t *e = get_entries(dst); in delete_camera_metadata_entry()
836 for (i = 0; i < dst->entry_count; i++) { in delete_camera_metadata_entry()
844 dst->data_count -= data_bytes; in delete_camera_metadata_entry()
849 (dst->entry_count - index - 1) ); in delete_camera_metadata_entry()
850 dst->entry_count -= 1; in delete_camera_metadata_entry()
852 assert(validate_camera_metadata_structure(dst, NULL) == OK); in delete_camera_metadata_entry()
856 int update_camera_metadata_entry(camera_metadata_t *dst, in update_camera_metadata_entry() argument
861 if (dst == NULL) return ERROR; in update_camera_metadata_entry()
862 if (index >= dst->entry_count) return ERROR; in update_camera_metadata_entry()
864 camera_metadata_buffer_entry_t *entry = get_entries(dst) + index; in update_camera_metadata_entry()
877 if (dst->data_capacity < dst->data_count + data_bytes - entry_bytes) { in update_camera_metadata_entry()
883 uint8_t *start = get_data(dst) + entry->data.offset; in update_camera_metadata_entry()
885 size_t length = dst->data_count - entry->data.offset - entry_bytes; in update_camera_metadata_entry()
887 dst->data_count -= entry_bytes; in update_camera_metadata_entry()
890 camera_metadata_buffer_entry_t *e = get_entries(dst); in update_camera_metadata_entry()
892 for (i = 0; i < dst->entry_count; i++) { in update_camera_metadata_entry()
904 entry->data.offset = dst->data_count; in update_camera_metadata_entry()
906 memcpy(get_data(dst) + entry->data.offset, data, data_payload_bytes); in update_camera_metadata_entry()
907 dst->data_count += data_bytes; in update_camera_metadata_entry()
911 memcpy(get_data(dst) + entry->data.offset, data, data_payload_bytes); in update_camera_metadata_entry()
923 get_camera_metadata_entry(dst, in update_camera_metadata_entry()
928 assert(validate_camera_metadata_structure(dst, NULL) == OK); in update_camera_metadata_entry()