decklinksrc: port to 1.0

Compiles, not tested yet. A great number of superfluous custom
pad functions may have been harmed in the making of this port.
This commit is contained in:
Tim-Philipp Müller 2013-02-27 23:27:20 +00:00
parent 8b30362783
commit 126df5a0c2
6 changed files with 185 additions and 883 deletions

View file

@ -8,10 +8,9 @@ libgstdecklink_la_CPPFLAGS = \
$(DECKLINK_CXXFLAGS)
libgstdecklink_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) \
-lgstvideo-@GST_API_VERSION@ \
$(GST_BASE_LIBS) \
$(GST_LIBS) \
-lgstvideo-@GST_API_VERSION@ \
-lgstinterfaces-@GST_API_VERSION@ \
$(DECKLINK_LIBS) \
$(LIBM)
libgstdecklink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
@ -23,9 +22,9 @@ endif
libgstdecklink_la_LIBTOOLFLAGS = --tag=disable-static
# gstdecklinksink.cpp
libgstdecklink_la_SOURCES = \
gstdecklinksrc.cpp \
gstdecklinksink.cpp \
gstdecklink.cpp \
capture.cpp

View file

@ -31,44 +31,38 @@
#include <unistd.h>
#include <fcntl.h>
#include <gst/glib-compat-private.h>
#include "gstdecklinksrc.h"
#include "capture.h"
#define GST_CAT_DEFAULT gst_decklink_src_debug_category
IDeckLink *deckLink;
IDeckLinkInput *deckLinkInput;
IDeckLinkDisplayModeIterator *displayModeIterator;
static BMDTimecodeFormat g_timecodeFormat = (BMDTimecodeFormat) 0;
DeckLinkCaptureDelegate::DeckLinkCaptureDelegate ():m_refCount (0)
{
m_mutex = g_mutex_new ();
g_mutex_init (&m_mutex);
}
DeckLinkCaptureDelegate::~DeckLinkCaptureDelegate ()
{
g_mutex_free (m_mutex);
g_mutex_clear (&m_mutex);
}
ULONG DeckLinkCaptureDelegate::AddRef (void)
{
g_mutex_lock (m_mutex);
g_mutex_lock (&m_mutex);
m_refCount++;
g_mutex_unlock (m_mutex);
g_mutex_unlock (&m_mutex);
return (ULONG) m_refCount;
}
ULONG DeckLinkCaptureDelegate::Release (void)
{
g_mutex_lock (m_mutex);
g_mutex_lock (&m_mutex);
m_refCount--;
g_mutex_unlock (m_mutex);
g_mutex_unlock (&m_mutex);
if (m_refCount == 0) {
delete
@ -106,6 +100,7 @@ HRESULT
return S_OK;
}
/* FIXME: g_timecodeFormat is inited to 0 and never changed? dead code? */
if (g_timecodeFormat != 0) {
IDeckLinkTimecode *timecode;
if (videoFrame->GetTimecode (g_timecodeFormat, &timecode) == S_OK) {
@ -121,7 +116,7 @@ HRESULT
if (timecodeString)
FREE_COM_STRING (timecodeString);
g_mutex_lock (decklinksrc->mutex);
g_mutex_lock (&decklinksrc->mutex);
if (decklinksrc->video_frame != NULL) {
decklinksrc->dropped_frames++;
decklinksrc->video_frame->Release();
@ -139,8 +134,8 @@ HRESULT
/* increment regardless whether frame was dropped or not */
decklinksrc->frame_num++;
g_cond_signal (decklinksrc->cond);
g_mutex_unlock (decklinksrc->mutex);
g_cond_signal (&decklinksrc->cond);
g_mutex_unlock (&decklinksrc->mutex);
return S_OK;
}

View file

@ -19,7 +19,7 @@ class DeckLinkCaptureDelegate : public IDeckLinkInputCallback
private:
ULONG m_refCount;
GMutex *m_mutex;
GMutex m_mutex;
};
#endif

View file

@ -152,14 +152,14 @@ gst_decklink_mode_get_structure (GstDecklinkModeEnum e)
{
const GstDecklinkMode *mode = &modes[e];
return gst_structure_new ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'),
return gst_structure_new ("video/x-raw",
"format", G_TYPE_STRING, "UYVY",
"width", G_TYPE_INT, mode->width,
"height", G_TYPE_INT, mode->height,
"framerate", GST_TYPE_FRACTION, mode->fps_n, mode->fps_d,
"interlaced", G_TYPE_BOOLEAN, mode->interlaced,
"interlace-mode", G_TYPE_STRING, mode->interlaced ? "interleaved" : "progressive",
"pixel-aspect-ratio", GST_TYPE_FRACTION, mode->par_n, mode->par_d,
"color-matrix", G_TYPE_STRING, mode->is_hdtv ? "hdtv" : "sdtv",
"colorimetry", G_TYPE_STRING, mode->is_hdtv ? "bt709" : "bt601",
"chroma-site", G_TYPE_STRING, "mpeg2", NULL);
}
@ -288,8 +288,10 @@ plugin_init (GstPlugin * plugin)
gst_element_register (plugin, "decklinksrc", GST_RANK_NONE,
gst_decklink_src_get_type ());
#if 0
gst_element_register (plugin, "decklinksink", GST_RANK_NONE,
gst_decklink_sink_get_type ());
#endif
return TRUE;
}

File diff suppressed because it is too large Load diff

View file

@ -24,10 +24,13 @@
#include "gstdecklink.h"
G_BEGIN_DECLS
GST_DEBUG_CATEGORY_EXTERN (gst_decklink_src_debug_category);
#define GST_TYPE_DECKLINK_SRC (gst_decklink_src_get_type())
#define GST_DECKLINK_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DECKLINK_SRC,GstDecklinkSrc))
#define GST_DECKLINK_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DECKLINK_SRC,GstDecklinkSrcClass))
#define GST_DECKLINK_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DECKLINK_SRC, GstDecklinkSrcClass))
#define GST_IS_DECKLINK_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DECKLINK_SRC))
#define GST_IS_DECKLINK_SRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DECKLINK_SRC))
@ -41,14 +44,12 @@ struct _GstDecklinkSrc
GstPad *audiosrcpad;
GstPad *videosrcpad;
GstCaps *audio_caps;
IDeckLink *decklink;
IDeckLinkInput *input;
IDeckLinkConfiguration *config;
GMutex *mutex;
GCond *cond;
GMutex mutex;
GCond cond;
int dropped_frames;
int dropped_frames_old;
gboolean stop;
@ -56,11 +57,10 @@ struct _GstDecklinkSrc
IDeckLinkAudioInputPacket * audio_frame;
GstTask *task;
GStaticRecMutex task_mutex;
GRecMutex task_mutex;
guint64 num_audio_samples;
GstCaps *video_caps;
guint64 frame_num;
int fps_n;
int fps_d;
@ -68,8 +68,9 @@ struct _GstDecklinkSrc
int height;
gboolean interlaced;
BMDDisplayMode bmd_mode;
gboolean video_new_segment;
gboolean audio_new_segment;
/* so we send a stream-start, caps, and newsegment events before buffers */
gboolean started;
/* properties */
gboolean copy_data;