2004-04-30 02:25:09 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
|
2012-06-25 20:42:44 +00:00
|
|
|
* 2012 Stefan Sauer <ensonic@users.sf.net>
|
2004-04-30 02:25:09 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2012-06-25 20:42:44 +00:00
|
|
|
#include "visual.h"
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_EXTERN (libvisual_debug);
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
#define GST_CAT_DEFAULT (libvisual_debug)
|
|
|
|
|
2010-10-05 10:00:28 +00:00
|
|
|
/* amounf of samples before we can feed libvisual */
|
|
|
|
#define VISUAL_SAMPLES 512
|
|
|
|
|
2004-04-30 02:25:09 +00:00
|
|
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2011-06-16 10:48:33 +00:00
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (" { "
|
2004-05-11 15:31:36 +00:00
|
|
|
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
2011-06-16 10:48:33 +00:00
|
|
|
"\"xRGB\", " "\"RGB\", "
|
2004-05-11 15:31:36 +00:00
|
|
|
#else
|
2011-06-16 10:48:33 +00:00
|
|
|
"\"BGRx\", " "\"BGR\", "
|
2004-05-11 15:31:36 +00:00
|
|
|
#endif
|
2011-06-16 10:48:33 +00:00
|
|
|
"\"RGB16\" } "))
|
2004-04-30 02:25:09 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2011-08-19 14:49:30 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-raw, "
|
|
|
|
"format = (string) " GST_AUDIO_NE (S16) ", "
|
2011-12-31 13:25:09 +00:00
|
|
|
"layout = (string) interleaved, " "channels = (int) { 1, 2 }, "
|
2012-07-08 17:19:38 +00:00
|
|
|
"channel-mask = (bitmask) 0x3, "
|
2006-09-27 11:58:17 +00:00
|
|
|
#if defined(VISUAL_API_VERSION) && VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
|
|
|
|
"rate = (int) { 8000, 11250, 22500, 32000, 44100, 48000, 96000 }"
|
|
|
|
#else
|
|
|
|
"rate = (int) [ 1000, MAX ]"
|
|
|
|
#endif
|
|
|
|
)
|
2004-04-30 02:25:09 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
static void gst_visual_init (GstVisual * visual);
|
2011-04-29 16:23:25 +00:00
|
|
|
static void gst_visual_finalize (GObject * object);
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2012-07-16 19:58:23 +00:00
|
|
|
static gboolean gst_visual_setup (GstAudioVisualizer * bscope);
|
|
|
|
static gboolean gst_visual_render (GstAudioVisualizer * bscope,
|
2012-07-08 17:19:38 +00:00
|
|
|
GstBuffer * audio, GstBuffer * video);
|
2004-04-30 02:25:09 +00:00
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
|
|
|
|
GType
|
|
|
|
gst_visual_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
ext/libvisual/visual.c: Small cleanups.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_get_type),
(gst_visual_src_setcaps), (gst_vis_src_negotiate),
(gst_visual_chain):
Small cleanups.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_init),
(gst_theora_dec_reset), (_theora_granule_time),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Add simple QoS.
2006-03-09 17:58:00 +00:00
|
|
|
if (G_UNLIKELY (type == 0)) {
|
2004-04-30 02:25:09 +00:00
|
|
|
static const GTypeInfo info = {
|
|
|
|
sizeof (GstVisualClass),
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
gst_visual_class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof (GstVisual),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gst_visual_init,
|
|
|
|
};
|
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
type =
|
2012-07-16 19:58:23 +00:00
|
|
|
g_type_register_static (GST_TYPE_AUDIO_VISUALIZER, "GstVisual",
|
2012-07-08 17:19:38 +00:00
|
|
|
&info, 0);
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2012-06-25 20:42:44 +00:00
|
|
|
void
|
2004-04-30 02:25:09 +00:00
|
|
|
gst_visual_class_init (gpointer g_class, gpointer class_data)
|
|
|
|
{
|
2012-07-08 17:19:38 +00:00
|
|
|
GObjectClass *gobject_class = (GObjectClass *) g_class;
|
|
|
|
GstElementClass *element_class = (GstElementClass *) g_class;
|
2012-07-16 19:58:23 +00:00
|
|
|
GstAudioVisualizerClass *scope_class = (GstAudioVisualizerClass *) g_class;
|
2012-07-08 17:19:38 +00:00
|
|
|
GstVisualClass *klass = (GstVisualClass *) g_class;
|
2004-04-30 02:25:09 +00:00
|
|
|
|
|
|
|
klass->plugin = class_data;
|
|
|
|
|
|
|
|
if (class_data == NULL) {
|
|
|
|
parent_class = g_type_class_peek_parent (g_class);
|
|
|
|
} else {
|
2012-06-25 20:42:44 +00:00
|
|
|
gchar *longname = g_strdup_printf ("libvisual %s plugin v.%s",
|
2004-04-30 02:25:09 +00:00
|
|
|
klass->plugin->info->name, klass->plugin->info->version);
|
|
|
|
|
|
|
|
/* FIXME: improve to only register what plugin supports? */
|
2012-07-08 17:19:38 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2004-04-30 02:25:09 +00:00
|
|
|
gst_static_pad_template_get (&src_template));
|
2012-07-08 17:19:38 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2004-04-30 02:25:09 +00:00
|
|
|
gst_static_pad_template_get (&sink_template));
|
2011-04-29 16:23:25 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
gst_element_class_set_static_metadata (element_class,
|
2010-03-16 14:45:23 +00:00
|
|
|
longname, "Visualization",
|
|
|
|
klass->plugin->info->about, "Benjamin Otte <otte@gnome.org>");
|
|
|
|
|
|
|
|
g_free (longname);
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
gobject_class->finalize = gst_visual_finalize;
|
|
|
|
|
|
|
|
scope_class->setup = GST_DEBUG_FUNCPTR (gst_visual_setup);
|
|
|
|
scope_class->render = GST_DEBUG_FUNCPTR (gst_visual_render);
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_visual_init (GstVisual * visual)
|
|
|
|
{
|
2012-07-08 17:19:38 +00:00
|
|
|
/* do nothing */
|
2004-05-04 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
gst_visual_clear_actors (GstVisual * visual)
|
2004-05-04 00:44:19 +00:00
|
|
|
{
|
2005-09-07 20:06:43 +00:00
|
|
|
if (visual->actor) {
|
|
|
|
visual_object_unref (VISUAL_OBJECT (visual->actor));
|
|
|
|
visual->actor = NULL;
|
|
|
|
}
|
|
|
|
if (visual->video) {
|
|
|
|
visual_object_unref (VISUAL_OBJECT (visual->video));
|
|
|
|
visual->video = NULL;
|
|
|
|
}
|
2006-09-27 11:58:17 +00:00
|
|
|
if (visual->audio) {
|
|
|
|
visual_object_unref (VISUAL_OBJECT (visual->audio));
|
|
|
|
visual->audio = NULL;
|
|
|
|
}
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-04-29 16:23:25 +00:00
|
|
|
gst_visual_finalize (GObject * object)
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
{
|
|
|
|
GstVisual *visual = GST_VISUAL (object);
|
|
|
|
|
|
|
|
gst_visual_clear_actors (visual);
|
|
|
|
|
2011-04-29 16:23:25 +00:00
|
|
|
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
static gboolean
|
2012-07-16 19:58:23 +00:00
|
|
|
gst_visual_setup (GstAudioVisualizer * bscope)
|
2004-04-30 02:25:09 +00:00
|
|
|
{
|
2012-07-08 17:19:38 +00:00
|
|
|
GstVisual *visual = GST_VISUAL (bscope);
|
|
|
|
gint pitch, depth;
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
gst_visual_clear_actors (visual);
|
2011-05-16 10:18:03 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
depth = bscope->vinfo.finfo->pixel_stride[0];
|
|
|
|
if (bscope->vinfo.finfo->bits >= 8) {
|
|
|
|
depth *= 8;
|
2011-05-16 10:18:03 +00:00
|
|
|
}
|
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
visual->actor =
|
|
|
|
visual_actor_new (GST_VISUAL_GET_CLASS (visual)->plugin->info->plugname);
|
|
|
|
visual->video = visual_video_new ();
|
|
|
|
visual->audio = visual_audio_new ();
|
|
|
|
/* can't have a play without actors */
|
|
|
|
if (!visual->actor || !visual->video)
|
|
|
|
goto no_actors;
|
2011-11-16 11:37:44 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
if (visual_actor_realize (visual->actor) != 0)
|
|
|
|
goto no_realize;
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
visual_actor_set_video (visual->actor, visual->video);
|
2011-06-16 10:48:33 +00:00
|
|
|
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
visual_video_set_depth (visual->video,
|
2004-04-30 02:25:09 +00:00
|
|
|
visual_video_depth_enum_from_value (depth));
|
2012-07-08 17:19:38 +00:00
|
|
|
visual_video_set_dimension (visual->video, bscope->width, bscope->height);
|
|
|
|
pitch = GST_ROUND_UP_4 (bscope->width * visual->video->bpp);
|
2007-01-29 10:25:11 +00:00
|
|
|
visual_video_set_pitch (visual->video, pitch);
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
visual_actor_video_negotiate (visual->actor, 0, FALSE, FALSE);
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "WxH: %dx%d, bpp: %d, pitch: %d, depth: %d",
|
|
|
|
bscope->width, bscope->height, visual->video->bpp, pitch, depth);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
|
2005-09-07 20:06:43 +00:00
|
|
|
return TRUE;
|
2011-08-19 14:49:30 +00:00
|
|
|
/* ERRORS */
|
2012-07-08 17:19:38 +00:00
|
|
|
no_actors:
|
2011-08-19 14:49:30 +00:00
|
|
|
{
|
2012-07-08 17:19:38 +00:00
|
|
|
GST_ELEMENT_ERROR (visual, LIBRARY, INIT, (NULL),
|
|
|
|
("could not create actors"));
|
|
|
|
gst_visual_clear_actors (visual);
|
2011-08-19 14:49:30 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2012-07-08 17:19:38 +00:00
|
|
|
no_realize:
|
2006-02-27 12:08:22 +00:00
|
|
|
{
|
2012-07-08 17:19:38 +00:00
|
|
|
GST_ELEMENT_ERROR (visual, LIBRARY, INIT, (NULL),
|
|
|
|
("could not realize actor"));
|
|
|
|
gst_visual_clear_actors (visual);
|
2006-02-27 12:08:22 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2006-02-26 21:05:46 +00:00
|
|
|
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
static gboolean
|
2012-07-16 19:58:23 +00:00
|
|
|
gst_visual_render (GstAudioVisualizer * bscope, GstBuffer * audio,
|
2012-07-08 17:19:38 +00:00
|
|
|
GstBuffer * video)
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
{
|
2012-07-08 17:19:38 +00:00
|
|
|
GstVisual *visual = GST_VISUAL (bscope);
|
|
|
|
GstMapInfo amap, vmap;
|
|
|
|
const guint16 *adata;
|
|
|
|
gint i, channels;
|
|
|
|
gboolean res = TRUE;
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
gst_buffer_map (audio, &amap, GST_MAP_READ);
|
|
|
|
gst_buffer_map (video, &vmap, GST_MAP_WRITE);
|
2011-05-19 11:38:55 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
visual_video_set_buffer (visual->video, vmap.data);
|
2005-09-06 22:29:00 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
channels = GST_AUDIO_INFO_CHANNELS (&bscope->ainfo);
|
|
|
|
adata = (const guint16 *) amap.data;
|
2006-05-31 16:21:48 +00:00
|
|
|
|
2006-09-27 11:58:17 +00:00
|
|
|
#if defined(VISUAL_API_VERSION) && VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
|
2012-07-08 17:19:38 +00:00
|
|
|
{
|
|
|
|
VisBuffer *lbuf, *rbuf;
|
|
|
|
guint16 ldata[VISUAL_SAMPLES], rdata[VISUAL_SAMPLES];
|
|
|
|
VisAudioSampleRateType vrate;
|
2006-09-27 11:58:17 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
lbuf = visual_buffer_new_with_buffer (ldata, sizeof (ldata), NULL);
|
|
|
|
rbuf = visual_buffer_new_with_buffer (rdata, sizeof (rdata), NULL);
|
2006-09-27 11:58:17 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
if (channels == 2) {
|
2010-10-05 10:00:28 +00:00
|
|
|
for (i = 0; i < VISUAL_SAMPLES; i++) {
|
2012-07-08 17:19:38 +00:00
|
|
|
ldata[i] = *adata++;
|
|
|
|
rdata[i] = *adata++;
|
2006-05-31 16:21:48 +00:00
|
|
|
}
|
|
|
|
} else {
|
2010-10-05 10:00:28 +00:00
|
|
|
for (i = 0; i < VISUAL_SAMPLES; i++) {
|
2012-07-08 17:19:38 +00:00
|
|
|
ldata[i] = *adata;
|
|
|
|
rdata[i] = *adata++;
|
2006-05-31 16:21:48 +00:00
|
|
|
}
|
2004-05-04 00:44:19 +00:00
|
|
|
}
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
/* 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;
|
2005-09-07 20:06:43 +00:00
|
|
|
}
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
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);
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
visual_object_unref (VISUAL_OBJECT (lbuf));
|
|
|
|
visual_object_unref (VISUAL_OBJECT (rbuf));
|
2007-03-09 16:46:35 +00:00
|
|
|
|
check/: Add extra tests for basetransform based components.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (GST_START_TEST), (simple_launch_lines_suite):
Add extra tests for basetransform based components.
Comment out the test_element_negotiation test until we decide
if it's testing correct behaviour.
* ext/libvisual/visual.c: (gst_visual_init), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Slightly more correct but still bogus timestamping.
Fix state change function.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init):
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_class_init):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_class_init),
(gst_videoscale_prepare_size), (gst_videoscale_set_caps),
(gst_videoscale_prepare_image):
* gst/volume/gstvolume.c: (gst_volume_class_init),
(volume_transform_ip):
Basetransform updates. Enable passthrough modes.
* sys/ximage/ximagesink.c: (gst_ximage_buffer_init),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
Negotiation fix that allows the window to return to the original
size and renegotiate passthrough upstream. Extra debug output.
2005-09-09 17:53:47 +00:00
|
|
|
}
|
2012-07-08 17:19:38 +00:00
|
|
|
#else
|
|
|
|
if (channels == 2) {
|
|
|
|
guint16 *ldata = visual->audio->plugpcm[0];
|
|
|
|
guint16 *rdata = visual->audio->plugpcm[1];
|
|
|
|
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++;
|
|
|
|
}
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
2012-07-08 17:19:38 +00:00
|
|
|
#endif
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
visual_audio_analyze (visual->audio);
|
|
|
|
visual_actor_run (visual->actor, visual->audio);
|
|
|
|
visual_video_set_buffer (visual->video, NULL);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "rendered one frame");
|
|
|
|
done:
|
|
|
|
gst_buffer_unmap (video, &vmap);
|
|
|
|
gst_buffer_unmap (audio, &amap);
|
|
|
|
return res;
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|