gtkgstbasewidget: Pass already parsed VideoInfo

As the base sink already parse the caps into VideoInfo it
makes sense to pass in VideoInfo to the widget instead.

https://bugzilla.gnome.org/show_bug.cgi?id=752441
This commit is contained in:
Nicolas Dufresne 2015-07-17 13:05:05 -04:00
parent 5584005f96
commit d099499275
3 changed files with 11 additions and 15 deletions

View file

@ -330,7 +330,7 @@ gst_gtk_base_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
return FALSE;
}
if (!gtk_gst_base_widget_set_caps (gtk_sink->widget, caps))
if (!gtk_gst_base_widget_set_format (gtk_sink->widget, &gtk_sink->v_info))
return FALSE;
GST_OBJECT_UNLOCK (gtk_sink);

View file

@ -258,22 +258,20 @@ gtk_gst_base_widget_finalize (GObject * object)
}
gboolean
gtk_gst_base_widget_set_caps (GtkGstBaseWidget * widget, GstCaps * caps)
gtk_gst_base_widget_set_format (GtkGstBaseWidget * widget,
GstVideoInfo * v_info)
{
GstVideoInfo v_info;
if (widget->caps && gst_caps_is_equal_fixed (widget->caps, caps))
return TRUE;
if (!gst_video_info_from_caps (&v_info, caps))
return FALSE;
GTK_GST_BASE_WIDGET_LOCK (widget);
if (gst_video_info_is_equal (&widget->v_info, v_info)) {
GTK_GST_BASE_WIDGET_UNLOCK (widget);
return TRUE;
}
/* FIXME this will cause black frame to be displayed, move this in the
* _queue_resize callback passing over the video info */
if (!_calculate_par (widget, &v_info)) {
if (!_calculate_par (widget, v_info)) {
GTK_GST_BASE_WIDGET_UNLOCK (widget);
return FALSE;
}
@ -282,8 +280,7 @@ gtk_gst_base_widget_set_caps (GtkGstBaseWidget * widget, GstCaps * caps)
widget->reset (widget);
gst_buffer_replace (&widget->buffer, NULL);
gst_caps_replace (&widget->caps, caps);
widget->v_info = v_info;
widget->v_info = *v_info;
widget->negotiated = TRUE;
widget->new_buffer = TRUE;

View file

@ -62,7 +62,6 @@ struct _GtkGstBaseWidget
/*< private >*/
GMutex lock;
GstCaps *caps;
/* Pending queued idles callback */
guint draw_id;
@ -86,7 +85,7 @@ void gtk_gst_base_widget_init (GtkGstBaseWidget * wid
void gtk_gst_base_widget_finalize (GObject * object);
/* API */
gboolean gtk_gst_base_widget_set_caps (GtkGstBaseWidget * widget, GstCaps *caps);
gboolean gtk_gst_base_widget_set_format (GtkGstBaseWidget * widget, GstVideoInfo *v_info);
void gtk_gst_base_widget_set_buffer (GtkGstBaseWidget * widget, GstBuffer *buffer);
G_END_DECLS