if (!type) {
static const GEnumValue connections[] = {
{GST_DECKLINK_AUDIO_CONNECTION_AUTO, "auto", "Automatic"},
- {GST_DECKLINK_AUDIO_CONNECTION_EMBEDDED, "embedded", "SDI/HDMI embedded audio"},
+ {GST_DECKLINK_AUDIO_CONNECTION_EMBEDDED, "embedded",
+ "SDI/HDMI embedded audio"},
{GST_DECKLINK_AUDIO_CONNECTION_AES_EBU, "aes", "AES/EBU input"},
{GST_DECKLINK_AUDIO_CONNECTION_ANALOG, "analog", "Analog input"},
{0, NULL, NULL}
#define HD 1, 1, false, true
static const GstDecklinkMode modes[] = {
- {bmdModeNTSC, 720, 486, 30000, 1001, true, NTSC },
- {bmdModeNTSC2398, 720, 486, 24000, 1001, true, NTSC },
- {bmdModePAL, 720, 576, 25, 1, true, PAL },
- {bmdModeNTSCp, 720, 486, 30000, 1001, false, NTSC },
- {bmdModePALp, 720, 576, 25, 1, false, PAL },
-
- {bmdModeHD1080p2398, 1920, 1080, 24000, 1001, false, HD },
- {bmdModeHD1080p24, 1920, 1080, 24, 1, false, HD },
- {bmdModeHD1080p25, 1920, 1080, 25, 1, false, HD },
- {bmdModeHD1080p2997, 1920, 1080, 30000, 1001, false, HD },
- {bmdModeHD1080p30, 1920, 1080, 30, 1, false, HD },
-
- {bmdModeHD1080i50, 1920, 1080, 25, 1, true, HD },
- {bmdModeHD1080i5994, 1920, 1080, 30000, 1001, true, HD },
- {bmdModeHD1080i6000, 1920, 1080, 30, 1, true, HD },
-
- {bmdModeHD1080p50, 1920, 1080, 50, 1, false, HD },
- {bmdModeHD1080p5994, 1920, 1080, 30000, 1001, false, HD },
- {bmdModeHD1080p6000, 1920, 1080, 60, 1, false, HD },
-
- {bmdModeHD720p50, 1280, 720, 50, 1, false, HD },
- {bmdModeHD720p5994, 1280, 720, 60000, 1001, false, HD },
- {bmdModeHD720p60, 1280, 720, 60, 1, false, HD }
+ {bmdModeNTSC, 720, 486, 30000, 1001, true, NTSC},
+ {bmdModeNTSC2398, 720, 486, 24000, 1001, true, NTSC},
+ {bmdModePAL, 720, 576, 25, 1, true, PAL},
+ {bmdModeNTSCp, 720, 486, 30000, 1001, false, NTSC},
+ {bmdModePALp, 720, 576, 25, 1, false, PAL},
+
+ {bmdModeHD1080p2398, 1920, 1080, 24000, 1001, false, HD},
+ {bmdModeHD1080p24, 1920, 1080, 24, 1, false, HD},
+ {bmdModeHD1080p25, 1920, 1080, 25, 1, false, HD},
+ {bmdModeHD1080p2997, 1920, 1080, 30000, 1001, false, HD},
+ {bmdModeHD1080p30, 1920, 1080, 30, 1, false, HD},
+
+ {bmdModeHD1080i50, 1920, 1080, 25, 1, true, HD},
+ {bmdModeHD1080i5994, 1920, 1080, 30000, 1001, true, HD},
+ {bmdModeHD1080i6000, 1920, 1080, 30, 1, true, HD},
+
+ {bmdModeHD1080p50, 1920, 1080, 50, 1, false, HD},
+ {bmdModeHD1080p5994, 1920, 1080, 30000, 1001, false, HD},
+ {bmdModeHD1080p6000, 1920, 1080, 60, 1, false, HD},
+
+ {bmdModeHD720p50, 1280, 720, 50, 1, false, HD},
+ {bmdModeHD720p5994, 1280, 720, 60000, 1001, false, HD},
+ {bmdModeHD720p60, 1280, 720, 60, 1, false, HD}
};
"interlaced", G_TYPE_BOOLEAN, mode->interlaced,
"pixel-aspect-ratio", GST_TYPE_FRACTION, mode->par_n, mode->par_d,
"color-matrix", G_TYPE_STRING, mode->is_hdtv ? "hdtv" : "sdtv",
- "chroma-site", G_TYPE_STRING, "mpeg2",
- NULL);
+ "chroma-site", G_TYPE_STRING, "mpeg2", NULL);
}
GstCaps *
GstStructure *s;
caps = gst_caps_new_empty ();
- for(i=0;i<(int)G_N_ELEMENTS(modes);i++) {
- s = gst_decklink_mode_get_structure ((GstDecklinkModeEnum)i);
+ for (i = 0; i < (int) G_N_ELEMENTS (modes); i++) {
+ s = gst_decklink_mode_get_structure ((GstDecklinkModeEnum) i);
gst_caps_append_structure (caps, s);
}
decklinksink->callback->decklinksink = decklinksink;
#ifdef _MSC_VER
- decklinksink->com_init_lock = g_mutex_new();
- decklinksink->com_deinit_lock = g_mutex_new();
- decklinksink->com_initialized = g_cond_new();
- decklinksink->com_uninitialize = g_cond_new();
- decklinksink->com_uninitialized = g_cond_new();
+ decklinksink->com_init_lock = g_mutex_new ();
+ decklinksink->com_deinit_lock = g_mutex_new ();
+ decklinksink->com_initialized = g_cond_new ();
+ decklinksink->com_uninitialize = g_cond_new ();
+ decklinksink->com_uninitialized = g_cond_new ();
g_mutex_lock (decklinksink->com_init_lock);
/* create the COM initialization thread */
- g_thread_create ((GThreadFunc)gst_decklink_sink_com_thread,
- decklinksink, FALSE, NULL);
+ g_thread_create ((GThreadFunc) gst_decklink_sink_com_thread,
+ decklinksink, FALSE, NULL);
/* wait until the COM thread signals that COM has been initialized */
g_cond_wait (decklinksink->com_initialized, decklinksink->com_init_lock);
res = CoInitializeEx (0, COINIT_MULTITHREADED);
if (res == S_FALSE)
- GST_WARNING_OBJECT (src, "COM has been already initialized in the same process");
+ GST_WARNING_OBJECT (src,
+ "COM has been already initialized in the same process");
else if (res == RPC_E_CHANGED_MODE)
GST_WARNING_OBJECT (src, "The concurrency model of COM has changed.");
else
if (decklinksink->comInitialized) {
g_mutex_lock (decklinksink->com_deinit_lock);
g_cond_signal (decklinksink->com_uninitialize);
- g_cond_wait (decklinksink->com_uninitialized, decklinksink->com_deinit_lock);
+ g_cond_wait (decklinksink->com_uninitialized,
+ decklinksink->com_deinit_lock);
g_mutex_unlock (decklinksink->com_deinit_lock);
}
}
//decklinksink->video_enabled = TRUE;
- decklinksink->output->
- SetScheduledFrameCompletionCallback (decklinksink->callback);
+ decklinksink->output->SetScheduledFrameCompletionCallback (decklinksink->
+ callback);
sample_depth = bmdAudioSampleType16bitInteger;
ret = decklinksink->output->EnableAudioOutput (bmdAudioSampleRate48kHz,
return S_OK;
}
-HRESULT Output::ScheduledPlaybackHasStopped ()
+HRESULT
+Output::ScheduledPlaybackHasStopped ()
{
GST_ERROR ("ScheduledPlaybackHasStopped");
return S_OK;
}
-HRESULT Output::RenderAudioSamples (bool preroll)
+HRESULT
+Output::RenderAudioSamples (bool preroll)
{
uint32_t samplesWritten;
- GstBuffer * buffer;
+ GstBuffer *buffer;
// guint64 samplesToWrite;
// running = true;
} else {
g_mutex_lock (decklinksink->audio_mutex);
- decklinksink->output->ScheduleAudioSamples (
- GST_BUFFER_DATA (decklinksink->audio_buffer),
- GST_BUFFER_SIZE (decklinksink->audio_buffer) / 4, // 2 bytes per sample, stereo
+ decklinksink->output->ScheduleAudioSamples (GST_BUFFER_DATA (decklinksink->audio_buffer), GST_BUFFER_SIZE (decklinksink->audio_buffer) / 4, // 2 bytes per sample, stereo
0, 0, &samplesWritten);
buffer =
decklinksrc->stop = FALSE;
decklinksrc->dropped_frames = 0;
decklinksrc->dropped_frames_old = 0;
- decklinksrc->frame_num = -1; /* -1 so will be 0 after incrementing */
+ decklinksrc->frame_num = -1; /* -1 so will be 0 after incrementing */
#ifdef _MSC_VER
- decklinksrc->com_init_lock = g_mutex_new();
- decklinksrc->com_deinit_lock = g_mutex_new();
- decklinksrc->com_initialized = g_cond_new();
- decklinksrc->com_uninitialize = g_cond_new();
- decklinksrc->com_uninitialized = g_cond_new();
+ decklinksrc->com_init_lock = g_mutex_new ();
+ decklinksrc->com_deinit_lock = g_mutex_new ();
+ decklinksrc->com_initialized = g_cond_new ();
+ decklinksrc->com_uninitialize = g_cond_new ();
+ decklinksrc->com_uninitialized = g_cond_new ();
g_mutex_lock (decklinksrc->com_init_lock);
/* create the COM initialization thread */
- g_thread_create ((GThreadFunc)gst_decklink_src_com_thread,
- decklinksrc, FALSE, NULL);
+ g_thread_create ((GThreadFunc) gst_decklink_src_com_thread,
+ decklinksrc, FALSE, NULL);
/* wait until the COM thread signals that COM has been initialized */
g_cond_wait (decklinksrc->com_initialized, decklinksrc->com_init_lock);
res = CoInitializeEx (0, COINIT_MULTITHREADED);
if (res == S_FALSE)
- GST_WARNING_OBJECT (src, "COM has been already initialized in the same process");
+ GST_WARNING_OBJECT (src,
+ "COM has been already initialized in the same process");
else if (res == RPC_E_CHANGED_MODE)
GST_WARNING_OBJECT (src, "The concurrency model of COM has changed.");
else
if (decklinksrc->video_caps) {
gst_caps_unref (decklinksrc->video_caps);
}
-
#ifdef _MSC_VER
/* signal the COM thread that it should uninitialize COM */
if (decklinksrc->comInitialized) {
/* warning on dropped frames */
if (decklinksrc->dropped_frames - decklinksrc->dropped_frames_old > 0) {
GST_ELEMENT_WARNING (decklinksrc, RESOURCE, READ,
- ("Dropped %d frame(s), for a total of %d frame(s)",
- decklinksrc->dropped_frames - decklinksrc->dropped_frames_old,
- decklinksrc->dropped_frames),
- (NULL));
+ ("Dropped %d frame(s), for a total of %d frame(s)",
+ decklinksrc->dropped_frames - decklinksrc->dropped_frames_old,
+ decklinksrc->dropped_frames), (NULL));
decklinksrc->dropped_frames_old = decklinksrc->dropped_frames;
}
gst_buffer_set_caps (buffer, decklinksrc->video_caps);
ret = gst_pad_push (decklinksrc->videosrcpad, buffer);
- if (! (ret == GST_FLOW_OK || ret == GST_FLOW_NOT_LINKED ||
- ret == GST_FLOW_WRONG_STATE)) {
+ if (!(ret == GST_FLOW_OK || ret == GST_FLOW_NOT_LINKED ||
+ ret == GST_FLOW_WRONG_STATE)) {
GST_ELEMENT_ERROR (decklinksrc, STREAM, FAILED,
- ("Internal data stream error."),
- ("stream stopped, reason %s",
- gst_flow_get_name (ret)));
+ ("Internal data stream error."),
+ ("stream stopped, reason %s", gst_flow_get_name (ret)));
}
if (gst_pad_is_linked (decklinksrc->audiosrcpad)) {
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 (n_samples * GST_SECOND, 1, 48000);
decklinksrc->num_audio_samples += n_samples;
if (decklinksrc->audio_caps == NULL) {
gst_buffer_set_caps (audio_buffer, decklinksrc->audio_caps);
ret = gst_pad_push (decklinksrc->audiosrcpad, audio_buffer);
- if (! (ret == GST_FLOW_OK || ret == GST_FLOW_NOT_LINKED ||
- ret == GST_FLOW_WRONG_STATE)) {
+ if (!(ret == GST_FLOW_OK || ret == GST_FLOW_NOT_LINKED ||
+ ret == GST_FLOW_WRONG_STATE)) {
GST_ELEMENT_ERROR (decklinksrc, STREAM, FAILED,
- ("Internal data stream error."),
- ("stream stopped, reason %s",
- gst_flow_get_name (ret)));
+ ("Internal data stream error."),
+ ("stream stopped, reason %s", gst_flow_get_name (ret)));
}
}
audio_frame->Release ();