2 * MltProperties.cpp - MLT Wrapper
3 * Copyright (C) 2004-2005 Charles Yates
4 * Author: Charles Yates <charles.yates@pandora.be>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #include "MltProperties.h"
24 Properties
::Properties( ) :
27 instance
= mlt_properties_new( );
30 Properties
::Properties( bool dummy
) :
35 Properties
::Properties( Properties
&properties
) :
36 instance( properties
.get_properties( ) )
38 fprintf( stderr
, "Incrementing ref count on properties #1\n" );
42 Properties
::Properties( mlt_properties properties
) :
43 instance( properties
)
45 fprintf( stderr
, "Incrementing ref count on properties #2\n" );
49 Properties
::Properties( char *file
) :
52 instance
= mlt_properties_load( file
);
55 Properties
::~Properties( )
57 mlt_properties_close( instance
);
60 mlt_properties Properties
::get_properties( )
65 int Properties
::inc_ref( )
67 return mlt_properties_inc_ref( get_properties( ) );
70 int Properties
::dec_ref( )
72 return mlt_properties_dec_ref( get_properties( ) );
75 bool Properties
::is_valid( )
77 return get_properties( ) != NULL
;
80 int Properties
::count( )
82 return mlt_properties_count( get_properties( ) );
85 char *Properties
::get( char *name
)
87 return mlt_properties_get( get_properties( ), name
);
90 int Properties
::get_int( char *name
)
92 return mlt_properties_get_int( get_properties( ), name
);
95 double Properties
::get_double( char *name
)
97 return mlt_properties_get_double( get_properties( ), name
);
100 void *Properties
::get_data( char *name
, int &size
)
102 return mlt_properties_get_data( get_properties( ), name
, &size
);
105 int Properties
::set( char *name
, char *value
)
107 return mlt_properties_set( get_properties( ), name
, value
);
110 int Properties
::set( char *name
, int value
)
112 return mlt_properties_set_int( get_properties( ), name
, value
);
115 int Properties
::set( char *name
, double value
)
117 return mlt_properties_set_double( get_properties( ), name
, value
);
120 int Properties
::set( char *name
, void *value
, int size
, mlt_destructor destructor
, mlt_serialiser serialiser
)
122 return mlt_properties_set_data( get_properties( ), name
, value
, size
, destructor
, serialiser
);
125 int Properties
::pass_values( Properties
&that
, char *prefix
)
127 return mlt_properties_pass( get_properties( ), that
.get_properties( ), prefix
);
130 int Properties
::parse( char *namevalue
)
132 return mlt_properties_parse( get_properties( ), namevalue
);
135 char *Properties
::get_name( int index
)
137 return mlt_properties_get_name( get_properties( ), index
);
140 char *Properties
::get( int index
)
142 return mlt_properties_get_value( get_properties( ), index
);
145 void *Properties
::get_data( int index
, int &size
)
147 return mlt_properties_get_data_at( get_properties( ), index
, &size
);
150 void Properties
::mirror( Properties
&that
)
152 mlt_properties_mirror( get_properties( ), that
.get_properties( ) );
155 int Properties
::inherit( Properties
&that
)
157 return mlt_properties_inherit( get_properties( ), that
.get_properties( ) );
160 int Properties
::rename( char *source
, char *dest
)
162 return mlt_properties_rename( get_properties( ), source
, dest
);
165 void Properties
::dump( FILE *output
)
167 mlt_properties_dump( get_properties( ), output
);
170 void Properties
::debug( char *title
, FILE *output
)
172 mlt_properties_debug( get_properties( ), title
, output
);
175 int Properties
::save( char *file
)
178 FILE *f
= fopen( file
, "w" );