summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2013-02-05 19:07:08 +1100
committerErik de Castro Lopo <erikd@mega-nerd.com>2013-02-05 19:07:08 +1100
commit862b00cc40940568a915270f92e08ebb3b24c359 (patch)
treed4e94e892ecceb072f871879620ee5847df5cc27
parent3bf4533c9612fc3f37800f614f942638b8db41b9 (diff)
src/alac.c : The 'pakt' chunk header should now be written correctly.
-rw-r--r--ChangeLog6
-rw-r--r--src/alac.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index be08e6c..5e9b251 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/src/alac.c b/src/alac.c
index b2247a5..f4763fc 100644
--- a/src/alac.c
+++ b/src/alac.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 ;