Object validity checks
[melted] / mlt++ / test / play.cpp
1
2 #include <iostream>
3 #include <string>
4 using namespace std;
5
6 #include <mlt++/MltFactory.h>
7 using namespace Mlt;
8
9 #include <time.h>
10
11 int main( int argc, char **argv )
12 {
13 Factory::init( NULL );
14 Producer *producer = Factory::producer( argv[ 1 ] );
15 if ( !producer->is_valid( ) )
16 {
17 cerr << "Can't construct producer for " << argv[ 1 ] << endl;
18 return 0;
19 }
20 Consumer *consumer = Factory::consumer( "sdl" );
21 consumer->set( "rescale", "none" );
22 Filter *filter = Factory::filter( "greyscale" );
23 filter->connect( *producer );
24 consumer->connect( *filter );
25 consumer->start( );
26 struct timespec tm = { 1, 0 };
27 while ( !consumer->is_stopped( ) )
28 nanosleep( &tm, NULL );
29 consumer->stop( );
30 delete consumer;
31 delete producer;
32 delete filter;
33 Factory::close( );
34 return 0;
35 }