r4126 - trunk/bse
- From: timj svn gnome org
- To: svn-commits-list gnome org
- Subject: r4126 - trunk/bse
- Date: Sun, 3 Dec 2006 20:50:36 -0500 (EST)
Author: timj
Date: 2006-12-03 20:50:34 -0500 (Sun, 03 Dec 2006)
New Revision: 4126
Modified:
trunk/bse/ChangeLog
trunk/bse/bseserver.proc
trunk/bse/gslvorbis-enc.c
trunk/bse/gslvorbis-enc.h
Log:
Mon Dec 4 02:42:56 2006 Tim Janik <timj gtk org>
* gslvorbis-enc.h, gslvorbis-enc.c: added gsl_vorbis_encoder_version()
which has to go through some hoops to query the library version (encode
and decode a dummy file), but manages to return a version string.
* bseserver.proc: provide bse_server_get_vorbis_version().
Modified: trunk/bse/ChangeLog
===================================================================
--- trunk/bse/ChangeLog 2006-12-04 00:05:40 UTC (rev 4125)
+++ trunk/bse/ChangeLog 2006-12-04 01:50:34 UTC (rev 4126)
@@ -1,3 +1,11 @@
+Mon Dec 4 02:42:56 2006 Tim Janik <timj gtk org>
+
+ * gslvorbis-enc.h, gslvorbis-enc.c: added gsl_vorbis_encoder_version()
+ which has to go through some hoops to query the library version (encode
+ and decode a dummy file), but manages to return a version string.
+
+ * bseserver.proc: provide bse_server_get_vorbis_version().
+
Sun Dec 3 19:13:17 2006 Tim Janik <timj gtk org>
* bseexports.h: changed plugin mechanism to skip per-plugin names and
Modified: trunk/bse/bseserver.proc
===================================================================
--- trunk/bse/bseserver.proc 2006-12-04 00:05:40 UTC (rev 4125)
+++ trunk/bse/bseserver.proc 2006-12-04 01:50:34 UTC (rev 4126)
@@ -689,6 +689,29 @@
return BSE_ERROR_NONE;
}
+#include "gslvorbis-enc.h"
+
+METHOD (BseServer, get-vorbis-version) {
+ HELP = "Retrieve BSE Vorbis handler version.";
+ IN = bse_param_spec_object ("server", "Server", NULL,
+ BSE_TYPE_SERVER, SFI_PARAM_STANDARD);
+ OUT = sfi_pspec_string ("version", NULL, NULL, NULL, SFI_PARAM_STANDARD);
+}
+BODY (BseProcedureClass *proc,
+ const GValue *in_values,
+ GValue *out_values)
+{
+ gchar *v = gsl_vorbis_encoder_version();
+ if (v && strncmp (v, "Xiphophorus libVorbis", 21) == 0)
+ sfi_value_take_string (out_values++, g_strconcat ("Ogg/Vorbis", v + 21, NULL));
+ else if (v && strncmp (v, "Xiph.Org libVorbis", 18) == 0)
+ sfi_value_take_string (out_values++, g_strconcat ("Ogg/Vorbis", v + 18, NULL));
+ else if (v)
+ sfi_value_take_string (out_values++, g_strconcat ("Ogg/Vorbis ", v, NULL));
+ g_free (v);
+ return BSE_ERROR_NONE;
+}
+
#include "gsldatahandle-mad.h"
METHOD (BseServer, get-mp3-version) {
Modified: trunk/bse/gslvorbis-enc.c
===================================================================
--- trunk/bse/gslvorbis-enc.c 2006-12-04 00:05:40 UTC (rev 4125)
+++ trunk/bse/gslvorbis-enc.c 2006-12-04 01:50:34 UTC (rev 4126)
@@ -471,3 +471,52 @@
return self->eos && !self->dblocks;
}
+
+gchar*
+gsl_vorbis_encoder_version (void)
+{
+ /* encode the first 3 header packets */
+ vorbis_info vinfo = { 0 };
+ vorbis_info_init (&vinfo);
+ int r = vorbis_encode_init_vbr (&vinfo, 1, 44100, 0.0);
+ if (r != 0)
+ {
+ vorbis_info_clear (&vinfo);
+ goto error_result;
+ }
+ vorbis_dsp_state vdsp = { 0 };
+ vorbis_analysis_init (&vdsp, &vinfo);
+ vorbis_comment vcomment = { 0, };
+ vorbis_comment_init (&vcomment);
+ vorbis_block vblock = { 0 };
+ vorbis_block_init (&vdsp, &vblock);
+ ogg_packet opacket1 = { 0 }, opacket2 = { 0 }, opacket3 = { 0 };
+ vorbis_analysis_headerout (&vdsp, &vcomment, &opacket1, &opacket2, &opacket3);
+ /* decode packets */
+ vorbis_info oinfo = { 0 };
+ vorbis_info_init (&oinfo);
+ vorbis_comment ocomment = { 0, };
+ vorbis_comment_init (&ocomment);
+ r = vorbis_synthesis_headerin (&oinfo, &ocomment, &opacket1); // vorbis setup packet
+ if (r == 0)
+ r = vorbis_synthesis_headerin (&oinfo, &ocomment, &opacket2); // vorbis comments
+ if (r == 0)
+ r = vorbis_synthesis_headerin (&oinfo, &ocomment, &opacket3); // vorbis codebooks
+ /* save vendor */
+ char *vendor = NULL;
+ if (r == 0)
+ vendor = g_strdup (ocomment.vendor);
+ /* cleanup decoder state */
+ vorbis_comment_clear (&ocomment);
+ vorbis_info_clear (&oinfo);
+ /* cleanup encoder state */
+ vorbis_block_clear (&vblock);
+ vorbis_comment_clear (&vcomment);
+ vorbis_dsp_clear (&vdsp);
+ vorbis_info_clear (&vinfo);
+ /* return result */
+ if (vendor)
+ return vendor; // e.g. "Xiphophorus libVorbis I 20000508" (first beta) or "Xiph.Org libVorbis I 20020717" (1.0)
+ error_result:
+ return g_strdup ("unknown");
+}
Modified: trunk/bse/gslvorbis-enc.h
===================================================================
--- trunk/bse/gslvorbis-enc.h 2006-12-04 00:05:40 UTC (rev 4125)
+++ trunk/bse/gslvorbis-enc.h 2006-12-04 01:50:34 UTC (rev 4126)
@@ -74,7 +74,10 @@
/* cleanup */
void gsl_vorbis_encoder_destroy (GslVorbisEncoder *self);
+/* retrive vendor version string */
+gchar* gsl_vorbis_encoder_version (void);
+
G_END_DECLS
#endif /* __GSL_VORBIS_ENC_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]