decklink: reindent
This commit is contained in:
parent
ca8ea19cc3
commit
1e1c16150b
@ -35,7 +35,8 @@
|
||||
#define KDeckLinkPreviewAPI_Name "libDeckLinkPreviewAPI.so"
|
||||
|
||||
typedef IDeckLinkIterator *(*CreateIteratorFunc) (void);
|
||||
typedef IDeckLinkGLScreenPreviewHelper* (*CreateOpenGLScreenPreviewHelperFunc)(void);
|
||||
typedef IDeckLinkGLScreenPreviewHelper
|
||||
* (*CreateOpenGLScreenPreviewHelperFunc) (void);
|
||||
typedef IDeckLinkVideoConversion *(*CreateVideoConversionInstanceFunc) (void);
|
||||
|
||||
static pthread_once_t gDeckLinkOnceControl = PTHREAD_ONCE_INIT;
|
||||
@ -45,42 +46,47 @@ static CreateIteratorFunc gCreateIteratorFunc = NULL;
|
||||
static CreateOpenGLScreenPreviewHelperFunc gCreateOpenGLPreviewFunc = NULL;
|
||||
static CreateVideoConversionInstanceFunc gCreateVideoConversionFunc = NULL;
|
||||
|
||||
static
|
||||
void InitDeckLinkAPI (void)
|
||||
static void
|
||||
InitDeckLinkAPI (void)
|
||||
{
|
||||
void *libraryHandle;
|
||||
|
||||
libraryHandle = dlopen (kDeckLinkAPI_Name, RTLD_NOW | RTLD_GLOBAL);
|
||||
if (!libraryHandle)
|
||||
{
|
||||
if (!libraryHandle) {
|
||||
fprintf (stderr, "%s\n", dlerror ());
|
||||
return;
|
||||
}
|
||||
gCreateIteratorFunc = (CreateIteratorFunc)dlsym(libraryHandle, "CreateDeckLinkIteratorInstance_0001");
|
||||
gCreateIteratorFunc =
|
||||
(CreateIteratorFunc) dlsym (libraryHandle,
|
||||
"CreateDeckLinkIteratorInstance_0001");
|
||||
if (!gCreateIteratorFunc)
|
||||
fprintf (stderr, "%s\n", dlerror ());
|
||||
gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc)dlsym(libraryHandle, "CreateVideoConversionInstance_0001");
|
||||
gCreateVideoConversionFunc =
|
||||
(CreateVideoConversionInstanceFunc) dlsym (libraryHandle,
|
||||
"CreateVideoConversionInstance_0001");
|
||||
if (!gCreateVideoConversionFunc)
|
||||
fprintf (stderr, "%s\n", dlerror ());
|
||||
}
|
||||
|
||||
static
|
||||
void InitDeckLinkPreviewAPI (void)
|
||||
static void
|
||||
InitDeckLinkPreviewAPI (void)
|
||||
{
|
||||
void *libraryHandle;
|
||||
|
||||
libraryHandle = dlopen (KDeckLinkPreviewAPI_Name, RTLD_NOW | RTLD_GLOBAL);
|
||||
if (!libraryHandle)
|
||||
{
|
||||
if (!libraryHandle) {
|
||||
fprintf (stderr, "%s\n", dlerror ());
|
||||
return;
|
||||
}
|
||||
gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc)dlsym(libraryHandle, "CreateOpenGLScreenPreviewHelper_0001");
|
||||
gCreateOpenGLPreviewFunc =
|
||||
(CreateOpenGLScreenPreviewHelperFunc) dlsym (libraryHandle,
|
||||
"CreateOpenGLScreenPreviewHelper_0001");
|
||||
if (!gCreateOpenGLPreviewFunc)
|
||||
fprintf (stderr, "%s\n", dlerror ());
|
||||
}
|
||||
|
||||
IDeckLinkIterator* CreateDeckLinkIteratorInstance (void)
|
||||
IDeckLinkIterator *
|
||||
CreateDeckLinkIteratorInstance (void)
|
||||
{
|
||||
pthread_once (&gDeckLinkOnceControl, InitDeckLinkAPI);
|
||||
|
||||
@ -89,7 +95,8 @@ IDeckLinkIterator* CreateDeckLinkIteratorInstance (void)
|
||||
return gCreateIteratorFunc ();
|
||||
}
|
||||
|
||||
IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void)
|
||||
IDeckLinkGLScreenPreviewHelper *
|
||||
CreateOpenGLScreenPreviewHelper (void)
|
||||
{
|
||||
pthread_once (&gDeckLinkOnceControl, InitDeckLinkAPI);
|
||||
pthread_once (&gPreviewOnceControl, InitDeckLinkPreviewAPI);
|
||||
@ -99,7 +106,8 @@ IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void)
|
||||
return gCreateOpenGLPreviewFunc ();
|
||||
}
|
||||
|
||||
IDeckLinkVideoConversion* CreateVideoConversionInstance (void)
|
||||
IDeckLinkVideoConversion *
|
||||
CreateVideoConversionInstance (void)
|
||||
{
|
||||
pthread_once (&gDeckLinkOnceControl, InitDeckLinkAPI);
|
||||
|
||||
@ -107,4 +115,3 @@ IDeckLinkVideoConversion* CreateVideoConversionInstance (void)
|
||||
return NULL;
|
||||
return gCreateVideoConversionFunc ();
|
||||
}
|
||||
|
||||
|
@ -103,8 +103,7 @@ DeckLinkCaptureDelegate::VideoInputFrameArrived (IDeckLinkVideoInputFrame *
|
||||
|
||||
GST_DEBUG ("Frame received [%s] - %s - Size: %li bytes",
|
||||
timecodeString != NULL ? timecodeString : "No timecode",
|
||||
"Valid Frame",
|
||||
videoFrame->GetRowBytes () * videoFrame->GetHeight ());
|
||||
"Valid Frame", videoFrame->GetRowBytes () * videoFrame->GetHeight ());
|
||||
|
||||
if (timecodeString)
|
||||
free ((void *) timecodeString);
|
||||
@ -128,10 +127,9 @@ DeckLinkCaptureDelegate::VideoInputFrameArrived (IDeckLinkVideoInputFrame *
|
||||
}
|
||||
|
||||
HRESULT
|
||||
DeckLinkCaptureDelegate::
|
||||
VideoInputFormatChanged (BMDVideoInputFormatChangedEvents events,
|
||||
IDeckLinkDisplayMode * mode, BMDDetectedVideoInputFormatFlags)
|
||||
{
|
||||
DeckLinkCaptureDelegate::VideoInputFormatChanged
|
||||
(BMDVideoInputFormatChangedEvents events, IDeckLinkDisplayMode * mode,
|
||||
BMDDetectedVideoInputFormatFlags) {
|
||||
GST_ERROR ("moo");
|
||||
return S_OK;
|
||||
}
|
||||
@ -140,19 +138,25 @@ VideoInputFormatChanged (BMDVideoInputFormatChangedEvents events,
|
||||
int
|
||||
usage (int status)
|
||||
{
|
||||
HRESULT result;
|
||||
IDeckLinkDisplayMode *displayMode;
|
||||
int displayModeCount = 0;
|
||||
HRESULT
|
||||
result;
|
||||
IDeckLinkDisplayMode *
|
||||
displayMode;
|
||||
int
|
||||
displayModeCount = 0;
|
||||
|
||||
fprintf (stderr,
|
||||
"Usage: Capture -m <mode id> [OPTIONS]\n" "\n" " -m <mode id>:\n");
|
||||
|
||||
while (displayModeIterator->Next (&displayMode) == S_OK) {
|
||||
char *displayModeString = NULL;
|
||||
char *
|
||||
displayModeString = NULL;
|
||||
|
||||
result = displayMode->GetName ((const char **) &displayModeString);
|
||||
if (result == S_OK) {
|
||||
BMDTimeValue frameRateDuration, frameRateScale;
|
||||
BMDTimeValue
|
||||
frameRateDuration,
|
||||
frameRateScale;
|
||||
displayMode->GetFrameRate (&frameRateDuration, &frameRateScale);
|
||||
|
||||
fprintf (stderr, " %2d: %-20s \t %li x %li \t %g FPS\n",
|
||||
@ -194,17 +198,28 @@ usage (int status)
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
IDeckLinkIterator *deckLinkIterator = CreateDeckLinkIteratorInstance ();
|
||||
DeckLinkCaptureDelegate *delegate;
|
||||
IDeckLinkDisplayMode *displayMode;
|
||||
BMDVideoInputFlags inputFlags = 0;
|
||||
BMDDisplayMode selectedDisplayMode = bmdModeNTSC;
|
||||
BMDPixelFormat pixelFormat = bmdFormat8BitYUV;
|
||||
int displayModeCount = 0;
|
||||
int exitStatus = 1;
|
||||
int ch;
|
||||
bool foundDisplayMode = false;
|
||||
HRESULT result;
|
||||
IDeckLinkIterator *
|
||||
deckLinkIterator = CreateDeckLinkIteratorInstance ();
|
||||
DeckLinkCaptureDelegate *
|
||||
delegate;
|
||||
IDeckLinkDisplayMode *
|
||||
displayMode;
|
||||
BMDVideoInputFlags
|
||||
inputFlags = 0;
|
||||
BMDDisplayMode
|
||||
selectedDisplayMode = bmdModeNTSC;
|
||||
BMDPixelFormat
|
||||
pixelFormat = bmdFormat8BitYUV;
|
||||
int
|
||||
displayModeCount = 0;
|
||||
int
|
||||
exitStatus = 1;
|
||||
int
|
||||
ch;
|
||||
bool
|
||||
foundDisplayMode = false;
|
||||
HRESULT
|
||||
result;
|
||||
|
||||
pthread_mutex_init (&sleepMutex, NULL);
|
||||
pthread_cond_init (&sleepCond, NULL);
|
||||
@ -334,8 +349,10 @@ main (int argc, char *argv[])
|
||||
|
||||
while (displayModeIterator->Next (&displayMode) == S_OK) {
|
||||
if (g_videoModeIndex == displayModeCount) {
|
||||
BMDDisplayModeSupport result;
|
||||
const char *displayModeName;
|
||||
BMDDisplayModeSupport
|
||||
result;
|
||||
const char *
|
||||
displayModeName;
|
||||
|
||||
foundDisplayMode = true;
|
||||
displayMode->GetName (&displayModeName);
|
||||
@ -427,4 +444,3 @@ bail:
|
||||
return exitStatus;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -67,7 +67,8 @@ static gboolean gst_decklink_sink_query (GstElement * element,
|
||||
GstQuery * query);
|
||||
|
||||
static GstCaps *gst_decklink_sink_videosink_getcaps (GstPad * pad);
|
||||
static gboolean gst_decklink_sink_videosink_setcaps (GstPad * pad, GstCaps * caps);
|
||||
static gboolean gst_decklink_sink_videosink_setcaps (GstPad * pad,
|
||||
GstCaps * caps);
|
||||
static gboolean gst_decklink_sink_videosink_acceptcaps (GstPad * pad,
|
||||
GstCaps * caps);
|
||||
static gboolean gst_decklink_sink_videosink_activate (GstPad * pad);
|
||||
@ -81,15 +82,18 @@ static GstFlowReturn gst_decklink_sink_videosink_chain (GstPad * pad,
|
||||
GstBuffer * buffer);
|
||||
static GstFlowReturn gst_decklink_sink_videosink_chainlist (GstPad * pad,
|
||||
GstBufferList * bufferlist);
|
||||
static gboolean gst_decklink_sink_videosink_event (GstPad * pad, GstEvent * event);
|
||||
static gboolean gst_decklink_sink_videosink_query (GstPad * pad, GstQuery * query);
|
||||
static gboolean gst_decklink_sink_videosink_event (GstPad * pad,
|
||||
GstEvent * event);
|
||||
static gboolean gst_decklink_sink_videosink_query (GstPad * pad,
|
||||
GstQuery * query);
|
||||
static GstFlowReturn gst_decklink_sink_videosink_bufferalloc (GstPad * pad,
|
||||
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
|
||||
static GstIterator *gst_decklink_sink_videosink_iterintlink (GstPad * pad);
|
||||
|
||||
|
||||
static GstCaps *gst_decklink_sink_audiosink_getcaps (GstPad * pad);
|
||||
static gboolean gst_decklink_sink_audiosink_setcaps (GstPad * pad, GstCaps * caps);
|
||||
static gboolean gst_decklink_sink_audiosink_setcaps (GstPad * pad,
|
||||
GstCaps * caps);
|
||||
static gboolean gst_decklink_sink_audiosink_acceptcaps (GstPad * pad,
|
||||
GstCaps * caps);
|
||||
static gboolean gst_decklink_sink_audiosink_activate (GstPad * pad);
|
||||
@ -103,8 +107,10 @@ static GstFlowReturn gst_decklink_sink_audiosink_chain (GstPad * pad,
|
||||
GstBuffer * buffer);
|
||||
static GstFlowReturn gst_decklink_sink_audiosink_chainlist (GstPad * pad,
|
||||
GstBufferList * bufferlist);
|
||||
static gboolean gst_decklink_sink_audiosink_event (GstPad * pad, GstEvent * event);
|
||||
static gboolean gst_decklink_sink_audiosink_query (GstPad * pad, GstQuery * query);
|
||||
static gboolean gst_decklink_sink_audiosink_event (GstPad * pad,
|
||||
GstEvent * event);
|
||||
static gboolean gst_decklink_sink_audiosink_query (GstPad * pad,
|
||||
GstQuery * query);
|
||||
static GstFlowReturn gst_decklink_sink_audiosink_bufferalloc (GstPad * pad,
|
||||
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
|
||||
static GstIterator *gst_decklink_sink_audiosink_iterintlink (GstPad * pad);
|
||||
@ -125,25 +131,34 @@ static GstStaticPadTemplate gst_decklink_sink_videosink_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("videosink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (
|
||||
MODE(720,486,30000,1001,true)
|
||||
GST_STATIC_CAPS (MODE (720, 486, 30000, 1001, true)
|
||||
));
|
||||
#if 0
|
||||
MODE (720, 486, 24000, 1001, true) ";"
|
||||
MODE(720,576,25,1,true) ";"
|
||||
MODE(1920,1080,24000,1001,false) ";"
|
||||
MODE(1920,1080,24,1,false) ";"
|
||||
MODE(1920,1080,25,1,false) ";"
|
||||
MODE(1920,1080,30000,1001,false) ";"
|
||||
MODE(1920,1080,30,1,false) ";"
|
||||
MODE(1920,1080,25,1,true) ";"
|
||||
MODE(1920,1080,30000,1001,true) ";"
|
||||
MODE(1920,1080,30,1,true) ";"
|
||||
MODE(1280,720,50,1,true) ";"
|
||||
MODE(1280,720,60000,1001,true) ";"
|
||||
MODE (720, 576, 25, 1, true)
|
||||
";"
|
||||
MODE (1920, 1080, 24000, 1001, false)
|
||||
";"
|
||||
MODE (1920, 1080, 24, 1, false)
|
||||
";"
|
||||
MODE (1920, 1080, 25, 1, false)
|
||||
";"
|
||||
MODE (1920, 1080, 30000, 1001, false)
|
||||
";"
|
||||
MODE (1920, 1080, 30, 1, false)
|
||||
";"
|
||||
MODE (1920, 1080, 25, 1, true)
|
||||
";"
|
||||
MODE (1920, 1080, 30000, 1001, true)
|
||||
";"
|
||||
MODE (1920, 1080, 30, 1, true)
|
||||
";"
|
||||
MODE (1280, 720, 50, 1, true)
|
||||
";"
|
||||
MODE (1280, 720, 60000, 1001, true)
|
||||
";"
|
||||
MODE (1280, 720, 60, 1, true)
|
||||
#endif
|
||||
|
||||
static GstStaticPadTemplate gst_decklink_sink_audiosink_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("audiosink",
|
||||
GST_PAD_SINK,
|
||||
@ -152,7 +167,8 @@ GST_STATIC_PAD_TEMPLATE ("audiosink",
|
||||
);
|
||||
|
||||
typedef struct _DecklinkMode DecklinkMode;
|
||||
struct _DecklinkMode {
|
||||
struct _DecklinkMode
|
||||
{
|
||||
BMDDisplayMode mode;
|
||||
int width;
|
||||
int height;
|
||||
@ -424,7 +440,8 @@ gst_decklink_sink_start (GstDecklinkSink *decklinksink)
|
||||
}
|
||||
//decklinksink->video_enabled = TRUE;
|
||||
|
||||
decklinksink->output->SetScheduledFrameCompletionCallback (decklinksink->callback);
|
||||
decklinksink->output->
|
||||
SetScheduledFrameCompletionCallback (decklinksink->callback);
|
||||
|
||||
if (0) {
|
||||
ret = decklinksink->output->EnableAudioOutput (bmdAudioSampleRate48kHz,
|
||||
@ -773,8 +790,8 @@ gst_decklink_sink_videosink_query (GstPad * pad, GstQuery * query)
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_decklink_sink_videosink_bufferalloc (GstPad * pad, guint64 offset, guint size,
|
||||
GstCaps * caps, GstBuffer ** buf)
|
||||
gst_decklink_sink_videosink_bufferalloc (GstPad * pad, guint64 offset,
|
||||
guint size, GstCaps * caps, GstBuffer ** buf)
|
||||
{
|
||||
GstDecklinkSink *decklinksink;
|
||||
|
||||
@ -984,8 +1001,8 @@ gst_decklink_sink_audiosink_query (GstPad * pad, GstQuery * query)
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_decklink_sink_audiosink_bufferalloc (GstPad * pad, guint64 offset, guint size,
|
||||
GstCaps * caps, GstBuffer ** buf)
|
||||
gst_decklink_sink_audiosink_bufferalloc (GstPad * pad, guint64 offset,
|
||||
guint size, GstCaps * caps, GstBuffer ** buf)
|
||||
{
|
||||
GstDecklinkSink *decklinksink;
|
||||
|
||||
@ -1047,4 +1064,3 @@ Output::RenderAudioSamples (bool preroll)
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -68,36 +68,48 @@ static gboolean gst_decklink_src_send_event (GstElement * element,
|
||||
static gboolean gst_decklink_src_query (GstElement * element, GstQuery * query);
|
||||
|
||||
static GstCaps *gst_decklink_src_audio_src_getcaps (GstPad * pad);
|
||||
static gboolean gst_decklink_src_audio_src_setcaps (GstPad * pad, GstCaps * caps);
|
||||
static gboolean gst_decklink_src_audio_src_acceptcaps (GstPad * pad, GstCaps * caps);
|
||||
static void gst_decklink_src_audio_src_fixatecaps (GstPad * pad, GstCaps * caps);
|
||||
static gboolean gst_decklink_src_audio_src_setcaps (GstPad * pad,
|
||||
GstCaps * caps);
|
||||
static gboolean gst_decklink_src_audio_src_acceptcaps (GstPad * pad,
|
||||
GstCaps * caps);
|
||||
static void gst_decklink_src_audio_src_fixatecaps (GstPad * pad,
|
||||
GstCaps * caps);
|
||||
static gboolean gst_decklink_src_audio_src_activate (GstPad * pad);
|
||||
static gboolean gst_decklink_src_audio_src_activatepush (GstPad * pad,
|
||||
gboolean active);
|
||||
static gboolean gst_decklink_src_audio_src_activatepull (GstPad * pad,
|
||||
gboolean active);
|
||||
static GstPadLinkReturn gst_decklink_src_audio_src_link (GstPad * pad, GstPad * peer);
|
||||
static GstPadLinkReturn gst_decklink_src_audio_src_link (GstPad * pad,
|
||||
GstPad * peer);
|
||||
static GstFlowReturn gst_decklink_src_audio_src_getrange (GstPad * pad,
|
||||
guint64 offset, guint length, GstBuffer ** buffer);
|
||||
static gboolean gst_decklink_src_audio_src_event (GstPad * pad, GstEvent * event);
|
||||
static gboolean gst_decklink_src_audio_src_query (GstPad * pad, GstQuery * query);
|
||||
static gboolean gst_decklink_src_audio_src_event (GstPad * pad,
|
||||
GstEvent * event);
|
||||
static gboolean gst_decklink_src_audio_src_query (GstPad * pad,
|
||||
GstQuery * query);
|
||||
static GstIterator *gst_decklink_src_audio_src_iterintlink (GstPad * pad);
|
||||
|
||||
|
||||
static GstCaps *gst_decklink_src_video_src_getcaps (GstPad * pad);
|
||||
static gboolean gst_decklink_src_video_src_setcaps (GstPad * pad, GstCaps * caps);
|
||||
static gboolean gst_decklink_src_video_src_acceptcaps (GstPad * pad, GstCaps * caps);
|
||||
static void gst_decklink_src_video_src_fixatecaps (GstPad * pad, GstCaps * caps);
|
||||
static gboolean gst_decklink_src_video_src_setcaps (GstPad * pad,
|
||||
GstCaps * caps);
|
||||
static gboolean gst_decklink_src_video_src_acceptcaps (GstPad * pad,
|
||||
GstCaps * caps);
|
||||
static void gst_decklink_src_video_src_fixatecaps (GstPad * pad,
|
||||
GstCaps * caps);
|
||||
static gboolean gst_decklink_src_video_src_activate (GstPad * pad);
|
||||
static gboolean gst_decklink_src_video_src_activatepush (GstPad * pad,
|
||||
gboolean active);
|
||||
static gboolean gst_decklink_src_video_src_activatepull (GstPad * pad,
|
||||
gboolean active);
|
||||
static GstPadLinkReturn gst_decklink_src_video_src_link (GstPad * pad, GstPad * peer);
|
||||
static GstPadLinkReturn gst_decklink_src_video_src_link (GstPad * pad,
|
||||
GstPad * peer);
|
||||
static GstFlowReturn gst_decklink_src_video_src_getrange (GstPad * pad,
|
||||
guint64 offset, guint length, GstBuffer ** buffer);
|
||||
static gboolean gst_decklink_src_video_src_event (GstPad * pad, GstEvent * event);
|
||||
static gboolean gst_decklink_src_video_src_query (GstPad * pad, GstQuery * query);
|
||||
static gboolean gst_decklink_src_video_src_event (GstPad * pad,
|
||||
GstEvent * event);
|
||||
static gboolean gst_decklink_src_video_src_query (GstPad * pad,
|
||||
GstQuery * query);
|
||||
static GstIterator *gst_decklink_src_video_src_iterintlink (GstPad * pad);
|
||||
|
||||
static void gst_decklink_src_task (void *priv);
|
||||
@ -124,8 +136,7 @@ static GstStaticPadTemplate gst_decklink_src_video_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("videosrc",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (
|
||||
MODE(720,486,30000,1001,true) ";"
|
||||
GST_STATIC_CAPS (MODE (720, 486, 30000, 1001, true) ";"
|
||||
MODE (720, 486, 24000, 1001, true) ";"
|
||||
MODE (720, 576, 25, 1, true) ";"
|
||||
MODE (1920, 1080, 24000, 1001, false) ";"
|
||||
@ -137,12 +148,12 @@ GST_STATIC_PAD_TEMPLATE ("videosrc",
|
||||
MODE (1920, 1080, 30000, 1001, true) ";"
|
||||
MODE (1920, 1080, 30, 1, true) ";"
|
||||
MODE (1280, 720, 50, 1, true) ";"
|
||||
MODE(1280,720,60000,1001,true) ";"
|
||||
MODE(1280,720,60,1,true)
|
||||
MODE (1280, 720, 60000, 1001, true) ";" MODE (1280, 720, 60, 1, true)
|
||||
));
|
||||
|
||||
typedef struct _DecklinkMode DecklinkMode;
|
||||
struct _DecklinkMode {
|
||||
struct _DecklinkMode
|
||||
{
|
||||
BMDDisplayMode mode;
|
||||
int width;
|
||||
int height;
|
||||
@ -226,7 +237,8 @@ gst_decklink_src_init (GstDecklinkSrc * decklinksrc,
|
||||
gst_task_set_lock (decklinksrc->task, &decklinksrc->task_mutex);
|
||||
|
||||
decklinksrc->audiosrcpad =
|
||||
gst_pad_new_from_static_template (&gst_decklink_src_audio_src_template, "audiosrc");
|
||||
gst_pad_new_from_static_template (&gst_decklink_src_audio_src_template,
|
||||
"audiosrc");
|
||||
gst_pad_set_getcaps_function (decklinksrc->audiosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_getcaps));
|
||||
gst_pad_set_setcaps_function (decklinksrc->audiosrcpad,
|
||||
@ -256,7 +268,8 @@ gst_decklink_src_init (GstDecklinkSrc * decklinksrc,
|
||||
|
||||
|
||||
decklinksrc->videosrcpad =
|
||||
gst_pad_new_from_static_template (&gst_decklink_src_video_src_template, "videosrc");
|
||||
gst_pad_new_from_static_template (&gst_decklink_src_video_src_template,
|
||||
"videosrc");
|
||||
gst_pad_set_getcaps_function (decklinksrc->videosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_getcaps));
|
||||
gst_pad_set_setcaps_function (decklinksrc->videosrcpad,
|
||||
@ -446,8 +459,9 @@ gst_decklink_src_start (GstElement * element)
|
||||
|
||||
sample_depth = 16;
|
||||
channels = 2;
|
||||
ret = decklinksrc->input->EnableAudioInput (bmdAudioSampleRate48kHz, sample_depth,
|
||||
channels);
|
||||
ret =
|
||||
decklinksrc->input->EnableAudioInput (bmdAudioSampleRate48kHz,
|
||||
sample_depth, channels);
|
||||
if (ret != S_OK) {
|
||||
GST_ERROR ("enable video input failed");
|
||||
return FALSE;
|
||||
@ -1004,9 +1018,11 @@ gst_decklink_src_task (void *priv)
|
||||
|
||||
video_frame->GetBytes (&data);
|
||||
if (decklinksrc->copy_data) {
|
||||
buffer = gst_buffer_new_and_alloc (decklinksrc->width * decklinksrc->height * 2);
|
||||
buffer =
|
||||
gst_buffer_new_and_alloc (decklinksrc->width * decklinksrc->height * 2);
|
||||
|
||||
memcpy (GST_BUFFER_DATA (buffer), data, decklinksrc->width * decklinksrc->height * 2);
|
||||
memcpy (GST_BUFFER_DATA (buffer), data,
|
||||
decklinksrc->width * decklinksrc->height * 2);
|
||||
|
||||
video_frame->Release ();
|
||||
} else {
|
||||
@ -1024,8 +1040,7 @@ gst_decklink_src_task (void *priv)
|
||||
decklinksrc->fps_d, decklinksrc->fps_n);
|
||||
GST_BUFFER_DURATION (buffer) =
|
||||
gst_util_uint64_scale_int ((decklinksrc->num_frames + 1) * GST_SECOND,
|
||||
decklinksrc->fps_d, decklinksrc->fps_n) -
|
||||
GST_BUFFER_TIMESTAMP (buffer);
|
||||
decklinksrc->fps_d, decklinksrc->fps_n) - GST_BUFFER_TIMESTAMP (buffer);
|
||||
GST_BUFFER_OFFSET (buffer) = decklinksrc->num_frames;
|
||||
if (decklinksrc->num_frames == 0) {
|
||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
|
||||
@ -1039,8 +1054,7 @@ gst_decklink_src_task (void *priv)
|
||||
"height", G_TYPE_INT, decklinksrc->height,
|
||||
"framerate", GST_TYPE_FRACTION,
|
||||
decklinksrc->fps_n, decklinksrc->fps_d,
|
||||
"interlaced", G_TYPE_BOOLEAN, decklinksrc->interlaced,
|
||||
NULL);
|
||||
"interlaced", G_TYPE_BOOLEAN, decklinksrc->interlaced, NULL);
|
||||
}
|
||||
gst_buffer_set_caps (buffer, decklinksrc->video_caps);
|
||||
|
||||
@ -1060,8 +1074,9 @@ gst_decklink_src_task (void *priv)
|
||||
gst_util_uint64_scale_int (decklinksrc->num_audio_samples * GST_SECOND,
|
||||
1, 48000);
|
||||
GST_BUFFER_DURATION (audio_buffer) =
|
||||
gst_util_uint64_scale_int ((decklinksrc->num_audio_samples + n_samples) * GST_SECOND,
|
||||
1, 48000) - GST_BUFFER_TIMESTAMP (audio_buffer);
|
||||
gst_util_uint64_scale_int ((decklinksrc->num_audio_samples +
|
||||
n_samples) * GST_SECOND, 1,
|
||||
48000) - GST_BUFFER_TIMESTAMP (audio_buffer);
|
||||
decklinksrc->num_audio_samples += n_samples;
|
||||
|
||||
if (decklinksrc->audio_caps == NULL) {
|
||||
@ -1070,9 +1085,7 @@ gst_decklink_src_task (void *priv)
|
||||
"signed", G_TYPE_BOOLEAN, TRUE,
|
||||
"depth", G_TYPE_INT, 16,
|
||||
"width", G_TYPE_INT, 16,
|
||||
"channels", G_TYPE_INT, 2,
|
||||
"rate", G_TYPE_INT, 48000,
|
||||
NULL);
|
||||
"channels", G_TYPE_INT, 2, "rate", G_TYPE_INT, 48000, NULL);
|
||||
}
|
||||
gst_buffer_set_caps (audio_buffer, decklinksrc->audio_caps);
|
||||
|
||||
@ -1081,5 +1094,3 @@ gst_decklink_src_task (void *priv)
|
||||
GST_ELEMENT_ERROR (decklinksrc, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user