mlt_log_verbose( getConsumer(), "BMD mode %dx%d %.3f fps prog %d\n", m_width, m_height, m_fps, p );
if ( m_width == profile->width && p == profile->progressive
- && m_fps == mlt_profile_fps( profile )
+ && (int) m_fps == (int) mlt_profile_fps( profile )
&& ( m_height == profile->height || ( m_height == 486 && profile->height == 480 ) ) )
result = mode;
else
m_decklinkFrame = NULL;
}
- ~DeckLinkConsumer()
+ virtual ~DeckLinkConsumer()
{
SAFE_RELEASE( m_displayMode );
SAFE_RELEASE( m_deckLinkKeyer );
void* preroll_thread()
{
+ mlt_properties properties = MLT_CONSUMER_PROPERTIES( getConsumer() );
+
// preroll frames
- for ( unsigned i = 0; i < m_preroll; i++ )
+ for ( unsigned i = 0; i < m_preroll && mlt_properties_get_int( properties, "running" ); i++ )
ScheduleNextFrame( true );
// start scheduled playback
- m_deckLinkOutput->StartScheduledPlayback( 0, m_timescale, 1.0 );
+ if ( mlt_properties_get_int( properties, "running" ) )
+ m_deckLinkOutput->StartScheduledPlayback( 0, m_timescale, 1.0 );
return 0;
}
m_preroll = preroll;
m_reprio = false;
- // Do preroll in thread to ensure asynchronicity of mlt_consumer_start().
- pthread_create( &m_prerollThread, NULL, preroll_thread_proxy, this );
-
// Set the running state
mlt_properties_set_int( properties, "running", 1 );
+ // Do preroll in thread to ensure asynchronicity of mlt_consumer_start().
+ pthread_create( &m_prerollThread, NULL, preroll_thread_proxy, this );
+
return true;
}
// set running state is 0
mlt_properties_set_int( properties, "running", 0 );
- mlt_consumer_stopped( getConsumer() );
+
+ if ( wasRunning )
+ pthread_join( m_prerollThread, NULL );
// Stop the audio and video output streams immediately
if ( m_deckLinkOutput )
// release decklink frame
SAFE_RELEASE( m_decklinkFrame );
- if ( wasRunning )
- pthread_join( m_prerollThread, NULL );
+ mlt_consumer_stopped( getConsumer() );
return true;
}
if ( !mlt_frame_get_audio( frame, (void**) &pcm, &format, &frequency, &m_channels, &samples ) )
{
#ifdef WIN32
+#define DECKLINK_UNSIGNED_FORMAT "%lu"
unsigned long written = 0;
#else
+#define DECKLINK_UNSIGNED_FORMAT "%u"
uint32_t written = 0;
#endif
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 %lu audiosamples\n", written );
+ mlt_log_verbose( getConsumer(), "renderAudio: will flush " DECKLINK_UNSIGNED_FORMAT " audiosamples\n", written );
m_deckLinkOutput->FlushBufferedAudioSamples();
};
#ifdef WIN32
#endif
if ( written != (uint32_t) samples )
- mlt_log_verbose( getConsumer(), "renderAudio: samples=%d, written=%lu\n", samples, written );
+ mlt_log_verbose( getConsumer(), "renderAudio: samples=%d, written=" DECKLINK_UNSIGNED_FORMAT "\n", samples, written );
}
}
// Normal non-keyer playout - needs byte swapping
if ( !progressive && m_displayMode->GetFieldDominance() == bmdUpperFieldFirst )
// convert lower field first to top field first
- swab( (char*) image, (char*) buffer + stride, stride * ( height - 1 ) );
+ swab2( (char*) image, (char*) buffer + stride, stride * ( height - 1 ) );
else
- swab( (char*) image, (char*) buffer, stride * height );
+ swab2( (char*) image, (char*) buffer, stride * height );
}
else if ( !mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "test_image" ) )
{
if ( cnt != m_acnt )
{
mlt_log_debug( getConsumer(),
- "ScheduledFrameCompleted: GetBufferedAudioSampleFrameCount %u -> %lu, m_count=%"PRIu64"\n",
- m_acnt, cnt, m_count );
+ "ScheduledFrameCompleted: GetBufferedAudioSampleFrameCount %u -> " DECKLINK_UNSIGNED_FORMAT
+ ", m_count=%"PRIu64"\n", m_acnt, cnt, m_count );
m_acnt = cnt;
}