This patch offers interface to get the library name which software uses. Function: char *vorbis_version_string(void); PATCH (for libvorbis-1.2.1RC2): diff -crN libvorbis-1.2.1RC2/include/vorbis/codec.h libvorbis-1.2.1RC2_NI/include/vorbis/codec.h *** libvorbis-1.2.1RC2/include/vorbis/codec.h Mon Aug 25 05:57:44 2008 --- libvorbis-1.2.1RC2_NI/include/vorbis/codec.h Sat Sep 13 05:00:22 2008 *************** *** 178,183 **** --- 178,185 ---- extern void vorbis_dsp_clear(vorbis_dsp_state *v); extern double vorbis_granule_time(vorbis_dsp_state *v, ogg_int64_t granulepos); + + extern const char *vorbis_version_string(void); /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/ diff -crN libvorbis-1.2.1RC2/lib/info.c libvorbis-1.2.1RC2_NI/lib/info.c *** libvorbis-1.2.1RC2/lib/info.c Thu Sep 04 23:38:42 2008 --- libvorbis-1.2.1RC2_NI/lib/info.c Sat Sep 13 05:20:28 2008 *************** *** 31,36 **** --- 31,39 ---- #include "misc.h" #include "os.h" + #define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.2.1RC2" + #define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20080501" + /* helpers */ static int ilog2(unsigned int v){ int ret=0; *************** *** 457,464 **** } static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){ ! char temp[]="Xiph.Org libVorbis I 20080501"; ! int bytes = strlen(temp); /* preamble */ oggpack_write(opb,0x03,8); --- 460,466 ---- } static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){ ! int bytes = strlen(ENCODE_VENDOR_STRING); /* preamble */ oggpack_write(opb,0x03,8); *************** *** 466,472 **** /* vendor */ oggpack_write(opb,bytes,32); ! _v_writestring(opb,temp, bytes); /* comments */ --- 468,474 ---- /* vendor */ oggpack_write(opb,bytes,32); ! _v_writestring(opb,ENCODE_VENDOR_STRING, bytes); /* comments */ *************** *** 647,650 **** --- 649,656 ---- if(granulepos>=0) return((double)granulepos/v->vi->rate); return(-1); + } + + const char *vorbis_version_string(void){ + return GENERAL_VENDOR_STRING; }
Aoyumi wrote:> This patch offers interface to get the library name which software uses. > > > Function: > char *vorbis_version_string(void);It should be "const char*". Its correct in the patch, but not correct here. In general, I'm in favour of things like this. Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "C++ is like jamming a helicopter inside a Miata and expecting some sort of improvement." -- Drew Olbrich
Erik de Castro Lopo wrote:> It should be "const char*". Its correct in the patch, but not correct > here.It is "const char*" as you say. I revise it as follows. Function: const char *vorbis_version_string(void); Thank you. Aoyumi
I made an additional patch to the patch which I submitted before. This is necessary for DLL of Windows. PATCH (for libvorbis-trunk): diff -crN libvorbis-trunk/win32/vorbis.def libvorbis-trunkR/win32/vorbis.def *** libvorbis-trunk/win32/vorbis.def Sat Mar 29 00:37:57 2008 --- libvorbis-trunkR/win32/vorbis.def Mon Nov 24 23:02:04 2008 *************** *** 55,57 **** --- 55,59 ---- vorbis_encode_init_vbr vorbis_encode_setup_init vorbis_encode_ctl + + vorbis_version_string> This patch offers interface to get the library name which software uses. > > > Function: > char *vorbis_version_string(void); > > > PATCH (for libvorbis-1.2.1RC2): > diff -crN libvorbis-1.2.1RC2/include/vorbis/codec.h libvorbis-1.2.1RC2_NI/include/vorbis/codec.h > *** libvorbis-1.2.1RC2/include/vorbis/codec.h Mon Aug 25 05:57:44 2008 > --- libvorbis-1.2.1RC2_NI/include/vorbis/codec.h Sat Sep 13 05:00:22 2008 > *************** > *** 178,183 **** > --- 178,185 ---- > extern void vorbis_dsp_clear(vorbis_dsp_state *v); > extern double vorbis_granule_time(vorbis_dsp_state *v, > ogg_int64_t granulepos); > + > + extern const char *vorbis_version_string(void); > > /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/ > > diff -crN libvorbis-1.2.1RC2/lib/info.c libvorbis-1.2.1RC2_NI/lib/info.c > *** libvorbis-1.2.1RC2/lib/info.c Thu Sep 04 23:38:42 2008 > --- libvorbis-1.2.1RC2_NI/lib/info.c Sat Sep 13 05:20:28 2008 > *************** > *** 31,36 **** > --- 31,39 ---- > #include "misc.h" > #include "os.h" > > + #define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.2.1RC2" > + #define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20080501" > + > /* helpers */ > static int ilog2(unsigned int v){ > int ret=0; > *************** > *** 457,464 **** > } > > static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){ > ! char temp[]="Xiph.Org libVorbis I 20080501"; > ! int bytes = strlen(temp); > > /* preamble */ > oggpack_write(opb,0x03,8); > --- 460,466 ---- > } > > static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){ > ! int bytes = strlen(ENCODE_VENDOR_STRING); > > /* preamble */ > oggpack_write(opb,0x03,8); > *************** > *** 466,472 **** > > /* vendor */ > oggpack_write(opb,bytes,32); > ! _v_writestring(opb,temp, bytes); > > /* comments */ > > --- 468,474 ---- > > /* vendor */ > oggpack_write(opb,bytes,32); > ! _v_writestring(opb,ENCODE_VENDOR_STRING, bytes); > > /* comments */ > > *************** > *** 647,650 **** > --- 649,656 ---- > if(granulepos>=0) > return((double)granulepos/v->vi->rate); > return(-1); > + } > + > + const char *vorbis_version_string(void){ > + return GENERAL_VENDOR_STRING; > }