-
Notifications
You must be signed in to change notification settings - Fork 3
/
simpleplayer.cpp
68 lines (44 loc) · 1.32 KB
/
simpleplayer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
Taken from http://ubuntuforums.org/showthread.php?p=7370184
Adapted fixing crashes & cleanup by Harry van Haaren 2013
MLT++ Player Example
g++ simpleplayer.cpp -I/usr/include/mlt -I/usr/include/mlt++ -lmlt++ -lmlt -o simpleplayer
Usage: simpleplayer <file>
http://www.mltframework.org/twiki/bin/view/MLT/Framework
*/
#include <iostream>
#include <unistd.h>
#include <Mlt.h>
using namespace std;
int main( int argc, char *argv[] )
{
Mlt::Repository *repository;
// initialise the factory
repository = Mlt::Factory::init();
if ( not repository )
{
cout << "Unable to locate factory modules" << endl;
}
Mlt::Profile *profile;
Mlt::Consumer *consumer;
Mlt::Producer *producer;
profile = new Mlt::Profile();
// Create the default consumer
consumer = new Mlt::Consumer( *profile,"sdl");
// Create via the default producer
producer = new Mlt::Producer( *profile,NULL, argv[ 1 ] );
// Connect the producer to the consumer
consumer->connect(*producer);
// Start the consumer
consumer->start();
// Wait for the consumer to terminate
while( !consumer->is_stopped() )
sleep( 1 );
// Close the consumer
delete(consumer);
// Close the producer
delete(producer);
// Close the factory
Mlt::Factory::close();
return 0;
}