audiovisualizers: update baseclass from libvisual porting

This commit is contained in:
Stefan Sauer 2012-07-08 19:23:30 +02:00
parent ea65e5d501
commit 266d1f62c0
2 changed files with 16 additions and 4 deletions

View file

@ -502,8 +502,9 @@ gst_base_audio_visualizer_init (GstBaseAudioVisualizer * scope,
scope->fps_d = 1; scope->fps_d = 1;
scope->frame_duration = GST_CLOCK_TIME_NONE; scope->frame_duration = GST_CLOCK_TIME_NONE;
/* reset the initial audio state */ /* reset the initial state */
gst_audio_info_init (&scope->ainfo); gst_audio_info_init (&scope->ainfo);
gst_video_info_init (&scope->vinfo);
g_mutex_init (&scope->config_lock); g_mutex_init (&scope->config_lock);
} }
@ -614,20 +615,25 @@ static gboolean
gst_base_audio_visualizer_src_setcaps (GstBaseAudioVisualizer * scope, gst_base_audio_visualizer_src_setcaps (GstBaseAudioVisualizer * scope,
GstCaps * caps) GstCaps * caps)
{ {
GstVideoInfo info;
GstBaseAudioVisualizerClass *klass; GstBaseAudioVisualizerClass *klass;
GstStructure *structure; GstStructure *structure;
gboolean res; gboolean res;
if (!gst_video_info_from_caps (&info, caps))
goto wrong_caps;
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
if (!gst_structure_get_int (structure, "width", &scope->width) || if (!gst_structure_get_int (structure, "width", &scope->width) ||
!gst_structure_get_int (structure, "height", &scope->height) || !gst_structure_get_int (structure, "height", &scope->height) ||
!gst_structure_get_fraction (structure, "framerate", &scope->fps_n, !gst_structure_get_fraction (structure, "framerate", &scope->fps_n,
&scope->fps_d)) &scope->fps_d))
goto error; goto wrong_caps;
klass = GST_BASE_AUDIO_VISUALIZER_CLASS (G_OBJECT_GET_CLASS (scope)); klass = GST_BASE_AUDIO_VISUALIZER_CLASS (G_OBJECT_GET_CLASS (scope));
//scope->video_format = format; ?? scope->vinfo = info;
scope->video_format = info.finfo->format;
scope->frame_duration = gst_util_uint64_scale_int (GST_SECOND, scope->frame_duration = gst_util_uint64_scale_int (GST_SECOND,
scope->fps_d, scope->fps_n); scope->fps_d, scope->fps_n);
@ -654,7 +660,7 @@ gst_base_audio_visualizer_src_setcaps (GstBaseAudioVisualizer * scope,
return res; return res;
/* ERRORS */ /* ERRORS */
error: wrong_caps:
{ {
GST_DEBUG_OBJECT (scope, "error parsing caps"); GST_DEBUG_OBJECT (scope, "error parsing caps");
return FALSE; return FALSE;
@ -963,6 +969,11 @@ gst_base_audio_visualizer_src_event (GstPad * pad, GstObject * parent,
res = gst_pad_push_event (scope->sinkpad, event); res = gst_pad_push_event (scope->sinkpad, event);
break; break;
} }
case GST_EVENT_RECONFIGURE:
/* dont't forward */
gst_event_unref (event);
res = TRUE;
break;
default: default:
res = gst_pad_push_event (scope->sinkpad, event); res = gst_pad_push_event (scope->sinkpad, event);
break; break;

View file

@ -87,6 +87,7 @@ struct _GstBaseAudioVisualizer
guint req_spf; /* min samples per frame wanted by the subclass */ guint req_spf; /* min samples per frame wanted by the subclass */
/* video state */ /* video state */
GstVideoInfo vinfo;
GstVideoFormat video_format; GstVideoFormat video_format;
gint fps_n, fps_d; gint fps_n, fps_d;
gint width; gint width;