mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 01:49:53 +00:00
RF64 tweaks
* Comments. * Improve the `rf64_long_file_downgrade_test` test.
This commit is contained in:
parent
ff26310437
commit
cecc9a7498
@ -339,6 +339,7 @@ rf64_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
|
||||
} ;
|
||||
break ;
|
||||
|
||||
case JUNK_MARKER :
|
||||
case PAD_MARKER :
|
||||
psf_log_printf (psf, "%M : %d\n", marker, chunk_size) ;
|
||||
psf_binheader_readf (psf, "j", chunk_size) ;
|
||||
@ -740,6 +741,7 @@ rf64_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
|
||||
#endif
|
||||
|
||||
/* Padding may be needed if string data sizes change. */
|
||||
pad_size = psf->dataoffset - 16 - psf->header.indx ;
|
||||
if (pad_size >= 0)
|
||||
psf_binheader_writef (psf, "m4z", PAD_MARKER, (unsigned int) pad_size, make_size_t (pad_size)) ;
|
||||
|
@ -480,17 +480,18 @@ rf64_downgrade_test (const char *filename)
|
||||
static void
|
||||
rf64_long_file_downgrade_test (const char *filename)
|
||||
{ static int output [BUFFER_LEN] ;
|
||||
static int input [1] = { 0 } ;
|
||||
|
||||
SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
sf_count_t k, output_frames = 0 ;
|
||||
sf_count_t output_frames = 0 ;
|
||||
|
||||
print_test_name (__func__, filename) ;
|
||||
|
||||
sf_info_clear (&sfinfo) ;
|
||||
|
||||
for (k = 0 ; k < BUFFER_LEN ; k++)
|
||||
output [k] = 0x1020304 ;
|
||||
memset (output, 0, sizeof (output)) ;
|
||||
output [0] = 0x1020304 ;
|
||||
|
||||
sfinfo.samplerate = 44100 ;
|
||||
sfinfo.frames = ARRAY_LEN (output) ;
|
||||
@ -516,6 +517,10 @@ rf64_long_file_downgrade_test (const char *filename)
|
||||
exit_if_true (sfinfo.channels != 1, "\n\nLine %d: Incorrect number of channels in file.\n", __LINE__) ;
|
||||
exit_if_true (sfinfo.frames != output_frames, "\n\nLine %d: Incorrect number of frames in file (%d should be %d).\n", __LINE__, (int) sfinfo.frames, (int) output_frames) ;
|
||||
|
||||
/* Check that the first sample read is the same as the first written. */
|
||||
test_read_int_or_die (file, 0, input, ARRAY_LEN (input), __LINE__) ;
|
||||
exit_if_true (input [0] != output [0], "\n\nLine %d: Bad first sample (0x%08x).\n", __LINE__, input [0]) ;
|
||||
|
||||
check_log_buffer_or_die (file, __LINE__) ;
|
||||
|
||||
sf_close (file) ;
|
||||
|
Loading…
Reference in New Issue
Block a user