Read the ALAC 'pakt' header and stash the values.

This commit is contained in:
Erik de Castro Lopo 2013-02-03 09:38:22 +11:00
parent a1b8c7e3dc
commit 20f29c6806
3 changed files with 29 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2013-02-03 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/common.h src/caf.c
Read the ALAC 'pakt' header and stash the values.
2013-02-02 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* doc/FAQ.html

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2005-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2005-2013 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -462,8 +462,25 @@ caf_read_header (SF_PRIVATE *psf)
case pakt_MARKER :
psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
psf_binheader_readf (psf, "E8844", &pcaf->alac.packets, &pcaf->alac.valid_frames,
&pcaf->alac.priming_frames, &pcaf->alac.remainder_frames) ;
psf_log_printf (psf,
" Packets : %D\n"
" Valid frames : %D\n"
" Priming frames : %d\n"
" Remainder frames : %d\n",
pcaf->alac.packets, pcaf->alac.valid_frames, pcaf->alac.priming_frames,
pcaf->alac.remainder_frames
) ;
if (pcaf->alac.packets == 0 && pcaf->alac.valid_frames == 0
&& pcaf->alac.priming_frames == 0 && pcaf->alac.remainder_frames == 0)
psf_log_printf (psf, "*** 'pakt' chunk header is all zero.\n") ;
pcaf->alac.pakt_offset = psf_ftell (psf) - 12 ;
psf_binheader_readf (psf, "j", make_size_t (chunk_size)) ;
psf_binheader_readf (psf, "j", make_size_t (chunk_size) - 24) ;
break ;
default :

View File

@ -183,6 +183,11 @@ typedef struct
unsigned bits_per_sample ;
unsigned frames_per_packet ;
int64_t packets ;
int64_t valid_frames ;
int32_t priming_frames ;
int32_t remainder_frames ;
} ALAC_DECODER_INFO ;
/*---------------------------------------------------------------------------------------