Start work towards detecting ausio codec type from the actual audio data.

This commit is contained in:
Erik de Castro Lopo 2007-02-13 13:19:24 +11:00
parent ac61efccb8
commit b1112ed550
3 changed files with 24 additions and 1 deletions

View File

@ -692,6 +692,9 @@ wav_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
if (psf->endian == SF_ENDIAN_BIG)
psf->sf.format |= SF_ENDIAN_BIG ;
if (wpriv->fmt_is_broken)
wav_w64_analyze (psf) ;
return 0 ;
} /* wav_read_header */

View File

@ -116,7 +116,7 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize)
{ psf_log_printf (psf, " Bit Width : 24\n") ;
psf_log_printf (psf, "\n"
"Ambiguous information in 'fmt ' chunk. Possibilities\n"
"Ambiguous information in 'fmt ' chunk. Possibile file types:\n"
" 0) Invalid IEEE float file generated by Syntrillium's Cooledit!\n"
" 1) File generated by ALSA's arecord containing 24 bit samples in 32 bit containers.\n"
" 2) 24 bit file with incorrect Block Align value.\n"
@ -360,6 +360,25 @@ wavex_write_guid (SF_PRIVATE *psf, const EXT_SUBFORMAT * subformat)
subformat->esf_field4, make_size_t (8)) ;
} /* wavex_write_guid */
void
wav_w64_analyze (SF_PRIVATE *psf)
{ unsigned char buffer [512] ;
if (psf->is_pipe)
{ psf_log_printf (psf, "*** Error : Reading from a pipe. Can't analyze data section to figure out real data format.\n\n") ;
return ;
} ;
printf ("wpriv->fmt_is_broken : dataoffset %lld datalength %lld current : %lld\n", psf->dataoffset, psf->datalength, psf_fseek (psf, 0, SEEK_CUR)) ;
/* Code goes here. */
/* Seek back to start of audio data before returning. */
psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
} /* wav_w64_analyze */
/*==============================================================================
*/

View File

@ -281,6 +281,7 @@ int wav_w64_srate2blocksize (int srate_chan_product) ;
char const* wav_w64_format_str (int k) ;
int wav_w64_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize) ;
void wavex_write_guid (SF_PRIVATE *psf, const EXT_SUBFORMAT * subformat) ;
void wav_w64_analyze (SF_PRIVATE *psf) ;
#endif
/*