wavlike: Add fmt MPEGLAYER3

See Microsoft's documentation for <mmreg.h>.
This commit is contained in:
Arthur Taylor 2021-03-25 15:43:00 -07:00
parent 294eb05633
commit c42e41324b
2 changed files with 36 additions and 1 deletions

View File

@ -173,6 +173,7 @@ wavlike_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize)
{ switch (wav_fmt->format)
{ case WAVE_FORMAT_GSM610 :
case WAVE_FORMAT_IPP_ITU_G_723_1 :
case WAVE_FORMAT_MPEGLAYER3 :
psf_log_printf (psf, " Bit Width : %d\n", wav_fmt->min.bitwidth) ;
break ;
default :
@ -183,7 +184,8 @@ wavlike_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize)
{ switch (wav_fmt->format)
{ case WAVE_FORMAT_GSM610 :
case WAVE_FORMAT_IPP_ITU_G_723_1 :
psf_log_printf (psf, " Bit Width : %d (should be 0)\n", wav_fmt->min.bitwidth) ;
case WAVE_FORMAT_MPEGLAYER3 :
psf_log_printf (psf, " Bit Width : %d (should be 0)\n", wav_fmt->min.bitwidth) ;
break ;
default :
psf_log_printf (psf, " Bit Width : %d\n", wav_fmt->min.bitwidth) ;
@ -306,6 +308,23 @@ wavlike_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize)
psf_log_printf (psf, " Samples/Block : %d\n", wav_fmt->gsm610.samplesperblock) ;
break ;
case WAVE_FORMAT_MPEGLAYER3 :
bytesread += psf_binheader_readf (psf, "24222", &(wav_fmt->mpeg3.extrabytes),
&(wav_fmt->mpeg3.id), &(wav_fmt->mpeg3.flags), &(wav_fmt->mpeg3.blocksize),
&(wav_fmt->mpeg3.samplesperblock), &(wav_fmt->mpeg3.codecdelay)) ;
psf_log_printf (psf, " Bytes/sec : %d\n", wav_fmt->mpeg3.bytespersec) ;
psf_log_printf (psf, " Extra Bytes : %d\n", wav_fmt->mpeg3.extrabytes) ;
if (wav_fmt->mpeg3.id != 1)
psf_log_printf (psf, " ID : %d (unknown, should be 1)\n", wav_fmt->mpeg3.id) ;
else
psf_log_printf (psf, " ID : MPEGLAYER3_ID_MPEG\n") ;
psf_log_printf (psf, " Flags : 0x%08x\n", wav_fmt->mpeg3.flags) ;
psf_log_printf (psf, " Block Size : %d\n", wav_fmt->mpeg3.blocksize) ;
psf_log_printf (psf, " Samples/Block : %d\n", wav_fmt->mpeg3.samplesperblock) ;
psf_log_printf (psf, " Codec Delay : %d samples\n", wav_fmt->mpeg3.codecdelay) ;
break ;
case WAVE_FORMAT_EXTENSIBLE :
if (wav_fmt->ext.bytespersec != wav_fmt->ext.samplerate * wav_fmt->ext.blockalign)
psf_log_printf (psf, " Bytes/sec : %d (should be %d)\n", wav_fmt->ext.bytespersec, wav_fmt->ext.samplerate * wav_fmt->ext.blockalign) ;

View File

@ -263,6 +263,21 @@ typedef struct
unsigned short samplesperblock ;
} GSM610_WAV_FMT ;
typedef struct
{ unsigned short format ;
unsigned short channels ;
unsigned int samplerate ;
unsigned int bytespersec ;
unsigned short blockalign ;
unsigned short bitwidth ;
unsigned short extrabytes ;
unsigned short id ;
unsigned int flags ;
unsigned short blocksize ;
unsigned short samplesperblock ;
unsigned short codecdelay ;
} MPEGLAYER3_WAV_FMT ;
typedef struct
{ unsigned int esf_field1 ;
unsigned short esf_field2 ;
@ -291,6 +306,7 @@ typedef union
G72x_ADPCM_WAV_FMT g72x ;
EXTENSIBLE_WAV_FMT ext ;
GSM610_WAV_FMT gsm610 ;
MPEGLAYER3_WAV_FMT mpeg3 ;
WAV_FMT_SIZE20 size20 ;
char padding [512] ;
} WAV_FMT ;