From 38a4a437f6508d59ad8a9fc87604ed823506ef19 Mon Sep 17 00:00:00 2001 From: ivo Date: Sun, 28 Sep 2008 18:06:00 +0000 Subject: [PATCH] define GENERAL_VENDOR_STRING and ENCODE_VENDOR_STRING. Patch by Aoyumi. svn path=/trunk/vorbis/; revision=15346 --- include/vorbis/codec.h | 2 ++ lib/info.c | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/vorbis/codec.h b/include/vorbis/codec.h index 7b37e96..e383395 100644 --- a/include/vorbis/codec.h +++ b/include/vorbis/codec.h @@ -179,6 +179,8 @@ 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 ****************************/ extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi); diff --git a/lib/info.c b/lib/info.c index af15ba2..9574730 100644 --- a/lib/info.c +++ b/lib/info.c @@ -31,6 +31,9 @@ #include "misc.h" #include "os.h" +#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.2.1" +#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20080501" + /* helpers */ static int ilog2(unsigned int v){ int ret=0; @@ -457,8 +460,7 @@ static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){ } static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){ - char temp[]="Xiph.Org libVorbis I 20080501"; - int bytes = strlen(temp); + int bytes = strlen(ENCODE_VENDOR_STRING); /* preamble */ oggpack_write(opb,0x03,8); @@ -466,8 +468,8 @@ static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){ /* vendor */ oggpack_write(opb,bytes,32); - _v_writestring(opb,temp, bytes); - + _v_writestring(opb,ENCODE_VENDOR_STRING, bytes); + /* comments */ oggpack_write(opb,vc->comments,32); @@ -648,3 +650,7 @@ double vorbis_granule_time(vorbis_dsp_state *v,ogg_int64_t granulepos){ return((double)granulepos/v->vi->rate); return(-1); } + +const char *vorbis_version_string(void){ + return GENERAL_VENDOR_STRING; +} -- 2.7.4