mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
decklink: Fix indentation
This commit is contained in:
parent
58e2b2ef1c
commit
571c8bc1ff
3 changed files with 35 additions and 41 deletions
|
@ -865,36 +865,33 @@ private:
|
|||
GMutex m_mutex;
|
||||
uint32_t m_lastBufferSize;
|
||||
uint32_t m_nonEmptyCalls;
|
||||
GstQueueArray * m_buffers;
|
||||
GstQueueArray *m_buffers;
|
||||
gint m_refcount;
|
||||
|
||||
void _clearBufferPool()
|
||||
void _clearBufferPool ()
|
||||
{
|
||||
uint8_t * buf;
|
||||
uint8_t *buf;
|
||||
|
||||
if (!m_buffers)
|
||||
return;
|
||||
return;
|
||||
|
||||
while ((buf = (uint8_t*)gst_queue_array_pop_head (m_buffers)))
|
||||
g_free(buf - 128);
|
||||
while ((buf = (uint8_t *) gst_queue_array_pop_head (m_buffers)))
|
||||
g_free (buf - 128);
|
||||
}
|
||||
|
||||
public:
|
||||
GStreamerDecklinkMemoryAllocator ()
|
||||
: IDeckLinkMemoryAllocator (),
|
||||
m_lastBufferSize (0),
|
||||
m_nonEmptyCalls (0),
|
||||
m_buffers (NULL),
|
||||
m_refcount (1)
|
||||
: IDeckLinkMemoryAllocator (),
|
||||
m_lastBufferSize (0),
|
||||
m_nonEmptyCalls (0), m_buffers (NULL), m_refcount (1)
|
||||
{
|
||||
g_mutex_init (&m_mutex);
|
||||
|
||||
m_buffers = gst_queue_array_new (60);
|
||||
}
|
||||
|
||||
virtual ~ GStreamerDecklinkMemoryAllocator ()
|
||||
{
|
||||
Decommit();
|
||||
virtual ~ GStreamerDecklinkMemoryAllocator () {
|
||||
Decommit ();
|
||||
|
||||
gst_queue_array_free (m_buffers);
|
||||
|
||||
|
@ -936,22 +933,22 @@ public:
|
|||
}
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE
|
||||
AllocateBuffer (uint32_t bufferSize, void **allocatedBuffer)
|
||||
AllocateBuffer (uint32_t bufferSize, void **allocatedBuffer)
|
||||
{
|
||||
uint8_t * buf;
|
||||
uint8_t *buf;
|
||||
|
||||
g_mutex_lock (&m_mutex);
|
||||
|
||||
/* If buffer size changed since last call, empty buffer pool */
|
||||
if (bufferSize != m_lastBufferSize) {
|
||||
_clearBufferPool();
|
||||
_clearBufferPool ();
|
||||
m_lastBufferSize = bufferSize;
|
||||
}
|
||||
|
||||
/* Look if there is a free buffer in the pool */
|
||||
if (!(buf = (uint8_t*) gst_queue_array_pop_head (m_buffers))) {
|
||||
if (!(buf = (uint8_t *) gst_queue_array_pop_head (m_buffers))) {
|
||||
/* If not, alloc a new one */
|
||||
buf = (uint8_t*) g_malloc (bufferSize + 128);
|
||||
buf = (uint8_t *) g_malloc (bufferSize + 128);
|
||||
*((uint32_t *) buf) = bufferSize;
|
||||
buf += 128;
|
||||
}
|
||||
|
@ -961,12 +958,12 @@ public:
|
|||
* remove one of them every fifth call */
|
||||
if (gst_queue_array_get_length (m_buffers) > 0) {
|
||||
if (++m_nonEmptyCalls >= 5) {
|
||||
buf = (uint8_t*) gst_queue_array_pop_head (m_buffers) - 128;
|
||||
buf = (uint8_t *) gst_queue_array_pop_head (m_buffers) - 128;
|
||||
g_free (buf);
|
||||
m_nonEmptyCalls = 0;
|
||||
}
|
||||
} else {
|
||||
m_nonEmptyCalls = 0;
|
||||
m_nonEmptyCalls = 0;
|
||||
}
|
||||
|
||||
g_mutex_unlock (&m_mutex);
|
||||
|
@ -974,13 +971,12 @@ public:
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE
|
||||
ReleaseBuffer (void * buffer)
|
||||
virtual HRESULT STDMETHODCALLTYPE ReleaseBuffer (void *buffer)
|
||||
{
|
||||
g_mutex_lock (&m_mutex);
|
||||
|
||||
/* Put the buffer back to the pool if size matches with current pool */
|
||||
uint32_t size = *(uint32_t *) ((uint8_t*)buffer - 128);
|
||||
uint32_t size = *(uint32_t *) ((uint8_t *) buffer - 128);
|
||||
if (size == m_lastBufferSize) {
|
||||
gst_queue_array_push_tail (m_buffers, buffer);
|
||||
} else {
|
||||
|
@ -992,17 +988,15 @@ public:
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE
|
||||
Commit ()
|
||||
virtual HRESULT STDMETHODCALLTYPE Commit ()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE
|
||||
Decommit ()
|
||||
virtual HRESULT STDMETHODCALLTYPE Decommit ()
|
||||
{
|
||||
/* Clear all remaining pools */
|
||||
_clearBufferPool();
|
||||
_clearBufferPool ();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1299,8 +1293,8 @@ gst_decklink_acquire_nth_input (gint n, GstElement * src, gboolean is_audio)
|
|||
}
|
||||
|
||||
g_mutex_lock (&input->lock);
|
||||
input->input->SetVideoInputFrameMemoryAllocator(
|
||||
new GStreamerDecklinkMemoryAllocator);
|
||||
input->input->SetVideoInputFrameMemoryAllocator (new
|
||||
GStreamerDecklinkMemoryAllocator);
|
||||
if (is_audio && !input->audiosrc) {
|
||||
input->audiosrc = GST_ELEMENT_CAST (gst_object_ref (src));
|
||||
g_mutex_unlock (&input->lock);
|
||||
|
|
|
@ -275,8 +275,8 @@ public:
|
|||
written_sum += written;
|
||||
} while (len > 0 && res == S_OK);
|
||||
|
||||
GST_LOG_OBJECT (m_ringbuffer->sink, "Wrote %u samples: 0x%08lx", written_sum,
|
||||
(unsigned long) res);
|
||||
GST_LOG_OBJECT (m_ringbuffer->sink, "Wrote %u samples: 0x%08lx",
|
||||
written_sum, (unsigned long) res);
|
||||
|
||||
gst_audio_ring_buffer_clear (GST_AUDIO_RING_BUFFER_CAST (m_ringbuffer),
|
||||
seg);
|
||||
|
|
|
@ -71,9 +71,8 @@ public:
|
|||
return ret;
|
||||
}
|
||||
|
||||
virtual HRESULT WINAPI ScheduledFrameCompleted (
|
||||
IDeckLinkVideoFrame * completedFrame,
|
||||
BMDOutputFrameCompletionResult result)
|
||||
virtual HRESULT WINAPI ScheduledFrameCompleted (IDeckLinkVideoFrame *
|
||||
completedFrame, BMDOutputFrameCompletionResult result)
|
||||
{
|
||||
switch (result) {
|
||||
case bmdOutputFrameCompleted:
|
||||
|
@ -624,7 +623,8 @@ gst_decklink_video_sink_prepare (GstBaseSink * bsink, GstBuffer * buffer)
|
|||
|
||||
frame->GetBytes ((void **) &outdata);
|
||||
indata = (guint8 *) GST_VIDEO_FRAME_PLANE_DATA (&vframe, 0);
|
||||
stride = MIN (GST_VIDEO_FRAME_PLANE_STRIDE (&vframe, 0), frame->GetRowBytes());
|
||||
stride =
|
||||
MIN (GST_VIDEO_FRAME_PLANE_STRIDE (&vframe, 0), frame->GetRowBytes ());
|
||||
for (i = 0; i < self->info.height; i++) {
|
||||
memcpy (outdata, indata, stride);
|
||||
indata += GST_VIDEO_FRAME_PLANE_STRIDE (&vframe, 0);
|
||||
|
@ -670,7 +670,7 @@ gst_decklink_video_sink_prepare (GstBaseSink * bsink, GstBuffer * buffer)
|
|||
if (ret != S_OK) {
|
||||
GST_ELEMENT_WARNING (self, STREAM, FAILED,
|
||||
(NULL), ("Failed to show video frame synchronously: 0x%08lx",
|
||||
(unsigned long) ret));
|
||||
(unsigned long) ret));
|
||||
ret = S_OK;
|
||||
}
|
||||
}
|
||||
|
@ -833,7 +833,7 @@ gst_decklink_video_sink_start_scheduled_playback (GstElement * element)
|
|||
if (res != S_OK) {
|
||||
GST_ELEMENT_ERROR (self, STREAM, FAILED,
|
||||
(NULL), ("Failed to stop scheduled playback: 0x%08lx",
|
||||
(unsigned long) res));
|
||||
(unsigned long) res));
|
||||
gst_object_unref (clock);
|
||||
return;
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ gst_decklink_video_sink_start_scheduled_playback (GstElement * element)
|
|||
if (res != S_OK) {
|
||||
GST_ELEMENT_ERROR (self, STREAM, FAILED,
|
||||
(NULL), ("Failed to start scheduled playback: 0x%08lx",
|
||||
(unsigned long) res));
|
||||
(unsigned long) res));
|
||||
gst_object_unref (clock);
|
||||
return;
|
||||
}
|
||||
|
@ -918,7 +918,7 @@ gst_decklink_video_sink_stop_scheduled_playback (GstDecklinkVideoSink * self)
|
|||
if (res != S_OK) {
|
||||
GST_ELEMENT_ERROR (self, STREAM, FAILED,
|
||||
(NULL), ("Failed to stop scheduled playback: 0x%08lx", (unsigned long)
|
||||
res));
|
||||
res));
|
||||
ret = GST_STATE_CHANGE_FAILURE;
|
||||
}
|
||||
self->internal_base_time = GST_CLOCK_TIME_NONE;
|
||||
|
|
Loading…
Reference in a new issue