Commit 52b6fb73 authored by Edward Hervey's avatar Edward Hervey

libvisual: Remove < 0.4 support

And remove the version guards that went along with it

https://bugzilla.gnome.org/show_bug.cgi?id=733046
parent f260baf2
...@@ -671,16 +671,8 @@ dnl *** libvisual *** ...@@ -671,16 +671,8 @@ dnl *** libvisual ***
translit(dnm, m, l) AM_CONDITIONAL(USE_LIBVISUAL, true) translit(dnm, m, l) AM_CONDITIONAL(USE_LIBVISUAL, true)
AG_GST_CHECK_FEATURE(LIBVISUAL, [libvisual visualization library], libvisual, [ AG_GST_CHECK_FEATURE(LIBVISUAL, [libvisual visualization library], libvisual, [
AG_GST_PKG_CHECK_MODULES(LIBVISUAL, libvisual-0.4 >= 0.4.0) AG_GST_PKG_CHECK_MODULES(LIBVISUAL, libvisual-0.4 >= 0.4.0)
if test $HAVE_LIBVISUAL = no if test x$HAVE_LIBVISUAL = xyes; then
then LIBVIS_PLUGINSDIR="`$PKG_CONFIG --variable=pluginsbasedir libvisual-0.4`"
AG_GST_PKG_CHECK_MODULES(LIBVISUAL, libvisual = 0.2.0)
if test x$HAVE_LIBVISUAL = xyes; then
LIBVIS_PLUGINSDIR="`$PKG_CONFIG --variable=pluginsbasedir libvisual-0.2`"
fi
else
if test x$HAVE_LIBVISUAL = xyes; then
LIBVIS_PLUGINSDIR="`$PKG_CONFIG --variable=pluginsbasedir libvisual-0.4`"
fi
fi fi
AC_MSG_NOTICE([libvisual pluginsdir: $LIBVIS_PLUGINSDIR]) AC_MSG_NOTICE([libvisual pluginsdir: $LIBVIS_PLUGINSDIR])
if test x$LIBVIS_PLUGINSDIR != x; then if test x$LIBVIS_PLUGINSDIR != x; then
......
...@@ -58,21 +58,10 @@ gst_visual_actor_plugin_is_gl (VisObject * plugin, const gchar * name) ...@@ -58,21 +58,10 @@ gst_visual_actor_plugin_is_gl (VisObject * plugin, const gchar * name)
gboolean is_gl; gboolean is_gl;
gint depth; gint depth;
#if !defined(VISUAL_API_VERSION)
depth = VISUAL_PLUGIN_ACTOR (plugin)->depth;
is_gl = (depth == VISUAL_VIDEO_DEPTH_GL);
#elif VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
depth = VISUAL_ACTOR_PLUGIN (plugin)->vidoptions.depth; depth = VISUAL_ACTOR_PLUGIN (plugin)->vidoptions.depth;
/* FIXME: how to figure this out correctly in 0.4? */ /* FIXME: how to figure this out correctly in 0.4? */
is_gl = (depth & VISUAL_VIDEO_DEPTH_GL) == VISUAL_VIDEO_DEPTH_GL; is_gl = (depth & VISUAL_VIDEO_DEPTH_GL) == VISUAL_VIDEO_DEPTH_GL;
#else
# error what libvisual version is this?
#endif
if (!is_gl) { if (!is_gl) {
GST_DEBUG ("plugin %s is not a GL plugin (%d), registering", name, depth); GST_DEBUG ("plugin %s is not a GL plugin (%d), registering", name, depth);
} else { } else {
...@@ -111,11 +100,7 @@ plugin_init (GstPlugin * plugin) ...@@ -111,11 +100,7 @@ plugin_init (GstPlugin * plugin)
list = visual_actor_get_list (); list = visual_actor_get_list ();
#if !defined(VISUAL_API_VERSION)
count = visual_list_count (list);
#elif VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
count = visual_collection_size (VISUAL_COLLECTION (list)); count = visual_collection_size (VISUAL_COLLECTION (list));
#endif
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
VisPluginRef *ref = visual_list_get (list, i); VisPluginRef *ref = visual_list_get (list, i);
......
...@@ -48,12 +48,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", ...@@ -48,12 +48,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_STATIC_CAPS ("audio/x-raw, " GST_STATIC_CAPS ("audio/x-raw, "
"format = (string) " GST_AUDIO_NE (S16) ", " "format = (string) " GST_AUDIO_NE (S16) ", "
"layout = (string) interleaved, " "channels = (int) { 1, 2 }, " "layout = (string) interleaved, " "channels = (int) { 1, 2 }, "
#if defined(VISUAL_API_VERSION) && VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000 "rate = (int) { 8000, 11250, 22500, 32000, 44100, 48000, 96000 }")
"rate = (int) { 8000, 11250, 22500, 32000, 44100, 48000, 96000 }"
#else
"rate = (int) [ 1000, MAX ]"
#endif
)
); );
...@@ -224,6 +219,9 @@ gst_visual_render (GstAudioVisualizer * bscope, GstBuffer * audio, ...@@ -224,6 +219,9 @@ gst_visual_render (GstAudioVisualizer * bscope, GstBuffer * audio,
const guint16 *adata; const guint16 *adata;
gint i, channels; gint i, channels;
gboolean res = TRUE; gboolean res = TRUE;
VisBuffer *lbuf, *rbuf;
guint16 ldata[VISUAL_SAMPLES], rdata[VISUAL_SAMPLES];
VisAudioSampleRateType vrate;
visual_video_set_buffer (visual->video, GST_VIDEO_FRAME_PLANE_DATA (video, visual_video_set_buffer (visual->video, GST_VIDEO_FRAME_PLANE_DATA (video,
0)); 0));
...@@ -235,74 +233,10 @@ gst_visual_render (GstAudioVisualizer * bscope, GstBuffer * audio, ...@@ -235,74 +233,10 @@ gst_visual_render (GstAudioVisualizer * bscope, GstBuffer * audio,
gst_buffer_map (audio, &amap, GST_MAP_READ); gst_buffer_map (audio, &amap, GST_MAP_READ);
adata = (const guint16 *) amap.data; adata = (const guint16 *) amap.data;
#if defined(VISUAL_API_VERSION) && VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000 lbuf = visual_buffer_new_with_buffer (ldata, sizeof (ldata), NULL);
{ rbuf = visual_buffer_new_with_buffer (rdata, sizeof (rdata), NULL);
VisBuffer *lbuf, *rbuf;
guint16 ldata[VISUAL_SAMPLES], rdata[VISUAL_SAMPLES];
VisAudioSampleRateType vrate;
lbuf = visual_buffer_new_with_buffer (ldata, sizeof (ldata), NULL);
rbuf = visual_buffer_new_with_buffer (rdata, sizeof (rdata), NULL);
if (channels == 2) {
for (i = 0; i < VISUAL_SAMPLES; i++) {
ldata[i] = *adata++;
rdata[i] = *adata++;
}
} else {
for (i = 0; i < VISUAL_SAMPLES; i++) {
ldata[i] = *adata;
rdata[i] = *adata++;
}
}
/* TODO(ensonic): move to setup */
switch (bscope->ainfo.rate) {
case 8000:
vrate = VISUAL_AUDIO_SAMPLE_RATE_8000;
break;
case 11250:
vrate = VISUAL_AUDIO_SAMPLE_RATE_11250;
break;
case 22500:
vrate = VISUAL_AUDIO_SAMPLE_RATE_22500;
break;
case 32000:
vrate = VISUAL_AUDIO_SAMPLE_RATE_32000;
break;
case 44100:
vrate = VISUAL_AUDIO_SAMPLE_RATE_44100;
break;
case 48000:
vrate = VISUAL_AUDIO_SAMPLE_RATE_48000;
break;
case 96000:
vrate = VISUAL_AUDIO_SAMPLE_RATE_96000;
break;
default:
visual_object_unref (VISUAL_OBJECT (lbuf));
visual_object_unref (VISUAL_OBJECT (rbuf));
GST_ERROR_OBJECT (visual, "unsupported rate %d", bscope->ainfo.rate);
res = FALSE;
goto done;
}
visual_audio_samplepool_input_channel (visual->audio->samplepool,
lbuf,
vrate, VISUAL_AUDIO_SAMPLE_FORMAT_S16,
(char *) VISUAL_AUDIO_CHANNEL_LEFT);
visual_audio_samplepool_input_channel (visual->audio->samplepool, rbuf,
vrate, VISUAL_AUDIO_SAMPLE_FORMAT_S16,
(char *) VISUAL_AUDIO_CHANNEL_RIGHT);
visual_object_unref (VISUAL_OBJECT (lbuf));
visual_object_unref (VISUAL_OBJECT (rbuf));
}
#else
if (channels == 2) { if (channels == 2) {
guint16 *ldata = visual->audio->plugpcm[0];
guint16 *rdata = visual->audio->plugpcm[1];
for (i = 0; i < VISUAL_SAMPLES; i++) { for (i = 0; i < VISUAL_SAMPLES; i++) {
ldata[i] = *adata++; ldata[i] = *adata++;
rdata[i] = *adata++; rdata[i] = *adata++;
...@@ -313,7 +247,48 @@ gst_visual_render (GstAudioVisualizer * bscope, GstBuffer * audio, ...@@ -313,7 +247,48 @@ gst_visual_render (GstAudioVisualizer * bscope, GstBuffer * audio,
rdata[i] = *adata++; rdata[i] = *adata++;
} }
} }
#endif
/* TODO(ensonic): move to setup */
switch (bscope->ainfo.rate) {
case 8000:
vrate = VISUAL_AUDIO_SAMPLE_RATE_8000;
break;
case 11250:
vrate = VISUAL_AUDIO_SAMPLE_RATE_11250;
break;
case 22500:
vrate = VISUAL_AUDIO_SAMPLE_RATE_22500;
break;
case 32000:
vrate = VISUAL_AUDIO_SAMPLE_RATE_32000;
break;
case 44100:
vrate = VISUAL_AUDIO_SAMPLE_RATE_44100;
break;
case 48000:
vrate = VISUAL_AUDIO_SAMPLE_RATE_48000;
break;
case 96000:
vrate = VISUAL_AUDIO_SAMPLE_RATE_96000;
break;
default:
visual_object_unref (VISUAL_OBJECT (lbuf));
visual_object_unref (VISUAL_OBJECT (rbuf));
GST_ERROR_OBJECT (visual, "unsupported rate %d", bscope->ainfo.rate);
res = FALSE;
goto done;
}
visual_audio_samplepool_input_channel (visual->audio->samplepool,
lbuf,
vrate, VISUAL_AUDIO_SAMPLE_FORMAT_S16,
(char *) VISUAL_AUDIO_CHANNEL_LEFT);
visual_audio_samplepool_input_channel (visual->audio->samplepool, rbuf,
vrate, VISUAL_AUDIO_SAMPLE_FORMAT_S16,
(char *) VISUAL_AUDIO_CHANNEL_RIGHT);
visual_object_unref (VISUAL_OBJECT (lbuf));
visual_object_unref (VISUAL_OBJECT (rbuf));
visual_audio_analyze (visual->audio); visual_audio_analyze (visual->audio);
visual_actor_run (visual->actor, visual->audio); visual_actor_run (visual->actor, visual->audio);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment