mlt 0.7.6
Public Member Functions | Data Fields | Private Member Functions | Private Attributes

mlt_properties_s Struct Reference

Properties class. More...

#include <mlt_properties.h>

Inheritance diagram for mlt_properties_s:
mlt_frame_s mlt_parser_s mlt_repository_s mlt_service_s mlt_consumer_s mlt_filter_s mlt_producer_s mlt_transition_s mlt_multitrack_s mlt_playlist_s mlt_tractor_s

Public Member Functions

void mlt_properties_close (mlt_properties self)
 Close a properties object.
int mlt_properties_count (mlt_properties self)
 Return the number of items in the list.
void mlt_properties_debug (mlt_properties self, const char *title, FILE *output)
 Output the properties to a file handle.
int mlt_properties_dec_ref (mlt_properties self)
 Decrement the reference count.
int mlt_properties_dir_list (mlt_properties self, const char *dirname, const char *pattern, int sort)
 Get the contents of a directory.
void mlt_properties_dump (mlt_properties self, FILE *output)
 Dump the properties to a file handle.
char * mlt_properties_get (mlt_properties self, const char *name)
 Get a string value by name.
void * mlt_properties_get_data (mlt_properties self, const char *name, int *length)
 Get a binary data value associated to the name.
void * mlt_properties_get_data_at (mlt_properties self, int index, int *size)
 Get a data value by index.
double mlt_properties_get_double (mlt_properties self, const char *name)
 Get a floating point value associated to the name.
int mlt_properties_get_int (mlt_properties self, const char *name)
 Get an integer associated to the name.
int64_t mlt_properties_get_int64 (mlt_properties self, const char *name)
 Get a 64-bit integer associated to the name.
const char * mlt_properties_get_lcnumeric (mlt_properties self)
 Get the numeric locale for this properties object.
char * mlt_properties_get_name (mlt_properties self, int index)
 Get a property name by index.
mlt_position mlt_properties_get_position (mlt_properties self, const char *name)
 Get a position value associated to the name.
char * mlt_properties_get_value (mlt_properties self, int index)
 Get a property's string value by index.
int mlt_properties_inc_ref (mlt_properties self)
 Increment the reference count.
int mlt_properties_inherit (mlt_properties self, mlt_properties that)
 Copy all serializable properties to another properties list.
int mlt_properties_init (mlt_properties self, void *child)
 Initialize a properties object that was already allocated.
int mlt_properties_is_sequence (mlt_properties properties)
 Determine if the properties list is really just a sequence or ordered list.
mlt_properties mlt_properties_load (const char *filename)
 Create a properties object by reading a .properties text file.
void mlt_properties_lock (mlt_properties self)
 Protect a properties list against concurrent access.
void mlt_properties_mirror (mlt_properties self, mlt_properties that)
 Set a properties list to be a mirror copy of another.
mlt_properties mlt_properties_new ()
 Create a properties object.
int mlt_properties_parse (mlt_properties self, const char *namevalue)
 Set a value by parsing a name=value string.
mlt_properties mlt_properties_parse_yaml (const char *filename)
 Parse a YAML Tiny file by name.
int mlt_properties_pass (mlt_properties self, mlt_properties that, const char *prefix)
 Pass all serializable properties that match a prefix to another properties object.
int mlt_properties_pass_list (mlt_properties self, mlt_properties that, const char *list)
 Copy all properties specified in a comma-separated list to another properties list.
void mlt_properties_pass_property (mlt_properties self, mlt_properties that, const char *name)
 Copy a property to another properties list.
int mlt_properties_preset (mlt_properties self, const char *name)
 Set properties from a preset.
int mlt_properties_ref_count (mlt_properties self)
 Get the reference count.
int mlt_properties_rename (mlt_properties self, const char *source, const char *dest)
 Rename a property.
int mlt_properties_save (mlt_properties self, const char *filename)
 Save the properties to a file by name.
char * mlt_properties_serialise_yaml (mlt_properties self)
 Serialize a properties list as a string of YAML Tiny.
int mlt_properties_set (mlt_properties self, const char *name, const char *value)
 Set a property to a string.
int mlt_properties_set_data (mlt_properties self, const char *name, void *value, int length, mlt_destructor destroy, mlt_serialiser serialise)
 Store binary data as a property.
int mlt_properties_set_double (mlt_properties self, const char *name, double value)
 Set a property to a floating point value.
int mlt_properties_set_int (mlt_properties self, const char *name, int value)
 Set a property to an integer value.
int mlt_properties_set_int64 (mlt_properties self, const char *name, int64_t value)
 Set a property to a 64-bit integer value.
int mlt_properties_set_lcnumeric (mlt_properties self, const char *locale)
 Set the numeric locale used for string/double conversions.
int mlt_properties_set_or_default (mlt_properties self, const char *name, const char *value, const char *def)
 Set or default a property to a string.
int mlt_properties_set_position (mlt_properties self, const char *name, mlt_position value)
 Set a property to a position value.
void mlt_properties_unlock (mlt_properties self)
 End protecting a properties list against concurrent access.

Data Fields

mlt_destructor close
 the destructor virtual function
void * close_object
 the object supplied to the close virtual function

Private Member Functions

static int generate_hash (const char *name)
 Generate a hash key.
static int mlt_compare (const void *self, const void *that)
 Compare the string or serialized value of two properties.
static int mlt_fnmatch (const char *wild, const char *file)
 Test whether a filename or pathname matches a shell-style pattern.
static mlt_property mlt_properties_add (mlt_properties self, const char *name)
 Add a new property.
static void mlt_properties_do_mirror (mlt_properties self, const char *name)
 Copy a serializable property to a properties list that is mirroring this one.
static mlt_property mlt_properties_fetch (mlt_properties self, const char *name)
 Fetch a property by name and add one if not found.
static mlt_property mlt_properties_find (mlt_properties self, const char *name)
 Locate a property by name.
static void serialise_yaml (mlt_properties self, strbuf output, int indent, int is_parent_sequence)
 Recursively serialize a properties list into a string buffer as YAML Tiny.

Private Attributes

void * child
 the object of a subclass
void * local
 instance object

Detailed Description

Properties class.

Properties is a combination list/dictionary of name/mlt_property pairs. It is also a base class for many of the other MLT classes.


Member Function Documentation

static int generate_hash ( const char *  name) [inline, private]

Generate a hash key.

Parameters:
namea string
Returns:
an integer
static int mlt_compare ( const void *  self,
const void *  that 
) [private]

Compare the string or serialized value of two properties.

Parameters:
selfa property
thata property
Returns:
< 0 if self less than that, 0 if equal, or > 0 if self is greater than that
static int mlt_fnmatch ( const char *  wild,
const char *  file 
) [private]

Test whether a filename or pathname matches a shell-style pattern.

Parameters:
wilda string containing a wildcard pattern
filethe name of a file to test against
Returns:
true if the file name matches the wildcard pattern
static mlt_property mlt_properties_add ( mlt_properties  self,
const char *  name 
) [private]

Add a new property.

Parameters:
selfa properties list
namethe name of the new property
Returns:
the new property
void mlt_properties_close ( mlt_properties  self)

Close a properties object.

Deallocates the properties object and everything it contains.

Parameters:
selfa properties object
int mlt_properties_count ( mlt_properties  self)

Return the number of items in the list.

Parameters:
selfa properties list
Returns:
the number of property objects
void mlt_properties_debug ( mlt_properties  self,
const char *  title,
FILE *  output 
)

Output the properties to a file handle.

This version includes reference counts and does not put each property on a new line.

Parameters:
selfa properties pointer
titlea string to preface the output
outputa file handle
int mlt_properties_dec_ref ( mlt_properties  self)

Decrement the reference count.

Parameters:
selfa properties list
Returns:
the new reference count
int mlt_properties_dir_list ( mlt_properties  self,
const char *  dirname,
const char *  pattern,
int  sort 
)

Get the contents of a directory.

Obtains an optionally sorted list of the files found in a directory with a specific wild card. Entries in the list have a numeric name (running from 0 to count - 1). Only values change position if sort is enabled. Designed to be posix compatible (linux, os/x, mingw etc).

Parameters:
selfa properties list
dirnamethe name of the directory
patterna wildcard pattern to filter the directory listing
sortDo you want to sort the directory listing?
Returns:
the number of items in the directory listing
static void mlt_properties_do_mirror ( mlt_properties  self,
const char *  name 
) [inline, private]

Copy a serializable property to a properties list that is mirroring this one.

Special case - when a container (such as loader) is protecting another producer, we need to ensure that properties are passed through to the real producer.

Parameters:
selfa properties list
namethe name of the property to copy
void mlt_properties_dump ( mlt_properties  self,
FILE *  output 
)

Dump the properties to a file handle.

Parameters:
selfa properties list
outputa file handle
static mlt_property mlt_properties_fetch ( mlt_properties  self,
const char *  name 
) [private]

Fetch a property by name and add one if not found.

Parameters:
selfa properties list
namethe property to lookup or add
Returns:
the property
static mlt_property mlt_properties_find ( mlt_properties  self,
const char *  name 
) [inline, private]

Locate a property by name.

Parameters:
selfa properties list
namethe property to lookup by name
Returns:
the property or NULL for failure
char * mlt_properties_get ( mlt_properties  self,
const char *  name 
)

Get a string value by name.

Do not free the returned string. It's lifetime is controlled by the property and this properties object.

Parameters:
selfa properties list
namethe property to get
Returns:
the property's string value or NULL if it does not exist
void * mlt_properties_get_data ( mlt_properties  self,
const char *  name,
int *  length 
)

Get a binary data value associated to the name.

Do not free the returned pointer if you supplied a destructor function when you set this property.

Parameters:
selfa properties list
namethe property to get
[out]lengthThe size of the binary data in bytes, if available (often it is not, you should know)
void * mlt_properties_get_data_at ( mlt_properties  self,
int  index,
int *  size 
)

Get a data value by index.

Do not free the returned pointer if you supplied a destructor function when you set this property.

Parameters:
selfa properties list
indexthe numeric index of the property
[out]sizethe size of the binary data in bytes or NULL if the index is out of range
double mlt_properties_get_double ( mlt_properties  self,
const char *  name 
)

Get a floating point value associated to the name.

Parameters:
selfa properties list
namethe property to get
Returns:
the floating point, 0 if not found (which may also be a legitimate value)
int mlt_properties_get_int ( mlt_properties  self,
const char *  name 
)

Get an integer associated to the name.

Parameters:
selfa properties list
namethe property to get
Returns:
The integer value, 0 if not found (which may also be a legitimate value)
int64_t mlt_properties_get_int64 ( mlt_properties  self,
const char *  name 
)

Get a 64-bit integer associated to the name.

Parameters:
selfa properties list
namethe property to get
Returns:
the integer value, 0 if not found (which may also be a legitimate value)
const char * mlt_properties_get_lcnumeric ( mlt_properties  self)

Get the numeric locale for this properties object.

Do not free the result.

Parameters:
selfa properties list
Returns:
the locale name if this properties has a specific locale it is using, NULL otherwise
char * mlt_properties_get_name ( mlt_properties  self,
int  index 
)

Get a property name by index.

Do not free the returned string.

Parameters:
selfa properties list
indexthe numeric index of the property
Returns:
the name of the property or NULL if index is out of range
mlt_position mlt_properties_get_position ( mlt_properties  self,
const char *  name 
)

Get a position value associated to the name.

Parameters:
selfa properties list
namethe property to get
Returns:
the position, 0 if not found (which may also be a legitimate value)
char * mlt_properties_get_value ( mlt_properties  self,
int  index 
)

Get a property's string value by index.

Do not free the returned string.

Parameters:
selfa properties list
indexthe numeric index of the property
Returns:
the property value as a string or NULL if the index is out of range
int mlt_properties_inc_ref ( mlt_properties  self)

Increment the reference count.

Parameters:
selfa properties list
Returns:
the new reference count
int mlt_properties_inherit ( mlt_properties  self,
mlt_properties  that 
)

Copy all serializable properties to another properties list.

Parameters:
selfThe properties to copy to
thatThe properties to copy from
Returns:
false
int mlt_properties_init ( mlt_properties  self,
void *  child 
)

Initialize a properties object that was already allocated.

This does allocate its property_list, and it adds a reference count.

Parameters:
selfthe properties structure to initialize
childan opaque pointer to a subclass object
Returns:
true if failed
int mlt_properties_is_sequence ( mlt_properties  properties)

Determine if the properties list is really just a sequence or ordered list.

Parameters:
propertiesa properties list
Returns:
true if all of the property names are numeric (a sequence)
mlt_properties mlt_properties_load ( const char *  filename)

Create a properties object by reading a .properties text file.

Free the properties object with mlt_properties_close().

Deprecated:
Please start using mlt_properties_parse_yaml().
Parameters:
filenamethe absolute file name
Returns:
a new properties object
void mlt_properties_lock ( mlt_properties  self)

Protect a properties list against concurrent access.

Parameters:
selfa properties list
void mlt_properties_mirror ( mlt_properties  self,
mlt_properties  that 
)

Set a properties list to be a mirror copy of another.

Note that this does not copy all existing properties. Rather, you must call this before setting the properties that you wish to copy.

Parameters:
thatthe properties which will receive copies of the properties as they are set.
selfthe properties to mirror
mlt_properties mlt_properties_new ( )

Create a properties object.

This allocates the properties structure and calls mlt_properties_init() on it. Free the properties object with mlt_properties_close().

Returns:
a new properties object
int mlt_properties_parse ( mlt_properties  self,
const char *  namevalue 
)

Set a value by parsing a name=value string.

Parameters:
selfa properties list
namevaluea string containing name and value delimited by '='
Returns:
true if there was an error
mlt_properties mlt_properties_parse_yaml ( const char *  filename)

Parse a YAML Tiny file by name.

Parameters:
filenamethe name of a text file containing YAML Tiny
Returns:
a new properties list
int mlt_properties_pass ( mlt_properties  self,
mlt_properties  that,
const char *  prefix 
)

Pass all serializable properties that match a prefix to another properties object.

Parameters:
selfthe properties to copy to
thatThe properties to copy from
prefixthe property names to match (required)
Returns:
false
int mlt_properties_pass_list ( mlt_properties  self,
mlt_properties  that,
const char *  list 
)

Copy all properties specified in a comma-separated list to another properties list.

White space is also a delimiter.

Author:
Zach <zachary.drew@gmail.com>
Parameters:
selfthe properties to copy to
thatthe properties to copy from
lista delimited list of property names
Returns:
false
void mlt_properties_pass_property ( mlt_properties  self,
mlt_properties  that,
const char *  name 
)

Copy a property to another properties list.

Author:
Zach <zachary.drew@gmail.com>
Parameters:
selfthe properties to copy to
thatthe properties to copy from
namethe name of the property to copy
int mlt_properties_preset ( mlt_properties  self,
const char *  name 
)

Set properties from a preset.

Presets are typically installed to $prefix/share/mlt/presets/{type}/{service}/[{profile}/]{name}. For example, "/usr/share/mlt/presets/consumer/avformat/dv_ntsc_wide/DVD" could be an encoding preset for a widescreen NTSC DVD Video. Do not specify the type and service in the preset name parameter; these are inferred automatically from the service to which you are applying the preset. Using the example above and assuming you are calling this function on the avformat consumer, the name passed to the function should simply be DVD. Note that the profile portion of the path is optional, but a profile-specific preset with the same name as a more generic one is given a higher priority.

Todo:
Look in a user-specific location - somewhere in the home directory.
Parameters:
selfa properties list
namethe name of a preset in a well-known location or the explicit path
Returns:
true if error
int mlt_properties_ref_count ( mlt_properties  self)

Get the reference count.

Parameters:
selfa properties list
Returns:
the current reference count
int mlt_properties_rename ( mlt_properties  self,
const char *  source,
const char *  dest 
)

Rename a property.

Parameters:
selfa properties list
sourcethe property to rename
destthe new name
Returns:
true if the name is already in use
int mlt_properties_save ( mlt_properties  self,
const char *  filename 
)

Save the properties to a file by name.

This uses the dump format - one line per property.

Parameters:
selfa properties list
filenamethe name of a file to create or overwrite
Returns:
true if there was an error
char * mlt_properties_serialise_yaml ( mlt_properties  self)

Serialize a properties list as a string of YAML Tiny.

The caller MUST free the returned string! This operates on properties containing properties as a hierarchical data structure.

Parameters:
selfa properties list
Returns:
a string containing YAML Tiny that represents the properties list
int mlt_properties_set ( mlt_properties  self,
const char *  name,
const char *  value 
)

Set a property to a string.

The property name "properties" is reserved to load the preset in value. When the value begins with '@' then it is interpreted as a very simple math expression containing only the +, -, *, and / operators. The event "property-changed" is fired after the property has been set.

This makes a copy of the string value you supply.

Parameters:
selfa properties list
namethe property to set
valuethe property's new value
Returns:
true if error
int mlt_properties_set_data ( mlt_properties  self,
const char *  name,
void *  value,
int  length,
mlt_destructor  destroy,
mlt_serialiser  serialise 
)

Store binary data as a property.

Parameters:
selfa properties list
namethe property to set
valuean opaque pointer to binary data
lengththe size of the binary data in bytes (optional)
destroya function to deallocate the binary data when the property is closed (optional)
serialisea function that can serialize the binary data as text (optional)
Returns:
true if error
int mlt_properties_set_double ( mlt_properties  self,
const char *  name,
double  value 
)

Set a property to a floating point value.

Parameters:
selfa properties list
namethe property to set
valuethe floating point value
Returns:
true if error
int mlt_properties_set_int ( mlt_properties  self,
const char *  name,
int  value 
)

Set a property to an integer value.

Parameters:
selfa properties list
namethe property to set
valuethe integer
Returns:
true if error
int mlt_properties_set_int64 ( mlt_properties  self,
const char *  name,
int64_t  value 
)

Set a property to a 64-bit integer value.

Parameters:
selfa properties list
namethe property to set
valuethe integer
Returns:
true if error
int mlt_properties_set_lcnumeric ( mlt_properties  self,
const char *  locale 
)

Set the numeric locale used for string/double conversions.

Parameters:
selfa properties list
localethe locale name
Returns:
true if error
int mlt_properties_set_or_default ( mlt_properties  self,
const char *  name,
const char *  value,
const char *  def 
)

Set or default a property to a string.

This makes a copy of the string value you supply.

Parameters:
selfa properties list
namethe property to set
valuethe string value to set or NULL to use the default
defthe default string if value is NULL
Returns:
true if error
int mlt_properties_set_position ( mlt_properties  self,
const char *  name,
mlt_position  value 
)

Set a property to a position value.

Parameters:
selfa properties list
namethe property to get
valuethe position
Returns:
true if error
void mlt_properties_unlock ( mlt_properties  self)

End protecting a properties list against concurrent access.

Parameters:
selfa properties list
static void serialise_yaml ( mlt_properties  self,
strbuf  output,
int  indent,
int  is_parent_sequence 
) [private]

Recursively serialize a properties list into a string buffer as YAML Tiny.

Parameters:
selfa properties list
outputa string buffer to hold the serialized YAML Tiny
indentthe number of spaces to indent (for recursion, initialize to 0)
is_parent_sequenceIs this properties list really just a sequence (for recursion, initialize to 0)?

Field Documentation

void* mlt_properties_s::child [private]

the object of a subclass

Reimplemented in mlt_consumer_s, mlt_filter_s, mlt_producer_s, mlt_service_s, and mlt_transition_s.

the destructor virtual function

Reimplemented in mlt_consumer_s, mlt_filter_s, mlt_producer_s, mlt_service_s, and mlt_transition_s.

the object supplied to the close virtual function

Reimplemented in mlt_producer_s, and mlt_service_s.

void* mlt_properties_s::local [private]

instance object

Reimplemented in mlt_consumer_s, mlt_producer_s, and mlt_service_s.


The documentation for this struct was generated from the following files:
TWiki Appliance - Powered by TurnKey Linux