@@ -3032,17 +3032,18 @@ FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const
3032
3032
(void )is_last_block ;
3033
3033
#endif
3034
3034
3035
- /* FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED just means we didn't get the offset; no error */
3036
- if (encoder -> private_ -> tell_callback && encoder -> private_ -> tell_callback (encoder , & output_position , encoder -> private_ -> client_data ) == FLAC__STREAM_ENCODER_TELL_STATUS_ERROR ) {
3037
- encoder -> protected_ -> state = FLAC__STREAM_ENCODER_CLIENT_ERROR ;
3038
- return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR ;
3039
- }
3040
-
3041
3035
/*
3042
3036
* Watch for the STREAMINFO block and first SEEKTABLE block to go by and store their offsets.
3043
3037
*/
3044
3038
if (samples == 0 ) {
3045
3039
FLAC__MetadataType type = (buffer [0 ] & 0x7f );
3040
+
3041
+ /* FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED just means we didn't get the offset; no error */
3042
+ if (encoder -> private_ -> tell_callback && encoder -> private_ -> tell_callback (encoder , & output_position , encoder -> private_ -> client_data ) == FLAC__STREAM_ENCODER_TELL_STATUS_ERROR ) {
3043
+ encoder -> protected_ -> state = FLAC__STREAM_ENCODER_CLIENT_ERROR ;
3044
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR ;
3045
+ }
3046
+
3046
3047
if (type == FLAC__METADATA_TYPE_STREAMINFO )
3047
3048
encoder -> protected_ -> streaminfo_offset = output_position ;
3048
3049
else if (type == FLAC__METADATA_TYPE_SEEKTABLE && encoder -> protected_ -> seektable_offset == 0 )
@@ -3066,6 +3067,12 @@ FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const
3066
3067
break ;
3067
3068
}
3068
3069
else if (test_sample >= frame_first_sample ) {
3070
+ /* FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED just means we didn't get the offset; no error */
3071
+ if (output_position == 0 && encoder -> private_ -> tell_callback && encoder -> private_ -> tell_callback (encoder , & output_position , encoder -> private_ -> client_data ) == FLAC__STREAM_ENCODER_TELL_STATUS_ERROR ) {
3072
+ encoder -> protected_ -> state = FLAC__STREAM_ENCODER_CLIENT_ERROR ;
3073
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR ;
3074
+ }
3075
+
3069
3076
encoder -> private_ -> seek_table -> points [i ].sample_number = frame_first_sample ;
3070
3077
encoder -> private_ -> seek_table -> points [i ].stream_offset = output_position - encoder -> protected_ -> audio_offset ;
3071
3078
encoder -> private_ -> seek_table -> points [i ].frame_samples = blocksize ;
0 commit comments