src/flac.c : Improve reporting of FLAC metadata.

This commit is contained in:
Erik de Castro Lopo 2007-07-12 22:16:35 +10:00
parent cb40320a58
commit 89a552500a
2 changed files with 28 additions and 0 deletions

View File

@ -3,6 +3,7 @@
* src/flac.c
Apply patch from Ed Schouten to read artist and title metadata from FLAC
files.
Improve reporting of FLAC metadata.
* src/sndfile.h.in tests/string_test.c src/flac.c
Add string type SF_STR_ALBUM, update test and use for FLAC files.

View File

@ -368,6 +368,7 @@ sf_flac_meta_get_vorbiscomment (SF_PRIVATE *psf, int str_type, const FLAC__Strea
if ((s = strchr (value, '=')) != NULL)
value = s + 1 ;
psf_log_printf (psf, " %-10s : %s\n", tag, value) ;
psf_store_string (psf, str_type, value) ;
} ;
@ -416,6 +417,30 @@ sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC_
sf_flac_meta_get_vorbiscomment (psf, SF_STR_ALBUM, metadata, "album") ;
break ;
case FLAC__METADATA_TYPE_PADDING :
psf_log_printf (psf, "Padding Metadata\n") ;
break ;
case FLAC__METADATA_TYPE_APPLICATION :
psf_log_printf (psf, "Application Metadata\n") ;
break ;
case FLAC__METADATA_TYPE_SEEKTABLE :
psf_log_printf (psf, "Seektable Metadata\n") ;
break ;
case FLAC__METADATA_TYPE_CUESHEET :
psf_log_printf (psf, "Cuesheet Metadata\n") ;
break ;
case FLAC__METADATA_TYPE_PICTURE :
psf_log_printf (psf, "Picture Metadata\n") ;
break ;
case FLAC__METADATA_TYPE_UNDEFINED :
psf_log_printf (psf, "Undefined Metadata\n") ;
break ;
default :
psf_log_printf (psf, "sf_flac_meta_callback : metadata-type %d not yet implemented.\n", metadata->type) ;
break ;
@ -627,6 +652,8 @@ flac_read_header (SF_PRIVATE *psf)
if ((pflac->fsd = FLAC__stream_decoder_new ()) == NULL)
return SFE_FLAC_NEW_DECODER ;
FLAC__stream_decoder_set_metadata_respond_all (pflac->fsd) ;
if (FLAC__stream_decoder_init_stream (pflac->fsd, sf_flac_read_callback, sf_flac_seek_callback, sf_flac_tell_callback, sf_flac_length_callback, sf_flac_eof_callback, sf_flac_write_callback, sf_flac_meta_callback, sf_flac_error_callback, psf) != FLAC__STREAM_DECODER_INIT_STATUS_OK)
return SFE_FLAC_INIT_DECODER ;