Home | History | Annotate | Download | only in libFLAC

Lines Matching refs:block

90 static FLAC__bool read_metadata_block_data_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block);
92 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata *block);
93 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_StreamInfo *block);
94 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, unsigned block_length);
95 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, unsigned block_length);
96 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, unsigned block_length);
98 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment *block);
100 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet *block);
101 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Picture *block);
102 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, unsigned block_length);
104 static FLAC__bool write_metadata_block_header_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block);
105 static FLAC__bool write_metadata_block_data_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block);
106 static FLAC__bool write_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block);
107 static FLAC__bool write_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block);
108 static FLAC__bool write_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_StreamInfo *block);
109 static FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, unsigned block_length);
110 static FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, unsigned block_length);
111 static FLAC__bool write_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_SeekTable *block);
112 static FLAC__bool write_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_VorbisComment *block);
113 static FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_CueSheet *block);
114 static FLAC__bool write_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Picture *block);
115 static FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, unsigned block_length);
117 static FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *iterator, const FLAC__StreamMetadata *block);
118 static FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, unsigned padding_length, FLAC__bool padding_is_last);
119 static FLAC__bool rewrite_whole_file_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool append);
267 * we assume we only get here when the one metadata block we were
353 off_t first_offset; /* this is the offset to the STREAMINFO block */
355 /* this is the metadata block header of the current block we are pointing to: */
646 FLAC__StreamMetadata *block = FLAC__metadata_object_new(iterator->type);
651 if(0 != block) {
652 block->is_last = iterator->is_last;
653 block->length = iterator->length;
655 if(!read_metadata_block_data_(iterator, block)) {
656 FLAC__metadata_object_delete(block);
660 /* back up to the beginning of the block data to stay consistent */
663 FLAC__metadata_object_delete(block);
670 return block;
673 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding)
680 FLAC__ASSERT(0 != block);
687 if(iterator->type == FLAC__METADATA_TYPE_STREAMINFO || block->type == FLAC__METADATA_TYPE_STREAMINFO) {
688 if(iterator->type != block->type) {
694 block->is_last = iterator->is_last;
696 if(iterator->length == block->length)
697 return write_metadata_block_stationary_(iterator, block);
698 else if(iterator->length > block->length) {
699 if(use_padding && iterator->length >= FLAC__STREAM_METADATA_HEADER_LENGTH + block->length) {
700 ret = write_metadata_block_stationary_with_padding_(iterator, block, iterator->length - FLAC__STREAM_METADATA_HEADER_LENGTH - block->length, block->is_last);
706 ret = rewrite_whole_file_(iterator, block, /*append=*/false);
712 else /* iterator->length < block->length */ {
721 const unsigned extra_padding_bytes_required = block->length - iterator->length;
733 block->is_last = iterator->is_last;
740 block->is_last = false;
749 ret = write_metadata_block_stationary_(iterator, block);
756 ret = write_metadata_block_stationary_with_padding_(iterator, block, padding_leftover - FLAC__STREAM_METADATA_HEADER_LENGTH, padding_is_last);
763 ret = rewrite_whole_file_(iterator, block, /*append=*/false);
771 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding)
781 FLAC__ASSERT(0 != block);
786 if(block->type == FLAC__METADATA_TYPE_STREAMINFO) {
791 block->is_last = iterator->is_last;
808 if(iterator->length == block->length) {
810 block->is_last = iterator->is_last;
812 else if(iterator->length < FLAC__STREAM_METADATA_HEADER_LENGTH + block->length)
815 padding_leftover = iterator->length - block->length;
817 block->is_last = false;
825 /* move to the next block, which is suitable padding */
829 ret = write_metadata_block_stationary_(iterator, block);
836 ret = write_metadata_block_stationary_with_padding_(iterator, block, padding_leftover - FLAC__STREAM_METADATA_HEADER_LENGTH, padding_is_last);
843 ret = rewrite_whole_file_(iterator, block, /*append=*/true);
1124 /* if the metadata shrank and the last block is padding, we just extend the last padding block */
1131 /* if the metadata shrank more than 4 bytes then there's room to add another padding block */
1150 /* if the metadata grew but the last block is padding, try cutting the padding to restore the original length so we don't have to rewrite the whole file */
1154 /* if the delta is exactly the size of the last padding block, remove the padding block */
1408 /* copy the file prefix (data up to first metadata block */
1467 /* copy the file prefix (data up to first metadata block */
1625 /* if the metadata shrank and the last block is padding, we just extend the last padding block */
1628 /* if the metadata shrank more than 4 bytes then there's room to add another padding block */
1631 /* if the metadata grew but the last block is padding, try cutting the padding to restore the original length so we don't have to rewrite the whole file */
1635 /* if the delta is exactly the size of the last padding block, remove the padding block */
1902 FLAC_API FLAC__bool FLAC__metadata_iterator_set_block(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block)
1905 FLAC__ASSERT(0 != block);
1906 block);
1935 FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block)
1941 FLAC__ASSERT(0 != block);
1943 if(block->type == FLAC__METADATA_TYPE_STREAMINFO)
1954 node->data = block;
1960 FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block)
1966 FLAC__ASSERT(0 != block);
1968 if(block->type == FLAC__METADATA_TYPE_STREAMINFO)
1974 node->data = block;
2069 FLAC__bool read_metadata_block_data_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block)
2074 iterator->status = read_metadata_block_data_cb_((FLAC__IOHandle)iterator->file, (FLAC__IOCallback_Read)fread, fseek_wrapper_, block);
2092 * we just will read in an opaque block
2098 FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata *block)
2100 switch(block->type) {
2102 return read_metadata_block_data_streaminfo_cb_(handle, read_cb, &block->data.stream_info);
2104 return read_metadata_block_data_padding_cb_(handle, seek_cb, &block->data.padding, block->length);
2106 return read_metadata_block_data_application_cb_(handle, read_cb, &block->data.application, block->length);
2108 return read_metadata_block_data_seektable_cb_(handle, read_cb, &block->data.seek_table, block->length);
2110 return read_metadata_block_data_vorbis_comment_cb_(handle, read_cb, &block->data.vorbis_comment);
2112 return read_metadata_block_data_cuesheet_cb_(handle, read_cb, &block->data.cue_sheet);
2114 return read_metadata_block_data_picture_cb_(handle, read_cb, &block->data.picture);
2116 return read_metadata_block_data_unknown_cb_(handle, read_cb, &block->data.unknown, block->length);
2120 FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_StreamInfo *block)
2133 block->min_blocksize = unpack_uint32_(b, 2); b += 2;
2134 block->max_blocksize = unpack_uint32_(b, 2); b += 2;
2135 block->min_framesize = unpack_uint32_(b, 3); b += 3;
2136 block->max_framesize = unpack_uint32_(b, 3); b += 3;
2137 block->sample_rate = (unpack_uint32_(b, 2) << 4) | ((unsigned)(b[2] & 0xf0) >> 4);
2138 block->channels = (unsigned)((b[2] & 0x0e) >> 1) + 1;
2139 block->bits_per_sample = ((((unsigned)(b[2] & 0x01)) << 4) | (((unsigned)(b[3] & 0xf0)) >> 4)) + 1;
2140 block->total_samples = (((FLAC__uint64)(b[3] & 0x0f)) << 32) | unpack_uint64_(b+4, 4);
2141 memcpy(block->md5sum, b+8, 16);
2146 FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, unsigned block_length)
2148 (void)block; /* nothing to do; we don't care about reading the padding bytes */
2156 FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, unsigned block_length)
2160 if(read_cb(block->id, 1, id_bytes, handle) != id_bytes)
2169 block->data = 0;
2172 if(0 == (block->data = (FLAC__byte*)malloc(block_length)))
2175 if(read_cb(block->data, 1, block_length, handle) != block_length)
2182 FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, unsigned block_length)
2189 block->num_points = block_length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
2191 if(block->num_points == 0)
2192 block->points = 0;
2193 else if(0 == (block->points = (FLAC__StreamMetadata_SeekPoint*)safe_malloc_mul_2op_(block->num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint))))
2196 for(i = 0; i < block->num_points; i++) {
2200 block->points[i].sample_number = unpack_uint64_(buffer, 8);
2201 block->points[i].stream_offset = unpack_uint64_(buffer+8, 8);
2202 block->points[i].frame_samples = unpack_uint32_(buffer+16, 2);
2238 FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment *block)
2247 if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_vorbis_comment_entry_cb_(handle, read_cb, &(block->vendor_string))))
2252 block->num_comments = unpack_uint32_little_endian_(buffer, num_comments_len);
2254 if(block->num_comments == 0) {
2255 block->comments = 0;
2257 else if(0 == (block->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)calloc(block->num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry))))
2260 for(i = 0; i < block->num_comments; i++) {
2261 if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_vorbis_comment_entry_cb_(handle, read_cb, block->comments + i)))
2337 FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet *block)
2348 if(read_cb(block->media_catalog_number, 1, len, handle) != len)
2355 block->lead_in = unpack_uint64_(buffer, len);
2361 block->is_cd = buffer[0]&0x80? true : false;
2367 block->num_tracks = unpack_uint32_(buffer, len);
2369 if(block->num_tracks == 0) {
2370 block->tracks = 0;
2372 else if(0 == (block->tracks = (FLAC__StreamMetadata_CueSheet_Track*)calloc(block->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track))))
2375 for(i = 0; i < block->num_tracks; i++) {
2376 if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_cuesheet_track_cb_(handle, read_cb, block->tracks + i)))
2414 FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Picture *block)
2430 block->type = (FLAC__StreamMetadata_Picture_Type)unpack_uint32_(buffer, len);
2432 if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, (FLAC__byte**)(&(block->mime_type)), &len, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK)
2435 if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, &(block->description), &len, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK)
2442 block->width = unpack_uint32_(buffer, len);
2448 block->height = unpack_uint32_(buffer, len);
2454 block->depth = unpack_uint32_(buffer, len);
2460 block->colors = unpack_uint32_(buffer, len);
2463 if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, &(block->data), &(block->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK)
2469 FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, unsigned block_length)
2472 block->data = 0;
2475 if(0 == (block->data = (FLAC__byte*)malloc(block_length)))
2478 if(read_cb(block->data, 1, block_length, handle) != block_length)
2485 FLAC__bool write_metadata_block_header_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block)
2490 if(!write_metadata_block_header_cb_((FLAC__IOHandle)file, (FLAC__IOCallback_Write)fwrite, block)) {
2498 FLAC__bool write_metadata_block_data_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block)
2503 if (write_metadata_block_data_cb_((FLAC__IOHandle)file, (FLAC__IOCallback_Write)fwrite, block)) {
2513 FLAC__bool write_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block)
2517 FLAC__ASSERT(block->length < (1u << FLAC__STREAM_METADATA_LENGTH_LEN));
2519 buffer[0] = (block->is_last? 0x80 : 0) | (FLAC__byte)block->type;
2520 pack_uint32_(block->length, buffer + 1, 3);
2528 FLAC__bool write_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block)
2530 FLAC__ASSERT(0 != block);
2532 switch(block->type) {
2534 return write_metadata_block_data_streaminfo_cb_(handle, write_cb, &block->data.stream_info);
2536 return write_metadata_block_data_padding_cb_(handle, write_cb, &block->data.padding, block->length);
2538 return write_metadata_block_data_application_cb_(handle, write_cb, &block->data.application, block->length);
2540 return write_metadata_block_data_seektable_cb_(handle, write_cb, &block->data.seek_table);
2542 return write_metadata_block_data_vorbis_comment_cb_(handle, write_cb, &block->data.vorbis_comment);
2544 return write_metadata_block_data_cuesheet_cb_(handle, write_cb, &block->data.cue_sheet);
2546 return write_metadata_block_data_picture_cb_(handle, write_cb, &block->data.picture);
2548 return write_metadata_block_data_unknown_cb_(handle, write_cb, &block->data.unknown, block->length);
2552 FLAC__bool write_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_StreamInfo *block)
2555 const unsigned channels1 = block->channels - 1;
2556 const unsigned bps1 = block->bits_per_sample - 1;
2562 pack_uint32_(block->min_blocksize, buffer, 2);
2563 pack_uint32_(block->max_blocksize, buffer+2, 2);
2564 pack_uint32_(block->min_framesize, buffer+4, 3);
2565 pack_uint32_(block->max_framesize, buffer+7, 3);
2566 buffer[10] = (block->sample_rate >> 12) & 0xff;
2567 buffer[11] = (block->sample_rate >> 4) & 0xff;
2568 buffer[12] = ((block->sample_rate & 0x0f) << 4) | (channels1 << 1) | (bps1 >> 4);
2569 buffer[13] = (FLAC__byte)(((bps1 & 0x0f) << 4) | ((block->total_samples >> 32) & 0x0f));
2570 pack_uint32_((FLAC__uint32)block->total_samples, buffer+14, 4);
2571 memcpy(buffer+18, block->md5sum, 16);
2579 FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, unsigned block_length)
2584 (void)block;
2600 FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, unsigned block_length)
2604 if(write_cb(block->id, 1, id_bytes, handle) != id_bytes)
2609 if(write_cb(block->data, 1, block_length, handle) != block_length)
2615 FLAC__bool write_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_SeekTable *block)
2620 for(i = 0; i < block->num_points; i++) {
2622 pack_uint64_(block->points[i].sample_number, buffer, 8);
2623 pack_uint64_(block->points[i].stream_offset, buffer+8, 8);
2624 pack_uint32_(block->points[i].frame_samples, buffer+16, 2);
2632 FLAC__bool write_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_VorbisComment *block)
2641 pack_uint32_little_endian_(block->vendor_string.length, buffer, entry_length_len);
2644 if(write_cb(block->vendor_string.entry, 1, block->vendor_string.length, handle) != block->vendor_string.length)
2647 pack_uint32_little_endian_(block->num_comments, buffer, num_comments_len);
2651 for(i = 0; i < block->num_comments; i++) {
2652 pack_uint32_little_endian_(block->comments[i].length, buffer, entry_length_len);
2655 if(write_cb(block->comments[i].entry, 1, block->comments[i].length, handle) != block->comments[i].length)
2662 FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_CueSheet *block)
2674 if(write_cb(block->media_catalog_number, 1, len, handle) != len)
2679 pack_uint64_(block->lead_in, buffer, len);
2686 if(block->is_cd)
2693 pack_uint32_(block->num_tracks, buffer, len);
2697 for(i = 0; i < block->num_tracks; i++) {
2698 FLAC__StreamMetadata_CueSheet_Track *track = block->tracks + i;
2756 FLAC__bool write_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Picture *block)
2780 pack_uint32_(block->type, buffer, len);
2785 slen = strlen(block->mime_type);
2789 if(write_cb(block->mime_type, 1, slen, handle) != slen)
2793 slen = strlen((const char *)block->description);
2797 if(write_cb(block->description, 1, slen, handle) != slen)
2801 pack_uint32_(block->width, buffer, len);
2806 pack_uint32_(block->height, buffer, len);
2811 pack_uint32_(block->depth, buffer, len);
2816 pack_uint32_(block->colors, buffer, len);
2821 pack_uint32_(block->data_length, buffer, len);
2824 if(write_cb(block->data, 1, block->data_length, handle) != block->data_length)
2830 FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, unsigned block_length)
2832 if(write_cb(block->data, 1, block_length, handle) != block_length)
2838 FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *iterator, const FLAC__StreamMetadata *block)
2845 if(!write_metadata_block_header_(iterator->file, &iterator->status, block))
2848 if(!write_metadata_block_data_(iterator->file, &iterator->status, block))
2859 FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, unsigned padding_length, FLAC__bool padding_is_last)
2868 block->is_last = false;
2870 if(!write_metadata_block_header_(iterator->file, &iterator->status, block))
2873 if(!write_metadata_block_data_(iterator->file, &iterator->status, block))
2902 FLAC__bool rewrite_whole_file_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool append)
2909 FLAC__ASSERT(0 != block || append == false);
2916 else if(0 == block) {
2932 if(0 != block) {
2933 if(!write_metadata_block_header_(tempfile, &iterator->status, block)) {
2938 if(!write_metadata_block_data_(tempfile, &iterator->status, block)) {
2944 if(!simple_iterator_copy_file_postfix_(iterator, &tempfile, &tempfilename, fixup_is_last_code, fixup_is_last_flag_offset, block==0))
3070 * if code == 1, it means a block was appended to the end so
3071 * we have to clear the is_last flag of the previous block
3072 * if code == -1, it means the last block was deleted so
3073 * we have to set the is_last flag of the previous block
3124 /* move the iterator to it's original block faster by faking a push, then doing a pop_ */