[beast: 13/31] BSE: move bse_server.get_vorbis_version to bseapi.idl
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 13/31] BSE: move bse_server.get_vorbis_version to bseapi.idl
- Date: Mon, 22 Jun 2015 14:39:15 +0000 (UTC)
commit 5101a19f1993829e01fbf6c1e877865345c1d583
Author: Tim Janik <timj gnu org>
Date: Fri Jun 12 15:17:54 2015 +0200
BSE: move bse_server.get_vorbis_version to bseapi.idl
beast-gtk/bstmain.cc | 9 +++++----
bse/bseapi.idl | 1 +
bse/bseserver.cc | 9 ++++++++-
bse/bseserver.hh | 1 +
bse/bseserver.proc | 23 -----------------------
bse/gslvorbis-enc.cc | 22 ++++++++++++----------
bse/gslvorbis-enc.hh | 2 +-
7 files changed, 28 insertions(+), 39 deletions(-)
---
diff --git a/beast-gtk/bstmain.cc b/beast-gtk/bstmain.cc
index 9aba265..67d151e 100644
--- a/beast-gtk/bstmain.cc
+++ b/beast-gtk/bstmain.cc
@@ -690,16 +690,17 @@ static void G_GNUC_NORETURN
bst_exit_print_version (void)
{
assert (bse_server != NULL); // we need BSE
+ String s;
const gchar *c;
gchar *freeme = NULL;
g_print ("BEAST version %s (%s)\n", BST_VERSION, BST_VERSION_HINT);
g_print ("Libraries: ");
g_print ("GLib %u.%u.%u", glib_major_version, glib_minor_version, glib_micro_version);
g_print (", BSE %s", BST_VERSION);
- c = bse_server_get_vorbis_version (BSE_SERVER);
- if (c)
- g_print (", %s", c);
- String s = bse_server.get_mp3_version();
+ s = bse_server.get_vorbis_version();
+ if (!s.empty())
+ printout (", %s", s);
+ s = bse_server.get_mp3_version();
if (!s.empty())
printout (", %s", s);
g_print (", GTK+ %u.%u.%u", gtk_major_version, gtk_minor_version, gtk_micro_version);
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index e59700f..191f512 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -44,6 +44,7 @@ interface Server : Object {
TestObject get_test_object (); ///< Retrieve object for API, signal, etc tests.
Object from_proxy (int64 proxyid); ///< Find an Object from its associated BseObject
proxy id.
String get_mp3_version (); ///< Retrieve BSE MP3 handler version.
+ String get_vorbis_version (); ///< Retrieve BSE Vorbis handler version.
};
} // Bse
diff --git a/bse/bseserver.cc b/bse/bseserver.cc
index e4f14ed..96031f8 100644
--- a/bse/bseserver.cc
+++ b/bse/bseserver.cc
@@ -18,6 +18,7 @@
#include <string.h>
#include "bsepcmmodule.cc"
#include "gsldatahandle-mad.hh"
+#include "gslvorbis-enc.hh"
using namespace Bse;
/* --- parameters --- */
@@ -1165,10 +1166,16 @@ ServerImpl::send_user_message (const UserMessage &umsg)
sig_user_message.emit (umsg);
}
-std::string
+String
ServerImpl::get_mp3_version ()
{
return String ("MAD ") + gsl_data_handle_mad_version ();
}
+String
+ServerImpl::get_vorbis_version ()
+{
+ return "Ogg/Vorbis " + gsl_vorbis_encoder_version();
+}
+
} // Bse
diff --git a/bse/bseserver.hh b/bse/bseserver.hh
index 71d4fc0..7019335 100644
--- a/bse/bseserver.hh
+++ b/bse/bseserver.hh
@@ -108,6 +108,7 @@ public:
virtual TestObjectIfaceP get_test_object () override;
virtual ObjectIfaceP from_proxy (int64_t proxyid) override;
virtual std::string get_mp3_version () override;
+ virtual std::string get_vorbis_version () override;
void send_user_message (const UserMessage &umsg);
static ServerImpl& instance ();
};
diff --git a/bse/bseserver.proc b/bse/bseserver.proc
index fe6fe60..a3f7b38 100644
--- a/bse/bseserver.proc
+++ b/bse/bseserver.proc
@@ -575,26 +575,3 @@ BODY (BseProcedureClass *proc,
sfi_value_take_string (out_values++, g_path_concat (BSE_PATH_LADSPA, BSE_GCONFIG (ladspa_path), NULL));
return BSE_ERROR_NONE;
}
-
-#include "gslvorbis-enc.hh"
-
-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;
-}
diff --git a/bse/gslvorbis-enc.cc b/bse/gslvorbis-enc.cc
index 3703984..50775f4 100644
--- a/bse/gslvorbis-enc.cc
+++ b/bse/gslvorbis-enc.cc
@@ -454,9 +454,10 @@ gsl_vorbis_encoder_ogg_eos (GslVorbisEncoder *self)
return self->eos && !self->dblocks;
}
-gchar*
-gsl_vorbis_encoder_version (void)
+String
+gsl_vorbis_encoder_version ()
{
+ String version = "unknown";
/* encode the first 3 header packets */
vorbis_info vinfo = { 0 };
vorbis_info_init (&vinfo);
@@ -464,7 +465,7 @@ gsl_vorbis_encoder_version (void)
if (r != 0)
{
vorbis_info_clear (&vinfo);
- return g_strdup ("unknown");
+ return version;
}
vorbis_dsp_state vdsp = { 0 };
vorbis_analysis_init (&vdsp, &vinfo);
@@ -485,9 +486,13 @@ gsl_vorbis_encoder_version (void)
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);
+ if (r == 0 && ocomment.vendor) // e.g. "Xiphophorus libVorbis I 20000508" (first beta) or "Xiph.Org
libVorbis I 20020717" (1.0)
+ {
+ if (strncmp (ocomment.vendor, "Xiph.Org libVorbis ", 19) == 0)
+ version = ocomment.vendor + 19;
+ else
+ version = ocomment.vendor;
+ }
/* cleanup decoder state */
vorbis_comment_clear (&ocomment);
vorbis_info_clear (&oinfo);
@@ -496,8 +501,5 @@ gsl_vorbis_encoder_version (void)
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)
- return g_strdup ("unknown");
+ return version;
}
diff --git a/bse/gslvorbis-enc.hh b/bse/gslvorbis-enc.hh
index 1e2e262..6bc0acc 100644
--- a/bse/gslvorbis-enc.hh
+++ b/bse/gslvorbis-enc.hh
@@ -58,7 +58,7 @@ gboolean gsl_vorbis_encoder_ogg_eos (GslVorbisEncoder
void gsl_vorbis_encoder_destroy (GslVorbisEncoder *self);
/* retrive vendor version string */
-gchar* gsl_vorbis_encoder_version (void);
+String gsl_vorbis_encoder_version ();
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]