Debian Codegraph @

external/lame/version.c

raw symbols SCIP
1 /*
2 * Version numbering for LAME.
3 *
4 * Copyright (c) 1999 A.L. Faber
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
22 /*!
23 \file version.c
24 \brief Version numbering for LAME.
25
26 Contains functions which describe the version of LAME.
27
28 \author A.L. Faber
29 \version \$Id: version.c,v 1.34 2011/11/18 09:51:02 robert Exp $
30 \ingroup libmp3lame
31 */
32
33
34 //#ifdef HAVE_CONFIG_H
35 #include "lame__config.h"
36 //#endif
37
38
39 #include "lame.h"
40 #include "machine.h"
41
42 #include "version.h" /* macros of version numbers */
43
44
45
46
47
48 /*! Get the LAME version string. */
49 /*!
50 \param void
51 \return a pointer to a string which describes the version of LAME.
52 */
53 const char *
54 get_lame_version(void)
55 { /* primary to write screen reports */
56 /* Here we can also add informations about compile time configurations */
57
58 #if LAME_ALPHA_VERSION
59 static /*@observer@ */ const char *const str =
60 STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " "
61 "(alpha " STR(LAME_PATCH_VERSION) ", " __DATE__ " " __TIME__ ")";
62 #elif LAME_BETA_VERSION
63 static /*@observer@ */ const char *const str =
64 STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " "
65 "(beta " STR(LAME_PATCH_VERSION) ", " __DATE__ ")";
66 #elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0)
67 static /*@observer@ */ const char *const str =
68 STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) "." STR(LAME_PATCH_VERSION);
69 #else
70 static /*@observer@ */ const char *const str =
71 STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION);
72 #endif
73
74 return str;
75 }
76
77
78 /*! Get the short LAME version string. */
79 /*!
80 It's mainly for inclusion into the MP3 stream.
81
82 \param void
83 \return a pointer to the short version of the LAME version string.
84 */
85 const char *
86 get_lame_short_version(void)
87 {
88 /* adding date and time to version string makes it harder for output
89 validation */
90
91 #if LAME_ALPHA_VERSION
92 static /*@observer@ */ const char *const str =
93 STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " (alpha " STR(LAME_PATCH_VERSION) ")";
94 #elif LAME_BETA_VERSION
95 static /*@observer@ */ const char *const str =
96 STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " (beta " STR(LAME_PATCH_VERSION) ")";
97 #elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0)
98 static /*@observer@ */ const char *const str =
99 STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) "." STR(LAME_PATCH_VERSION);
100 #else
101 static /*@observer@ */ const char *const str =
102 STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION);
103 #endif
104
105 return str;
106 }
107
108 /*! Get the _very_ short LAME version string. */
109 /*!
110 It's used in the LAME VBR tag only.
111
112 \param void
113 \return a pointer to the short version of the LAME version string.
114 */
115 const char *
116 get_lame_very_short_version(void)
117 {
118 /* adding date and time to version string makes it harder for output
119 validation */
120 #if LAME_ALPHA_VERSION
121 #define P "a"
122 #elif LAME_BETA_VERSION
123 #define P "b"
124 #elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0)
125 #define P "r"
126 #else
127 #define P " "
128 #endif
129 static /*@observer@ */ const char *const str =
130 #if (LAME_PATCH_VERSION > 0)
131 "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) P STR(LAME_PATCH_VERSION)
132 #else
133 "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) P
134 #endif
135 ;
136 return str;
137 }
138
139 /*! Get the _very_ short LAME version string. */
140 /*!
141 It's used in the LAME VBR tag only, limited to 9 characters max.
142 Due to some 3rd party HW/SW decoders, it has to start with LAME.
143
144 \param void
145 \return a pointer to the short version of the LAME version string.
146 */
147 const char* get_lame_tag_encoder_short_version(void);
148
149 const char*
150 get_lame_tag_encoder_short_version(void)
151 {
152 static /*@observer@ */ const char *const str =
153 /* FIXME: new scheme / new version counting / drop versioning here ? */
154 "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) P
155 ;
156 return str;
157 }
158
159 /*! Get the version string for GPSYCHO. */
160 /*!
161 \param void
162 \return a pointer to a string which describes the version of GPSYCHO.
163 */
164 const char *
165 get_psy_version(void)
166 {
167 #if PSY_ALPHA_VERSION > 0
168 static /*@observer@ */ const char *const str =
169 STR(PSY_MAJOR_VERSION) "." STR(PSY_MINOR_VERSION)
170 " (alpha " STR(PSY_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")";
171 #elif PSY_BETA_VERSION > 0
172 static /*@observer@ */ const char *const str =
173 STR(PSY_MAJOR_VERSION) "." STR(PSY_MINOR_VERSION)
174 " (beta " STR(PSY_BETA_VERSION) ", " __DATE__ ")";
175 #else
176 static /*@observer@ */ const char *const str =
177 STR(PSY_MAJOR_VERSION) "." STR(PSY_MINOR_VERSION);
178 #endif
179
180 return str;
181 }
182
183
184 /*! Get the URL for the LAME website. */
185 /*!
186 \param void
187 \return a pointer to a string which is a URL for the LAME website.
188 */
189 const char *
190 get_lame_url(void)
191 {
192 static /*@observer@ */ const char *const str = LAME_URL;
193
194 return str;
195 }
196
197
198 /*! Get the numerical representation of the version. */
199 /*!
200 Writes the numerical representation of the version of LAME and
201 GPSYCHO into lvp.
202
203 \param lvp
204 */
205 void
206 get_lame_version_numerical(lame_version_t * lvp)
207 {
208 static /*@observer@ */ const char *const features = ""; /* obsolete */
209
210 /* generic version */
211 lvp->major = LAME_MAJOR_VERSION;
212 lvp->minor = LAME_MINOR_VERSION;
213 #if LAME_ALPHA_VERSION
214 lvp->alpha = LAME_PATCH_VERSION;
215 lvp->beta = 0;
216 #elif LAME_BETA_VERSION
217 lvp->alpha = 0;
218 lvp->beta = LAME_PATCH_VERSION;
219 #else
220 lvp->alpha = 0;
221 lvp->beta = 0;
222 #endif
223
224 /* psy version */
225 lvp->psy_major = PSY_MAJOR_VERSION;
226 lvp->psy_minor = PSY_MINOR_VERSION;
227 lvp->psy_alpha = PSY_ALPHA_VERSION;
228 lvp->psy_beta = PSY_BETA_VERSION;
229
230 /* compile time features */
231 /*@-mustfree@ */
232 lvp->features = features;
233 /*@=mustfree@ */
234 }
235
236
237 const char *
238 get_lame_os_bitness(void)
239 {
240 static /*@observer@ */ const char *const strXX = "";
241 static /*@observer@ */ const char *const str32 = "32bits";
242 static /*@observer@ */ const char *const str64 = "64bits";
243
244 switch (sizeof(void *)) {
245 case 4:
246 return str32;
247
248 case 8:
249 return str64;
250
251 default:
252 return strXX;
253 }
254 }
255
256 /* end of version.c */