+ mlt_profile profile = mlt_service_profile( MLT_PRODUCER_SERVICE( getProducer() ) );
+ if ( events & bmdVideoInputDisplayModeChanged )
+ {
+ BMDTimeValue duration;
+ BMDTimeScale timescale;
+ mode->GetFrameRate( &duration, ×cale );
+ profile->width = mode->GetWidth();
+ profile->height = mode->GetHeight();
+ profile->height = profile->height == 486 ? 480 : profile->height;
+ profile->frame_rate_num = timescale;
+ profile->frame_rate_den = duration;
+ if ( profile->width == 720 )
+ {
+ if ( profile->height == 576 )
+ {
+ profile->sample_aspect_num = 16;
+ profile->sample_aspect_den = 15;
+ }
+ else
+ {
+ profile->sample_aspect_num = 8;
+ profile->sample_aspect_den = 9;
+ }
+ profile->display_aspect_num = 4;
+ profile->display_aspect_den = 3;
+ }
+ else
+ {
+ profile->sample_aspect_num = 1;
+ profile->sample_aspect_den = 1;
+ profile->display_aspect_num = 16;
+ profile->display_aspect_den = 9;
+ }
+ free( profile->description );
+ profile->description = strdup( "decklink" );
+ mlt_log_verbose( getProducer(), "format changed %dx%d %.3f fps\n",
+ profile->width, profile->height, (double) profile->frame_rate_num / profile->frame_rate_den );
+ }
+ if ( events & bmdVideoInputFieldDominanceChanged )
+ {
+ profile->progressive = mode->GetFieldDominance() == bmdProgressiveFrame;
+ m_topFieldFirst = mode->GetFieldDominance() == bmdUpperFieldFirst;
+ mlt_log_verbose( getProducer(), "field dominance changed prog %d tff %d\n",
+ profile->progressive, m_topFieldFirst );
+ }
+ if ( events & bmdVideoInputColorspaceChanged )
+ {
+ profile->colorspace = m_colorspace =
+ ( mode->GetFlags() & bmdDisplayModeColorspaceRec709 ) ? 709 : 601;
+ mlt_log_verbose( getProducer(), "colorspace changed %d\n", profile->colorspace );
+ }