mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
decklink: reindent
This commit is contained in:
parent
e37ce96b2c
commit
83e2ca791c
4 changed files with 71 additions and 75 deletions
|
@ -55,8 +55,7 @@ DeckLinkCaptureDelegate::~DeckLinkCaptureDelegate ()
|
||||||
g_mutex_free (m_mutex);
|
g_mutex_free (m_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG DeckLinkCaptureDelegate::AddRef (void)
|
||||||
DeckLinkCaptureDelegate::AddRef (void)
|
|
||||||
{
|
{
|
||||||
g_mutex_lock (m_mutex);
|
g_mutex_lock (m_mutex);
|
||||||
m_refCount++;
|
m_refCount++;
|
||||||
|
@ -65,15 +64,15 @@ DeckLinkCaptureDelegate::AddRef (void)
|
||||||
return (ULONG) m_refCount;
|
return (ULONG) m_refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG DeckLinkCaptureDelegate::Release (void)
|
||||||
DeckLinkCaptureDelegate::Release (void)
|
|
||||||
{
|
{
|
||||||
g_mutex_lock (m_mutex);
|
g_mutex_lock (m_mutex);
|
||||||
m_refCount--;
|
m_refCount--;
|
||||||
g_mutex_unlock (m_mutex);
|
g_mutex_unlock (m_mutex);
|
||||||
|
|
||||||
if (m_refCount == 0) {
|
if (m_refCount == 0) {
|
||||||
delete this;
|
delete
|
||||||
|
this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,8 @@ gst_decklink_audio_connection_get_type (void)
|
||||||
if (!type) {
|
if (!type) {
|
||||||
static const GEnumValue connections[] = {
|
static const GEnumValue connections[] = {
|
||||||
{GST_DECKLINK_AUDIO_CONNECTION_AUTO, "auto", "Automatic"},
|
{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_AES_EBU, "aes", "AES/EBU input"},
|
||||||
{GST_DECKLINK_AUDIO_CONNECTION_ANALOG, "analog", "Analog input"},
|
{GST_DECKLINK_AUDIO_CONNECTION_ANALOG, "analog", "Analog input"},
|
||||||
{0, NULL, NULL}
|
{0, NULL, NULL}
|
||||||
|
@ -155,8 +156,7 @@ gst_decklink_mode_get_structure (GstDecklinkModeEnum e)
|
||||||
"interlaced", G_TYPE_BOOLEAN, mode->interlaced,
|
"interlaced", G_TYPE_BOOLEAN, mode->interlaced,
|
||||||
"pixel-aspect-ratio", GST_TYPE_FRACTION, mode->par_n, mode->par_d,
|
"pixel-aspect-ratio", GST_TYPE_FRACTION, mode->par_n, mode->par_d,
|
||||||
"color-matrix", G_TYPE_STRING, mode->is_hdtv ? "hdtv" : "sdtv",
|
"color-matrix", G_TYPE_STRING, mode->is_hdtv ? "hdtv" : "sdtv",
|
||||||
"chroma-site", G_TYPE_STRING, "mpeg2",
|
"chroma-site", G_TYPE_STRING, "mpeg2", NULL);
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GstCaps *
|
GstCaps *
|
||||||
|
|
|
@ -347,7 +347,8 @@ gst_decklink_sink_com_thread (GstDecklinkSink * src)
|
||||||
|
|
||||||
res = CoInitializeEx (0, COINIT_MULTITHREADED);
|
res = CoInitializeEx (0, COINIT_MULTITHREADED);
|
||||||
if (res == S_FALSE)
|
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)
|
else if (res == RPC_E_CHANGED_MODE)
|
||||||
GST_WARNING_OBJECT (src, "The concurrency model of COM has changed.");
|
GST_WARNING_OBJECT (src, "The concurrency model of COM has changed.");
|
||||||
else
|
else
|
||||||
|
@ -402,7 +403,8 @@ gst_decklink_sink_finalize (GObject * object)
|
||||||
if (decklinksink->comInitialized) {
|
if (decklinksink->comInitialized) {
|
||||||
g_mutex_lock (decklinksink->com_deinit_lock);
|
g_mutex_lock (decklinksink->com_deinit_lock);
|
||||||
g_cond_signal (decklinksink->com_uninitialize);
|
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);
|
g_mutex_unlock (decklinksink->com_deinit_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,8 +457,8 @@ gst_decklink_sink_start (GstDecklinkSink * decklinksink)
|
||||||
}
|
}
|
||||||
//decklinksink->video_enabled = TRUE;
|
//decklinksink->video_enabled = TRUE;
|
||||||
|
|
||||||
decklinksink->output->
|
decklinksink->output->SetScheduledFrameCompletionCallback (decklinksink->
|
||||||
SetScheduledFrameCompletionCallback (decklinksink->callback);
|
callback);
|
||||||
|
|
||||||
sample_depth = bmdAudioSampleType16bitInteger;
|
sample_depth = bmdAudioSampleType16bitInteger;
|
||||||
ret = decklinksink->output->EnableAudioOutput (bmdAudioSampleRate48kHz,
|
ret = decklinksink->output->EnableAudioOutput (bmdAudioSampleRate48kHz,
|
||||||
|
@ -1089,13 +1091,15 @@ HRESULT
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT Output::ScheduledPlaybackHasStopped ()
|
HRESULT
|
||||||
|
Output::ScheduledPlaybackHasStopped ()
|
||||||
{
|
{
|
||||||
GST_ERROR ("ScheduledPlaybackHasStopped");
|
GST_ERROR ("ScheduledPlaybackHasStopped");
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT Output::RenderAudioSamples (bool preroll)
|
HRESULT
|
||||||
|
Output::RenderAudioSamples (bool preroll)
|
||||||
{
|
{
|
||||||
uint32_t samplesWritten;
|
uint32_t samplesWritten;
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
@ -1108,9 +1112,7 @@ HRESULT Output::RenderAudioSamples (bool preroll)
|
||||||
// running = true;
|
// running = true;
|
||||||
} else {
|
} else {
|
||||||
g_mutex_lock (decklinksink->audio_mutex);
|
g_mutex_lock (decklinksink->audio_mutex);
|
||||||
decklinksink->output->ScheduleAudioSamples (
|
decklinksink->output->ScheduleAudioSamples (GST_BUFFER_DATA (decklinksink->audio_buffer), GST_BUFFER_SIZE (decklinksink->audio_buffer) / 4, // 2 bytes per sample, stereo
|
||||||
GST_BUFFER_DATA (decklinksink->audio_buffer),
|
|
||||||
GST_BUFFER_SIZE (decklinksink->audio_buffer) / 4, // 2 bytes per sample, stereo
|
|
||||||
0, 0, &samplesWritten);
|
0, 0, &samplesWritten);
|
||||||
|
|
||||||
buffer =
|
buffer =
|
||||||
|
|
|
@ -415,7 +415,8 @@ gst_decklink_src_com_thread (GstDecklinkSrc * src)
|
||||||
|
|
||||||
res = CoInitializeEx (0, COINIT_MULTITHREADED);
|
res = CoInitializeEx (0, COINIT_MULTITHREADED);
|
||||||
if (res == S_FALSE)
|
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)
|
else if (res == RPC_E_CHANGED_MODE)
|
||||||
GST_WARNING_OBJECT (src, "The concurrency model of COM has changed.");
|
GST_WARNING_OBJECT (src, "The concurrency model of COM has changed.");
|
||||||
else
|
else
|
||||||
|
@ -470,7 +471,6 @@ gst_decklink_src_finalize (GObject * object)
|
||||||
if (decklinksrc->video_caps) {
|
if (decklinksrc->video_caps) {
|
||||||
gst_caps_unref (decklinksrc->video_caps);
|
gst_caps_unref (decklinksrc->video_caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
/* signal the COM thread that it should uninitialize COM */
|
/* signal the COM thread that it should uninitialize COM */
|
||||||
if (decklinksrc->comInitialized) {
|
if (decklinksrc->comInitialized) {
|
||||||
|
@ -1215,8 +1215,7 @@ gst_decklink_src_task (void *priv)
|
||||||
GST_ELEMENT_WARNING (decklinksrc, RESOURCE, READ,
|
GST_ELEMENT_WARNING (decklinksrc, RESOURCE, READ,
|
||||||
("Dropped %d frame(s), for a total of %d frame(s)",
|
("Dropped %d frame(s), for a total of %d frame(s)",
|
||||||
decklinksrc->dropped_frames - decklinksrc->dropped_frames_old,
|
decklinksrc->dropped_frames - decklinksrc->dropped_frames_old,
|
||||||
decklinksrc->dropped_frames),
|
decklinksrc->dropped_frames), (NULL));
|
||||||
(NULL));
|
|
||||||
decklinksrc->dropped_frames_old = decklinksrc->dropped_frames;
|
decklinksrc->dropped_frames_old = decklinksrc->dropped_frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1273,8 +1272,7 @@ gst_decklink_src_task (void *priv)
|
||||||
ret == GST_FLOW_WRONG_STATE)) {
|
ret == GST_FLOW_WRONG_STATE)) {
|
||||||
GST_ELEMENT_ERROR (decklinksrc, STREAM, FAILED,
|
GST_ELEMENT_ERROR (decklinksrc, STREAM, FAILED,
|
||||||
("Internal data stream error."),
|
("Internal data stream error."),
|
||||||
("stream stopped, reason %s",
|
("stream stopped, reason %s", gst_flow_get_name (ret)));
|
||||||
gst_flow_get_name (ret)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gst_pad_is_linked (decklinksrc->audiosrcpad)) {
|
if (gst_pad_is_linked (decklinksrc->audiosrcpad)) {
|
||||||
|
@ -1287,9 +1285,7 @@ gst_decklink_src_task (void *priv)
|
||||||
gst_util_uint64_scale_int (decklinksrc->num_audio_samples * GST_SECOND,
|
gst_util_uint64_scale_int (decklinksrc->num_audio_samples * GST_SECOND,
|
||||||
1, 48000);
|
1, 48000);
|
||||||
GST_BUFFER_DURATION (audio_buffer) =
|
GST_BUFFER_DURATION (audio_buffer) =
|
||||||
gst_util_uint64_scale_int ((decklinksrc->num_audio_samples +
|
gst_util_uint64_scale_int (n_samples * GST_SECOND, 1, 48000);
|
||||||
n_samples) * GST_SECOND, 1,
|
|
||||||
48000) - GST_BUFFER_TIMESTAMP (audio_buffer);
|
|
||||||
decklinksrc->num_audio_samples += n_samples;
|
decklinksrc->num_audio_samples += n_samples;
|
||||||
|
|
||||||
if (decklinksrc->audio_caps == NULL) {
|
if (decklinksrc->audio_caps == NULL) {
|
||||||
|
@ -1307,8 +1303,7 @@ gst_decklink_src_task (void *priv)
|
||||||
ret == GST_FLOW_WRONG_STATE)) {
|
ret == GST_FLOW_WRONG_STATE)) {
|
||||||
GST_ELEMENT_ERROR (decklinksrc, STREAM, FAILED,
|
GST_ELEMENT_ERROR (decklinksrc, STREAM, FAILED,
|
||||||
("Internal data stream error."),
|
("Internal data stream error."),
|
||||||
("stream stopped, reason %s",
|
("stream stopped, reason %s", gst_flow_get_name (ret)));
|
||||||
gst_flow_get_name (ret)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
audio_frame->Release ();
|
audio_frame->Release ();
|
||||||
|
|
Loading…
Reference in a new issue