diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2013-02-05 19:07:08 +1100 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2013-02-05 19:07:08 +1100 |
commit | 862b00cc40940568a915270f92e08ebb3b24c359 (patch) | |
tree | d4e94e892ecceb072f871879620ee5847df5cc27 | |
parent | 3bf4533c9612fc3f37800f614f942638b8db41b9 (diff) |
src/alac.c : The 'pakt' chunk header should now be written correctly.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/alac.c | 7 |
2 files changed, 11 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2013-02-05 Erik de Castro Lopo <erikd AT mega-nerd DOT com> + + * src/alac.c + The 'pakt' chunk header should now be written correctly. + Closes: https://github.com/erikd/libsndfile/issues/24 + 2013-02-03 Erik de Castro Lopo <erikd AT mega-nerd DOT com> * src/common.h src/caf.c @@ -168,14 +168,17 @@ alac_close (SF_PRIVATE *psf) SF_CHUNK_INFO chunk_info ; sf_count_t readcount ; uint8_t *kuki_data [plac->kuki_size] ; - uint32_t pakt_size = 0 ; + uint32_t pakt_size = 0, saved_partial_block_frames ; plac->final_write_block = 1 ; + saved_partial_block_frames = plac->partial_block_frames ; /* If a block has been partially assembled, write it out as the final block. */ if (plac->partial_block_frames && plac->partial_block_frames < plac->frames_per_block) alac_encode_block (psf, plac) ; + plac->partial_block_frames = saved_partial_block_frames ; + alac_get_magic_cookie (penc, kuki_data, &plac->kuki_size) ; memset (&chunk_info, 0, sizeof (chunk_info)) ; @@ -875,7 +878,7 @@ alac_pakt_encode (const SF_PRIVATE *psf, uint32_t * pakt_size_out) psf_put_be64 (data, 0, info->count) ; psf_put_be64 (data, 8, psf->sf.frames) ; - psf_put_be32 (data, 20, plac->partial_block_frames) ; + psf_put_be32 (data, 20, kALACDefaultFramesPerPacket - plac->partial_block_frames) ; /* Real 'pakt' data starts after 24 byte header. */ pakt_size = 24 ; |