mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-07-15 18:58:45 +00:00
decklinksrc: Handle callback/delegate object the same way as in the sink
Potentially fixes crashes.
This commit is contained in:
parent
2a0123d79a
commit
ee8766b342
|
@ -7,7 +7,7 @@ class DeckLinkCaptureDelegate : public IDeckLinkInputCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DeckLinkCaptureDelegate();
|
DeckLinkCaptureDelegate();
|
||||||
~DeckLinkCaptureDelegate();
|
virtual ~DeckLinkCaptureDelegate();
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
|
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
|
||||||
virtual ULONG STDMETHODCALLTYPE AddRef(void);
|
virtual ULONG STDMETHODCALLTYPE AddRef(void);
|
||||||
|
|
|
@ -408,7 +408,6 @@ static gboolean
|
||||||
gst_decklink_src_start (GstElement * element)
|
gst_decklink_src_start (GstElement * element)
|
||||||
{
|
{
|
||||||
GstDecklinkSrc *decklinksrc = GST_DECKLINK_SRC (element);
|
GstDecklinkSrc *decklinksrc = GST_DECKLINK_SRC (element);
|
||||||
DeckLinkCaptureDelegate *delegate;
|
|
||||||
BMDAudioSampleType sample_depth;
|
BMDAudioSampleType sample_depth;
|
||||||
int channels;
|
int channels;
|
||||||
HRESULT ret;
|
HRESULT ret;
|
||||||
|
@ -431,9 +430,9 @@ gst_decklink_src_start (GstElement * element)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate = new DeckLinkCaptureDelegate ();
|
decklinksrc->delegate = new DeckLinkCaptureDelegate ();
|
||||||
delegate->priv = decklinksrc;
|
decklinksrc->delegate->priv = decklinksrc;
|
||||||
ret = decklinksrc->input->SetCallback (delegate);
|
ret = decklinksrc->input->SetCallback (decklinksrc->delegate);
|
||||||
if (ret != S_OK) {
|
if (ret != S_OK) {
|
||||||
GST_ERROR ("set callback failed (input source)");
|
GST_ERROR ("set callback failed (input source)");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -559,6 +558,10 @@ gst_decklink_src_stop (GstElement * element)
|
||||||
decklinksrc->input->DisableVideoInput ();
|
decklinksrc->input->DisableVideoInput ();
|
||||||
decklinksrc->input->DisableAudioInput ();
|
decklinksrc->input->DisableAudioInput ();
|
||||||
|
|
||||||
|
decklinksrc->input->SetCallback (NULL);
|
||||||
|
delete decklinksrc->delegate;
|
||||||
|
decklinksrc->delegate = NULL;
|
||||||
|
|
||||||
g_list_free_full (decklinksrc->pending_events,
|
g_list_free_full (decklinksrc->pending_events,
|
||||||
(GDestroyNotify) gst_mini_object_unref);
|
(GDestroyNotify) gst_mini_object_unref);
|
||||||
decklinksrc->pending_events = NULL;
|
decklinksrc->pending_events = NULL;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include "gstdecklink.h"
|
#include "gstdecklink.h"
|
||||||
|
#include "capture.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ struct _GstDecklinkSrc
|
||||||
IDeckLink *decklink;
|
IDeckLink *decklink;
|
||||||
IDeckLinkInput *input;
|
IDeckLinkInput *input;
|
||||||
IDeckLinkConfiguration *config;
|
IDeckLinkConfiguration *config;
|
||||||
|
DeckLinkCaptureDelegate *delegate;
|
||||||
|
|
||||||
GMutex mutex;
|
GMutex mutex;
|
||||||
GCond cond;
|
GCond cond;
|
||||||
|
|
Loading…
Reference in a new issue