From 9d7f5fe054e26901e709fc7dcf6e6415fa074709 Mon Sep 17 00:00:00 2001 From: Yury Gribov Date: Fri, 27 Apr 2018 21:28:29 +0100 Subject: [PATCH] Hide private symbols. --- configure.ac | 23 ++++++++++++ include/vorbis/codec.h | 82 ++++++++++++++++++++++-------------------- include/vorbis/vorbisenc.h | 12 +++---- include/vorbis/vorbisfile.h | 86 ++++++++++++++++++++++----------------------- lib/block.c | 2 +- vorbis.version | 4 +++ 6 files changed, 121 insertions(+), 88 deletions(-) create mode 100644 vorbis.version diff --git a/configure.ac b/configure.ac index 28b0a14..11d1cb3 100644 --- a/configure.ac +++ b/configure.ac @@ -220,6 +220,29 @@ else fi CFLAGS="$CFLAGS $cflags_save" +dnl -------------------------------- +dnl Check for visibility annotations +dnl -------------------------------- +OLDCFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -fvisibility=hidden" +AC_MSG_CHECKING(whether compiler supports visibility annotations) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[void __attribute__((visibility("default"))) foo() {}]])], + [CFLAGS="$CFLAGS -DVORBIS_ENABLE_VISIBILITY"; + AC_MSG_RESULT(yes)], + [CFLAGS="$OLDCFLAGS" + AC_MSG_RESULT(yes)]) + +dnl ------------------------- +dnl Check for version scripts +dnl ------------------------- +OLDLDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS -Wl,--version-script=$srcdir/vorbis.version" +AC_MSG_CHECKING(whether linker accepts version scripts) +AC_TRY_LINK(,, + AC_MSG_RESULT(yes), + [LDFLAGS="$OLDLDFLAGS" + AC_MSG_RESULT(no)]) + dnl -------------------------------------------------- dnl Check for headers dnl -------------------------------------------------- diff --git a/include/vorbis/codec.h b/include/vorbis/codec.h index 42aa291..f774d58 100644 --- a/include/vorbis/codec.h +++ b/include/vorbis/codec.h @@ -24,6 +24,12 @@ extern "C" #include +#ifdef VORBIS_ENABLE_VISIBILITY +# define VORBIS_EXPORT __attribute__((visibility("default"))) +#else +# define VORBIS_EXPORT +#endif + typedef struct vorbis_info{ int version; int channels; @@ -161,60 +167,60 @@ typedef struct vorbis_comment{ /* Vorbis PRIMITIVES: general ***************************************/ -extern void vorbis_info_init(vorbis_info *vi); -extern void vorbis_info_clear(vorbis_info *vi); -extern int vorbis_info_blocksize(vorbis_info *vi,int zo); -extern void vorbis_comment_init(vorbis_comment *vc); -extern void vorbis_comment_add(vorbis_comment *vc, const char *comment); -extern void vorbis_comment_add_tag(vorbis_comment *vc, +extern VORBIS_EXPORT void vorbis_info_init(vorbis_info *vi); +extern VORBIS_EXPORT void vorbis_info_clear(vorbis_info *vi); +extern VORBIS_EXPORT int vorbis_info_blocksize(vorbis_info *vi,int zo); +extern VORBIS_EXPORT void vorbis_comment_init(vorbis_comment *vc); +extern VORBIS_EXPORT void vorbis_comment_add(vorbis_comment *vc, const char *comment); +extern VORBIS_EXPORT void vorbis_comment_add_tag(vorbis_comment *vc, const char *tag, const char *contents); -extern char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count); -extern int vorbis_comment_query_count(vorbis_comment *vc, const char *tag); -extern void vorbis_comment_clear(vorbis_comment *vc); - -extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); -extern int vorbis_block_clear(vorbis_block *vb); -extern void vorbis_dsp_clear(vorbis_dsp_state *v); -extern double vorbis_granule_time(vorbis_dsp_state *v, +extern VORBIS_EXPORT char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count); +extern VORBIS_EXPORT int vorbis_comment_query_count(vorbis_comment *vc, const char *tag); +extern VORBIS_EXPORT void vorbis_comment_clear(vorbis_comment *vc); + +extern VORBIS_EXPORT int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); +extern VORBIS_EXPORT int vorbis_block_clear(vorbis_block *vb); +extern VORBIS_EXPORT void vorbis_dsp_clear(vorbis_dsp_state *v); +extern VORBIS_EXPORT double vorbis_granule_time(vorbis_dsp_state *v, ogg_int64_t granulepos); -extern const char *vorbis_version_string(void); +extern VORBIS_EXPORT const char *vorbis_version_string(void); /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/ -extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi); -extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op); -extern int vorbis_analysis_headerout(vorbis_dsp_state *v, +extern VORBIS_EXPORT int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi); +extern VORBIS_EXPORT int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op); +extern VORBIS_EXPORT int vorbis_analysis_headerout(vorbis_dsp_state *v, vorbis_comment *vc, ogg_packet *op, ogg_packet *op_comm, ogg_packet *op_code); -extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals); -extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals); -extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb); -extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op); +extern VORBIS_EXPORT float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals); +extern VORBIS_EXPORT int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals); +extern VORBIS_EXPORT int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb); +extern VORBIS_EXPORT int vorbis_analysis(vorbis_block *vb,ogg_packet *op); -extern int vorbis_bitrate_addblock(vorbis_block *vb); -extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, +extern VORBIS_EXPORT int vorbis_bitrate_addblock(vorbis_block *vb); +extern VORBIS_EXPORT int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op); /* Vorbis PRIMITIVES: synthesis layer *******************************/ -extern int vorbis_synthesis_idheader(ogg_packet *op); -extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, +extern VORBIS_EXPORT int vorbis_synthesis_idheader(ogg_packet *op); +extern VORBIS_EXPORT int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, ogg_packet *op); -extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi); -extern int vorbis_synthesis_restart(vorbis_dsp_state *v); -extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op); -extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op); -extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb); -extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm); -extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm); -extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples); -extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op); - -extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag); -extern int vorbis_synthesis_halfrate_p(vorbis_info *v); +extern VORBIS_EXPORT int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi); +extern VORBIS_EXPORT int vorbis_synthesis_restart(vorbis_dsp_state *v); +extern VORBIS_EXPORT int vorbis_synthesis(vorbis_block *vb,ogg_packet *op); +extern VORBIS_EXPORT int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op); +extern VORBIS_EXPORT int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb); +extern VORBIS_EXPORT int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm); +extern VORBIS_EXPORT int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm); +extern VORBIS_EXPORT int vorbis_synthesis_read(vorbis_dsp_state *v,int samples); +extern VORBIS_EXPORT long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op); + +extern VORBIS_EXPORT int vorbis_synthesis_halfrate(vorbis_info *v,int flag); +extern VORBIS_EXPORT int vorbis_synthesis_halfrate_p(vorbis_info *v); /* Vorbis ERRORS and return codes ***********************************/ diff --git a/include/vorbis/vorbisenc.h b/include/vorbis/vorbisenc.h index 55f3b4a..3ad3303 100644 --- a/include/vorbis/vorbisenc.h +++ b/include/vorbis/vorbisenc.h @@ -56,7 +56,7 @@ extern "C" * \retval OV_EINVAL Invalid setup request, eg, out of range argument. * \retval OV_EIMPL Unimplemented mode; unable to comply with bitrate request. */ -extern int vorbis_encode_init(vorbis_info *vi, +extern VORBIS_EXPORT int vorbis_encode_init(vorbis_info *vi, long channels, long rate, @@ -93,7 +93,7 @@ extern int vorbis_encode_init(vorbis_info *vi, * \retval OV_EINVAL Invalid setup request, eg, out of range argument. * \retval OV_EIMPL Unimplemented mode; unable to comply with bitrate request. */ -extern int vorbis_encode_setup_managed(vorbis_info *vi, +extern VORBIS_EXPORT int vorbis_encode_setup_managed(vorbis_info *vi, long channels, long rate, @@ -125,7 +125,7 @@ extern int vorbis_encode_setup_managed(vorbis_info *vi, * \retval OV_EINVAL Invalid setup request, eg, out of range argument. * \retval OV_EIMPL Unimplemented mode; unable to comply with quality level request. */ -extern int vorbis_encode_setup_vbr(vorbis_info *vi, +extern VORBIS_EXPORT int vorbis_encode_setup_vbr(vorbis_info *vi, long channels, long rate, @@ -154,7 +154,7 @@ extern int vorbis_encode_setup_vbr(vorbis_info *vi, * \retval OV_EINVAL Invalid setup request, eg, out of range argument. * \retval OV_EIMPL Unimplemented mode; unable to comply with quality level request. */ -extern int vorbis_encode_init_vbr(vorbis_info *vi, +extern VORBIS_EXPORT int vorbis_encode_init_vbr(vorbis_info *vi, long channels, long rate, @@ -188,7 +188,7 @@ extern int vorbis_encode_init_vbr(vorbis_info *vi, * initialize the high-level encoding setup * */ -extern int vorbis_encode_setup_init(vorbis_info *vi); +extern VORBIS_EXPORT int vorbis_encode_setup_init(vorbis_info *vi); /** * This function implements a generic interface to miscellaneous encoder @@ -216,7 +216,7 @@ extern int vorbis_encode_setup_init(vorbis_info *vi); * * \retval OV_EIMPL Unimplemented or unknown request */ -extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg); +extern VORBIS_EXPORT int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg); /** * \deprecated This is a deprecated interface. Please use vorbis_encode_ctl() diff --git a/include/vorbis/vorbisfile.h b/include/vorbis/vorbisfile.h index 5662611..5880c65 100644 --- a/include/vorbis/vorbisfile.h +++ b/include/vorbis/vorbisfile.h @@ -145,57 +145,57 @@ typedef struct OggVorbis_File { } OggVorbis_File; -extern int ov_clear(OggVorbis_File *vf); -extern int ov_fopen(const char *path,OggVorbis_File *vf); -extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes); -extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf, +extern VORBIS_EXPORT int ov_clear(OggVorbis_File *vf); +extern VORBIS_EXPORT int ov_fopen(const char *path,OggVorbis_File *vf); +extern VORBIS_EXPORT int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes); +extern VORBIS_EXPORT int ov_open_callbacks(void *datasource, OggVorbis_File *vf, const char *initial, long ibytes, ov_callbacks callbacks); -extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes); -extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf, +extern VORBIS_EXPORT int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes); +extern VORBIS_EXPORT int ov_test_callbacks(void *datasource, OggVorbis_File *vf, const char *initial, long ibytes, ov_callbacks callbacks); -extern int ov_test_open(OggVorbis_File *vf); - -extern long ov_bitrate(OggVorbis_File *vf,int i); -extern long ov_bitrate_instant(OggVorbis_File *vf); -extern long ov_streams(OggVorbis_File *vf); -extern long ov_seekable(OggVorbis_File *vf); -extern long ov_serialnumber(OggVorbis_File *vf,int i); - -extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i); -extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i); -extern double ov_time_total(OggVorbis_File *vf,int i); - -extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_time_seek(OggVorbis_File *vf,double pos); -extern int ov_time_seek_page(OggVorbis_File *vf,double pos); - -extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_time_seek_lap(OggVorbis_File *vf,double pos); -extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos); - -extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf); -extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf); -extern double ov_time_tell(OggVorbis_File *vf); - -extern vorbis_info *ov_info(OggVorbis_File *vf,int link); -extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link); - -extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples, +extern VORBIS_EXPORT int ov_test_open(OggVorbis_File *vf); + +extern VORBIS_EXPORT long ov_bitrate(OggVorbis_File *vf,int i); +extern VORBIS_EXPORT long ov_bitrate_instant(OggVorbis_File *vf); +extern VORBIS_EXPORT long ov_streams(OggVorbis_File *vf); +extern VORBIS_EXPORT long ov_seekable(OggVorbis_File *vf); +extern VORBIS_EXPORT long ov_serialnumber(OggVorbis_File *vf,int i); + +extern VORBIS_EXPORT ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i); +extern VORBIS_EXPORT ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i); +extern VORBIS_EXPORT double ov_time_total(OggVorbis_File *vf,int i); + +extern VORBIS_EXPORT int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos); +extern VORBIS_EXPORT int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos); +extern VORBIS_EXPORT int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos); +extern VORBIS_EXPORT int ov_time_seek(OggVorbis_File *vf,double pos); +extern VORBIS_EXPORT int ov_time_seek_page(OggVorbis_File *vf,double pos); + +extern VORBIS_EXPORT int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos); +extern VORBIS_EXPORT int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos); +extern VORBIS_EXPORT int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos); +extern VORBIS_EXPORT int ov_time_seek_lap(OggVorbis_File *vf,double pos); +extern VORBIS_EXPORT int ov_time_seek_page_lap(OggVorbis_File *vf,double pos); + +extern VORBIS_EXPORT ogg_int64_t ov_raw_tell(OggVorbis_File *vf); +extern VORBIS_EXPORT ogg_int64_t ov_pcm_tell(OggVorbis_File *vf); +extern VORBIS_EXPORT double ov_time_tell(OggVorbis_File *vf); + +extern VORBIS_EXPORT vorbis_info *ov_info(OggVorbis_File *vf,int link); +extern VORBIS_EXPORT vorbis_comment *ov_comment(OggVorbis_File *vf,int link); + +extern VORBIS_EXPORT long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples, int *bitstream); -extern long ov_read_filter(OggVorbis_File *vf,char *buffer,int length, +extern VORBIS_EXPORT long ov_read_filter(OggVorbis_File *vf,char *buffer,int length, int bigendianp,int word,int sgned,int *bitstream, void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param); -extern long ov_read(OggVorbis_File *vf,char *buffer,int length, +extern VORBIS_EXPORT long ov_read(OggVorbis_File *vf,char *buffer,int length, int bigendianp,int word,int sgned,int *bitstream); -extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2); +extern VORBIS_EXPORT int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2); -extern int ov_halfrate(OggVorbis_File *vf,int flag); -extern int ov_halfrate_p(OggVorbis_File *vf); +extern VORBIS_EXPORT int ov_halfrate(OggVorbis_File *vf,int flag); +extern VORBIS_EXPORT int ov_halfrate_p(OggVorbis_File *vf); #ifdef __cplusplus } diff --git a/lib/block.c b/lib/block.c index db245b3..9fba962 100644 --- a/lib/block.c +++ b/lib/block.c @@ -1035,7 +1035,7 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){ } -const float *vorbis_window(vorbis_dsp_state *v,int W){ +VORBIS_EXPORT const float *vorbis_window(vorbis_dsp_state *v,int W){ vorbis_info *vi=v->vi; codec_setup_info *ci=vi->codec_setup; int hs=ci->halfrate_flag; diff --git a/vorbis.version b/vorbis.version new file mode 100644 index 0000000..2ad3b75 --- /dev/null +++ b/vorbis.version @@ -0,0 +1,4 @@ +{ + global: vorbis_*; ov_*; _ov_*; OV_*; + local: *; +}; -- 2.7.4