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
|
2012-11-03 23:05:09 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2004-04-30 02:25:09 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#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-05-11 15:31:36 +00:00
|
|
|
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
2016-03-17 18:17:48 +00:00
|
|
|
#define RGB_ORDER_CAPS "xRGB, RGB"
|
2004-05-11 15:31:36 +00:00
|
|
|
#else
|
2016-03-17 18:17:48 +00:00
|
|
|
#define RGB_ORDER_CAPS "BGRx, BGR"
|
2004-05-11 15:31:36 +00:00
|
|
|
#endif
|
2016-03-17 18:17:48 +00:00
|
|
|
|
|
|
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (" { " RGB_ORDER_CAPS ", 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 }, "
|
2014-07-11 08:13:03 +00:00
|
|
|
"rate = (int) { 8000, 11250, 22500, 32000, 44100, 48000, 96000 }")
|
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-08-13 11:47:01 +00:00
|
|
|
GstBuffer * audio, GstVideoFrame * 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? */
|
2016-03-03 07:46:24 +00:00
|
|
|
gst_element_class_add_static_pad_template (element_class, &src_template);
|
|
|
|
gst_element_class_add_static_pad_template (element_class, &sink_template);
|
2011-04-29 16:23:25 +00:00
|
|
|
|
2020-06-11 17:57:58 +00:00
|
|
|
gst_element_class_set_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);
|
2020-06-23 00:49:44 +00:00
|
|
|
|
|
|
|
gst_type_mark_as_plugin_api (GST_TYPE_VISUAL, 0);
|
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);
|
2012-08-13 11:47:01 +00:00
|
|
|
gint 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-30 13:38:45 +00:00
|
|
|
/* FIXME: we need to know how many bits we actually have in memory */
|
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-08-13 11:47:01 +00:00
|
|
|
visual_video_set_dimension (visual->video,
|
|
|
|
GST_VIDEO_INFO_WIDTH (&bscope->vinfo),
|
|
|
|
GST_VIDEO_INFO_HEIGHT (&bscope->vinfo));
|
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-08-13 11:47:01 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "WxH: %dx%d, bpp: %d, depth: %d",
|
|
|
|
GST_VIDEO_INFO_WIDTH (&bscope->vinfo),
|
|
|
|
GST_VIDEO_INFO_HEIGHT (&bscope->vinfo), visual->video->bpp, 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-08-13 11:47:01 +00:00
|
|
|
GstVideoFrame * 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);
|
2012-08-13 11:47:01 +00:00
|
|
|
GstMapInfo amap;
|
2012-07-08 17:19:38 +00:00
|
|
|
const guint16 *adata;
|
|
|
|
gint i, channels;
|
|
|
|
gboolean res = TRUE;
|
2014-07-11 08:13:03 +00:00
|
|
|
VisBuffer *lbuf, *rbuf;
|
|
|
|
guint16 ldata[VISUAL_SAMPLES], rdata[VISUAL_SAMPLES];
|
|
|
|
VisAudioSampleRateType vrate;
|
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-08-13 11:47:01 +00:00
|
|
|
visual_video_set_buffer (visual->video, GST_VIDEO_FRAME_PLANE_DATA (video,
|
|
|
|
0));
|
|
|
|
visual_video_set_pitch (visual->video, GST_VIDEO_FRAME_PLANE_STRIDE (video,
|
|
|
|
0));
|
2005-09-06 22:29:00 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
channels = GST_AUDIO_INFO_CHANNELS (&bscope->ainfo);
|
2012-08-13 11:47:01 +00:00
|
|
|
|
|
|
|
gst_buffer_map (audio, &amap, GST_MAP_READ);
|
2012-07-08 17:19:38 +00:00
|
|
|
adata = (const guint16 *) amap.data;
|
2006-05-31 16:21:48 +00:00
|
|
|
|
2014-07-11 08:13:03 +00:00
|
|
|
lbuf = visual_buffer_new_with_buffer (ldata, sizeof (ldata), NULL);
|
|
|
|
rbuf = visual_buffer_new_with_buffer (rdata, sizeof (rdata), NULL);
|
2007-03-09 16:46:35 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
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++;
|
|
|
|
}
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
2014-07-11 08:13:03 +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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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));
|
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 (audio, &amap);
|
2012-08-13 11:47:01 +00:00
|
|
|
|
2012-07-08 17:19:38 +00:00
|
|
|
return res;
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|