Lines Matching refs:cntr
431 static int detect_container_version(struct container_context *cntr) in detect_container_version() argument
433 struct parser_state *state = cntr->private_data; in detect_container_version()
438 memcpy(&header.magic, cntr->magic, sizeof(cntr->magic)); in detect_container_version()
439 err = container_recursive_read(cntr, in detect_container_version()
440 (char *)&header + sizeof(cntr->magic), in detect_container_version()
441 sizeof(header) - sizeof(cntr->magic)); in detect_container_version()
444 if (cntr->eof) in detect_container_version()
450 static int allocate_for_block_cache(struct container_context *cntr, in allocate_for_block_cache() argument
474 err = container_recursive_read(cntr, cache + sizeof(*header), in allocate_for_block_cache()
480 if (cntr->eof) { in allocate_for_block_cache()
490 static int cache_data_block(struct container_context *cntr, in cache_data_block() argument
496 err = container_recursive_read(cntr, &header->type, in cache_data_block()
500 if (cntr->eof) in cache_data_block()
509 err = container_recursive_read(cntr, &header->size, in cache_data_block()
513 if (cntr->eof) in cache_data_block()
516 return allocate_for_block_cache(cntr, header, buf); in cache_data_block()
519 static int detect_format_block(struct container_context *cntr) in detect_format_block() argument
521 struct parser_state *state = cntr->private_data; in detect_format_block()
528 err = cache_data_block(cntr, &header, &buf); in detect_format_block()
556 static int voc_parser_pre_process(struct container_context *cntr, in voc_parser_pre_process() argument
562 struct parser_state *state = cntr->private_data; in voc_parser_pre_process()
566 err = detect_container_version(cntr); in voc_parser_pre_process()
570 err = detect_format_block(cntr); in voc_parser_pre_process()
600 static int write_container_header(struct container_context *cntr, in write_container_header() argument
603 struct builder_state *state = cntr->private_data; in write_container_header()
611 return container_recursive_write(cntr, header, sizeof(*header)); in write_container_header()
614 static int write_v120_format_block(struct container_context *cntr, in write_v120_format_block() argument
619 struct builder_state *state = cntr->private_data; in write_v120_format_block()
629 return container_recursive_write(cntr, block, sizeof(*block)); in write_v120_format_block()
632 static int write_extended_v110_format_block(struct container_context *cntr, in write_extended_v110_format_block() argument
636 struct builder_state *state = cntr->private_data; in write_extended_v110_format_block()
656 return container_recursive_write(cntr, block, sizeof(*block)); in write_extended_v110_format_block()
659 static int write_v110_format_block(struct container_context *cntr, in write_v110_format_block() argument
664 struct builder_state *state = cntr->private_data; in write_v110_format_block()
677 return container_recursive_write(cntr, block, sizeof(*block)); in write_v110_format_block()
680 static int write_data_blocks(struct container_context *cntr, in write_data_blocks() argument
690 struct builder_state *state = cntr->private_data; in write_data_blocks()
693 err = write_container_header(cntr, &buf.header); in write_data_blocks()
698 err = write_v120_format_block(cntr, &buf.v120_format, in write_data_blocks()
702 err = write_extended_v110_format_block(cntr, in write_data_blocks()
708 err = write_v110_format_block(cntr, &buf.v110_data, in write_data_blocks()
715 static int voc_builder_pre_process(struct container_context *cntr, in voc_builder_pre_process() argument
721 struct builder_state *state = cntr->private_data; in voc_builder_pre_process()
764 return write_data_blocks(cntr, *frames_per_second, *byte_count); in voc_builder_pre_process()
767 static int write_block_terminator(struct container_context *cntr) in write_block_terminator() argument
772 return container_recursive_write(cntr, &block, sizeof(block)); in write_block_terminator()
775 static int write_data_size(struct container_context *cntr, uint64_t byte_count) in write_data_size() argument
777 struct builder_state *state = cntr->private_data; in write_data_size()
785 err = container_seek_offset(cntr, offset); in write_data_size()
794 if (byte_count > cntr->max_size - offset) in write_data_size()
795 byte_count = cntr->max_size; in write_data_size()
800 return container_recursive_write(cntr, &size_field, sizeof(size_field)); in write_data_size()
803 static int voc_builder_post_process(struct container_context *cntr, in voc_builder_post_process() argument
808 err = write_block_terminator(cntr); in voc_builder_post_process()
812 return write_data_size(cntr, handled_byte_count); in voc_builder_post_process()