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
This commit is contained in:
Jan Schmidt 2004-11-12 17:37:49 +00:00
parent 7ca81ea6a5
commit b15bb53be7
3 changed files with 94 additions and 18 deletions

View file

@ -1,3 +1,23 @@
2004-11-13 Jan Schmidt <thaytan@mad.scientist.com>
* 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 Ronald S. Bultje <rbultje@ronald.bitfreak.net> 2004-11-12 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/volume/gstvolume.c: * gst/volume/gstvolume.c:

View file

@ -1213,7 +1213,7 @@ GST_CHECK_FEATURE(LIBRFB, [librfb Remote Framebuffer], rfbsrc, [
dnl *** libvisual *** dnl *** libvisual ***
translit(dnm, m, l) AM_CONDITIONAL(USE_LIBVISUAL, true) translit(dnm, m, l) AM_CONDITIONAL(USE_LIBVISUAL, true)
GST_CHECK_FEATURE(LIBVISUAL, [libvisual visualization plugins], libvisual, [ GST_CHECK_FEATURE(LIBVISUAL, [libvisual visualization plugins], libvisual, [
PKG_CHECK_MODULES(LIBVISUAL, libvisual = 0.1.1, HAVE_LIBVISUAL="yes", HAVE_LIBVISUAL="no") PKG_CHECK_MODULES(LIBVISUAL, libvisual = 0.1.7, HAVE_LIBVISUAL="yes", HAVE_LIBVISUAL="no")
AC_SUBST(LIBVISUAL_CFLAGS) AC_SUBST(LIBVISUAL_CFLAGS)
AC_SUBST(LIBVISUAL_LIBS) AC_SUBST(LIBVISUAL_LIBS)
]) ])

View file

@ -37,6 +37,9 @@
typedef struct _GstVisual GstVisual; typedef struct _GstVisual GstVisual;
typedef struct _GstVisualClass GstVisualClass; typedef struct _GstVisualClass GstVisualClass;
GST_DEBUG_CATEGORY_STATIC (libvisual_debug);
#define GST_CAT_DEFAULT (libvisual_debug)
struct _GstVisual struct _GstVisual
{ {
GstElement element; GstElement element;
@ -106,6 +109,8 @@ static GstPadLinkReturn gst_visual_sinklink (GstPad * pad,
const GstCaps * caps); const GstCaps * caps);
static GstPadLinkReturn gst_visual_srclink (GstPad * pad, const GstCaps * caps); static GstPadLinkReturn gst_visual_srclink (GstPad * pad, const GstCaps * caps);
static GstCaps *gst_visual_getcaps (GstPad * pad); static GstCaps *gst_visual_getcaps (GstPad * pad);
static void libvisual_log_handler (const char *message, const char *funcname,
void *priv);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
@ -128,10 +133,29 @@ gst_visual_get_type (void)
}; };
type = g_type_register_static (GST_TYPE_ELEMENT, "GstVisual", &info, 0); type = g_type_register_static (GST_TYPE_ELEMENT, "GstVisual", &info, 0);
GST_DEBUG_CATEGORY_INIT (libvisual_debug, "libvisual", 0,
"libvisual audio visualisations");
visual_log_set_verboseness (VISUAL_LOG_VERBOSENESS_MEDIUM);
visual_log_set_info_handler (libvisual_log_handler,
(void *) GST_LEVEL_INFO);
visual_log_set_warning_handler (libvisual_log_handler,
(void *) GST_LEVEL_WARNING);
visual_log_set_critical_handler (libvisual_log_handler,
(void *) GST_LEVEL_ERROR);
visual_log_set_error_handler (libvisual_log_handler,
(void *) GST_LEVEL_ERROR);
} }
return type; return type;
} }
static void
libvisual_log_handler (const char *message, const char *funcname, void *priv)
{
GST_CAT_LEVEL_LOG (libvisual_debug, (GstDebugLevel) (priv), NULL, "%s - %s",
funcname, message);
}
static void static void
gst_visual_class_init (gpointer g_class, gpointer class_data) gst_visual_class_init (gpointer g_class, gpointer class_data)
{ {
@ -207,28 +231,35 @@ gst_visual_getcaps (GstPad * pad)
{ {
GstCaps *ret; GstCaps *ret;
GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad)); GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
int depths;
if (!visual->actor) if (!visual->actor)
return gst_caps_copy (gst_pad_get_pad_template_caps (visual->srcpad)); return gst_caps_copy (gst_pad_get_pad_template_caps (visual->srcpad));
ret = gst_caps_new_empty (); ret = gst_caps_new_empty ();
if (visual_actor_depth_is_supported (visual->actor, depths = visual_actor_get_supported_depth (visual->actor);
VISUAL_VIDEO_CONTEXT_32BIT) == 1) { if (depths < 0) {
gst_caps_append (ret, /* FIXME: set an error */
gst_caps_from_string (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN)); return ret;
} }
if (visual_actor_depth_is_supported (visual->actor, if (depths == VISUAL_VIDEO_DEPTH_GL) {
VISUAL_VIDEO_CONTEXT_24BIT) == 1) { /* We can't handle GL only plugins */
return ret;
}
gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN));
if (depths & VISUAL_VIDEO_DEPTH_24BIT) {
#if G_BYTE_ORDER == G_BIG_ENDIAN #if G_BYTE_ORDER == G_BIG_ENDIAN
gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_RGB)); gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_RGB));
#else #else
gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_BGR)); gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_BGR));
#endif #endif
} }
if (visual_actor_depth_is_supported (visual->actor, if (depths & VISUAL_VIDEO_DEPTH_16BIT) {
VISUAL_VIDEO_CONTEXT_16BIT) == 1) {
gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_RGB_16)); gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_RGB_16));
} }
return ret; return ret;
} }
@ -254,10 +285,10 @@ gst_visual_srclink (GstPad * pad, const GstCaps * caps)
visual_video_free (visual->video); visual_video_free (visual->video);
visual->video = visual_video_new (); visual->video = visual_video_new ();
visual_actor_set_video (visual->actor, visual->video); visual_actor_set_video (visual->actor, visual->video);
visual_video_set_opts (visual->video, "depth", visual_video_set_depth (visual->video,
visual_video_depth_enum_from_value (depth)); visual_video_depth_enum_from_value (depth));
visual_video_set_dimension (visual->video, visual->width, visual->height); visual_video_set_dimension (visual->video, visual->width, visual->height);
visual_actor_video_negotiate (visual->actor); visual_actor_video_negotiate (visual->actor, 0, FALSE, FALSE);
return GST_PAD_LINK_OK; return GST_PAD_LINK_OK;
} }
@ -315,9 +346,11 @@ gst_visual_change_state (GstElement * element)
switch (GST_STATE_TRANSITION (element)) { switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY: case GST_STATE_NULL_TO_READY:
visual->actor = visual->actor =
visual_actor_new (GST_VISUAL_GET_CLASS (visual)->plugin->name); visual_actor_new (GST_VISUAL_GET_CLASS (visual)->plugin->info->
plugname);
if (!visual->actor) if (!visual->actor)
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
if (visual_actor_realize (visual->actor) != 0) { if (visual_actor_realize (visual->actor) != 0) {
visual_actor_free (visual->actor); visual_actor_free (visual->actor);
visual->actor = NULL; visual->actor = NULL;
@ -335,7 +368,7 @@ gst_visual_change_state (GstElement * element)
case GST_STATE_PAUSED_TO_READY: case GST_STATE_PAUSED_TO_READY:
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_READY_TO_NULL:
visual_actor_destroy (visual->actor); visual_actor_free (visual->actor);
visual->actor = NULL; visual->actor = NULL;
break; break;
default: default:
@ -348,6 +381,24 @@ gst_visual_change_state (GstElement * element)
return GST_STATE_SUCCESS; return GST_STATE_SUCCESS;
} }
static void
make_valid_name (char *name)
{
/*
* Replace invalid chars with _ in the type name
*/
static const gchar *extra_chars = "-_+";
gchar *p = name;
for (; *p; p++) {
int valid = ((p[0] >= 'A' && p[0] <= 'Z') ||
(p[0] >= 'a' && p[0] <= 'z') ||
(p[0] >= '0' && p[0] <= '9') || strchr (extra_chars, p[0]));
if (!valid)
*p = '_';
}
}
static gboolean static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
{ {
@ -357,8 +408,9 @@ plugin_init (GstPlugin * plugin)
if (!gst_library_load ("gstbytestream")) if (!gst_library_load ("gstbytestream"))
return FALSE; return FALSE;
if (visual_init (NULL, NULL) != 0) if (!visual_is_initialized ())
return FALSE; if (visual_init (NULL, NULL) != 0)
return FALSE;
list = visual_actor_get_list (); list = visual_actor_get_list ();
for (i = 0; i < visual_list_count (list); i++) { for (i = 0; i < visual_list_count (list); i++) {
@ -377,12 +429,16 @@ plugin_init (GstPlugin * plugin)
NULL NULL
}; };
if (ref->name == NULL) if (ref->info->plugname == NULL)
continue; continue;
name = g_strdup_printf ("GstVisual%s", ref->name);
name = g_strdup_printf ("GstVisual%s", ref->info->plugname);
make_valid_name (name);
type = g_type_register_static (GST_TYPE_VISUAL, name, &info, 0); type = g_type_register_static (GST_TYPE_VISUAL, name, &info, 0);
g_free (name); g_free (name);
name = g_strdup_printf ("libvisual_%s", ref->name);
name = g_strdup_printf ("libvisual_%s", ref->info->plugname);
make_valid_name (name);
if (!gst_element_register (plugin, name, GST_RANK_NONE, type)) { if (!gst_element_register (plugin, name, GST_RANK_NONE, type)) {
g_free (name); g_free (name);
return FALSE; return FALSE;