Start working on setting/getting chunks.

This commit is contained in:
Erik de Castro Lopo 2011-12-28 14:13:46 +11:00
parent 9b5e0d33cb
commit 6eb38cdc4b
3 changed files with 62 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2011-11-12 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/sndfile.h.in src/common.h src/sndfile.c
Start working on setting/getting chunks.
2011-11-24 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/binheader_writef_check.py src/create_symbols_file.py

View File

@ -438,6 +438,11 @@ typedef struct sf_private_tag
int virtual_io ;
SF_VIRTUAL_IO vio ;
void *vio_user_data ;
/* Chunk get/set. */
int (*set_chunk) (struct sf_private_tag*, const SF_CHUNK_INFO * chunk_info) ;
int (*get_chunk_size) (struct sf_private_tag*, SF_CHUNK_INFO * chunk_info) ;
int (*get_chunk_data) (struct sf_private_tag*, SF_CHUNK_INFO * chunk_info) ;
} SF_PRIVATE ;
@ -631,6 +636,7 @@ enum
SFE_VORBIS_ENCODER_BUG,
SFE_RF64_NOT_RF64,
SFE_BAD_CHUNK_INFO_PTR,
SFE_MAX_ERROR /* This must be last in list. */
} ;

View File

@ -254,6 +254,8 @@ ErrorStruct SndfileErrors [] =
{ SFE_RF64_NOT_RF64 , "Error : Not an RF64 file." },
{ SFE_BAD_CHUNK_INFO_PTR , "Error : Bad SF_CHUNK_INFO pointer." },
{ SFE_MAX_ERROR , "Maximum error number." },
{ SFE_MAX_ERROR + 1 , NULL }
} ;
@ -2921,3 +2923,52 @@ error_exit :
return NULL ;
} /* psf_open_file */
/*==============================================================================
** Chunk getting and setting.
*/
int
sf_set_chunk (SNDFILE * sndfile, const SF_CHUNK_INFO * chunk_info)
{ SF_PRIVATE *psf ;
VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
if (chunk_info == NULL)
return SFE_BAD_CHUNK_INFO_PTR ;
if (psf->set_chunk)
return psf->set_chunk (psf, chunk_info) ;
return SFE_UNIMPLEMENTED ;
} /* sf_set_chunk */
int
sf_get_chunk_size (SNDFILE * sndfile, SF_CHUNK_INFO * chunk_info)
{ SF_PRIVATE *psf ;
VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
if (chunk_info == NULL)
return SFE_BAD_CHUNK_INFO_PTR ;
if (psf->get_chunk_size)
return psf->get_chunk_size (psf, chunk_info) ;
return SFE_UNIMPLEMENTED ;
} /* sf_get_chunk_size */
int
sf_get_chunk_data (SNDFILE * sndfile, SF_CHUNK_INFO * chunk_info)
{ SF_PRIVATE *psf ;
VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
if (chunk_info == NULL)
return SFE_BAD_CHUNK_INFO_PTR ;
if (psf->get_chunk_data)
return psf->get_chunk_data (psf, chunk_info) ;
return SFE_UNIMPLEMENTED ;
} /* sf_get_chunk_data */