]> git.sesse.net Git - mlt/blob - src/modules/decklink/consumer_decklink.cpp
Make scheduling priority of decklink lib thread adjustable.
[mlt] / src / modules / decklink / consumer_decklink.cpp
1 /*
2  * consumer_decklink.c -- output through Blackmagic Design DeckLink
3  * Copyright (C) 2010 Dan Dennedy <dan@dennedy.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with consumer library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 #define __STDC_FORMAT_MACROS  /* see inttypes.h */
21 #include <framework/mlt.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <pthread.h>
25 #include <unistd.h>
26 #include <sys/time.h>
27 #include <limits.h>
28 #ifdef WIN32
29 #include <objbase.h>
30 #include "DeckLinkAPI_h.h"
31 #else
32 #include "DeckLinkAPI.h"
33 #endif
34
35 static const unsigned PREROLL_MINIMUM = 3;
36
37 class DeckLinkConsumer
38         : public IDeckLinkVideoOutputCallback
39 {
40 private:
41         mlt_consumer_s              m_consumer;
42         IDeckLink*                  m_deckLink;
43         IDeckLinkOutput*            m_deckLinkOutput;
44         IDeckLinkDisplayMode*       m_displayMode;
45         int                         m_width;
46         int                         m_height;
47         BMDTimeValue                m_duration;
48         BMDTimeScale                m_timescale;
49         double                      m_fps;
50         uint64_t                    m_count;
51         int                         m_channels;
52         unsigned                    m_dropped;
53         IDeckLinkMutableVideoFrame* m_decklinkFrame;
54         bool                        m_isAudio;
55         int                         m_isKeyer;
56         IDeckLinkKeyer*             m_deckLinkKeyer;
57         bool                        m_terminate_on_pause;
58         uint32_t                    m_preroll;
59         uint32_t                    m_acnt;
60         bool                        m_reprio;
61
62         IDeckLinkDisplayMode* getDisplayMode()
63         {
64                 mlt_profile profile = mlt_service_profile( MLT_CONSUMER_SERVICE( getConsumer() ) );
65                 IDeckLinkDisplayModeIterator* iter;
66                 IDeckLinkDisplayMode* mode;
67                 IDeckLinkDisplayMode* result = 0;
68                 
69                 if ( m_deckLinkOutput->GetDisplayModeIterator( &iter ) == S_OK )
70                 {
71                         while ( !result && iter->Next( &mode ) == S_OK )
72                         {
73                                 m_width = mode->GetWidth();
74                                 m_height = mode->GetHeight();
75                                 mode->GetFrameRate( &m_duration, &m_timescale );
76                                 m_fps = (double) m_timescale / m_duration;
77                                 int p = mode->GetFieldDominance() == bmdProgressiveFrame;
78                                 mlt_log_verbose( getConsumer(), "BMD mode %dx%d %.3f fps prog %d\n", m_width, m_height, m_fps, p );
79                                 
80                                 if ( m_width == profile->width && m_height == profile->height && p == profile->progressive
81                                          && m_fps == mlt_profile_fps( profile ) )
82                                         result = mode;
83                         }
84                 }
85                 
86                 return result;
87         }
88         
89 public:
90         mlt_consumer getConsumer()
91                 { return &m_consumer; }
92         
93         ~DeckLinkConsumer()
94         {
95                 if ( m_deckLinkKeyer )
96                         m_deckLinkKeyer->Release();
97                 if ( m_deckLinkOutput )
98                         m_deckLinkOutput->Release();
99                 if ( m_deckLink )
100                         m_deckLink->Release();
101         }
102         
103         bool open( unsigned card = 0 )
104         {
105                 unsigned i = 0;
106 #ifdef WIN32
107                 IDeckLinkIterator* deckLinkIterator = NULL;
108                 HRESULT result =  CoInitialize( NULL );
109                 if ( FAILED( result ) )
110                 {
111                         mlt_log_error( getConsumer(), "COM initialization failed\n" );
112                         return false;
113                 }
114                 result = CoCreateInstance( CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL, IID_IDeckLinkIterator, (void**) &deckLinkIterator );
115                 if ( FAILED( result ) )
116                 {
117                         mlt_log_error( getConsumer(), "The DeckLink drivers not installed.\n" );
118                         return false;
119                 }
120 #else
121                 IDeckLinkIterator* deckLinkIterator = CreateDeckLinkIteratorInstance();
122                 
123                 if ( !deckLinkIterator )
124                 {
125                         mlt_log_error( getConsumer(), "The DeckLink drivers not installed.\n" );
126                         return false;
127                 }
128 #endif
129                 
130                 // Connect to the Nth DeckLink instance
131                 do {
132                         if ( deckLinkIterator->Next( &m_deckLink ) != S_OK )
133                         {
134                                 mlt_log_error( getConsumer(), "DeckLink card not found\n" );
135                                 deckLinkIterator->Release();
136                                 return false;
137                         }
138                 } while ( ++i <= card );
139                 deckLinkIterator->Release();
140                 
141                 // Obtain the audio/video output interface (IDeckLinkOutput)
142                 if ( m_deckLink->QueryInterface( IID_IDeckLinkOutput, (void**)&m_deckLinkOutput ) != S_OK )
143                 {
144                         mlt_log_error( getConsumer(), "No DeckLink cards support output\n" );
145                         m_deckLink->Release();
146                         m_deckLink = 0;
147                         return false;
148                 }
149                 
150                 // Get the keyer interface
151                 IDeckLinkAttributes *deckLinkAttributes = 0;
152                 m_deckLinkKeyer = 0;
153                 if ( m_deckLink->QueryInterface( IID_IDeckLinkAttributes, (void**) &deckLinkAttributes ) == S_OK )
154                 {
155 #ifdef WIN32
156                         BOOL flag = FALSE;
157 #else
158                         bool flag = false;
159 #endif
160                         if ( deckLinkAttributes->GetFlag( BMDDeckLinkSupportsInternalKeying, &flag ) == S_OK && flag )
161                         {
162                                 if ( m_deckLink->QueryInterface( IID_IDeckLinkKeyer, (void**) &m_deckLinkKeyer ) != S_OK )
163                                 {
164                                         mlt_log_error( getConsumer(), "Failed to get keyer\n" );
165                                         m_deckLinkOutput->Release();
166                                         m_deckLinkOutput = 0;
167                                         m_deckLink->Release();
168                                         m_deckLink = 0;
169                                         return false;
170                                 }
171                         }
172                         deckLinkAttributes->Release();
173                 }
174
175                 // Provide this class as a delegate to the audio and video output interfaces
176                 m_deckLinkOutput->SetScheduledFrameCompletionCallback( this );
177                 
178                 return true;
179         }
180         
181         bool start( unsigned preroll )
182         {
183                 unsigned i;
184                 mlt_properties properties = MLT_CONSUMER_PROPERTIES( getConsumer() );
185
186                 // Initialize members
187                 m_count = 0;
188                 m_dropped = 0;
189                 m_decklinkFrame = NULL;
190                 preroll = preroll < PREROLL_MINIMUM ? PREROLL_MINIMUM : preroll;
191                 m_channels = mlt_properties_get_int( properties, "channels" );
192                 m_isAudio = !mlt_properties_get_int( properties, "audio_off" );
193                 m_terminate_on_pause = mlt_properties_get_int( properties, "terminate_on_pause" );
194
195
196                 m_displayMode = getDisplayMode();
197                 if ( !m_displayMode )
198                 {
199                         mlt_log_error( getConsumer(), "Profile is not compatible with decklink.\n" );
200                         return false;
201                 }
202                 
203                 // Set the keyer
204                 if ( m_deckLinkKeyer && ( m_isKeyer = mlt_properties_get_int( properties, "keyer" ) ) )
205                 {
206                         bool external = ( m_isKeyer == 2 );
207                         double level = mlt_properties_get_double( properties, "keyer_level" );
208
209                         if ( m_deckLinkKeyer->Enable( external ) != S_OK )
210                                 mlt_log_error( getConsumer(), "Failed to enable %s keyer\n",
211                                         external ? "external" : "internal" );
212                         m_deckLinkKeyer->SetLevel( level <= 1 ? ( level > 0 ? 255 * level : 255 ) : 255 );
213                 }
214                 else if ( m_deckLinkKeyer )
215                 {
216                         m_deckLinkKeyer->Disable();
217                 }
218
219                 // Set the video output mode
220                 if ( S_OK != m_deckLinkOutput->EnableVideoOutput( m_displayMode->GetDisplayMode(), bmdVideoOutputFlagDefault ) )
221                 {
222                         mlt_log_error( getConsumer(), "Failed to enable video output\n" );
223                         return false;
224                 }
225
226                 // Set the audio output mode
227                 if ( !m_isAudio )
228                 {
229                         m_deckLinkOutput->DisableAudioOutput();
230                         return true;
231                 }
232                 if ( S_OK != m_deckLinkOutput->EnableAudioOutput( bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger,
233                         m_channels, bmdAudioOutputStreamTimestamped ) )
234                 {
235                         mlt_log_error( getConsumer(), "Failed to enable audio output\n" );
236                         stop();
237                         return false;
238                 }
239
240                 m_preroll = preroll;
241                 m_reprio = false;
242
243                 // preroll frames
244                 for( i = 0; i < preroll; i++ )
245                         ScheduleNextFrame( true );
246
247                 // start scheduled playback
248                 m_deckLinkOutput->StartScheduledPlayback( 0, m_timescale, 1.0 );
249
250                 // Set the running state
251                 mlt_properties_set_int( properties, "running", 1 );
252
253                 return true;
254         }
255         
256         bool stop()
257         {
258                 mlt_properties properties = MLT_CONSUMER_PROPERTIES( getConsumer() );
259
260                 // set running state is 0
261                 mlt_properties_set_int( properties, "running", 0 );
262                 mlt_consumer_stopped( getConsumer() );
263
264                 // release decklink frame
265                 if ( m_decklinkFrame )
266                         m_decklinkFrame->Release();
267                 m_decklinkFrame = NULL;
268
269                 // Stop the audio and video output streams immediately
270                 if ( m_deckLinkOutput )
271                 {
272                         m_deckLinkOutput->StopScheduledPlayback( 0, 0, 0 );
273                         m_deckLinkOutput->DisableAudioOutput();
274                         m_deckLinkOutput->DisableVideoOutput();
275                 }
276
277                 return true;
278         }
279
280         void renderAudio( mlt_frame frame )
281         {
282                 mlt_audio_format format = mlt_audio_s16;
283                 int frequency = bmdAudioSampleRate48kHz;
284                 int samples = mlt_sample_calculator( m_fps, frequency, m_count );
285                 int16_t *pcm = 0;
286
287                 if ( !mlt_frame_get_audio( frame, (void**) &pcm, &format, &frequency, &m_channels, &samples ) )
288                 {
289                         uint32_t written = 0;
290                         BMDTimeValue streamTime = m_count * frequency * m_duration / m_timescale;
291                         m_deckLinkOutput->GetBufferedAudioSampleFrameCount( &written );
292                         if ( written > (m_preroll + 1) * samples )
293                         {
294                                 mlt_log_verbose( getConsumer(), "renderAudio: will flush %d audiosamples\n", written );
295                                 m_deckLinkOutput->FlushBufferedAudioSamples();
296                         };
297 #ifdef WIN32
298                         m_deckLinkOutput->ScheduleAudioSamples( pcm, samples, streamTime, frequency, (unsigned long*) &written );
299 #else
300                         m_deckLinkOutput->ScheduleAudioSamples( pcm, samples, streamTime, frequency, &written );
301 #endif
302
303                         if ( written != (uint32_t) samples )
304                                 mlt_log_verbose( getConsumer(), "renderAudio: samples=%d, written=%u\n", samples, written );
305                 }
306         }
307
308         bool createFrame( IDeckLinkMutableVideoFrame** decklinkFrame )
309         {
310                 BMDPixelFormat format = m_isKeyer? bmdFormat8BitARGB : bmdFormat8BitYUV;
311                 IDeckLinkMutableVideoFrame* frame = 0;
312                 uint8_t *buffer = 0;
313                 int stride = m_width * ( m_isKeyer? 4 : 2 );
314
315                 *decklinkFrame = NULL;
316
317                 // Generate a DeckLink video frame
318                 if ( S_OK != m_deckLinkOutput->CreateVideoFrame( m_width, m_height,
319                         stride, format, bmdFrameFlagDefault, &frame ) )
320                 {
321                         mlt_log_verbose( getConsumer(), "Failed to create video frame\n" );
322                         stop();
323                         return false;
324                 }
325                 
326                 // Make the first line black for field order correction.
327                 if ( S_OK == frame->GetBytes( (void**) &buffer ) && buffer )
328                 {
329                         if ( m_isKeyer )
330                         {
331                                 memset( buffer, 0, stride );
332                         }
333                         else for ( int i = 0; i < m_width; i++ )
334                         {
335                                 *buffer++ = 128;
336                                 *buffer++ = 16;
337                         }
338                 }
339
340                 *decklinkFrame = frame;
341
342                 return true;
343         }
344
345         void renderVideo( mlt_frame frame )
346         {
347                 mlt_image_format format = m_isKeyer? mlt_image_rgb24a : mlt_image_yuv422;
348                 uint8_t* image = 0;
349                 int rendered = mlt_properties_get_int( MLT_FRAME_PROPERTIES(frame), "rendered");
350
351                 if ( rendered && !mlt_frame_get_image( frame, &image, &format, &m_width, &m_height, 0 ) )
352                 {
353                         uint8_t* buffer = 0;
354                         int stride = m_width * ( m_isKeyer? 4 : 2 );
355
356                         if ( m_decklinkFrame )
357                                 m_decklinkFrame->Release();
358                         if ( createFrame( &m_decklinkFrame ) )
359                                 m_decklinkFrame->GetBytes( (void**) &buffer );
360
361                         if ( buffer )
362                         {
363                                 int progressive = mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "progressive" );
364
365                                 if ( !m_isKeyer )
366                                 {
367                                         // Normal non-keyer playout - needs byte swapping
368                                         if ( !progressive && m_displayMode->GetFieldDominance() == bmdUpperFieldFirst )
369                                                 // convert lower field first to top field first
370                                                 swab( (char*) image, (char*) buffer + stride, stride * ( m_height - 1 ) );
371                                         else
372                                                 swab( (char*) image, (char*) buffer, stride * m_height );
373                                 }
374                                 else if ( !mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "test_image" ) )
375                                 {
376                                         // Normal keyer output
377                                         int y = m_height + 1;
378                                         uint32_t* s = (uint32_t*) image;
379                                         uint32_t* d = (uint32_t*) buffer;
380
381                                         if ( !progressive && m_displayMode->GetFieldDominance() == bmdUpperFieldFirst )
382                                         {
383                                                 // Correct field order
384                                                 m_height--;
385                                                 y--;
386                                                 d += m_width;
387                                         }
388
389                                         // Need to relocate alpha channel RGBA => ARGB
390                                         while ( --y )
391                                         {
392                                                 int x = m_width + 1;
393                                                 while ( --x )
394                                                 {
395                                                         *d++ = ( *s << 8 ) | ( *s >> 24 );
396                                                         s++;
397                                                 }
398                                         }
399                                 }
400                                 else
401                                 {
402                                         // Keying blank frames - nullify alpha
403                                         memset( buffer, 0, stride * m_height );
404                                 }
405                         }
406                 }
407                 if ( m_decklinkFrame )
408                         m_deckLinkOutput->ScheduleVideoFrame( m_decklinkFrame, m_count * m_duration, m_duration, m_timescale );
409
410                 if ( !rendered )
411                         mlt_log_verbose( getConsumer(), "dropped video frame %u\n", ++m_dropped );
412         }
413
414         HRESULT render( mlt_frame frame )
415         {
416                 HRESULT result = S_OK;
417
418                 // Get the audio
419                 double speed = mlt_properties_get_double( MLT_FRAME_PROPERTIES(frame), "_speed" );
420                 if ( m_isAudio && speed == 1.0 )
421                         renderAudio( frame );
422
423                 // Get the video
424                 renderVideo( frame );
425                 ++m_count;
426
427                 return result;
428         }
429         
430         // *** DeckLink API implementation of IDeckLinkVideoOutputCallback IDeckLinkAudioOutputCallback *** //
431
432         // IUnknown needs only a dummy implementation
433         virtual HRESULT STDMETHODCALLTYPE QueryInterface( REFIID iid, LPVOID *ppv )
434                 { return E_NOINTERFACE; }
435         virtual ULONG STDMETHODCALLTYPE AddRef()
436                 { return 1; }
437         virtual ULONG STDMETHODCALLTYPE Release()
438                 { return 1; }
439         
440         /************************* DeckLink API Delegate Methods *****************************/
441         
442         virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult completed )
443         {
444                 if( !m_reprio )
445                 {
446                         mlt_properties properties = MLT_CONSUMER_PROPERTIES( getConsumer() );
447
448                         if ( mlt_properties_get( properties, "priority" ) )
449                         {
450                                 int r;
451                                 pthread_t thread;
452                                 pthread_attr_t tattr;
453                                 struct sched_param param;
454
455                                 pthread_attr_init(&tattr);
456                                 pthread_attr_setschedpolicy(&tattr, SCHED_FIFO);
457
458                                 if ( !strcmp( "max", mlt_properties_get( properties, "priority" ) ) )
459                                         param.sched_priority = sched_get_priority_max(SCHED_FIFO) - 1;
460                                 else if ( !strcmp( "min", mlt_properties_get( properties, "priority" ) ) )
461                                         param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1;
462                                 else
463                                         param.sched_priority = mlt_properties_get_int( properties, "priority" );
464
465                                 pthread_attr_setschedparam(&tattr, &param);
466
467                                 thread = pthread_self();
468
469                                 r = pthread_setschedparam(thread, SCHED_FIFO, &param);
470                                 if( r )
471                                         mlt_log_verbose( getConsumer(),
472                                                 "ScheduledFrameCompleted: pthread_setschedparam retured %d\n", r);
473                                 else
474                                         mlt_log_verbose( getConsumer(),
475                                                 "ScheduledFrameCompleted: param.sched_priority=%d\n", param.sched_priority);
476                         };
477
478                         m_reprio = true;
479                 };
480
481                 uint32_t cnt;
482                 m_deckLinkOutput->GetBufferedAudioSampleFrameCount( &cnt );
483                 if ( cnt != m_acnt )
484                 {
485                         mlt_log_verbose( getConsumer(),
486                                 "ScheduledFrameCompleted: GetBufferedAudioSampleFrameCount %u -> %u, m_count=%"PRIu64"\n",
487                                 m_acnt, cnt, m_count );
488                         m_acnt = cnt;
489                 }
490
491                 // When a video frame has been released by the API, schedule another video frame to be output
492
493                 // ignore handler if frame was flushed
494                 if ( bmdOutputFrameFlushed == completed )
495                         return S_OK;
496
497                 // schedule next frame
498                 ScheduleNextFrame( false );
499
500                 // step forward frames counter if underrun
501                 if ( bmdOutputFrameDisplayedLate == completed )
502                 {
503                         mlt_log_verbose( getConsumer(), "ScheduledFrameCompleted: bmdOutputFrameDisplayedLate == completed\n" );
504                         m_count++;
505                 }
506                 if ( bmdOutputFrameDropped == completed )
507                 {
508                         mlt_log_verbose( getConsumer(), "ScheduledFrameCompleted: bmdOutputFrameDropped == completed\n" );
509                         m_count++;
510                 }
511
512                 return S_OK;
513         }
514
515         virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped()
516         {
517                 return mlt_consumer_is_stopped( getConsumer() ) ? S_FALSE : S_OK;
518         }
519         
520
521         void ScheduleNextFrame( bool preroll )
522         {
523                 // get the consumer
524                 mlt_consumer consumer = getConsumer();
525
526                 // Get the properties
527                 mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer );
528
529                 // Frame and size
530                 mlt_frame frame = NULL;
531
532                 if( mlt_properties_get_int( properties, "running" ) || preroll )
533                 {
534                         frame = mlt_consumer_rt_frame( consumer );
535                         if ( frame != NULL )
536                         {
537                                 render( frame );
538
539                                 mlt_events_fire( properties, "consumer-frame-show", frame, NULL );
540
541                                 // terminate on pause
542                                 if ( m_terminate_on_pause &&
543                                         mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame ), "_speed" ) == 0.0 )
544                                         stop();
545
546                                 mlt_frame_close( frame );
547                         }
548                 }
549         }
550 };
551
552 /** Start the consumer.
553  */
554
555 static int start( mlt_consumer consumer )
556 {
557         // Get the properties
558         mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer );
559         DeckLinkConsumer* decklink = (DeckLinkConsumer*) consumer->child;
560         return decklink->start( mlt_properties_get_int( properties, "preroll" ) ) ? 0 : 1;
561 }
562
563 /** Stop the consumer.
564  */
565
566 static int stop( mlt_consumer consumer )
567 {
568         // Get the properties
569         DeckLinkConsumer* decklink = (DeckLinkConsumer*) consumer->child;
570         return decklink->stop();
571 }
572
573 /** Determine if the consumer is stopped.
574  */
575
576 static int is_stopped( mlt_consumer consumer )
577 {
578         // Get the properties
579         mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer );
580         return !mlt_properties_get_int( properties, "running" );
581 }
582
583 /** Close the consumer.
584  */
585
586 static void close( mlt_consumer consumer )
587 {
588         // Stop the consumer
589         mlt_consumer_stop( consumer );
590
591         // Close the parent
592         consumer->close = NULL;
593         mlt_consumer_close( consumer );
594
595         // Free the memory
596         delete (DeckLinkConsumer*) consumer->child;
597 }
598
599 extern "C" {
600
601 /** Initialise the consumer.
602  */
603
604 mlt_consumer consumer_decklink_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
605 {
606         // Allocate the consumer
607         DeckLinkConsumer* decklink = new DeckLinkConsumer();
608         mlt_consumer consumer = NULL;
609
610         // If allocated
611         if ( decklink && !mlt_consumer_init( decklink->getConsumer(), decklink, profile ) )
612         {
613                 // If initialises without error
614                 if ( decklink->open( arg? atoi(arg) : 0 ) )
615                 {
616                         consumer = decklink->getConsumer();
617                         
618                         // Setup callbacks
619                         consumer->close = close;
620                         consumer->start = start;
621                         consumer->stop = stop;
622                         consumer->is_stopped = is_stopped;
623                         mlt_properties_set( MLT_CONSUMER_PROPERTIES(consumer), "deinterlace_method", "onefield" );
624                 }
625         }
626
627         // Return consumer
628         return consumer;
629 }
630
631 extern mlt_producer producer_decklink_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
632
633 static mlt_properties metadata( mlt_service_type type, const char *id, void *data )
634 {
635         char file[ PATH_MAX ];
636         const char *service_type = NULL;
637         switch ( type )
638         {
639                 case consumer_type:
640                         service_type = "consumer";
641                         break;
642                 case producer_type:
643                         service_type = "producer";
644                         break;
645                 default:
646                         return NULL;
647         }
648         snprintf( file, PATH_MAX, "%s/decklink/%s_%s.yml", mlt_environment( "MLT_DATA" ), service_type, id );
649         return mlt_properties_parse_yaml( file );
650 }
651
652 MLT_REPOSITORY
653 {
654         MLT_REGISTER( consumer_type, "decklink", consumer_decklink_init );
655         MLT_REGISTER( producer_type, "decklink", producer_decklink_init );
656         MLT_REGISTER_METADATA( consumer_type, "decklink", metadata, NULL );
657         MLT_REGISTER_METADATA( producer_type, "decklink", metadata, NULL );
658 }
659
660 } // extern C