* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define __STDC_FORMAT_MACROS /* see inttypes.h */
#include <framework/mlt.h>
#include <stdlib.h>
#include <string.h>
int m_isKeyer;
IDeckLinkKeyer* m_deckLinkKeyer;
bool m_terminate_on_pause;
+ uint32_t m_preroll;
+ uint32_t m_acnt;
IDeckLinkDisplayMode* getDisplayMode()
{
return false;
}
+ m_preroll = preroll;
+
// preroll frames
for( i = 0; i < preroll; i++ )
ScheduleNextFrame( true );
{
uint32_t written = 0;
BMDTimeValue streamTime = m_count * frequency * m_duration / m_timescale;
-
+ m_deckLinkOutput->GetBufferedAudioSampleFrameCount(&written);
+ if ( written > (m_preroll + 1) * samples )
+ {
+ mlt_log_verbose( getConsumer(), "renderAudio: will flush %d audiosamples\n", written);
+ m_deckLinkOutput->FlushBufferedAudioSamples();
+ };
#ifdef WIN32
m_deckLinkOutput->ScheduleAudioSamples( pcm, samples, streamTime, frequency, (unsigned long*) &written );
#else
virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult completed )
{
+ uint32_t cnt;
+ m_deckLinkOutput->GetBufferedAudioSampleFrameCount(&cnt);
+ if(cnt != m_acnt)
+ {
+ mlt_log_verbose( getConsumer(),
+ "ScheduledFrameCompleted: GetBufferedAudioSampleFrameCount %u -> %u, m_count=%"PRIu64"\n",
+ m_acnt, cnt, m_count );
+ m_acnt = cnt;
+ };
+
// When a video frame has been released by the API, schedule another video frame to be output
// ignore handler if frame was flushed