add MltProfile and update examples
[melted] / mlt++ / src / MltProfile.cpp
1 /**
2 * MltProfile.cpp - MLT Wrapper
3 * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program 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
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20 #include "MltProfile.h"
21 #include "MltProperties.h"
22 using namespace Mlt;
23
24 Profile::Profile( ) :
25 instance( NULL )
26 {
27 instance = mlt_profile_init( NULL );
28 }
29
30 Profile::Profile( const char* name ) :
31 instance( NULL )
32 {
33 instance = mlt_profile_init( name );
34 }
35
36 Profile::Profile( Properties& properties ) :
37 instance( NULL )
38 {
39 instance = mlt_profile_load_properties( properties.get_properties() );
40 }
41
42 Profile::Profile( mlt_profile profile ) :
43 instance( profile )
44 {
45 }
46
47 Profile::~Profile( )
48 {
49 if ( instance )
50 mlt_profile_close( instance );
51 instance = NULL;
52 }
53
54 mlt_profile Profile::get_profile( ) const
55 {
56 return instance;
57 }
58
59 char* Profile::description() const
60 {
61 return instance->description;
62 }
63
64 int Profile::frame_rate_num() const
65 {
66 return instance->frame_rate_num;
67 }
68
69 int Profile::frame_rate_den() const
70 {
71 return instance->frame_rate_den;
72 }
73
74 double Profile::fps() const
75 {
76 return mlt_profile_fps( instance );
77 }
78
79 int Profile::width() const
80 {
81 return instance->width;
82 }
83
84 int Profile::height() const
85 {
86 return instance->height;
87 }
88
89 bool Profile::progressive() const
90 {
91 return instance->progressive;
92 }
93
94 int Profile::sample_aspect_num() const
95 {
96 return instance->sample_aspect_num;
97 }
98
99 int Profile::sample_aspect_den() const
100 {
101 return instance->sample_aspect_den;
102 }
103
104 double Profile::sar() const
105 {
106 return mlt_profile_sar( instance );
107 }
108
109 int Profile::display_aspect_num() const
110 {
111 return instance->display_aspect_num;
112 }
113
114 int Profile::display_aspect_den() const
115 {
116 return instance->display_aspect_den;
117 }
118
119 double Profile::dar() const
120 {
121 return mlt_profile_dar( instance );
122 }