give audio visualization on faces with audio-only media. linux/gstreamer only.

meow-7.2.2
Tofu Linden 2010-02-27 17:29:30 +00:00
parent 36acc8f2a5
commit 753ddd7714
1 changed files with 40 additions and 0 deletions

View File

@ -141,6 +141,7 @@ private:
// Very GStreamer-specific
GMainLoop *mPump; // event pump for this media
GstElement *mPlaybin;
GstElement *mVisualizer;
GstSLVideo *mVideoSink;
};
@ -159,6 +160,7 @@ MediaPluginGStreamer010::MediaPluginGStreamer010(
mSeekDestination(0.0),
mPump ( NULL ),
mPlaybin ( NULL ),
mVisualizer ( NULL ),
mVideoSink ( NULL ),
mCommand ( COMMAND_NONE )
{
@ -686,6 +688,33 @@ MediaPluginGStreamer010::load()
this);
llgst_object_unref (bus);
// get a visualizer element (bonus feature!)
char* vis_name = getenv("LL_GST_VIS_NAME");
if (!visname ||
(vis_name && std::string(vis_name)!="none"))
{
if (vis_name)
{
mVisualizer = llgst_element_factory_make (vis_name, "vis");
}
if (!mVisualizer)
{
mVisualizer = llgst_element_factory_make ("libvisual_jess", "vis");
if (!mVisualizer)
{
mVisualizer = llgst_element_factory_make ("goom", "vis");
if (!mVisualizer)
{
mVisualizer = llgst_element_factory_make ("libvisual_lv_scope", "vis");
if (!mVisualizer)
{
// That's okay, we don't NEED this.
}
}
}
}
}
if (NULL == getenv("LL_GSTREAMER_EXTERNAL")) {
// instantiate a custom video sink
mVideoSink =
@ -702,6 +731,11 @@ MediaPluginGStreamer010::load()
g_object_set(mPlaybin, "video-sink", mVideoSink, NULL);
}
if (mVisualizer)
{
g_object_set(mPlaybin, "vis-plugin", mVisualizer, NULL);
}
return true;
}
@ -724,6 +758,12 @@ MediaPluginGStreamer010::unload ()
mPlaybin = NULL;
}
if (mVisualizer)
{
llgst_object_unref (GST_OBJECT (mVisualizer));
mVisualizer = NULL;
}
if (mPump)
{
g_main_loop_quit(mPump);