+ mlt_audio_format format = mlt_audio_s16;
+ int frequency = bmdAudioSampleRate48kHz;
+ int samples = mlt_sample_calculator( m_fps, frequency, m_count );
+ int16_t *pcm = 0;
+
+ if ( !mlt_frame_get_audio( frame, (void**) &pcm, &format, &frequency, &m_channels, &samples ) )
+ {
+ uint32_t written = 0;
+
+ m_deckLinkOutput->ScheduleAudioSamples( pcm, samples, m_count * frequency / m_fps, frequency, &written );
+
+ if ( written != samples )
+ mlt_log_verbose( getConsumer(), "renderAudio: samples=%d, written=%d\n", samples, written );
+ }
+ }
+
+ bool createFrame( IDeckLinkMutableVideoFrame** decklinkFrame )
+ {
+ BMDPixelFormat format = m_isKeyer? bmdFormat8BitARGB : bmdFormat8BitYUV;
+ IDeckLinkMutableVideoFrame* frame = 0;
+ uint8_t *buffer = 0;
+ int stride = m_width * ( m_isKeyer? 4 : 2 );
+
+ *decklinkFrame = NULL;
+
+ // Generate a DeckLink video frame
+ if ( S_OK != m_deckLinkOutput->CreateVideoFrame( m_width, m_height,
+ stride, format, bmdFrameFlagDefault, &frame ) )
+ {
+ mlt_log_verbose( getConsumer(), "Failed to create video frame\n" );
+ stop();
+ return false;
+ }