mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-03 04:52:28 +00:00
d3dvideosink: Only open system resources in in NULL->READY, not on object instantiation
This commit is contained in:
parent
827655ffb4
commit
23265c8428
2 changed files with 22 additions and 3 deletions
|
@ -334,6 +334,13 @@ d3d_supported_caps (GstD3DVideoSink * sink)
|
|||
goto unlock;
|
||||
}
|
||||
|
||||
LOCK_CLASS (sink, class);
|
||||
if (class->d3d.refs == 0) {
|
||||
UNLOCK_CLASS (sink, class);
|
||||
goto unlock;
|
||||
}
|
||||
UNLOCK_CLASS (sink, class);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (gst_d3d_format_map); i++) {
|
||||
D3DFormatComp *comp;
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ static void gst_d3dvideosink_finalize (GObject * gobject);
|
|||
static GstCaps *gst_d3dvideosink_get_caps (GstBaseSink * basesink,
|
||||
GstCaps * filter);
|
||||
static gboolean gst_d3dvideosink_set_caps (GstBaseSink * bsink, GstCaps * caps);
|
||||
static gboolean gst_d3dvideosink_start (GstBaseSink * sink);
|
||||
static gboolean gst_d3dvideosink_stop (GstBaseSink * sink);
|
||||
/* GstVideoSink */
|
||||
static GstFlowReturn gst_d3dvideosink_show_frame (GstVideoSink * vsink,
|
||||
|
@ -113,6 +114,7 @@ gst_d3dvideosink_class_init (GstD3DVideoSinkClass * klass)
|
|||
|
||||
gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_d3dvideosink_get_caps);
|
||||
gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_d3dvideosink_set_caps);
|
||||
gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_d3dvideosink_start);
|
||||
gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_d3dvideosink_stop);
|
||||
|
||||
gstvideosink_class->show_frame =
|
||||
|
@ -161,8 +163,6 @@ gst_d3dvideosink_init (GstD3DVideoSink * sink)
|
|||
{
|
||||
GST_DEBUG_OBJECT (sink, " ");
|
||||
|
||||
d3d_class_init (sink);
|
||||
|
||||
/* Init Properties */
|
||||
sink->force_aspect_ratio = DEFAULT_FORCE_ASPECT_RATIO;
|
||||
sink->create_internal_window = DEFAULT_CREATE_RENDER_WINDOW;
|
||||
|
@ -181,7 +181,6 @@ gst_d3dvideosink_finalize (GObject * gobject)
|
|||
|
||||
GST_DEBUG_OBJECT (sink, " ");
|
||||
|
||||
d3d_class_destroy (sink);
|
||||
gst_caps_replace (&sink->supported_caps, NULL);
|
||||
|
||||
g_rec_mutex_clear (&sink->lock);
|
||||
|
@ -383,12 +382,25 @@ no_display_size:
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_d3dvideosink_start (GstBaseSink * bsink)
|
||||
{
|
||||
GstD3DVideoSink *sink = GST_D3DVIDEOSINK (bsink);
|
||||
|
||||
GST_DEBUG_OBJECT (bsink, "Start() called");
|
||||
|
||||
return d3d_class_init (sink);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_d3dvideosink_stop (GstBaseSink * bsink)
|
||||
{
|
||||
GstD3DVideoSink *sink = GST_D3DVIDEOSINK (bsink);
|
||||
|
||||
GST_DEBUG_OBJECT (bsink, "Stop() called");
|
||||
d3d_stop (sink);
|
||||
d3d_class_destroy (sink);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue