--- /dev/null
+MLT++ was developed by:
+Charles Yates <charles.yates@pandora.be>
+
+MLT++ is maintained by:
+Dan Dennedy <dan@dennedy.org>
--- /dev/null
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+\f
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+\f
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
--- /dev/null
+Server Customisation
+
+Copyright (C) 2005 Ushodaya Enterprises Limited
+Authors: Charles Yates <charles.yates@pandora.be>
+Last Revision: 2005-03-16
+
+
+INTRODUCTION
+
+ This document describes how miracle can be customised. The emphasis is on
+ showing simple examples of various aspects of the servers capabilities
+ rather than on focussing on the MLT++ API.
+
+
+THE BASIC CUSTOM SERVER
+
+ The most basic custom server exposes the entire DVCP protocol and is roughly
+ equivalent to the miracle server iteself, but in this case, it lacks the
+ initialisation from /etc/miracle.conf and the port is hardcoded to 5290:
+
+ #include <iostream.h>
+ using namespace std;
+
+ #include <MltMiracle.h>
+ using namespace Mlt;
+
+ int main( int argc, char **argv )
+ {
+ Miracle server( "miracle++", 5290 );
+ if ( server.start( ) )
+ {
+ server.execute( "uadd sdl" );
+ server.execute( "play u0" );
+ server.wait_for_shutdown( );
+ }
+ else
+ {
+ cerr << "Failed to start server" << endl;
+ }
+ return 0;
+ }
+
+ Note that after the server is started, this example submits the hard coded
+ commands specified - further units and property settings can of course be
+ specified via the DVCP protocol.
+
+ To specify initial DVCP commands from /etc/miracle.conf, it is sufficient to
+ specify an additional argument in the server constructor.
+
+ The wait_for_shutdown call is not required if the server is integrated in
+ a user interface application.
+
+
+CUSTOMISATION
+
+ This document focusses on the following areas of customisation:
+
+ * the Miracle server class
+ * extending the command set
+ * accessing the units
+ * the Response object
+ * handling pushed westley documents
+ * accessiving events
+
+
+THE MIRACLE SERVER CLASS
+
+ The full public interface of the server is as follows:
+
+ class Miracle : public Properties
+ {
+ public:
+ Miracle( char *name, int port = 5290, char *config = NULL );
+ virtual ~Miracle( );
+ mlt_properties get_properties( );
+ bool start( );
+ bool is_running( );
+ virtual Response *execute( char *command );
+ virtual Response *received( char *command, char *doc );
+ virtual Response *push( char *command, Service *service );
+ void wait_for_shutdown( );
+ static void log_level( int );
+ Properties *unit( int );
+ };
+
+ The focus of this document is on the 3 virtual methods (execute, received and
+ push). Some further information is provided about the unit properties method
+ and the types of functionality that it provides.
+
+
+EXTENDING THE COMMAND SET
+
+ The simplest customisation is carried out by overriding the the 'execute'
+ method - the following shows a simple example:
+
+ #include <iostream.h>
+ #include <string>
+ #include <sstring>
+ using namespace std;
+
+ #include <MltMiracle.h>
+ #include <MltResponse.h>
+ using namespace Mlt;
+
+ class Custom :
+ public Miracle
+ {
+ public:
+ Custom( char *name = "Custom", int port = 5290, char *config = NULL ) :
+ Miracle( name, port, config )
+ {
+ }
+
+ Response *execute( char *command )
+ {
+ cerr << "command = " << command << endl;
+ return Miracle::execute( command );
+ }
+ };
+
+ int main( int argc, char **argv )
+ {
+ Custom server( "miracle++", 5290 );
+ if ( server.start( ) )
+ {
+ server.execute( "uadd sdl" );
+ server.execute( "play u0" );
+ server.wait_for_shutdown( );
+ }
+ else
+ {
+ cerr << "Failed to start server" << endl;
+ }
+ return 0;
+ }
+
+ All this does is output each command and pass control over to the original
+ implementation.
+
+ When you execute this, you will see the following output:
+
+ (5) Starting server on 5290.
+ command = uadd sdl
+ (5) miracle++ version 0.0.1 listening on port 5290
+ command = play u0
+ (7) Received signal 2 - shutting down.
+
+ Note that all commands except the PUSH are passed through this method before
+ they are executed and this includes those coming from the main function itself.
+
+
+ACCESSING UNIT PROPERTIES
+
+ A unit consists of two objects - a playlist and a consumer. Your custom
+ server can access these by obtaining the Properties object associated to a unit
+ via the 'unit' method.
+
+ As a simple example we can replace our execute method above with the following:
+
+ Response *execute( char *command )
+ {
+ if ( !strcmp( command, "debug" ) )
+ {
+ int i = 0;
+ while( unit( i ) != NULL )
+ unit( i ++ )->debug( );
+ return new Response( 200, "Diagnostics output" );
+ }
+ return Miracle::execute( command );
+ }
+
+ When this runs and you send a 'debug' command via DVCP, the server will output
+ some information on stderr, like:
+
+ (5) Starting server on 5290.
+ (5) Server version 0.0.1 listening on port 5290
+ (5) Connection established with localhost (7)
+ Object: [ ref=3, unit=0, generation=0, constructor=sdl, id=sdl, arg=(nil),
+ consumer=0x80716a0, playlist=0x807f8a8, root=/, notifier=0x8087c28 ]
+ (6) localhost "debug" 100
+
+ You can extract the objects using:
+
+ Playlist playlist( ( mlt_playlist )( unit( i )->get_data( "playlist" ) ) );
+ Consumer consumer( ( mlt_consumer )( unit( i )->get_data( "consumer" ) ) );
+
+ and use the standard MLT++ wrapping methods to interact with them or you can
+ bypass these and using the C API directly.
+
+ Obviously, this opens a lot of possibilities for the types of editing operations
+ than can be carried out over the DVCP protocol - for example, you can attach filters
+ apply mixes/transitions between neighbouring cuts or carry out specific operations
+ on cuts.
+
+
+THE RESPONSE OBJECT
+
+ The example above doesn't do anything particularly useful - in order to extend
+ things in more interesting ways, we should be able to carry information back to
+ the client. In the code above, we introduced the Response object to carry an
+ error code and a description - it can also be used to carry arbitrary large
+ blocks of data.
+
+ Response *execute( char *command )
+ {
+ Response *response = NULL;
+ if ( !strcmp( command, "debug" ) )
+ {
+ response = new Response( 200, "Diagnostics output" );
+ for( int i = 0; unit( i ) != NULL; i ++ )
+ {
+ Properties *properties = unit( i );
+ stringstream output;
+ output << string( "Unit " ) << i << endl;
+ for ( int j = 0; j < properties->count( ); j ++ )
+ output << properties->get_name( j ) << " = " << properties->get( j ) << endl;
+ response->write( output.str( ).c_str( ) );
+ }
+ }
+ return response == NULL ? Miracle::execute( command ) : response;
+ }
+
+ Now when you connect to the server via a telnet session, you can access the
+ 'debug' command as follows:
+
+ $ telnet localhost 5290
+ Trying 127.0.0.1...
+ Connected to localhost (127.0.0.1).
+ Escape character is '^]'.
+ 100 VTR Ready
+ debug
+ 201 OK
+ Unit 0
+ unit = 0
+ generation = 0
+ constructor = sdl
+ id = sdl
+ arg =
+
+ Note that the '200' return code specified is automatically promoted to a 201
+ because of the multiple lines.
+
+ Alternatively, you can invoke response->write as many times as you like - each
+ string submitted is simply appended to the object in a similar way to writing
+ to a file or socket. Note that the client doesn't receive anything until the
+ response is returned from this method (ie: there's currently no support to
+ stream results back to the client).
+
+
+HANDLING PUSHED DOCUMENTS
+
+ The custom class receives PUSH'd westley either via the received or push
+ method.
+
+ The default handling is to simply append a pushed document on to the end of
+ first unit 0.
+
+ You can test this in the server defined above from the command line, for
+ example:
+
+ $ inigo noise: -consumer valerie:localhost:5290
+
+ By default, the 'push' method is used - this means that the xml document
+ received is automatically deserialised by the server itself and then offered
+ to the push method for handling - an example of this would be:
+
+ Response *push( char *command, Service *service )
+ {
+ Playlist playlist( ( mlt_playlist )( unit( 0 )->get_data( "playlist" ) ) );
+ Producer producer( *service );
+ if ( producer.is_valid( ) && playlist.is_valid( ) )
+ {
+ playlist.lock( );
+ playlist.clear( );
+ playlist.append( producer );
+ playlist.unlock( );
+ return new Response( 200, "OK" );
+ }
+ return new Response( 400, "Invalid" );
+ }
+
+ With this method, each service pushed into the server will automatically
+ replace whatever is currently playing.
+
+ Note that the 'received' method is not invoked by default - if you wish to
+ receive the XML document and carry out any additional processing prior to
+ processing, you should set the 'push-parser-off' property on the server to 1.
+ This can be done by placing the following line in your classes constructor:
+
+ set( "push-parser-off", 1 );
+
+ When this property is set, the received method is used instead of the push -
+ in this scenario, your implementation is responsible for all handling
+ of the document.
+
+ To simulate this, you can try the following method:
+
+ Response *received( char *command, char *document )
+ {
+ cerr << document;
+ Producer producer( "westley-xml", document );
+ return push( command, &producer );
+ }
+
+ When you push your videos in to the server via the inigo command above (or
+ from other tools, such as those in the shotcut suite), you will see the xml
+ in the servers stderr output. If you need to carry out some operations on the
+ xml document (such as replacing low quality videos used in the editing process
+ with their original) the received mechanism is the one that you would want to
+ use.
+
+
+OTHER MANIPULATIONS
+
+ What you do with the received MLT Service is largely up to you. As shown above,
+ you have flexibility in how the item is scheduled and you can carry out
+ manipulations on either the xml document and/or the deserialised producer.
+
+ Typically, shotcut and inigo produce 'tractor' objects - these can be easily
+ manipulated in the push method - for example, to remove a track from the
+ output, we could do something like:
+
+ Response *push( char *command, Service *service )
+ {
+ Playlist playlist( ( mlt_playlist )( unit( 0 )->get_data( "playlist" ) ) );
+ Tractor *tractor( *service );
+ if ( tractor.is_valid( ) && playlist.is_valid( ) )
+ {
+ // Remove track 2 (NB: tracks are indexed from 0 like everything else)
+ Producer *producer = tractor.track( 2 );
+ Playlist track( producer );
+
+ // If we have a valid track then hide video and audio
+ // This is a bit pattern - 1 is video, 2 is audio
+ if ( track.is_valid( ) )
+ track.set( "hide", 3 );
+
+ // You need to delete the reference to the playlist producer here
+ delete producer;
+
+ // Play it
+ playlist.lock( );
+ playlist.clear( );
+ playlist.append( producer );
+ playlist.unlock( );
+ return new Response( 200, "OK" );
+ }
+ return new Response( 400, "Invalid" );
+ }
+
+
+EVENT HANDLING
+
+ The MLT framework generates events which your custom server can use to do
+ various runtime manipulations. For the purpose of this document, I'll focus
+ on 'consumer-frame-render' - this event is fired immediately before a frame
+ is rendered.
+
+ See example in test/server.cpp
+
+
+DISABLING DVCP
+
+ In some cases, it is desirable to fully disable the entire DVCP command set
+ and handle the PUSH in an application specific way (for example, the shotcut
+ applications all do this). The simplest way of doing this is to generate a
+ response that signifies the rejection of the command. In this example, the
+ 'shutdown' command is also handled:
+
+ Response *execute( char *command )
+ {
+ if ( !strcmp( command, "shutdown" ) )
+ exit( 0 );
+ return new Response( 400, "Invalid Command" );
+ }
+
+ If you use this method in the code above, your server does nothing - no units
+ are defined, so even a PUSH will be rejected.
+
+
+
--- /dev/null
+2009-04-10 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * test/play.cpp, test/server.cpp: cleanup some warnings
+
+ * src/MltResponse.cpp, src/MltResponse.h: const update for MltResponse
+
+ * src/MltResponse.cpp, src/MltResponse.h: Constness changes
+
+ * src/MltTransition.cpp, src/MltTransition.h: Constness changes
+
+ * src/MltProducer.cpp, src/MltProducer.h: Constness changes
+
+ * src/MltProperties.cpp, src/MltProperties.h: Constness changes
+
+ * src/MltConsumer.cpp, src/MltConsumer.h: Constness changes
+
+ * src/MltProperties.cpp, src/MltResponse.cpp: Constness changes
+
+ * src/MltProperties.cpp, src/MltPushConsumer.cpp: Constness changes
+
+ * src/MltFilter.cpp, src/MltFilter.h, src/MltProperties.cpp,
+ src/MltProperties.h: Constness changes
+
+ * src/MltConsumer.cpp, src/MltField.cpp, src/MltFilter.cpp, src/MltFrame.cpp,
+ src/MltMultitrack.cpp, src/MltPlaylist.cpp, src/MltProducer.cpp,
+ src/MltTractor.cpp, src/MltTransition.cpp: Fix up warnings about explicit
+ base initializers in copy constructors
+
+ * configure: Add more warnings
+
+ * .gitignore: Add a .gitignore file
+
+2009-04-02 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * swig/ruby/thumbs.rb: thumbs.rb: fix setting size property for avformat
+ consumer
+
+2009-02-04 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * debian/changelog, debian/control, debian/copyright, debian/rules: remove
+ debian package subdirectory (they provide their own)
+
+2009-01-26 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * swig/configure, swig/php/build, swig/php/play.php: swig/configure,
+ swig/php/*: add php bindings
+
+2008-12-28 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * swig/java/build, swig/python/build, swig/python/play.py, swig/tcl/build:
+ swig/{java,python,tcl}/build: fix linking error __stack_chk_fail_local.
+ swig/python/play.py: fix syntax error reported by Jonathon Thomas.
+
+2008-12-27 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * swig/configure: swig/configure: use pkg-config mlt-framework instead of
+ deprecated mlt-config.
+
+2008-12-04 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * README: README: update instructions to use pkg-config instead of mlt-config
+
+ * swig/java/build, swig/perl/Makefile.PL, swig/python/build, swig/ruby/build,
+ swig/tcl/build, test/Makefile: test/Makefile, swig/*/build: replace more
+ mlt-config with pkg-config
+
+2008-11-06 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/Makefile: src/Makefile: suppress warning on ldconfig failure
+
+2008-10-25 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * configure: configure: apply patch from Alberto Villa to fix build on
+ FreeBSD
+
+2008-10-20 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * configure: configure: convert to use pkg-config; mlt-config is deprecated
+
+2008-08-06 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * AUTHORS: update mlt++ AUTHORS
+
+ * Makefile: fix make dist target
+
+ * configure: bump versions for 0.3.0 release
+
+ * Makefile: improve make dist target
+
+ * swig/java/Play.java, swig/java/Play.sh, swig/java/build: swig/java: fixup
+ the java bindings build script and example (bug 1523941)
+
+2008-06-26 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltProducer.cpp, src/MltProducer.h, swig/mltpp.i: MltProducer.{h,cpp},
+ mltpp.i: remove Producer::get_frame that is unncessary and introduced a
+ memory leak.
+
+2008-06-24 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltPlaylist.cpp: MltPlaylist.cpp: return null on clip_info method if
+ mlt_playlist_get_clip_info fails.
+
+2008-06-08 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltPlaylist.cpp: MltPlaylist.cpp: prevent strdup from crashing on a
+ null pointer.
+
+2008-04-23 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltProducer.cpp, src/MltProducer.h, swig/mltpp.i: MltProducer.{h,cpp},
+ swig/mltpp.i: add method Producer::get_frame.
+
+2008-04-12 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * test/server.cpp: test/server.cpp: bugfix (1940389) compilation on gcc 4.3
+
+2008-02-27 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltRepository.cpp, src/MltRepository.h: MltRepository.{h,cpp}: update
+ to latest mlt_repository.h change - finalization of callback declarations and
+ metadata handling
+
+2008-02-16 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * swig/python/build: swig/python/build: add -fPIC
+
+ * src/MltRepository.cpp, src/MltRepository.h, swig/mltpp.i:
+ MltRepository.{h,cpp}, swig/mltpp.i: added consumers, filters, producers,
+ transitions, register_metadata, and metadata methods to Repository class
+
+2008-02-12 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * Makefile: do not make tests automatically
+
+2008-02-07 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * configure, src/Makefile: configure: add soversion variable src/Makefile:
+ improve library versioning by linking on interface version (soversion)
+
+ * swig/ruby/thumbs.rb: thumbs.rb: fix error on Playlist.append due to args
+ not int
+
+ * src/Makefile, src/Mlt.h, src/MltFactory.cpp, src/MltFactory.h,
+ src/MltRepository.cpp, src/MltRepository.h, swig/mltpp.i: Mlt.h,
+ MltFactory.{h,cpp}, MltRepository.{h,cpp}, swig/mltpp.i: update to deal with
+ changes and new capabilities in mlt_factory and mlt_repository.
+
+2008-02-04 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * COPYING: add COPYING to disclose license
+
+2008-02-02 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/Makefile, src/Mlt.h, src/MltConsumer.cpp, src/MltConsumer.h,
+ src/MltFactory.cpp, src/MltFactory.h, src/MltFilter.cpp, src/MltFilter.h,
+ src/MltFilteredConsumer.cpp, src/MltFilteredConsumer.h,
+ src/MltFilteredProducer.cpp, src/MltFilteredProducer.h, src/MltProducer.cpp,
+ src/MltProducer.h, src/MltProfile.cpp, src/MltProfile.h,
+ src/MltPushConsumer.cpp, src/MltPushConsumer.h, src/MltService.cpp,
+ src/MltService.h, src/MltTractor.cpp, src/MltTractor.h,
+ src/MltTransition.cpp, src/MltTransition.h, swig/mltpp.i, swig/perl/play.pl,
+ swig/python/play.py, swig/ruby/miracle.rb, swig/ruby/play.rb,
+ swig/ruby/thumbs.rb, swig/tcl/play.tcl, test/play.cpp, test/server.cpp: add
+ MltProfile and update examples
+
+2007-06-12 ddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * Makefile: added dist make targets
+
+ * Makefile, src/Makefile, test/Makefile: added uninstall make targets
+
+2006-03-20 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltFactory.h: + Fix for swig parsing
+
+2006-02-23 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/Makefile: + Install of config.h for linux and os/x usage
+
+ * src/config.h: + Added the config.h for win32
+
+ * mlt++.sln, mlt++.vcproj, src/Mlt.h, src/MltConsumer.h, src/MltDeque.h,
+ src/MltEvent.h, src/MltFactory.cpp, src/MltFactory.h, src/MltField.h,
+ src/MltFilter.h, src/MltFilteredConsumer.h, src/MltFilteredProducer.h,
+ src/MltFrame.cpp, src/MltFrame.h, src/MltGeometry.h, src/MltMultitrack.h,
+ src/MltParser.h, src/MltPlaylist.cpp, src/MltPlaylist.h, src/MltProducer.cpp,
+ src/MltProducer.h, src/MltProperties.cpp, src/MltProperties.h,
+ src/MltPushConsumer.h, src/MltService.h, src/MltTokeniser.h,
+ src/MltTractor.h, src/MltTransition.h: + Win32 port - dev studio is required
+ to avoid issues with C++ ABI compatibility + Fix for image render in NTSC
+ NB: mlt patch to follow (this one isn't much use without it :-)) - mlt build
+ is purely mingw32 of course
+
+2005-12-05 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * configure, src/Makefile: + Fix for Darwin and soname logic
+
+ * debian/changelog, debian/control, debian/copyright, debian/rules: +
+ Functional debian build rules
+
+ * Makefile, configure, src/Makefile, test/Makefile: + MLT++ updates for 0.2.1
+ - distclean corrected, soname usage in linking
+
+2005-11-29 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * Makefile, configure: + Correction to a typo
+
+ * swig/perl/Makefile.PL: + Perl compilation patch submitted by Torsten
+ Spindler
+
+ * configure, src/Makefile: + Added a --libdir switch to the configure and
+ build and fixed test case compilation
+
+2005-11-22 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * configure: + Allow LDFLAGS to be inherited from the environment
+
+2005-11-21 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/Makefile: + Creates the lib directory on an install
+
+2005-11-10 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * Makefile, src/Makefile: + DESTDIR patch from Anthony Green (green at redhat
+ dot com) - many thanks :-)
+
+2005-10-03 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltProperties.cpp, src/MltProperties.h: OS/X gcc/g++ 4.x fix
+
+ * configure, src/Makefile, src/MltProperties.cpp, src/MltProperties.h,
+ test/Makefile: + Whoops - had forgotten these OS/X patches...
+
+2005-09-29 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltPushConsumer.cpp: + Oops - fix for memory leak
+
+2005-09-28 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/Makefile, src/Mlt.h, src/MltPushConsumer.cpp, src/MltPushConsumer.h: +
+ Added a push based consumer wrapper
+
+2005-07-26 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * swig/Makefile, swig/configure, swig/perl/Makefile.PL, swig/python/build,
+ swig/tcl/build: + Cleaned up swig build so it doesn't require an mlt++
+ install first - Temporarily disabled java
+
+2005-06-27 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * CUSTOMISING, test/server.cpp: CUSTOMISING + Replaced TBD for frame
+ rendering notification event test/server.cpp + Added an example frame
+ rendering callback that removes all shotcut related fx
+
+2005-06-26 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * CUSTOMISING, swig/ruby/thumbs.rb: CUSTOMISING + Added an example of how to
+ hide a track on reception swig/ruby/thumbs.rb + Changed generator to run,
+ rather than sleep and poll
+
+2005-04-12 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * CUSTOMISING: Minor doc updates
+
+2005-03-16 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * CUSTOMISING, src/MltProperties.cpp, src/MltProperties.h,
+ src/MltResponse.cpp, src/MltResponse.h, test/server.cpp: Server customisation
+
+
+2005-02-12 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltService.cpp: Minor correction
+
+2005-01-14 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltProperties.cpp, src/MltProperties.h: Const string usage in
+ properties
+
+2005-01-03 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltGeometry.cpp, src/MltGeometry.h: Next/Prev key extraction
+
+ * src/MltMiracle.cpp, src/MltMiracle.h, swig/mltpp.i: Fetch unit from miracle
+ server
+
+2004-12-31 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltGeometry.h: Update for geometry
+
+2004-12-24 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/Makefile, src/Mlt.h, src/MltGeometry.cpp, src/MltGeometry.h,
+ swig/mltpp.i: Geometry
+
+2004-12-12 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltPlaylist.cpp, src/MltPlaylist.h: blank_at method added
+
+2004-12-11 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltPlaylist.cpp, src/MltPlaylist.h: split_at method added
+
+2004-12-09 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltTractor.cpp, src/MltTractor.h: Tractor constructor modifications
+
+2004-11-25 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * swig/Makefile: Install makefile for swig
+
+ * src/Makefile, src/Mlt.h, src/MltDeque.cpp, src/MltDeque.h,
+ src/MltFactory.cpp, src/MltFactory.h, src/MltProducer.cpp, src/MltProducer.h,
+ src/MltTransition.cpp, src/MltTransition.h: Deque added; simplified producer
+ parent access; transition in and out
+
+2004-11-22 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltPlaylist.cpp, src/MltPlaylist.h, src/MltProducer.cpp,
+ src/MltProducer.h, src/MltProperties.cpp, src/MltService.cpp,
+ src/MltService.h, test/Makefile: More playlist modifications; service locking
+
+
+2004-11-17 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltProperties.cpp, src/MltProperties.h, src/MltTractor.cpp,
+ src/MltTractor.h: Ref count and event firing method on properties; locate_cut
+ on tractor
+
+2004-11-11 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltPlaylist.cpp, src/MltPlaylist.h, src/MltProducer.cpp,
+ src/MltProducer.h, src/MltProperties.cpp, src/MltProperties.h,
+ src/MltTractor.cpp, src/MltTractor.h: Playlist reorganisation
+
+2004-11-07 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltPlaylist.cpp, src/MltPlaylist.h, src/MltTractor.cpp,
+ src/MltTractor.h: Simplified playlist and track access
+
+2004-11-05 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltProducer.cpp, src/MltProducer.h: Added cut related methods
+
+2004-10-31 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/Makefile, src/Mlt.h, src/MltTokeniser.cpp, src/MltTokeniser.h,
+ test/server.cpp: Added courtesy tokenising class
+
+2004-10-27 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * configure, swig/configure, swig/ruby/build, swig/ruby/miracle.rb: Config
+ changes
+
+2004-10-17 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltMiracle.cpp, src/MltMiracle.h: id and log level for server
+
+ * src/MltMiracle.cpp: Server shutdown state
+
+2004-10-14 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltConsumer.cpp, src/MltConsumer.h, test/play.cpp: buffer fix and
+ tractor handling
+
+ * HOWTO: Doc updates
+
+ * src/MltMiracle.cpp, src/MltMiracle.h: Improved push capabilities
+
+2004-10-08 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltProducer.cpp, src/MltProducer.h: Same and following clip
+ identification
+
+2004-10-05 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/Makefile, src/Mlt.h, src/MltFrame.cpp, src/MltFrame.h,
+ src/MltParser.cpp, src/MltParser.h, src/MltService.cpp, src/MltService.h,
+ swig/mltpp.i: Added the parser object and moved type identity into mlt
+
+2004-09-29 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltPlaylist.cpp, src/MltPlaylist.h, swig/mltpp.i: new mix related
+ methods
+
+2004-09-26 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * README, src/MltPlaylist.cpp, src/MltPlaylist.h: Playlist repeat clip
+ functionality
+
+2004-09-24 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltProducer.cpp, src/MltProducer.h, swig/mltpp.i: Cut management part 1
+
+
+2004-09-23 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltService.cpp, swig/mltpp.i: get_frame and ruby listen fix
+
+2004-09-22 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltFrame.cpp, src/MltProperties.cpp, src/MltProperties.h, swig/mltpp.i:
+ Event and frame handling
+
+ * configure, src/MltMiracle.cpp: Server shutdown
+
+2004-09-19 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/Makefile, src/Mlt.h, src/MltMiracle.cpp, src/MltMiracle.h,
+ src/MltResponse.cpp, src/MltResponse.h, swig/mltpp.i: Added the response
+ object
+
+ * HOWTO, src/Makefile, src/Mlt.h, src/MltMiracle.cpp, src/MltMiracle.h,
+ swig/mltpp.i, swig/ruby/miracle.rb, test/Makefile, test/play.cpp,
+ test/server.cpp: Adding miracle
+
+2004-09-09 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltPlaylist.cpp, src/MltPlaylist.h: Adding the mix part 1
+
+2004-09-06 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltFilteredConsumer.cpp, src/MltFilteredConsumer.h,
+ src/MltProducer.cpp, src/MltProducer.h, src/MltService.cpp, src/MltService.h,
+ swig/mltpp.i: Service attach filters
+
+2004-09-03 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * HOWTO, src/MltProperties.cpp, src/MltProperties.h, swig/mltpp.i,
+ swig/perl/play.pl: More event stuff
+
+2004-09-02 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/Makefile, src/Mlt.h, src/MltEvent.cpp, src/MltEvent.h,
+ src/MltProperties.cpp, src/MltProperties.h, swig/mltpp.i, swig/ruby/play.rb,
+ test/play.cpp: Event modifications
+
+2004-08-31 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * HOWTO, src/Makefile, src/MltConsumer.cpp, src/MltConsumer.h,
+ src/MltFilter.cpp, src/MltFilter.h, src/MltFrame.cpp, src/MltFrame.h,
+ src/MltMultitrack.cpp, src/MltMultitrack.h, src/MltPlaylist.cpp,
+ src/MltPlaylist.h, src/MltProducer.cpp, src/MltProducer.h,
+ src/MltService.cpp, src/MltService.h, src/MltTractor.cpp, src/MltTractor.h,
+ src/MltTransition.cpp, src/MltTransition.h: Run time type identification
+
+2004-08-28 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * README, src/MltMultitrack.cpp, src/MltMultitrack.h, src/MltTractor.cpp,
+ src/MltTractor.h, swig/mltpp.i: Tractor enhancements
+
+ * src/Makefile, src/Mlt.h, src/MltField.cpp, src/MltField.h,
+ src/MltMultitrack.cpp, src/MltMultitrack.h, src/MltTractor.cpp,
+ src/MltTractor.h, swig/mltpp.i: Multitrack classes added
+
+ * src/MltPlaylist.cpp, src/MltPlaylist.h, src/MltProducer.cpp,
+ src/MltProducer.h, swig/mltpp.i: Producer filter extraction method
+
+2004-08-27 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/Makefile, src/Mlt.h, src/MltFilteredProducer.cpp,
+ src/MltFilteredProducer.h, src/MltProducer.cpp, src/MltProducer.h,
+ src/MltService.cpp, src/MltService.h, swig/mltpp.i: Removed FilteredProducer
+
+2004-08-26 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * Makefile, test/Makefile, test/play.cpp: Build modifications
+
+ * src/MltConsumer.cpp, src/MltConsumer.h, src/MltFilter.cpp, src/MltFilter.h,
+ src/MltFilteredConsumer.cpp, src/MltFilteredConsumer.h, src/MltFrame.cpp,
+ src/MltFrame.h, src/MltPlaylist.cpp, src/MltPlaylist.h, src/MltProducer.cpp,
+ src/MltProducer.h, src/MltProperties.cpp, src/MltProperties.h,
+ src/MltService.cpp, src/MltService.h, src/MltTransition.cpp,
+ src/MltTransition.h, swig/perl/play.pl: Mlt Ref Counts and Playlist
+ split/join
+
+2004-08-23 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * swig/perl/play.pl: Added play.pl
+
+ * src/Makefile, swig/mltpp.i: Workaround for perl
+
+2004-08-21 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltConsumer.cpp, src/MltFilter.cpp, src/MltProperties.cpp,
+ src/MltProperties.h, src/MltTransition.cpp: Constructor clean up
+
+ * src/MltConsumer.cpp, src/MltConsumer.h: consumer purge
+
+2004-08-20 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltFilter.cpp, src/MltFilter.h, src/MltPlaylist.cpp, src/MltPlaylist.h,
+ swig/configure, swig/java/build, swig/ruby/build, swig/ruby/thumbs.rb:
+ mlt_position, /usr/bin/env and Instance fix
+
+2004-08-18 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/MltFrame.cpp, src/MltFrame.h, src/MltProducer.cpp, src/MltProducer.h,
+ src/MltService.cpp, swig/mltpp.i, swig/ruby/play.rb: image handling
+
+2004-08-17 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * swig/java/Play.java, swig/ruby/play.rb, swig/ruby/thumbs.rb: Fixes for mods
+ to api
+
+ * src/Makefile, src/Mlt.h, src/MltConsumer.cpp, src/MltConsumer.h,
+ src/MltFilteredConsumer.cpp, src/MltFilteredConsumer.h,
+ src/MltFilteredProducer.cpp, src/MltFilteredProducer.h, src/MltService.cpp,
+ src/MltService.h, swig/mltpp.i: Filtered producers and consumers
+
+ * test/play.cpp: oops
+
+2004-08-16 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * swig/configure, swig/java/Play.java, swig/java/Play.sh, swig/java/build,
+ swig/mltpp.i, swig/perl/Makefile.PL, swig/perl/build, swig/python/build,
+ swig/python/play.py, swig/ruby/build, swig/ruby/play.rb, swig/ruby/thumbs.rb,
+ swig/tcl/build, swig/tcl/play.tcl: Experimental swig bindings
+
+ * README, src/MltFactory.cpp, src/MltFactory.h, src/MltFilter.cpp,
+ src/MltPlaylist.cpp, src/MltPlaylist.h, src/MltProducer.cpp,
+ src/MltProperties.cpp, src/MltProperties.h, src/MltService.cpp,
+ src/MltService.h, src/MltTransition.cpp, test/Makefile: More cleanups
+
+ * README, src/MltConsumer.cpp, src/MltConsumer.h, src/MltFactory.cpp,
+ src/MltFactory.h, src/MltFilter.cpp, src/MltFilter.h, src/MltFrame.cpp,
+ src/MltFrame.h, src/MltPlaylist.cpp, src/MltPlaylist.h, src/MltProducer.cpp,
+ src/MltProducer.h, src/MltProperties.cpp, src/MltProperties.h,
+ src/MltService.cpp, src/MltService.h, src/MltTransition.cpp,
+ src/MltTransition.h, test/play.cpp: Class rework and simplification
+
+ * src/Makefile, src/Mlt.h: Added Mlt.h convenience header
+
+ * src/MltPlaylist.cpp, src/MltPlaylist.h, src/MltProperties.cpp,
+ src/MltProperties.h, src/MltService.cpp: Complete methods for properties and
+ playlist; reversed NULL handling on service class
+
+ * README, src/MltProperties.cpp, src/MltProperties.h, test/play.cpp: Object
+ validity checks
+
+ * AUTHORS, Makefile, README, configure, src/Makefile, src/MltService.cpp,
+ test/play.cpp: Build and docs modifications
+
+2004-08-15 lilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
+
+ * src/Makefile, src/MltConsumer.cpp, src/MltConsumer.h, src/MltFactory.cpp,
+ src/MltFactory.h, src/MltFilter.cpp, src/MltFilter.h, src/MltFrame.cpp,
+ src/MltFrame.h, src/MltPlaylist.cpp, src/MltPlaylist.h, src/MltProducer.cpp,
+ src/MltProducer.h, src/MltProperties.cpp, src/MltProperties.h,
+ src/MltService.cpp, src/MltService.h, src/MltTransition.cpp,
+ src/MltTransition.h, test/Makefile, test/play.cpp: Initial revision
--- /dev/null
+INTRODUCTION
+------------
+
+ This document provides a brief tutorial on the use of the mlt++ wrapper
+ and bindings.
+
+
+Hello World
+-----------
+
+ The mlt++ wrapper is a c++ wrapper for the mlt C library. As such, it
+ provides clean C++ access to the underlying library.
+
+ An example of use is as follows:
+
+ #include <mlt++/Mlt.h>
+ using namespace Mlt;
+
+ int main( void )
+ {
+ Factory::init( );
+ Producer p( "pango:", "Hello World" );
+ Consumer c( "sdl" );
+ c.connect( p );
+ c.run( );
+ return 0;
+ }
+
+ This is a fairly typical example of mlt++ usage - create a 'producer' (an
+ object which produces 'frames'), create a 'consumer' (an object which consumes
+ frames), connect them together, start the consumer and wait until done (here
+ we just wait for the user to close the window).
+
+ In this case, we construct a window as a consumer using the 'sdl' consumer
+ (SDL is a standard portable library which provides platform independent
+ access to accelerated video display and audio) and use the 'pango'
+ producer to generate frames with the words 'Hello World' (pango is a
+ library from the gtk toolkit).
+
+ The main point of this example is to show that mlt uses existing libraries
+ to provide its functionality - this keeps the framework itself very small.
+
+ Note that mlt is designed to be housed in GUI or server type applications -
+ typically, applications don't wait around for the consumer to be stopped in
+ the manner shown.
+
+ So far, we've introduced the Producer and Consumer mlt classes. We'll cover
+ each of these in more detail later in the tutorial, but for now, we'll
+ briefly cover the remaining classes.
+
+
+Playlists
+---------
+
+ Another simple class is the Playlist - this is direct extension of Producer
+ and it allows you to maintain a list of producer objects.
+
+ As a simple example of the Playlist in action, we'll convert the example
+ above into an application which plays multiple video or audio files.
+
+ #include <mlt++/Mlt.h>
+ using namespace Mlt;
+
+ int main( int argc, char **argv )
+ {
+ Factory::init( );
+ Playlist list;
+ for ( int i = 1; i < argc; i ++ )
+ {
+ Producer p( argv[i] );
+ if ( p.is_valid( ) )
+ list.append( p );
+ }
+ Consumer c( "sdl" );
+ c.connect( list );
+ c.run( );
+ return 0;
+ }
+
+ Now you can run the program as:
+
+ ./player *.avi *.mp3 *.jpg etc
+
+ In this case, we construct a playlist by simply appending producers to it.
+ Notice that although the scope of the Producer is limited to the inner
+ for loop, we can safely add it to the playlist - this is due to the fact
+ that all mlt objects maintain reference counts and no object is really
+ destroyed until all the references are gone. In this case, when the list
+ object goes out of scope, all the producers we created will automatically
+ be destroyed.
+
+
+Filters
+-------
+
+ So far, we've shown how you can load and play media. We've given a brief
+ intro to the Playlist container, now it's time to start manipulating
+ things...
+
+ For the next example, I'll add a 'watermark' to the video - a watermark
+ is used by broadcasters to brand the channel and normally consists of a
+ logo of some sort. We'll just use some black text on a partially
+ transparent red background.
+
+ #include <mlt++/Mlt.h>
+ using namespace Mlt;
+
+ int main( int argc, char **argv )
+ {
+ Factory::init( );
+ Playlist list;
+ for ( int i = 1; i < argc; i ++ )
+ {
+ Producer p( argv[i] );
+ if ( p.is_valid( ) )
+ list.append( p );
+ }
+ Filter f( "watermark", "pango:" );
+ f.set( "producer.text", "MLT++" );
+ f.set( "producer.fgcolour", "0x000000ff" );
+ f.set( "producer.bgcolour", "0xff000080" );
+ list.attach( f );
+ Consumer c( "sdl" );
+ c.connect( list );
+ c.run( );
+ return 0;
+ }
+
+ Notice that the watermark filter reuses the 'pango' producer we showed in the
+ first example. In fact, you could use any producer here - if you wanted to
+ use a graphic or a video, you would just construct the filter with a full path
+ to that as the second argument.
+
+ We manipulate the filter using the set method - this method was also shown
+ in the first example.
+
+ Finally, we attach the filter to the playlist. This ensure that all frames
+ that are obtained from the playlist are watermarked.
+
+
+Cuts
+----
+
+ When you add a clip to a playlist, the a cut object is created - this is merely a
+ wrapper for the producer, spanning the specified in and out points.
+
+ Whenever you retrieve a clip from a playlist, you will always get a cut object.
+ This allows you to attach filters to a specific part of a producer and should
+ the position of the cut in the playlist change, then the filter will remain
+ correctly associated to it.
+
+ A producer and a cut are generally identical in behaviour, but should you need to
+ distinguish between them, you can use:
+
+ if ( producer.is_cut( ) )
+
+ and to retrieve the parent of a cut, you can use:
+
+ Producer parent = producer.parent_cut( );
+
+ Filters that are attached directly to a parent are executed before any filters
+ attached to the cut.
+
+
+Tractor
+-------
+
+ A tractor is an object that allows the manipulation of multiple video and audio
+ tracks.
+
+ Stepping away from the player example we've been tinkering with for a minute,
+ let's assume we want to do something like dub a video with some audio. This
+ a very trivial thing to do:
+
+ Tractor *dub( char *video_file, char *audio_file )
+ {
+ Tractor *tractor = new Tractor( );
+ Producer video( video_file );
+ Producer audio( audio_file );
+ tractor->set_track( video, 0 );
+ tractor->set_track( audio, 1 );
+ return tractor;
+ }
+
+ That's all that needs to be done - you can now connect the returned object to a
+ consumer, or add it to a playlist, or even apply it as a track to another tractor.
+
+
+Transition
+----------
+
+ Let's now assume we want to mix the audio between two tracks - to do this, we
+ need to introduce the concept of a transition. A transition in mlt is a service
+ which combines frames from two producers to produce a new frame.
+
+ Tractor *mix( char *video_file, char *audio_file )
+ {
+ Tractor *tractor = new Tractor( );
+ Transition mix( "mix" );
+ Producer video( video_file );
+ Producer audio( audio_file );
+ tractor.set_track( video, 0 );
+ tractor.set_track( audio, 1 );
+ tractor.field.plant_transition( mix, 0, 1 );
+ return tractor;
+ }
+
+ The tractor returned will now mix the audio from the original video and the
+ audio.
+
+
+Mix
+---
+
+ There is a convenience function which simplifies the process of applying
+ transitions betwee adjacent cuts on a playlist. This is often preferable
+ to use over the constuction of your own tractor and transition set up.
+
+ To apply a 25 frame luma transition between the first and second cut on
+ the playlist, you could use:
+
+ Transition luma;
+ playlist.mix( 0, 25, luma );
+
+
+Events
+------
+
+ Typically, applications need to be informed when changes occur in an mlt++ object.
+ This facilitates application services such as undo/redo management, or project
+ rendering in a timeline type widget and many other types of operations which an
+ application needs.
+
+ As an example, consider the following:
+
+ class Westley
+ {
+ private:
+ Consumer consumer;
+ Tractor &tractor;
+ public:
+ Westley( MltTractor &tractor ) :
+ tractor( tractor ),
+ consumer( "westley" )
+ {
+ consumer.connect( tractor );
+ tractor.listen( tractor, "producer-changed",
+ ( mlt_listener )Westley::listener );
+ }
+
+ static void listener( Properties *tractor, Westley *object )
+ {
+ object->activate( );
+ }
+
+ void activate( )
+ {
+ consumer.start( );
+ }
+ };
+
+ Now, each time the tractor is changed, the westley representation is output to
+ stderr.
+
+
+Servers and Westley Docs
+------------------------
+
+ One of the key features of MLT is its server capabilities. This feature
+ allows you to pass westley documents seamlessly from one process to
+ another and even to different computers on your network.
+
+ The miracle playout server is one such example of an application which
+ uses this functionality - you can build your own servers into your own
+ processes with ease.
+
+ A server process would be running as follows:
+
+ #include <mlt++/Miracle>
+ using namespace Mlt;
+
+ int main( void )
+ {
+ Miracle miracle( "miracle", 5250 );
+ miracle.start( );
+ miracle.execute( "uadd sdl" );
+ miracle.execute( "play u0" );
+ miracle.wait_for_shutdown( );
+ return 0;
+ }
+
+ Typically, when you have an MLT object such as a producer or a playlist,
+ you can send a westley representation of this to a running server with:
+
+ Conumser valerie( "valerie", "localhost:5250" );
+ valerie.connect( producer );
+ valerie.start( );
+
+ The effect of the push will be to append the producer on to the first
+ unit (u0).
+
+ You can completely customise the miracle server - an example of this
+ is shown below.
+
+
+That's All Folks...
+-------------------
+
+ And that, believe it or not, is a fairly complete summary of the classes you'll
+ typically be interfacing with in mlt++. Obviously, there's a little more to it
+ than this - a couple of intrisinc classes have been glossed over (notably, the
+ Properties and Service base classes). The next section will cover all of the
+ above, but in much more detail...
+
+
+DIGGING DEEPER
+--------------
+
+ The previous section was designed to give you a whistle stop tour through the major
+ framework classes. This section will take you through the scenic route.
+
+
+Introducing Base Classes
+------------------------
+
+ Services in mlt are the collective noun for Producers, Filters, Transitions and
+ Consumer. A Service is also the base class from which all of these classes
+ extend. It provides the basic connectivity which has been shown throughout the
+ examples in the previous section.
+
+ Properties are the main way in which we communicate with the Services -
+ essentially, it provides get/set methods for named values. All services extend
+ Properties.
+
+
+Properties
+----------
+
+ Properties provide the general mechanism for communicating with Services -
+ through the Properties interface, we are able to manipulate and serialise
+ a services state.
+
+ For example, to dump all the properties to stdout, you can use something
+ like:
+
+ void dump( Properties &properties )
+ {
+ for ( int i = 0; i < properties.count( ); i ++ )
+ cout << Properties.get_name( i ) << " = " << Properties.get( i ) << endl;
+ }
+
+ Note that the properties object handles type conversion, so the following
+ is acceptable:
+
+ properties.set( "hello", "10.5" );
+ int hello_int = properties.get_int( "hello" );
+ double hello_double = properties.get_double( "hello" );
+
+ A couple of convenience methods are provide to examine or serialise property
+ objects.
+
+ For example:
+
+ properties.debug( );
+
+ will report all serialisable properties on stderr, in the form:
+
+ Object: [ ref=1, in=0, out=0, track=0, u=75, v=150, _unique_id=15,
+ mlt_type=filter, mlt_service=sepia ]
+
+
+Services
+--------
+
+ Typically, all the services are constructed via the specific classes
+ constructor. Often, you will receive Service objects rather than their
+ specific type. In order to access the extended classes interface,
+ you will need to create a reference.
+
+ For example, given an arbitrary Service object, you can determine its
+ type by using the type method - this will return a 'service_type' which
+ has values of producer_type, filter_type etc. Alternatively, you can
+ create a wrapping object and check on its validity.
+
+ bool do_we_have_a_producer( Service &service )
+ {
+ Producer producer( service );
+ return producer.is_valid( );
+ }
+
+
+Events
+------
+
+
+Servers and Westley Docs
+------------------------
+
+ For various reasons, you might want to serialise a producer to a string.
+ To do this, you just need to specify a property to write to:
+
+ Consumer westley( "westley", "buffer" );
+ westley.connect( producer );
+ westley.start( );
+ buffer = westley.get( "buffer" );
+
+ You can use any name you want, and you can change it using the "resource"
+ property. Any name with a '.' in it is considered to be a file. Hence, you
+ can use a westley consumer to store multiple instances of the same MLT
+ object - useful if you want to provide undo/redo capabilities in an
+ editing application.
+
+ Should you receive an xml document as a string, and you want to send it
+ on to a server, you can use:
+
+ Conumser valerie( "valerie", "localhost:5250" );
+ valerie.set( "westley", buffer );
+ valerie.start( );
+
+ If you need to obtain an MLT object from a string:
+
+ Producer producer( "westley-xml", buffer );
+
+ The following shows a working example of an extended server:
+
+ class ShotcutServer : public Miracle
+ {
+ public:
+ ShotcutServer( char *id, int port ) :
+ Miracle( id, port )
+ {
+ }
+
+ void set_receive_doc( bool doc )
+ {
+ set( "push-parser-off", doc );
+ }
+
+ // Reject all commands other than push/receive
+ Response *execute( char *command )
+ {
+ valerie_response response = valerie_response_init( );
+ valerie_response_set_error( response, 400, "Not OK" );
+ return new Response( response );
+ }
+
+ // Push document handler
+ Response *received( char *command, char *doc )
+ {
+ valerie_response response = valerie_response_init( );
+ // Use doc in some way and assign Response
+ if ( doc != NULL )
+ valerie_response_set_error( response, 200, "OK" );
+ return new Response( response );
+ }
+
+ // Push service handler
+ Response *push( char *command, Service *service )
+ {
+ valerie_response response = valerie_response_init( );
+ // Use service in some way and assign Response
+ if ( service != NULL )
+ valerie_response_set_error( response, 200, "OK" );
+ return new Response( response );
+ }
+ };
+
+ NB: Should you be incorporating this into a GUI application, remember that the
+ execute, received and push methods are invoked from a thread - make sure that
+ you honour the locking requirements of your GUI toolkit before interacting with
+ the UI.
+
+
--- /dev/null
+include config.mak
+
+all clean distclean install uninstall:
+ $(MAKE) DESTDIR=$(DESTDIR) -C src $@
+
+dist:
+ [ -d "mlt++-$(version)" ] && rm -rf "mlt++-$(version)" || echo -n
+ svn export http://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++ "mlt++-$(version)"
+ tar -cvzf "mlt++-$(version).tar.gz" "mlt++-$(version)"
--- /dev/null
+MLT++
+-----
+
+ This mlt sub-project provides a C++ wrapping for the MLT library.
+
+INSTALLATION
+------------
+
+ ./configure [ --prefix=path ]
+ make
+ make install
+
+USAGE
+-----
+
+ Use the following definitions in a Makefile to compile and link with mlt++:
+
+ CXXFLAGS=`pkg-config --cflags mlt-framework` -Wall
+ LDFLAGS=-lmlt++ `pkg-config --libs mlt-framework`
+
+ Include files for the classes can either be explicitly included, ie:
+
+ #include <mlt++/MltProducer.h>
+ etc
+
+ Or you can include all using:
+
+ #include <mlt++/Mlt.h>
+
+ All definitions are placed in an Mlt namespace, and adhere closely to the C
+ naming convention. Mappings always follow the pattern:
+
+ Factory methods:
+
+ mlt_factory_init ==> Mlt::Factory::init
+ mlt_factory_producer ==> Mlt::Factory::producer
+ mlt_factory_filter ==> Mlt::Factory::filter
+ mlt_factory_transition ==> Mlt::Factory::transition
+ mlt_factory_consumer ==> Mlt::Factory::consumer
+ mlt_factory_close ==> Mlt::Factory::close
+
+ NB: Factory usage for service construction is optional.
+
+ Types:
+
+ mlt_properties ==> Mlt::Properties
+ mlt_frame ==> Mlt::Frame
+ mlt_service ==> Mlt::Service
+ mlt_producer ==> Mlt::Producer
+ mlt_filter ==> Mlt::Filter
+ mlt_transition ==> Mlt::Transition
+ mlt_consumer ==> Mlt::Consumer
+
+ Methods:
+
+ mlt_type_method ==> Mlt::Type.method
+ ie: mlt_playlist_append ==> Mlt::Playlist.append
+
+ Parent methods are available directly on children.
+
+ Additionally, you can specify:
+
+ using namespace Mlt;
+
+ To avoid the enforced use of the Mlt:: prefix.
+
+ Enumerators and macros are reused directly from the C library.
+
+CLASS HIERARCHY
+---------------
+
+ The currently mapped objects are shown in the following hierarchy:
+
+ Factory
+ Properties
+ Frame
+ Service
+ Consumer
+ Field
+ Filter
+ Multitrack
+ Producer
+ Playlist
+ Tractor
+ Transition
+
+ An additional set of classes allow apps to behave as, and communicate with,
+ client/server components - these components provide MLT with unique
+ possibilties for process to process or system to system communications.
+
+ Miracle
+ Response
+
+SPECIAL CASES
+-------------
+
+ Care should be taken with wrapper objects.
+
+ Taking, as an example, the C function that returns the immediate consumer of
+ a service:
+
+ mlt_service mlt_service_consumer( mlt_service );
+
+ This maps to:
+
+ Mlt::Service *Mlt::Service.consumer( );
+
+ Note that you get an object back - it is never the original c++ object, but
+ a wrapping object. This is done to keep consistency with the C api which may
+ instantiate C instances - therefore it cannot be assumed that a C++ object
+ exists for all mlt service instances.
+
+ As such, it is mandatory that you delete these objects. The original will
+ not be affected. However, all other modifications (to properties or its
+ state of connection) will be reflected in the original object.
+
+ This approach excludes the use of RTTI to determine the real type of the
+ object - this can only be done by parsing the objects properties.
+
+ Objects may be invalid - always use the is_valid method to check validity
+ before use.
+
+LIMITATIONS
+-----------
+
+ The mechanisms for the definition of new services are deliberately
+ excluded from the C++ wrappings - this is done to ensure that service
+ networks constructed can be serialised and used by existing applications
+ which are based on the C API (such as miracle).
+
+SWIG
+----
+
+ Experimental swig bindings based on mlt++ are provided.
+
--- /dev/null
+#!/bin/sh
+
+pkg-config mlt-framework 2>/dev/null
+[ $? != 0 ] && echo "MLT not installed - aborting" && exit 1
+
+# Determine default prefix
+prefix=`pkg-config --variable=prefix mlt-framework`
+[ "$prefix" = "" ] && echo "Can't locate MLT's prefix - please reconfigure MLT." && exit 1
+
+# Default the libdir
+libdir=""
+
+# Allow override from command line
+for i in "$@"
+do
+ case $i in
+ --prefix=* ) prefix="${i#--prefix=}" ;;
+ --libdir=* ) libdir="${i#--libdir=}" ;;
+ esac
+done
+
+# Determine the libdir if it's not specified in the args
+[ "$libdir" = "" ] && libdir=$prefix/lib
+
+# Sanity check
+[ ! -d "$prefix" ] && echo "Invalid prefix $prefix - aborting" && exit 1
+
+echo "version=`pkg-config --modversion mlt-framework`" > config.mak
+echo "soversion=1" >> config.mak
+echo "prefix=$prefix" >> config.mak
+echo "libdir=$libdir" >> config.mak
+
+targetos=$(uname -s)
+echo "targetos=$targetos" >> config.mak
+
+WARNINGS="-W -Wwrite-strings -Wcast-qual -Wpointer-arith -Wcast-align -Wredundant-decls"
+
+case $targetos in
+ Darwin)
+ echo LIBSUF=.dylib
+ echo "CXXFLAGS+=-D__DARWIN__ -Wall -fPIC `pkg-config --cflags mlt-framework`"
+ echo "LIBFLAGS=-dynamiclib -single_module"
+ echo "LDFLAGS+=`pkg-config --libs mlt-framework` `pkg-config mlt-miracle --libs` `pkg-config mlt-valerie --libs`"
+ ;;
+ Linux|FreeBSD)
+ echo LIBSUF=.so
+ echo "CXXFLAGS+=-pthread -Wall $WARNINGS -fPIC `pkg-config --cflags mlt-framework`"
+ echo "LIBFLAGS=-shared"
+ echo "LDFLAGS+=`pkg-config --libs mlt-framework` `pkg-config mlt-miracle --libs`"
+ ;;
+esac >> config.mak
+
+echo "MLT++ configured - will be installed in $prefix."
+
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 8.00\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mlt++", "mlt++.vcproj", "{31B6CBDB-6A84-4BC7-AACF-A1BCE02444FD}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ EndProjectSection\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfiguration) = preSolution\r
+ Debug = Debug\r
+ Release = Release\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfiguration) = postSolution\r
+ {31B6CBDB-6A84-4BC7-AACF-A1BCE02444FD}.Debug.ActiveCfg = Debug|Win32\r
+ {31B6CBDB-6A84-4BC7-AACF-A1BCE02444FD}.Debug.Build.0 = Debug|Win32\r
+ {31B6CBDB-6A84-4BC7-AACF-A1BCE02444FD}.Release.ActiveCfg = Release|Win32\r
+ {31B6CBDB-6A84-4BC7-AACF-A1BCE02444FD}.Release.Build.0 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityAddIns) = postSolution\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+ ProjectType="Visual C++"\r
+ Version="7.10"\r
+ Name="mlt++"\r
+ ProjectGUID="{31B6CBDB-6A84-4BC7-AACF-A1BCE02444FD}"\r
+ Keyword="Win32Proj">\r
+ <Platforms>\r
+ <Platform\r
+ Name="Win32"/>\r
+ </Platforms>\r
+ <Configurations>\r
+ <Configuration\r
+ Name="Debug|Win32"\r
+ OutputDirectory="Debug"\r
+ IntermediateDirectory="Debug"\r
+ ConfigurationType="2"\r
+ CharacterSet="2">\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="0"\r
+ AdditionalIncludeDirectories=""C:\Program Files\mlt\include\mlt""\r
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MLTPP_EXPORTS"\r
+ MinimalRebuild="TRUE"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="3"\r
+ TreatWChar_tAsBuiltInType="TRUE"\r
+ UsePrecompiledHeader="0"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="TRUE"\r
+ DebugInformationFormat="4"/>\r
+ <Tool\r
+ Name="VCCustomBuildTool"/>\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="libmlt.0.2.1.lib"\r
+ OutputFile="$(OutDir)/mlt++.dll"\r
+ LinkIncremental="2"\r
+ AdditionalLibraryDirectories=""C:\Program Files\mlt\lib""\r
+ GenerateDebugInformation="TRUE"\r
+ ProgramDatabaseFile="$(OutDir)/mlt++.pdb"\r
+ SubSystem="2"\r
+ ImportLibrary="$(OutDir)/mlt++.lib"\r
+ TargetMachine="1"/>\r
+ <Tool\r
+ Name="VCMIDLTool"/>\r
+ <Tool\r
+ Name="VCPostBuildEventTool"/>\r
+ <Tool\r
+ Name="VCPreBuildEventTool"/>\r
+ <Tool\r
+ Name="VCPreLinkEventTool"/>\r
+ <Tool\r
+ Name="VCResourceCompilerTool"/>\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"/>\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"/>\r
+ <Tool\r
+ Name="VCWebDeploymentTool"/>\r
+ <Tool\r
+ Name="VCManagedWrapperGeneratorTool"/>\r
+ <Tool\r
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Release|Win32"\r
+ OutputDirectory="Release"\r
+ IntermediateDirectory="Release"\r
+ ConfigurationType="2"\r
+ CharacterSet="2">\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ AdditionalIncludeDirectories=""C:\Program Files\mlt\include\mlt""\r
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MLTPP_EXPORTS"\r
+ RuntimeLibrary="0"\r
+ TreatWChar_tAsBuiltInType="TRUE"\r
+ UsePrecompiledHeader="0"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="TRUE"\r
+ DebugInformationFormat="3"/>\r
+ <Tool\r
+ Name="VCCustomBuildTool"/>\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="libmlt.0.2.1.lib"\r
+ OutputFile="$(OutDir)/mlt++.dll"\r
+ LinkIncremental="1"\r
+ AdditionalLibraryDirectories=""C:\Program Files\mlt\lib""\r
+ GenerateDebugInformation="TRUE"\r
+ SubSystem="2"\r
+ OptimizeReferences="2"\r
+ EnableCOMDATFolding="2"\r
+ ImportLibrary="$(OutDir)/mlt++.lib"\r
+ TargetMachine="1"/>\r
+ <Tool\r
+ Name="VCMIDLTool"/>\r
+ <Tool\r
+ Name="VCPostBuildEventTool"/>\r
+ <Tool\r
+ Name="VCPreBuildEventTool"/>\r
+ <Tool\r
+ Name="VCPreLinkEventTool"/>\r
+ <Tool\r
+ Name="VCResourceCompilerTool"/>\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"/>\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"/>\r
+ <Tool\r
+ Name="VCWebDeploymentTool"/>\r
+ <Tool\r
+ Name="VCManagedWrapperGeneratorTool"/>\r
+ <Tool\r
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
+ </Configuration>\r
+ </Configurations>\r
+ <References>\r
+ </References>\r
+ <Files>\r
+ <Filter\r
+ Name="Source Files"\r
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">\r
+ <File\r
+ RelativePath=".\src\config.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\Mlt.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltConsumer.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltConsumer.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltDeque.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltDeque.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltEvent.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltEvent.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltFactory.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltFactory.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltField.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltField.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltFilter.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltFilter.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltFilteredConsumer.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltFilteredConsumer.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltFilteredProducer.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltFilteredProducer.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltFrame.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltFrame.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltGeometry.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltGeometry.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltMultitrack.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltMultitrack.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltParser.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltParser.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltPlaylist.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltPlaylist.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltProducer.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltProducer.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltProperties.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltProperties.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltPushConsumer.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltPushConsumer.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltService.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltService.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltTokeniser.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltTokeniser.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltTractor.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltTractor.h">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltTransition.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\src\MltTransition.h">\r
+ </File>\r
+ </Filter>\r
+ <Filter\r
+ Name="Header Files"\r
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">\r
+ </Filter>\r
+ <Filter\r
+ Name="Resource Files"\r
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">\r
+ </Filter>\r
+ </Files>\r
+ <Globals>\r
+ </Globals>\r
+</VisualStudioProject>\r
--- /dev/null
+include ../config.mak
+INSTALL = install
+
+ifneq ($(targetos), Darwin)
+NAME = libmlt++$(LIBSUF)
+TARGET = $(NAME).$(version)
+SONAME = $(NAME).$(soversion)
+LIBFLAGS += -Wl,-soname,$(SONAME)
+else
+NAME = libmlt++$(LIBSUF)
+TARGET = libmlt++.$(version)$(LIBSUF)
+SONAME = libmlt++.$(soversion)$(LIBSUF)
+LIBFLAGS += -install_name $(libdir)/$(SONAME) -current_version $(version) -compatibility_version $(soversion)
+endif
+
+OBJS = MltConsumer.o \
+ MltDeque.o \
+ MltEvent.o \
+ MltFactory.o \
+ MltField.o \
+ MltFilter.o \
+ MltFilteredConsumer.o \
+ MltFrame.o \
+ MltGeometry.o \
+ MltMiracle.o \
+ MltMultitrack.o \
+ MltParser.o \
+ MltPlaylist.o \
+ MltProducer.o \
+ MltProfile.o \
+ MltProperties.o \
+ MltPushConsumer.o \
+ MltRepository.o \
+ MltResponse.o \
+ MltService.o \
+ MltTokeniser.o \
+ MltTractor.o \
+ MltTransition.o
+
+SRCS = $(OBJS:.o=.cpp)
+HEADERS = config.h Mlt.h $(OBJS:.o=.h)
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ $(CXX) $(LIBFLAGS) -o $@ $(OBJS) $(LDFLAGS)
+ ln -sf $(TARGET) $(NAME)
+ ln -sf $(TARGET) $(SONAME)
+
+clean:
+ $(RM) $(OBJS) $(TARGET) $(NAME)
+
+distclean: clean
+
+install:
+ $(INSTALL) -d "$(DESTDIR)$(libdir)"
+ $(INSTALL) -m 755 $(TARGET) $(DESTDIR)$(libdir)
+ ln -sf $(TARGET) $(DESTDIR)$(libdir)/$(NAME)
+ ln -sf $(TARGET) $(DESTDIR)$(libdir)/$(SONAME)
+ $(INSTALL) -d "$(DESTDIR)$(prefix)/include/mlt++"
+ $(INSTALL) -m 644 $(HEADERS) "$(DESTDIR)$(prefix)/include/mlt++"
+ /sbin/ldconfig 2> /dev/null || true
+
+uninstall:
+ rm -f "$(DESTDIR)$(libdir)/$(TARGET)"
+ rm -f "$(DESTDIR)$(libdir)/$(NAME)"
+ rm -f "$(DESTDIR)$(libdir)/$(SONAME)"
+ rm -rf "$(DESTDIR)$(prefix)/include/mlt++"
--- /dev/null
+/**
+ * Mlt.h - Convenience header file for all mlt++ objects
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_H_
+#define _MLTPP_H_
+
+#include "MltConsumer.h"
+#include "MltDeque.h"
+#include "MltEvent.h"
+#include "MltFactory.h"
+#include "MltField.h"
+#include "MltFilter.h"
+#include "MltFilteredConsumer.h"
+#include "MltFrame.h"
+#include "MltGeometry.h"
+#ifndef WIN32
+#include "MltMiracle.h"
+#endif
+#include "MltMultitrack.h"
+#include "MltParser.h"
+#include "MltPlaylist.h"
+#include "MltProducer.h"
+#include "MltProfile.h"
+#include "MltProperties.h"
+#include "MltPushConsumer.h"
+#include "MltRepository.h"
+#ifndef WIN32
+#include "MltResponse.h"
+#endif
+#include "MltService.h"
+#include "MltTokeniser.h"
+#include "MltTractor.h"
+#include "MltTransition.h"
+
+#endif
--- /dev/null
+/**
+ * MltConsumer.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "MltConsumer.h"
+#include "MltEvent.h"
+#include "MltProfile.h"
+using namespace Mlt;
+
+Consumer::Consumer( ) :
+ instance( NULL )
+{
+ instance = mlt_factory_consumer( NULL, NULL, NULL );
+}
+
+Consumer::Consumer( Profile& profile ) :
+ instance( NULL )
+{
+ instance = mlt_factory_consumer( profile.get_profile(), NULL, NULL );
+}
+
+Consumer::Consumer( Profile& profile, const char *id, const char *arg ) :
+ instance( NULL )
+{
+ if ( id == NULL || arg != NULL )
+ {
+ instance = mlt_factory_consumer( profile.get_profile(), id, arg );
+ }
+ else
+ {
+ if ( strchr( id, ':' ) )
+ {
+ char *temp = strdup( id );
+ char *arg = strchr( temp, ':' ) + 1;
+ *( arg - 1 ) = '\0';
+ instance = mlt_factory_consumer( profile.get_profile(), temp, arg );
+ free( temp );
+ }
+ else
+ {
+ instance = mlt_factory_consumer( profile.get_profile(), id, NULL );
+ }
+ }
+}
+
+Consumer::Consumer( Service &consumer ) :
+ instance( NULL )
+{
+ if ( consumer.type( ) == consumer_type )
+ {
+ instance = ( mlt_consumer )consumer.get_service( );
+ inc_ref( );
+ }
+}
+
+Consumer::Consumer( Consumer &consumer ) :
+ Mlt::Service( consumer ),
+ instance( consumer.get_consumer( ) )
+{
+ inc_ref( );
+}
+
+Consumer::Consumer( mlt_consumer consumer ) :
+ instance( consumer )
+{
+ inc_ref( );
+}
+
+Consumer::~Consumer( )
+{
+ mlt_consumer_close( instance );
+}
+
+mlt_consumer Consumer::get_consumer( )
+{
+ return instance;
+}
+
+mlt_service Consumer::get_service( )
+{
+ return mlt_consumer_service( get_consumer( ) );
+}
+
+int Consumer::connect( Service &service )
+{
+ return connect_producer( service );
+}
+
+int Consumer::start( )
+{
+ return mlt_consumer_start( get_consumer( ) );
+}
+
+void Consumer::purge( )
+{
+ mlt_consumer_purge( get_consumer( ) );
+}
+
+int Consumer::stop( )
+{
+ return mlt_consumer_stop( get_consumer( ) );
+}
+
+bool Consumer::is_stopped( )
+{
+ return mlt_consumer_is_stopped( get_consumer( ) ) != 0;
+}
+
+int Consumer::run( )
+{
+ int ret = start( );
+ if ( !is_stopped( ) )
+ {
+ Event *e = setup_wait_for( "consumer-stopped" );
+ wait_for( e );
+ delete e;
+ }
+ return ret;
+}
--- /dev/null
+/**
+ * MltConsumer.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_CONSUMER_H_
+#define _MLTPP_CONSUMER_H_
+
+#include "config.h"
+
+#include <framework/mlt.h>
+
+#include "MltService.h"
+
+namespace Mlt
+{
+ class Service;
+ class Profile;
+
+ class MLTPP_DECLSPEC Consumer : public Service
+ {
+ private:
+ mlt_consumer instance;
+ public:
+ Consumer( );
+ Consumer( Profile& profile );
+ Consumer( Profile& profile, const char *id , const char *service = NULL );
+ Consumer( Service &consumer );
+ Consumer( Consumer &consumer );
+ Consumer( mlt_consumer consumer );
+ virtual ~Consumer( );
+ virtual mlt_consumer get_consumer( );
+ mlt_service get_service( );
+ virtual int connect( Service &service );
+ int run( );
+ int start( );
+ void purge( );
+ int stop( );
+ bool is_stopped( );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltDeque.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltDeque.h"
+using namespace Mlt;
+
+Deque::Deque( )
+{
+ deque = mlt_deque_init( );
+}
+
+Deque::~Deque( )
+{
+ mlt_deque_close( deque );
+}
+
+int Deque::count( )
+{
+ return mlt_deque_count( deque );
+}
+
+int Deque::push_back( void *item )
+{
+ return mlt_deque_push_back( deque, item );
+}
+
+void *Deque::pop_back( )
+{
+ return mlt_deque_pop_back( deque );
+}
+
+int Deque::push_front( void *item )
+{
+ return mlt_deque_push_front( deque, item );
+}
+
+void *Deque::pop_front( )
+{
+ return mlt_deque_pop_front( deque );
+}
+
+void *Deque::peek_back( )
+{
+ return mlt_deque_peek_back( deque );
+}
+
+void *Deque::peek_front( )
+{
+ return mlt_deque_peek_front( deque );
+}
+
--- /dev/null
+/**
+ * MltDeque.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_DEQUE_H
+#define _MLTPP_DEQUE_H
+
+#include "config.h"
+
+#include <framework/mlt.h>
+
+namespace Mlt
+{
+ class MLTPP_DECLSPEC Deque
+ {
+ private:
+ mlt_deque deque;
+ public:
+ Deque( );
+ ~Deque( );
+ int count( );
+ int push_back( void *item );
+ void *pop_back( );
+ int push_front( void *item );
+ void *pop_front( );
+ void *peek_back( );
+ void *peek_front( );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltEvent.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltEvent.h"
+using namespace Mlt;
+
+
+Event::Event( mlt_event event ) :
+ instance( event )
+{
+ mlt_event_inc_ref( instance );
+}
+
+Event::Event( Event &event ) :
+ instance( event.get_event( ) )
+{
+ mlt_event_inc_ref( instance );
+}
+
+Event::~Event( )
+{
+ mlt_event_close( instance );
+}
+
+mlt_event Event::get_event( )
+{
+ return instance;
+}
+
+bool Event::is_valid( )
+{
+ return instance != NULL;
+}
+
+void Event::block( )
+{
+ mlt_event_block( get_event( ) );
+}
+
+void Event::unblock( )
+{
+ mlt_event_unblock( get_event( ) );
+}
+
--- /dev/null
+/**
+ * MltEvent.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_EVENT_H_
+#define _MLTPP_EVENT_H_
+
+#include "config.h"
+
+#include <framework/mlt.h>
+
+namespace Mlt
+{
+ class MLTPP_DECLSPEC Event
+ {
+ private:
+ mlt_event instance;
+ public:
+ Event( mlt_event );
+ Event( Event & );
+ ~Event( );
+ mlt_event get_event( );
+ bool is_valid( );
+ void block( );
+ void unblock( );
+ };
+}
+
+#endif
+
--- /dev/null
+/**
+ * MltFactory.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltFactory.h"
+#include "MltProducer.h"
+#include "MltFilter.h"
+#include "MltTransition.h"
+#include "MltConsumer.h"
+#include "MltRepository.h"
+using namespace Mlt;
+
+Repository *Factory::init( const char *directory )
+{
+ return new Repository( mlt_factory_init( directory ) );
+}
+
+Properties *Factory::event_object( )
+{
+ return new Properties( mlt_factory_event_object( ) );
+}
+
+Producer *Factory::producer( Profile& profile, char *id, char *arg )
+{
+ return new Producer( profile, id, arg );
+}
+
+Filter *Factory::filter( Profile& profile, char *id, char *arg )
+{
+ return new Filter( profile, id, arg );
+}
+
+Transition *Factory::transition( Profile& profile, char *id, char *arg )
+{
+ return new Transition( profile, id, arg );
+}
+
+Consumer *Factory::consumer( Profile& profile, char *id, char *arg )
+{
+ return new Consumer( profile, id, arg );
+}
+
+#ifdef WIN32
+char *Factory::getenv( const char *name )
+{
+ return mlt_getenv( name );
+}
+
+int Factory::setenv( const char *name, const char *value )
+{
+ return mlt_setenv( name, value );
+}
+#endif
+
+void Factory::close( )
+{
+ mlt_factory_close( );
+}
+
+
--- /dev/null
+/**
+ * MltFactory.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_FACTORY_H_
+#define _MLTPP_FACTORY_H_
+
+#include "config.h"
+
+#ifdef SWIG
+#define MLTPP_DECLSPEC
+#endif
+
+#include <framework/mlt.h>
+
+namespace Mlt
+{
+ class Properties;
+ class Producer;
+ class Filter;
+ class Transition;
+ class Consumer;
+ class Profile;
+ class Repository;
+
+ class MLTPP_DECLSPEC Factory
+ {
+ public:
+ static Repository *init( const char *directory = NULL );
+ static Properties *event_object( );
+ static Producer *producer( Profile& profile, char *id, char *arg = NULL );
+ static Filter *filter( Profile& profile, char *id, char *arg = NULL );
+ static Transition *transition( Profile& profile, char *id, char *arg = NULL );
+ static Consumer *consumer( Profile& profile, char *id, char *arg = NULL );
+#ifdef WIN32
+ static char *getenv( const char * );
+ static int setenv( const char *, const char * );
+#endif
+ static void close( );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltField.cpp - Field wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltField.h"
+#include "MltFilter.h"
+#include "MltTransition.h"
+using namespace Mlt;
+
+Field::Field( mlt_field field ) :
+ instance( field )
+{
+ inc_ref( );
+}
+
+Field::Field( Field &field ) :
+ Mlt::Service( field ),
+ instance( field.get_field( ) )
+{
+ inc_ref( );
+}
+
+Field::~Field( )
+{
+ mlt_field_close( instance );
+}
+
+mlt_field Field::get_field( )
+{
+ return instance;
+}
+
+mlt_service Field::get_service( )
+{
+ return mlt_field_service( get_field( ) );
+}
+
+int Field::plant_filter( Filter &filter, int track )
+{
+ return mlt_field_plant_filter( get_field( ), filter.get_filter( ), track );
+}
+
+int Field::plant_transition( Transition &transition, int a_track, int b_track )
+{
+ return mlt_field_plant_transition( get_field( ), transition.get_transition( ), a_track, b_track );
+}
+
+
--- /dev/null
+/**
+ * MltField.h - Field wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_FIELD_H_
+#define _MLTPP_FIELD_H_
+
+#include "config.h"
+
+#include <framework/mlt.h>
+
+#include "MltService.h"
+
+namespace Mlt
+{
+ class Service;
+ class Filter;
+ class Transition;
+
+ class MLTPP_DECLSPEC Field : public Service
+ {
+ private:
+ mlt_field instance;
+ public:
+ Field( mlt_field field );
+ Field( Field &field );
+ virtual ~Field( );
+ mlt_field get_field( );
+ mlt_service get_service( );
+ int plant_filter( Filter &filter, int track = 0 );
+ int plant_transition( Transition &transition, int a_track = 0, int b_track = 1 );
+ };
+}
+
+#endif
+
--- /dev/null
+/**
+ * MltFilter.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "MltFilter.h"
+#include "MltProfile.h"
+using namespace Mlt;
+
+Filter::Filter( Profile& profile, const char *id, const char *arg ) :
+ instance( NULL )
+{
+ if ( arg != NULL )
+ {
+ instance = mlt_factory_filter( profile.get_profile(), id, arg );
+ }
+ else
+ {
+ if ( strchr( id, ':' ) )
+ {
+ char *temp = strdup( id );
+ char *arg = strchr( temp, ':' ) + 1;
+ *( arg - 1 ) = '\0';
+ instance = mlt_factory_filter( profile.get_profile(), temp, arg );
+ free( temp );
+ }
+ else
+ {
+ instance = mlt_factory_filter( profile.get_profile(), id, NULL );
+ }
+ }
+}
+
+Filter::Filter( Service &filter ) :
+ instance( NULL )
+{
+ if ( filter.type( ) == filter_type )
+ {
+ instance = ( mlt_filter )filter.get_service( );
+ inc_ref( );
+ }
+}
+
+Filter::Filter( Filter &filter ) :
+ Mlt::Service( filter ),
+ instance( filter.get_filter( ) )
+{
+ inc_ref( );
+}
+
+Filter::Filter( mlt_filter filter ) :
+ instance( filter )
+{
+ inc_ref( );
+}
+
+Filter::~Filter( )
+{
+ mlt_filter_close( instance );
+}
+
+mlt_filter Filter::get_filter( )
+{
+ return instance;
+}
+
+mlt_service Filter::get_service( )
+{
+ return mlt_filter_service( get_filter( ) );
+}
+
+int Filter::connect( Service &service, int index )
+{
+ return mlt_filter_connect( get_filter( ), service.get_service( ), index );
+}
+
+void Filter::set_in_and_out( int in, int out )
+{
+ mlt_filter_set_in_and_out( get_filter( ), in, out );
+}
+
+int Filter::get_in( )
+{
+ return mlt_filter_get_in( get_filter( ) );
+}
+
+int Filter::get_out( )
+{
+ return mlt_filter_get_out( get_filter( ) );
+}
+
+int Filter::get_track( )
+{
+ return mlt_filter_get_track( get_filter( ) );
+}
+
--- /dev/null
+/**
+ * MltFilter.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_FILTER_H_
+#define _MLTPP_FILTER_H_
+
+#include "config.h"
+
+#include <framework/mlt.h>
+
+#include "MltService.h"
+
+namespace Mlt
+{
+ class Service;
+ class Profile;
+
+ class MLTPP_DECLSPEC Filter : public Service
+ {
+ private:
+ mlt_filter instance;
+ public:
+ Filter( Profile& profile, const char *id, const char *service = NULL );
+ Filter( Service &filter );
+ Filter( Filter &filter );
+ Filter( mlt_filter filter );
+ virtual ~Filter( );
+ virtual mlt_filter get_filter( );
+ mlt_service get_service( );
+ int connect( Service &service, int index = 0 );
+ void set_in_and_out( int in, int out );
+ int get_in( );
+ int get_out( );
+ int get_track( );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltFilteredConsumer.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltFilteredConsumer.h"
+using namespace Mlt;
+
+FilteredConsumer::FilteredConsumer( Profile& profile, char *id, char *arg ) :
+ Consumer( profile, id, arg )
+{
+ // Create a reference to the first service
+ first = new Service( *this );
+}
+
+FilteredConsumer::FilteredConsumer( Consumer &consumer ) :
+ Consumer( consumer )
+{
+ // Create a reference to the first service
+ first = new Service( *this );
+}
+
+FilteredConsumer::~FilteredConsumer( )
+{
+ // Delete the reference to the first service
+ delete first;
+}
+
+int FilteredConsumer::connect( Service &service )
+{
+ // All producers must connect to the first service, hence the use of the virtual here
+ return first->connect_producer( service );
+}
+
+int FilteredConsumer::attach( Filter &filter )
+{
+ int error = 0;
+ if ( filter.is_valid( ) )
+ {
+ Service *producer = first->producer( );
+ error = filter.connect( *producer );
+ if ( error == 0 )
+ {
+ first->connect_producer( filter );
+ delete first;
+ first = new Service( filter );
+ }
+ delete producer;
+ }
+ else
+ {
+ error = 1;
+ }
+ return error;
+}
+
+int FilteredConsumer::last( Filter &filter )
+{
+ int error = 0;
+ if ( filter.is_valid( ) )
+ {
+ Service *producer = this->producer( );
+ error = filter.connect( *producer );
+ if ( error == 0 )
+ connect_producer( filter );
+ delete producer;
+ }
+ else
+ {
+ error = 1;
+ }
+ return error;
+}
+
+int FilteredConsumer::detach( Filter &filter )
+{
+ if ( filter.is_valid( ) )
+ {
+ Service *it = new Service( *first );
+ while ( it->is_valid( ) && it->get_service( ) != filter.get_service( ) )
+ {
+ Service *consumer = it->consumer( );
+ delete it;
+ it = consumer;
+ }
+ if ( it->get_service( ) == filter.get_service( ) )
+ {
+ Service *producer = it->producer( );
+ Service *consumer = it->consumer( );
+ consumer->connect_producer( *producer );
+ Service dummy( NULL );
+ it->connect_producer( dummy );
+ if ( first->get_service( ) == it->get_service( ) )
+ {
+ delete first;
+ first = new Service( *consumer );
+ }
+ }
+ delete it;
+ }
+ return 0;
+}
+
--- /dev/null
+/**
+ * MltFilteredConsumer.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_FILTERED_CONSUMER_H_
+#define _MLTPP_FILTERED_CONSUMER_H_
+
+#include "config.h"
+
+#include "MltConsumer.h"
+#include "MltFilter.h"
+#include "MltService.h"
+
+namespace Mlt
+{
+ class Consumer;
+ class Service;
+ class Filter;
+ class Profile;
+
+ class MLTPP_DECLSPEC FilteredConsumer : public Consumer
+ {
+ private:
+ Service *first;
+ public:
+ FilteredConsumer( Profile& profile, char *id, char *arg = NULL );
+ FilteredConsumer( Consumer &consumer );
+ virtual ~FilteredConsumer( );
+ int connect( Service &service );
+ int attach( Filter &filter );
+ int last( Filter &filter );
+ int detach( Filter &filter );
+ };
+}
+
+#endif
+
--- /dev/null
+/**
+ * MltFilteredProducer.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltFilteredProducer.h"
+using namespace Mlt;
+
+FilteredProducer::FilteredProducer( Profile& profile, char *id, char *arg ) :
+ Producer( profile, id, arg )
+{
+ // Create a reference to the last service
+ last = new Service( *this );
+}
+
+FilteredProducer::~FilteredProducer( )
+{
+ // Delete the reference to the last service
+ delete last;
+}
+
+int FilteredProducer::attach( Filter &filter )
+{
+ int error = 0;
+ if ( filter.is_valid( ) )
+ {
+ Service *consumer = last->consumer( );
+ filter.connect_producer( *last );
+ if ( consumer->is_valid( ) )
+ consumer->connect_producer( filter );
+ delete consumer;
+ delete last;
+ last = new Service( filter );
+ }
+ else
+ {
+ error = 1;
+ }
+ return error;
+}
+
+int FilteredProducer::detach( Filter &filter )
+{
+ if ( filter.is_valid( ) )
+ {
+ Service *it = new Service( *last );
+ while ( it->is_valid( ) && it->get_service( ) != filter.get_service( ) )
+ {
+ Service *producer = it->producer( );
+ delete it;
+ it = producer;
+ }
+ if ( it->get_service( ) == filter.get_service( ) )
+ {
+ Service *producer = it->producer( );
+ Service *consumer = it->consumer( );
+ if ( consumer->is_valid( ) )
+ consumer->connect_producer( *producer );
+ Producer dummy( "colour" );
+ dummy.connect_producer( *it );
+ if ( last->get_service( ) == it->get_service( ) )
+ {
+ delete last;
+ last = new Service( *producer );
+ }
+ }
+ delete it;
+ }
+ return 0;
+}
+
--- /dev/null
+/**
+ * MltFilteredProducer.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_FILTERED_PRODUCER_H_
+#define _MLTPP_FILTERED_PRODUCER_H_
+
+#include "config.h"
+
+#include "MltProducer.h"
+#include "MltFilter.h"
+#include "MltService.h"
+
+namespace Mlt
+{
+ class Producer;
+ class Service;
+ class Filter;
+ class Profile;
+
+ class MLTPP_DECLSPEC FilteredProducer : public Producer
+ {
+ private:
+ Service *last;
+ public:
+ FilteredProducer( Profile* profile, char *id, char *arg = NULL );
+ virtual ~FilteredProducer( );
+ int attach( Filter &filter );
+ int detach( Filter &filter );
+ };
+}
+
+#endif
+
--- /dev/null
+/**
+ * MltFrame.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltFrame.h"
+#include "MltProducer.h"
+using namespace Mlt;
+
+Frame::Frame( mlt_frame frame ) :
+ instance( frame )
+{
+ inc_ref( );
+}
+
+Frame::Frame( Frame &frame ) :
+ Mlt::Properties( frame ),
+ instance( frame.get_frame( ) )
+{
+ inc_ref( );
+}
+
+Frame::~Frame( )
+{
+ mlt_frame_close( instance );
+}
+
+mlt_frame Frame::get_frame( )
+{
+ return instance;
+}
+
+mlt_properties Frame::get_properties( )
+{
+ return mlt_frame_properties( get_frame( ) );
+}
+
+uint8_t *Frame::get_image( mlt_image_format &format, int &w, int &h, int writable )
+{
+ uint8_t *image = NULL;
+ if ( get_double( "consumer_aspect_ratio" ) == 0.0 )
+ set( "consumer_aspect_ratio", 1.0 );
+ mlt_frame_get_image( get_frame( ), &image, &format, &w, &h, writable );
+ set( "format", format );
+ set( "writable", writable );
+ return image;
+}
+
+unsigned char *Frame::fetch_image( mlt_image_format f, int w, int h, int writable )
+{
+ uint8_t *image = NULL;
+ if ( get_double( "consumer_aspect_ratio" ) == 0.0 )
+ set( "consumer_aspect_ratio", 1.0 );
+ mlt_frame_get_image( get_frame( ), &image, &f, &w, &h, writable );
+ set( "format", f );
+ set( "writable", writable );
+ return image;
+}
+
+int16_t *Frame::get_audio( mlt_audio_format &format, int &frequency, int &channels, int &samples )
+{
+ int16_t *audio = NULL;
+ mlt_frame_get_audio( get_frame( ), &audio, &format, &frequency, &channels, &samples );
+ return audio;
+}
+
+unsigned char *Frame::get_waveform( int w, int h )
+{
+ return mlt_frame_get_waveform( get_frame( ), w, h );
+}
+
+Producer *Frame::get_original_producer( )
+{
+ return new Producer( mlt_frame_get_original_producer( get_frame( ) ) );
+}
--- /dev/null
+/**
+ * MltFilter.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_FRAME_H_
+#define _MLTPP_FRAME_H_
+
+#include "config.h"
+
+#include <framework/mlt.h>
+#include "MltProperties.h"
+
+namespace Mlt
+{
+ class Properties;
+ class Producer;
+
+ class MLTPP_DECLSPEC Frame : public Properties
+ {
+ private:
+ mlt_frame instance;
+ public:
+ Frame( mlt_frame frame );
+ Frame( Frame &frame );
+ virtual ~Frame( );
+ virtual mlt_frame get_frame( );
+ mlt_properties get_properties( );
+ uint8_t *get_image( mlt_image_format &format, int &w, int &h, int writable = 0 );
+ unsigned char *fetch_image( mlt_image_format format, int w, int h, int writable = 0 );
+ int16_t *get_audio( mlt_audio_format &format, int &frequency, int &channels, int &samples );
+ unsigned char *get_waveform( int w, int h );
+ Producer *get_original_producer( );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltGeometry.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdlib.h>
+#include "MltGeometry.h"
+using namespace Mlt;
+
+Geometry::Geometry( char *data, int length, int nw, int nh )
+{
+ geometry = mlt_geometry_init( );
+ parse( data, length, nw, nh );
+}
+
+Geometry::~Geometry( )
+{
+ mlt_geometry_close( geometry );
+}
+
+int Geometry::parse( char *data, int length, int nw, int nh )
+{
+ return mlt_geometry_parse( geometry, data, length, nw, nh );
+}
+
+// Fetch a geometry item for an absolute position
+int Geometry::fetch( GeometryItem &item, float position )
+{
+ return mlt_geometry_fetch( geometry, item.get_item( ), position );
+}
+
+int Geometry::fetch( GeometryItem *item, float position )
+{
+ return mlt_geometry_fetch( geometry, item->get_item( ), position );
+}
+
+// Specify a geometry item at an absolute position
+int Geometry::insert( GeometryItem &item )
+{
+ return mlt_geometry_insert( geometry, item.get_item( ) );
+}
+
+int Geometry::insert( GeometryItem *item )
+{
+ return mlt_geometry_insert( geometry, item->get_item( ) );
+}
+
+// Remove the key at the specified position
+int Geometry::remove( int position )
+{
+ return mlt_geometry_remove( geometry, position );
+}
+
+// Get the key at the position or the next following
+int Geometry::next_key( GeometryItem &item, int position )
+{
+ return mlt_geometry_next_key( geometry, item.get_item( ), position );
+}
+
+int Geometry::next_key( GeometryItem *item, int position )
+{
+ return mlt_geometry_next_key( geometry, item->get_item( ), position );
+}
+
+int Geometry::prev_key( GeometryItem &item, int position )
+{
+ return mlt_geometry_prev_key( geometry, item.get_item( ), position );
+}
+
+int Geometry::prev_key( GeometryItem *item, int position )
+{
+ return mlt_geometry_prev_key( geometry, item->get_item( ), position );
+}
+
+// Serialise the current geometry
+char *Geometry::serialise( int in, int out )
+{
+ return mlt_geometry_serialise_cut( geometry, in, out );
+}
+
+char *Geometry::serialise( )
+{
+ return mlt_geometry_serialise( geometry );
+}
+
--- /dev/null
+/**
+ * MltGeometry.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_GEOMETRY_H
+#define _MLTPP_GEOMETRY_H
+
+#include "config.h"
+
+#include <framework/mlt.h>
+
+namespace Mlt
+{
+ // Just for consistent naming purposes
+ class MLTPP_DECLSPEC GeometryItem
+ {
+ private:
+ struct mlt_geometry_item_s item;
+ public:
+ mlt_geometry_item get_item( ) { return &item; }
+ bool key( ) { return item.key != 0; }
+ int frame( ) { return item.frame; }
+ void frame( int value ) { item.frame = value; }
+ float x( ) { return item.x; }
+ void x( float value ) { item.f[0] = 1; item.x = value; }
+ float y( ) { return item.y; }
+ void y( float value ) { item.f[1] = 1; item.y = value; }
+ float w( ) { return item.w; }
+ void w( float value ) { item.f[2] = 1; item.w = value; }
+ float h( ) { return item.h; }
+ void h( float value ) { item.f[3] = 1; item.h = value; }
+ float mix( ) { return item.mix; }
+ void mix( float value ) { item.f[4] = 1; item.mix = value; }
+ };
+
+ class MLTPP_DECLSPEC Geometry
+ {
+ private:
+ mlt_geometry geometry;
+ public:
+ Geometry( char *data = NULL, int length = 0, int nw = -1, int nh = -1 );
+ ~Geometry( );
+ int parse( char *data, int length, int nw = -1, int nh = -1 );
+ // Fetch a geometry item for an absolute position
+ int fetch( GeometryItem &item, float position );
+ int fetch( GeometryItem *item, float position );
+ // Specify a geometry item at an absolute position
+ int insert( GeometryItem &item );
+ int insert( GeometryItem *item );
+ // Remove the key at the specified position
+ int remove( int position );
+ // Get the key at the position or the next following
+ int next_key( GeometryItem &item, int position );
+ int next_key( GeometryItem *item, int position );
+ int prev_key( GeometryItem &item, int position );
+ int prev_key( GeometryItem *item, int position );
+ // Serialise the current geometry
+ char *serialise( int in, int out );
+ char *serialise( );
+ };
+}
+
+#endif
+
--- /dev/null
+/**
+ * MltMiracle.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltMiracle.h"
+#include "MltService.h"
+#include "MltResponse.h"
+using namespace Mlt;
+
+#include <time.h>
+
+static valerie_response mlt_miracle_execute( void *arg, char *command )
+{
+ Miracle *miracle = ( Miracle * )arg;
+ if ( miracle != NULL )
+ {
+ Response *response = miracle->execute( command );
+ valerie_response real = valerie_response_clone( response->get_response( ) );
+ delete response;
+ return real;
+ }
+ else
+ {
+ valerie_response response = valerie_response_init( );
+ valerie_response_set_error( response, 500, "Invalid server" );
+ return response;
+ }
+}
+
+static valerie_response mlt_miracle_received( void *arg, char *command, char *doc )
+{
+ Miracle *miracle = ( Miracle * )arg;
+ if ( miracle != NULL )
+ {
+ Response *response = miracle->received( command, doc );
+ if ( response != NULL )
+ {
+ valerie_response real = valerie_response_clone( response->get_response( ) );
+ delete response;
+ return real;
+ }
+ return NULL;
+ }
+ else
+ {
+ valerie_response response = valerie_response_init( );
+ valerie_response_set_error( response, 500, "Invalid server" );
+ return response;
+ }
+}
+
+static valerie_response mlt_miracle_push( void *arg, char *command, mlt_service service )
+{
+ Miracle *miracle = ( Miracle * )arg;
+ if ( miracle != NULL )
+ {
+ Service input( service );
+ Response *response = miracle->push( command, &input );
+ valerie_response real = valerie_response_clone( response->get_response( ) );
+ delete response;
+ return real;
+ }
+ else
+ {
+ valerie_response response = valerie_response_init( );
+ valerie_response_set_error( response, 500, "Invalid server" );
+ return response;
+ }
+}
+
+Miracle::Miracle( char *name, int port, char *config ) :
+ Properties( false )
+{
+ server = miracle_server_init( name );
+ miracle_server_set_port( server, port );
+ miracle_server_set_config( server, config );
+}
+
+Miracle::~Miracle( )
+{
+ miracle_server_close( server );
+}
+
+mlt_properties Miracle::get_properties( )
+{
+ return &server->parent;
+}
+
+bool Miracle::start( )
+{
+ if ( miracle_server_execute( server ) == 0 )
+ {
+ _real = server->parser->real;
+ _execute = server->parser->execute;
+ _received = server->parser->received;
+ _push = server->parser->push;
+ server->parser->real = this;
+ server->parser->execute = mlt_miracle_execute;
+ server->parser->received = mlt_miracle_received;
+ server->parser->push = mlt_miracle_push;
+ }
+ return server->shutdown == 0;
+}
+
+bool Miracle::is_running( )
+{
+ return server->shutdown == 0;
+}
+
+Response *Miracle::execute( char *command )
+{
+ return new Response( _execute( _real, command ) );
+}
+
+Response *Miracle::received( char *command, char *doc )
+{
+ return new Response( _received( _real, command, doc ) );
+}
+
+Response *Miracle::push( char *command, Service *service )
+{
+ return new Response( _push( _real, command, service->get_service( ) ) );
+}
+
+void Miracle::wait_for_shutdown( )
+{
+ struct timespec tm = { 1, 0 };
+ while ( !server->shutdown )
+ nanosleep( &tm, NULL );
+}
+
+void Miracle::log_level( int threshold )
+{
+ miracle_log_init( log_stderr, threshold );
+}
+
+Properties *Miracle::unit( int index )
+{
+ mlt_properties properties = miracle_server_fetch_unit( server, index );
+ return properties != NULL ? new Properties( properties ) : NULL;
+}
--- /dev/null
+/**
+ * MltMiracle.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_MIRACLE_H_
+#define _MLTPP_MIRACLE_H_
+
+#include <miracle/miracle_server.h>
+#include <miracle/miracle_log.h>
+#include "MltService.h"
+
+namespace Mlt
+{
+ class Properties;
+ class Service;
+ class Response;
+
+ class Miracle : public Properties
+ {
+ private:
+ miracle_server server;
+ void *_real;
+ parser_execute _execute;
+ parser_received _received;
+ parser_push _push;
+ public:
+ Miracle( char *name, int port = 5250, char *config = NULL );
+ virtual ~Miracle( );
+ mlt_properties get_properties( );
+ bool start( );
+ bool is_running( );
+ virtual Response *execute( char *command );
+ virtual Response *received( char *command, char *doc );
+ virtual Response *push( char *command, Service *service );
+ void wait_for_shutdown( );
+ static void log_level( int );
+ Properties *unit( int );
+ };
+}
+
+#endif
+
--- /dev/null
+/**
+ * MltMultitrack.h - Multitrack wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltMultitrack.h"
+#include "MltProducer.h"
+using namespace Mlt;
+
+Multitrack::Multitrack( mlt_multitrack multitrack ) :
+ instance( multitrack )
+{
+ inc_ref( );
+}
+
+Multitrack::Multitrack( Service &multitrack ) :
+ instance( NULL )
+{
+ if ( multitrack.type( ) == multitrack_type )
+ {
+ instance = ( mlt_multitrack )multitrack.get_service( );
+ inc_ref( );
+ }
+}
+
+Multitrack::Multitrack( Multitrack &multitrack ) :
+ Mlt::Producer( multitrack ),
+ instance( multitrack.get_multitrack( ) )
+{
+ inc_ref( );
+}
+
+Multitrack::~Multitrack( )
+{
+ mlt_multitrack_close( instance );
+}
+
+mlt_multitrack Multitrack::get_multitrack( )
+{
+ return instance;
+}
+
+mlt_producer Multitrack::get_producer( )
+{
+ return mlt_multitrack_producer( get_multitrack( ) );
+}
+
+int Multitrack::connect( Producer &producer, int index )
+{
+ return mlt_multitrack_connect( get_multitrack( ), producer.get_producer( ), index );
+}
+
+int Multitrack::clip( mlt_whence whence, int index )
+{
+ return mlt_multitrack_clip( get_multitrack( ), whence, index );
+}
+
+int Multitrack::count( )
+{
+ return mlt_multitrack_count( get_multitrack( ) );
+}
+
+Producer *Multitrack::track( int index )
+{
+ return new Producer( mlt_multitrack_track( get_multitrack( ), index ) );
+}
+
+void Multitrack::refresh( )
+{
+ return mlt_multitrack_refresh( get_multitrack( ) );
+}
--- /dev/null
+/**
+ * MltMultitrack.h - Multitrack wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_MULTITRACK_H_
+#define _MLTPP_MULTITRACK_H_
+
+#include "config.h"
+
+#include <framework/mlt.h>
+
+#include "MltProducer.h"
+
+namespace Mlt
+{
+ class Service;
+ class Producer;
+
+ class MLTPP_DECLSPEC Multitrack : public Producer
+ {
+ private:
+ mlt_multitrack instance;
+ public:
+ Multitrack( mlt_multitrack multitrack );
+ Multitrack( Service &multitrack );
+ Multitrack( Multitrack &multitrack );
+ virtual ~Multitrack( );
+ mlt_multitrack get_multitrack( );
+ mlt_producer get_producer( );
+ int connect( Producer &producer, int index );
+ int clip( mlt_whence whence, int index );
+ int count( );
+ Producer *track( int index );
+ void refresh( );
+ };
+}
+
+#endif
+
--- /dev/null
+/**
+ * MltParser.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "Mlt.h"
+using namespace Mlt;
+
+static int on_invalid_cb( mlt_parser self, mlt_service object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Service service( object );
+ return parser->on_invalid( &service );
+}
+
+static int on_unknown_cb( mlt_parser self, mlt_service object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Service service( object );
+ return parser->on_unknown( &service );
+}
+
+static int on_start_producer_cb( mlt_parser self, mlt_producer object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Producer producer( object );
+ return parser->on_start_producer( &producer );
+}
+
+static int on_end_producer_cb( mlt_parser self, mlt_producer object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Producer producer( object );
+ return parser->on_end_producer( &producer );
+}
+
+static int on_start_playlist_cb( mlt_parser self, mlt_playlist object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Playlist playlist( object );
+ return parser->on_start_playlist( &playlist );
+}
+
+static int on_end_playlist_cb( mlt_parser self, mlt_playlist object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Playlist playlist( object );
+ return parser->on_end_playlist( &playlist );
+}
+
+static int on_start_tractor_cb( mlt_parser self, mlt_tractor object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Tractor tractor( object );
+ return parser->on_start_tractor( &tractor );
+}
+
+static int on_end_tractor_cb( mlt_parser self, mlt_tractor object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Tractor tractor( object );
+ return parser->on_end_tractor( &tractor );
+}
+
+static int on_start_multitrack_cb( mlt_parser self, mlt_multitrack object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Multitrack multitrack( object );
+ return parser->on_start_multitrack( &multitrack );
+}
+
+static int on_end_multitrack_cb( mlt_parser self, mlt_multitrack object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Multitrack multitrack( object );
+ return parser->on_end_multitrack( &multitrack );
+}
+
+static int on_start_track_cb( mlt_parser self )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ return parser->on_start_track( );
+}
+
+static int on_end_track_cb( mlt_parser self )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ return parser->on_end_track( );
+}
+
+static int on_start_filter_cb( mlt_parser self, mlt_filter object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Filter filter( object );
+ return parser->on_start_filter( &filter );
+}
+
+static int on_end_filter_cb( mlt_parser self, mlt_filter object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Filter filter( object );
+ return parser->on_end_filter( &filter );
+}
+
+static int on_start_transition_cb( mlt_parser self, mlt_transition object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Transition transition( object );
+ return parser->on_start_transition( &transition );
+}
+
+static int on_end_transition_cb( mlt_parser self, mlt_transition object )
+{
+ mlt_properties properties = mlt_parser_properties( self );
+ Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
+ Transition transition( object );
+ return parser->on_end_transition( &transition );
+}
+
+Parser::Parser( ) :
+ Properties( false )
+{
+ parser = mlt_parser_new( );
+ set( "_parser_object", this, 0 );
+ parser->on_invalid = on_invalid_cb;
+ parser->on_unknown = on_unknown_cb;
+ parser->on_start_producer = on_start_producer_cb;
+ parser->on_end_producer = on_end_producer_cb;
+ parser->on_start_playlist = on_start_playlist_cb;
+ parser->on_end_playlist = on_end_playlist_cb;
+ parser->on_start_tractor = on_start_tractor_cb;
+ parser->on_end_tractor = on_end_tractor_cb;
+ parser->on_start_multitrack = on_start_multitrack_cb;
+ parser->on_end_multitrack = on_end_multitrack_cb;
+ parser->on_start_track = on_start_track_cb;
+ parser->on_end_track = on_end_track_cb;
+ parser->on_start_filter = on_start_filter_cb;
+ parser->on_end_filter = on_end_filter_cb;
+ parser->on_start_transition = on_start_transition_cb;
+ parser->on_end_transition = on_end_transition_cb;
+}
+
+Parser::~Parser( )
+{
+ mlt_parser_close( parser );
+}
+
+mlt_properties Parser::get_properties( )
+{
+ return mlt_parser_properties( parser );
+}
+
+int Parser::start( Service &service )
+{
+ return mlt_parser_start( parser, service.get_service( ) );
+}
+
+int Parser::on_invalid( Service *object )
+{
+ object->debug( "Invalid" );
+ return 0;
+}
+
+int Parser::on_unknown( Service *object )
+{
+ object->debug( "Unknown" );
+ return 0;
+}
+
+int Parser::on_start_producer( Producer *object )
+{
+ object->debug( "on_start_producer" );
+ return 0;
+}
+
+int Parser::on_end_producer( Producer *object )
+{
+ object->debug( "on_end_producer" );
+ return 0;
+}
+
+int Parser::on_start_playlist( Playlist *object )
+{
+ object->debug( "on_start_playlist" );
+ return 0;
+}
+
+int Parser::on_end_playlist( Playlist *object )
+{
+ object->debug( "on_end_playlist" );
+ return 0;
+}
+
+int Parser::on_start_tractor( Tractor *object )
+{
+ object->debug( "on_start_tractor" );
+ return 0;
+}
+
+int Parser::on_end_tractor( Tractor *object )
+{
+ object->debug( "on_end_tractor" );
+ return 0;
+}
+
+int Parser::on_start_multitrack( Multitrack *object )
+{
+ object->debug( "on_start_multitrack" );
+ return 0;
+}
+
+int Parser::on_end_multitrack( Multitrack *object )
+{
+ object->debug( "on_end_multitrack" );
+ return 0;
+}
+
+int Parser::on_start_track( )
+{
+ fprintf( stderr, "on_start_track\n" );
+ return 0;
+}
+
+int Parser::on_end_track( )
+{
+ fprintf( stderr, "on_end_track\n" );
+ return 0;
+}
+
+int Parser::on_start_filter( Filter *object )
+{
+ object->debug( "on_start_filter" );
+ return 0;
+}
+
+int Parser::on_end_filter( Filter *object )
+{
+ object->debug( "on_end_filter" );
+ return 0;
+}
+
+int Parser::on_start_transition( Transition *object )
+{
+ object->debug( "on_start_transition" );
+ return 0;
+}
+
+int Parser::on_end_transition( Transition *object )
+{
+ object->debug( "on_end_transition" );
+ return 0;
+}
+
+
--- /dev/null
+/**
+ * MltParser.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_PARSER_H_
+#define _MLTPP_PARSER_H_
+
+#include "config.h"
+
+#include <framework/mlt.h>
+#include "MltProperties.h"
+
+namespace Mlt
+{
+ class Properties;
+ class Service;
+ class Producer;
+ class Playlist;
+ class Tractor;
+ class Multitrack;
+ class Filter;
+ class Transition;
+
+ class MLTPP_DECLSPEC Parser : public Properties
+ {
+ private:
+ mlt_parser parser;
+ public:
+ Parser( );
+ ~Parser( );
+ int start( Service &service );
+ virtual mlt_properties get_properties( );
+ virtual int on_invalid( Service *object );
+ virtual int on_unknown( Service *object );
+ virtual int on_start_producer( Producer *object );
+ virtual int on_end_producer( Producer *object );
+ virtual int on_start_playlist( Playlist *object );
+ virtual int on_end_playlist( Playlist *object );
+ virtual int on_start_tractor( Tractor *object );
+ virtual int on_end_tractor( Tractor *object );
+ virtual int on_start_multitrack( Multitrack *object );
+ virtual int on_end_multitrack( Multitrack *object );
+ virtual int on_start_track( );
+ virtual int on_end_track( );
+ virtual int on_start_filter( Filter *object );
+ virtual int on_end_filter( Filter *object );
+ virtual int on_start_transition( Transition *object );
+ virtual int on_end_transition( Transition *object );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltPlaylist.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include "MltPlaylist.h"
+#include "MltTransition.h"
+using namespace Mlt;
+
+ClipInfo::ClipInfo( ) :
+ clip( 0 ),
+ producer( NULL ),
+ cut( NULL ),
+ start( 0 ),
+ resource( NULL ),
+ frame_in( 0 ),
+ frame_out( 0 ),
+ frame_count( 0 ),
+ length( 0 ),
+ fps( 0 ),
+ repeat( 0 )
+{
+}
+
+ClipInfo::ClipInfo( mlt_playlist_clip_info *info ) :
+ clip( info->clip ),
+ producer( new Producer( info->producer ) ),
+ cut( new Producer( info->cut ) ),
+ start( info->start ),
+ resource( info->resource? strdup( info->resource ) : 0 ),
+ frame_in( info->frame_in ),
+ frame_out( info->frame_out ),
+ frame_count( info->frame_count ),
+ length( info->length ),
+ fps( info->fps ),
+ repeat( info->repeat )
+{
+}
+
+ClipInfo::~ClipInfo( )
+{
+ delete producer;
+ delete cut;
+ free( resource );
+}
+
+void ClipInfo::update( mlt_playlist_clip_info *info )
+{
+ delete producer;
+ delete cut;
+ free( resource );
+ clip = info->clip;
+ producer = new Producer( info->producer );
+ cut = new Producer( info->cut );
+ start = info->start;
+ resource = strdup( info->resource );
+ frame_in = info->frame_in;
+ frame_out = info->frame_out;
+ frame_count = info->frame_count;
+ length = info->length;
+ fps = info->fps;
+ repeat = info->repeat;
+}
+
+Playlist::Playlist( ) :
+ instance( NULL )
+{
+ instance = mlt_playlist_init( );
+}
+
+Playlist::Playlist( Service &producer ) :
+ instance( NULL )
+{
+ if ( producer.type( ) == playlist_type )
+ {
+ instance = ( mlt_playlist )producer.get_service( );
+ inc_ref( );
+ }
+}
+
+Playlist::Playlist( Playlist &playlist ) :
+ Mlt::Producer( playlist ),
+ instance( playlist.get_playlist( ) )
+{
+ inc_ref( );
+}
+
+Playlist::Playlist( mlt_playlist playlist ) :
+ instance( playlist )
+{
+ inc_ref( );
+}
+
+Playlist::~Playlist( )
+{
+ mlt_playlist_close( instance );
+}
+
+mlt_playlist Playlist::get_playlist( )
+{
+ return instance;
+}
+
+mlt_producer Playlist::get_producer( )
+{
+ return mlt_playlist_producer( get_playlist( ) );
+}
+
+int Playlist::count( )
+{
+ return mlt_playlist_count( get_playlist( ) );
+}
+
+int Playlist::clear( )
+{
+ return mlt_playlist_clear( get_playlist( ) );
+}
+
+int Playlist::append( Producer &producer, int in, int out )
+{
+ return mlt_playlist_append_io( get_playlist( ), producer.get_producer( ), in, out );
+}
+
+int Playlist::blank( int length )
+{
+ return mlt_playlist_blank( get_playlist( ), length );
+}
+
+int Playlist::clip( mlt_whence whence, int index )
+{
+ return mlt_playlist_clip( get_playlist( ), whence, index );
+}
+
+int Playlist::current_clip( )
+{
+ return mlt_playlist_current_clip( get_playlist( ) );
+}
+
+Producer *Playlist::current( )
+{
+ return new Producer( mlt_playlist_current( get_playlist( ) ) );
+}
+
+ClipInfo *Playlist::clip_info( int index, ClipInfo *info )
+{
+ mlt_playlist_clip_info clip_info;
+ if ( mlt_playlist_get_clip_info( get_playlist( ), &clip_info, index ) )
+ return NULL;
+ if ( info == NULL )
+ return new ClipInfo( &clip_info );
+ info->update( &clip_info );
+ return info;
+}
+
+void Playlist::delete_clip_info( ClipInfo *info )
+{
+ delete info;
+}
+
+int Playlist::insert( Producer &producer, int where, int in, int out )
+{
+ return mlt_playlist_insert( get_playlist( ), producer.get_producer( ), where, in, out );
+}
+
+int Playlist::remove( int where )
+{
+ return mlt_playlist_remove( get_playlist( ), where );
+}
+
+int Playlist::move( int from, int to )
+{
+ return mlt_playlist_move( get_playlist( ), from, to );
+}
+
+int Playlist::resize_clip( int clip, int in, int out )
+{
+ return mlt_playlist_resize_clip( get_playlist( ), clip, in, out );
+}
+
+int Playlist::split( int clip, int position )
+{
+ return mlt_playlist_split( get_playlist( ), clip, position );
+}
+
+int Playlist::split_at( int position, bool left )
+{
+ return mlt_playlist_split_at( get_playlist( ), position, left );
+}
+
+int Playlist::join( int clip, int count, int merge )
+{
+ return mlt_playlist_join( get_playlist( ), clip, count, merge );
+}
+
+int Playlist::mix( int clip, int length, Transition *transition )
+{
+ return mlt_playlist_mix( get_playlist( ), clip, length, transition == NULL ? NULL : transition->get_transition( ) );
+}
+
+int Playlist::mix_add( int clip, Transition *transition )
+{
+ return mlt_playlist_mix_add( get_playlist( ), clip, transition == NULL ? NULL : transition->get_transition( ) );
+}
+
+int Playlist::repeat( int clip, int count )
+{
+ return mlt_playlist_repeat_clip( get_playlist( ), clip, count );
+}
+
+Producer *Playlist::get_clip( int clip )
+{
+ mlt_producer producer = mlt_playlist_get_clip( get_playlist( ), clip );
+ return producer != NULL ? new Producer( producer ) : NULL;
+}
+
+Producer *Playlist::get_clip_at( int position )
+{
+ mlt_producer producer = mlt_playlist_get_clip_at( get_playlist( ), position );
+ return producer != NULL ? new Producer( producer ) : NULL;
+}
+
+int Playlist::get_clip_index_at( int position )
+{
+ return mlt_playlist_get_clip_index_at( get_playlist( ), position );
+}
+
+bool Playlist::is_mix( int clip )
+{
+ return mlt_playlist_clip_is_mix( get_playlist( ), clip ) != 0;
+}
+
+bool Playlist::is_blank( int clip )
+{
+ return mlt_playlist_is_blank( get_playlist( ), clip ) != 0;
+}
+
+bool Playlist::is_blank_at( int position )
+{
+ return mlt_playlist_is_blank_at( get_playlist( ), position ) != 0;
+}
+
+Producer *Playlist::replace_with_blank( int clip )
+{
+ mlt_producer producer = mlt_playlist_replace_with_blank( get_playlist( ), clip );
+ Producer *object = producer != NULL ? new Producer( producer ) : NULL;
+ mlt_producer_close( producer );
+ return object;
+}
+
+void Playlist::consolidate_blanks( int keep_length )
+{
+ return mlt_playlist_consolidate_blanks( get_playlist( ), keep_length );
+}
+
+void Playlist::insert_blank( int clip, int length )
+{
+ mlt_playlist_insert_blank( get_playlist( ), clip, length );
+}
+
+void Playlist::pad_blanks( int position, int length, int find )
+{
+ mlt_playlist_pad_blanks( get_playlist( ), position, length, find );
+}
+
+int Playlist::insert_at( int position, Producer *producer, int mode )
+{
+ return mlt_playlist_insert_at( get_playlist( ), position, producer->get_producer( ), mode );
+}
+
+int Playlist::insert_at( int position, Producer &producer, int mode )
+{
+ return mlt_playlist_insert_at( get_playlist( ), position, producer.get_producer( ), mode );
+}
+
+int Playlist::clip_start( int clip )
+{
+ return mlt_playlist_clip_start( get_playlist( ), clip );
+}
+
+int Playlist::blanks_from( int clip, int bounded )
+{
+ return mlt_playlist_blanks_from( get_playlist( ), clip, bounded );
+}
+
+int Playlist::clip_length( int clip )
+{
+ return mlt_playlist_clip_length( get_playlist( ), clip );
+}
+
+int Playlist::remove_region( int position, int length )
+{
+ return mlt_playlist_remove_region( get_playlist( ), position, length );
+}
+
+int Playlist::move_region( int position, int length, int new_position )
+{
+ return mlt_playlist_move_region( get_playlist( ), position, length, new_position );
+}
+
--- /dev/null
+/**
+ * MltPlaylist.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_PLAYLIST_H_
+#define _MLTPP_PLAYLIST_H_
+
+#include "config.h"
+
+#include <framework/mlt.h>
+
+#include "MltProducer.h"
+
+namespace Mlt
+{
+ class Producer;
+ class Service;
+ class Playlist;
+ class Transition;
+
+ class MLTPP_DECLSPEC ClipInfo
+ {
+ public:
+ ClipInfo( );
+ ClipInfo( mlt_playlist_clip_info *info );
+ ~ClipInfo( );
+ void update( mlt_playlist_clip_info *info );
+ int clip;
+ Producer *producer;
+ Producer *cut;
+ int start;
+ char *resource;
+ int frame_in;
+ int frame_out;
+ int frame_count;
+ int length;
+ float fps;
+ int repeat;
+ };
+
+ class MLTPP_DECLSPEC Playlist : public Producer
+ {
+ private:
+ mlt_playlist instance;
+ public:
+ Playlist( );
+ Playlist( Service &playlist );
+ Playlist( Playlist &playlist );
+ Playlist( mlt_playlist playlist );
+ virtual ~Playlist( );
+ virtual mlt_playlist get_playlist( );
+ mlt_producer get_producer( );
+ int count( );
+ int clear( );
+ int append( Producer &producer, int in = -1, int out = -1 );
+ int blank( int length );
+ int clip( mlt_whence whence, int index );
+ int current_clip( );
+ Producer *current( );
+ ClipInfo *clip_info( int index, ClipInfo *info = NULL );
+ static void delete_clip_info( ClipInfo *info );
+ int insert( Producer &producer, int where, int in = -1, int out = -1 );
+ int remove( int where );
+ int move( int from, int to );
+ int resize_clip( int clip, int in, int out );
+ int split( int clip, int position );
+ int split_at( int position, bool left = true );
+ int join( int clip, int count = 1, int merge = 1 );
+ int mix( int clip, int length, Transition *transition = NULL );
+ int mix_add( int clip, Transition *transition );
+ int repeat( int clip, int count );
+ Producer *get_clip( int clip );
+ Producer *get_clip_at( int position );
+ int get_clip_index_at( int position );
+ bool is_mix( int clip );
+ bool is_blank( int clip );
+ bool is_blank_at( int position );
+ void consolidate_blanks( int keep_length = 0 );
+ Producer *replace_with_blank( int clip );
+ void insert_blank( int clip, int length );
+ void pad_blanks( int position, int length, int find = 0 );
+ int insert_at( int position, Producer *producer, int mode = 0 );
+ int insert_at( int position, Producer &producer, int mode = 0 );
+ int clip_start( int clip );
+ int clip_length( int clip );
+ int blanks_from( int clip, int bounded = 0 );
+ int remove_region( int position, int length );
+ int move_region( int position, int length, int new_position );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltProducer.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltProducer.h"
+#include "MltFilter.h"
+#include "MltProfile.h"
+using namespace Mlt;
+
+Producer::Producer( ) :
+ instance( NULL ),
+ parent_( NULL )
+{
+}
+
+Producer::Producer( Profile& profile, const char *id, const char *service ) :
+ instance( NULL ),
+ parent_( NULL )
+{
+ if ( id != NULL && service != NULL )
+ instance = mlt_factory_producer( profile.get_profile(), id, service );
+ else
+ instance = mlt_factory_producer( profile.get_profile(), "fezzik", id != NULL ? id : service );
+}
+
+Producer::Producer( Service &producer ) :
+ instance( NULL ),
+ parent_( NULL )
+{
+ mlt_service_type type = producer.type( );
+ if ( type == producer_type || type == playlist_type ||
+ type == tractor_type || type == multitrack_type )
+ {
+ instance = ( mlt_producer )producer.get_service( );
+ inc_ref( );
+ }
+}
+
+Producer::Producer( mlt_producer producer ) :
+ instance( producer ),
+ parent_( NULL )
+{
+ inc_ref( );
+}
+
+Producer::Producer( Producer &producer ) :
+ Mlt::Service( producer ),
+ instance( producer.get_producer( ) ),
+ parent_( NULL )
+{
+ inc_ref( );
+}
+
+Producer::Producer( Producer *producer ) :
+ instance( producer != NULL ? producer->get_producer( ) : NULL ),
+ parent_( NULL )
+{
+ if ( is_valid( ) )
+ inc_ref( );
+}
+
+Producer::~Producer( )
+{
+ delete parent_;
+ mlt_producer_close( instance );
+ instance = NULL;
+}
+
+mlt_producer Producer::get_producer( )
+{
+ return instance;
+}
+
+mlt_producer Producer::get_parent( )
+{
+ return get_producer( ) != NULL && mlt_producer_cut_parent( get_producer( ) ) != NULL ? mlt_producer_cut_parent( get_producer( ) ) : get_producer( );
+}
+
+Producer &Producer::parent( )
+{
+ if ( is_cut( ) && parent_ == NULL )
+ parent_ = new Producer( get_parent( ) );
+ return parent_ == NULL ? *this : *parent_;
+}
+
+mlt_service Producer::get_service( )
+{
+ return mlt_producer_service( get_producer( ) );
+}
+
+int Producer::seek( int position )
+{
+ return mlt_producer_seek( get_producer( ), position );
+}
+
+int Producer::position( )
+{
+ return mlt_producer_position( get_producer( ) );
+}
+
+int Producer::frame( )
+{
+ return mlt_producer_frame( get_producer( ) );
+}
+
+int Producer::set_speed( double speed )
+{
+ return mlt_producer_set_speed( get_producer( ), speed );
+}
+
+double Producer::get_speed( )
+{
+ return mlt_producer_get_speed( get_producer( ) );
+}
+
+double Producer::get_fps( )
+{
+ return mlt_producer_get_fps( get_producer( ) );
+}
+
+int Producer::set_in_and_out( int in, int out )
+{
+ return mlt_producer_set_in_and_out( get_producer( ), in, out );
+}
+
+int Producer::get_in( )
+{
+ return mlt_producer_get_in( get_producer( ) );
+}
+
+int Producer::get_out( )
+{
+ return mlt_producer_get_out( get_producer( ) );
+}
+
+int Producer::get_length( )
+{
+ return mlt_producer_get_length( get_producer( ) );
+}
+
+int Producer::get_playtime( )
+{
+ return mlt_producer_get_playtime( get_producer( ) );
+}
+
+Producer *Producer::cut( int in, int out )
+{
+ mlt_producer producer = mlt_producer_cut( get_producer( ), in, out );
+ Producer *result = new Producer( producer );
+ mlt_producer_close( producer );
+ return result;
+}
+
+bool Producer::is_cut( )
+{
+ return mlt_producer_is_cut( get_producer( ) ) != 0;
+}
+
+bool Producer::is_blank( )
+{
+ return mlt_producer_is_blank( get_producer( ) ) != 0;
+}
+
+bool Producer::same_clip( Producer &that )
+{
+ return mlt_producer_cut_parent( get_producer( ) ) == mlt_producer_cut_parent( that.get_producer( ) );
+}
+
+bool Producer::runs_into( Producer &that )
+{
+ return same_clip( that ) && get_out( ) == ( that.get_in( ) - 1 );
+}
+
+void Producer::optimise( )
+{
+ mlt_producer_optimise( get_producer( ) );
+}
--- /dev/null
+/**
+ * MltProducer.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_PRODUCER_H_
+#define _MLTPP_PRODUCER_H_
+
+#include "config.h"
+
+#include <framework/mlt.h>
+
+#include "MltService.h"
+
+namespace Mlt
+{
+ class Service;
+ class Filter;
+ class Profile;
+ class Frame;
+
+ class MLTPP_DECLSPEC Producer : public Service
+ {
+ private:
+ mlt_producer instance;
+ Producer *parent_;
+ public:
+ Producer( );
+ Producer( Profile& profile, const char *id, const char *service = NULL );
+ Producer( Service &producer );
+ Producer( mlt_producer producer );
+ Producer( Producer &producer );
+ Producer( Producer *producer );
+ virtual ~Producer( );
+ virtual mlt_producer get_producer( );
+ Producer &parent( );
+ mlt_producer get_parent( );
+ mlt_service get_service( );
+ int seek( int position );
+ int position( );
+ int frame( );
+ int set_speed( double speed );
+ double get_speed( );
+ double get_fps( );
+ int set_in_and_out( int in, int out );
+ int get_in( );
+ int get_out( );
+ int get_length( );
+ int get_playtime( );
+ Producer *cut( int in = 0, int out = -1 );
+ bool is_cut( );
+ bool is_blank( );
+ bool same_clip( Producer &that );
+ bool runs_into( Producer &that );
+ void optimise( );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltProfile.cpp - MLT Wrapper
+ * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltProfile.h"
+#include "MltProperties.h"
+using namespace Mlt;
+
+Profile::Profile( ) :
+ instance( NULL )
+{
+ instance = mlt_profile_init( NULL );
+}
+
+Profile::Profile( const char* name ) :
+ instance( NULL )
+{
+ instance = mlt_profile_init( name );
+}
+
+Profile::Profile( Properties& properties ) :
+ instance( NULL )
+{
+ instance = mlt_profile_load_properties( properties.get_properties() );
+}
+
+Profile::Profile( mlt_profile profile ) :
+ instance( profile )
+{
+}
+
+Profile::~Profile( )
+{
+ if ( instance )
+ mlt_profile_close( instance );
+ instance = NULL;
+}
+
+mlt_profile Profile::get_profile( ) const
+{
+ return instance;
+}
+
+char* Profile::description() const
+{
+ return instance->description;
+}
+
+int Profile::frame_rate_num() const
+{
+ return instance->frame_rate_num;
+}
+
+int Profile::frame_rate_den() const
+{
+ return instance->frame_rate_den;
+}
+
+double Profile::fps() const
+{
+ return mlt_profile_fps( instance );
+}
+
+int Profile::width() const
+{
+ return instance->width;
+}
+
+int Profile::height() const
+{
+ return instance->height;
+}
+
+bool Profile::progressive() const
+{
+ return instance->progressive;
+}
+
+int Profile::sample_aspect_num() const
+{
+ return instance->sample_aspect_num;
+}
+
+int Profile::sample_aspect_den() const
+{
+ return instance->sample_aspect_den;
+}
+
+double Profile::sar() const
+{
+ return mlt_profile_sar( instance );
+}
+
+int Profile::display_aspect_num() const
+{
+ return instance->display_aspect_num;
+}
+
+int Profile::display_aspect_den() const
+{
+ return instance->display_aspect_den;
+}
+
+double Profile::dar() const
+{
+ return mlt_profile_dar( instance );
+}
--- /dev/null
+/**
+ * MltProfile.h - MLT Wrapper
+ * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_PROFILE_H_
+#define _MLTPP_PROFILE_H_
+
+#include "config.h"
+
+#ifdef SWIG
+#define MLTPP_DECLSPEC
+#endif
+
+#include <framework/mlt.h>
+
+namespace Mlt
+{
+ class Properties;
+
+ class MLTPP_DECLSPEC Profile
+ {
+ private:
+ mlt_profile instance;
+ public:
+ Profile( );
+ Profile( const char* name );
+ Profile( Properties& properties );
+ Profile( mlt_profile profile );
+ ~Profile();
+
+ mlt_profile get_profile( ) const;
+ char* description() const;
+ int frame_rate_num() const;
+ int frame_rate_den() const;
+ double fps() const;
+ int width() const;
+ int height() const;
+ bool progressive() const;
+ int sample_aspect_num() const;
+ int sample_aspect_den() const;
+ double sar() const;
+ int display_aspect_num() const;
+ int display_aspect_den() const;
+ double dar() const;
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltProperties.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltProperties.h"
+#include "MltEvent.h"
+using namespace Mlt;
+
+Properties::Properties( ) :
+ instance( NULL )
+{
+ instance = mlt_properties_new( );
+}
+
+Properties::Properties( bool /*dummy*/ ) :
+ instance( NULL )
+{
+}
+
+Properties::Properties( Properties &properties ) :
+ instance( properties.get_properties( ) )
+{
+ inc_ref( );
+}
+
+Properties::Properties( mlt_properties properties ) :
+ instance( properties )
+{
+ inc_ref( );
+}
+
+Properties::Properties( const char *file ) :
+ instance( NULL )
+{
+ instance = mlt_properties_load( file );
+}
+
+Properties::~Properties( )
+{
+ mlt_properties_close( instance );
+}
+
+mlt_properties Properties::get_properties( )
+{
+ return instance;
+}
+
+int Properties::inc_ref( )
+{
+ return mlt_properties_inc_ref( get_properties( ) );
+}
+
+int Properties::dec_ref( )
+{
+ return mlt_properties_dec_ref( get_properties( ) );
+}
+
+int Properties::ref_count( )
+{
+ return mlt_properties_ref_count( get_properties( ) );
+}
+
+void Properties::block( void *object )
+{
+ mlt_events_block( get_properties( ), object != NULL ? object : get_properties( ) );
+}
+
+void Properties::unblock( void *object )
+{
+ mlt_events_unblock( get_properties( ), object != NULL ? object : get_properties( ) );
+}
+
+void Properties::fire_event( const char *event )
+{
+ mlt_events_fire( get_properties( ), event, NULL );
+}
+
+bool Properties::is_valid( )
+{
+ return get_properties( ) != NULL;
+}
+
+int Properties::count( )
+{
+ return mlt_properties_count( get_properties( ) );
+}
+
+char *Properties::get( const char *name )
+{
+ return mlt_properties_get( get_properties( ), name );
+}
+
+int Properties::get_int( const char *name )
+{
+ return mlt_properties_get_int( get_properties( ), name );
+}
+
+double Properties::get_double( const char *name )
+{
+ return mlt_properties_get_double( get_properties( ), name );
+}
+
+void *Properties::get_data( const char *name, int &size )
+{
+ return mlt_properties_get_data( get_properties( ), name, &size );
+}
+
+void *Properties::get_data( const char *name )
+{
+ return mlt_properties_get_data( get_properties( ), name, NULL );
+}
+
+int Properties::set( const char *name, const char *value )
+{
+ return mlt_properties_set( get_properties( ), name, value );
+}
+
+int Properties::set( const char *name, int value )
+{
+ return mlt_properties_set_int( get_properties( ), name, value );
+}
+
+int Properties::set( const char *name, double value )
+{
+ return mlt_properties_set_double( get_properties( ), name, value );
+}
+
+int Properties::set( const char *name, void *value, int size, mlt_destructor destructor, mlt_serialiser serialiser )
+{
+ return mlt_properties_set_data( get_properties( ), name, value, size, destructor, serialiser );
+}
+
+int Properties::pass_values( Properties &that, const char *prefix )
+{
+ return mlt_properties_pass( get_properties( ), that.get_properties( ), prefix );
+}
+
+int Properties::parse( const char *namevalue )
+{
+ return mlt_properties_parse( get_properties( ), namevalue );
+}
+
+char *Properties::get_name( int index )
+{
+ return mlt_properties_get_name( get_properties( ), index );
+}
+
+char *Properties::get( int index )
+{
+ return mlt_properties_get_value( get_properties( ), index );
+}
+
+void *Properties::get_data( int index, int &size )
+{
+ return mlt_properties_get_data_at( get_properties( ), index, &size );
+}
+
+void Properties::mirror( Properties &that )
+{
+ mlt_properties_mirror( get_properties( ), that.get_properties( ) );
+}
+
+int Properties::inherit( Properties &that )
+{
+ return mlt_properties_inherit( get_properties( ), that.get_properties( ) );
+}
+
+int Properties::rename( const char *source, const char *dest )
+{
+ return mlt_properties_rename( get_properties( ), source, dest );
+}
+
+void Properties::dump( FILE *output )
+{
+ mlt_properties_dump( get_properties( ), output );
+}
+
+void Properties::debug( const char *title, FILE *output )
+{
+ mlt_properties_debug( get_properties( ), title, output );
+}
+
+void Properties::load( const char *file )
+{
+ mlt_properties properties = mlt_properties_load( file );
+ if ( properties != NULL )
+ mlt_properties_pass( get_properties( ), properties, "" );
+ mlt_properties_close( properties );
+}
+
+int Properties::save( const char *file )
+{
+#ifdef WIN32
+ return mlt_properties_save( get_properties( ), file );
+#else
+ int error = 0;
+ FILE *f = fopen( file, "w" );
+ if ( f != NULL )
+ {
+ dump( f );
+ fclose( f );
+ }
+ else
+ {
+ error = 1;
+ }
+ return error;
+#endif
+}
+
+#if defined( __DARWIN__ ) && GCC_VERSION < 40000
+
+Event *Properties::listen( const char *id, void *object, void (*listener)( ... ) )
+{
+ mlt_event event = mlt_events_listen( get_properties( ), object, id, ( mlt_listener )listener );
+ return new Event( event );
+}
+
+#else
+
+Event *Properties::listen( const char *id, void *object, mlt_listener listener )
+{
+ mlt_event event = mlt_events_listen( get_properties( ), object, id, listener );
+ return new Event( event );
+}
+
+#endif
+
+Event *Properties::setup_wait_for( const char *id )
+{
+ return new Event( mlt_events_setup_wait_for( get_properties( ), id ) );
+}
+
+void Properties::delete_event( Event *event )
+{
+ delete event;
+}
+
+void Properties::wait_for( Event *event, bool destroy )
+{
+ mlt_events_wait_for( get_properties( ), event->get_event( ) );
+ if ( destroy )
+ mlt_events_close_wait_for( get_properties( ), event->get_event( ) );
+}
+
--- /dev/null
+/**
+ * MltProperties.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_PROPERTIES_H_
+#define _MLTPP_PROPERTIES_H_
+
+#include "config.h"
+
+#include <stdio.h>
+#include <framework/mlt.h>
+
+namespace Mlt
+{
+ class Event;
+
+ /** Abstract Properties class.
+ */
+
+ class MLTPP_DECLSPEC Properties
+ {
+ private:
+ mlt_properties instance;
+ public:
+ Properties( );
+ Properties( bool dummy );
+ Properties( Properties &properties );
+ Properties( mlt_properties properties );
+ Properties( const char *file );
+ virtual ~Properties( );
+ virtual mlt_properties get_properties( );
+ int inc_ref( );
+ int dec_ref( );
+ int ref_count( );
+ void block( void *object = NULL );
+ void unblock( void *object = NULL );
+ void fire_event( const char *event );
+ bool is_valid( );
+ int count( );
+ char *get( const char *name );
+ int get_int( const char *name );
+ double get_double( const char *name );
+ void *get_data( const char *name, int &size );
+ void *get_data( const char *name );
+ int set( const char *name, const char *value );
+ int set( const char *name, int value );
+ int set( const char *name, double value );
+ int set( const char *name, void *value, int size, mlt_destructor destroy = NULL, mlt_serialiser serial = NULL );
+ int pass_values( Properties &that, const char *prefix );
+ int parse( const char *namevalue );
+ char *get_name( int index );
+ char *get( int index );
+ void *get_data( int index, int &size );
+ void mirror( Properties &that );
+ int inherit( Properties &that );
+ int rename( const char *source, const char *dest );
+ void dump( FILE *output = stderr );
+ void debug( const char *title = "Object", FILE *output = stderr );
+ void load( const char *file );
+ int save( const char *file );
+ #if defined( __DARWIN__ ) && GCC_VERSION < 40000
+ Event *listen( const char *id, void *object, void (*)( ... ) );
+ #else
+ Event *listen( const char *id, void *object, mlt_listener );
+ #endif
+ static void delete_event( Event * );
+ Event *setup_wait_for( const char *id );
+ void wait_for( Event *, bool destroy = true );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltPushConsumer.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltPushConsumer.h"
+#include "MltFilter.h"
+using namespace Mlt;
+
+namespace Mlt
+{
+ class PushPrivate
+ {
+ public:
+ PushPrivate( )
+ {
+ }
+ };
+}
+
+static void filter_destructor( void *arg )
+{
+ Filter *filter = ( Filter * )arg;
+ delete filter;
+}
+
+PushConsumer::PushConsumer( Profile& profile, char *id , char *service ) :
+ Consumer( profile, id, service ),
+ m_private( new PushPrivate( ) )
+{
+ if ( is_valid( ) )
+ {
+ // Set up push mode (known as put mode in mlt)
+ set( "real_time", 0 );
+ set( "put_mode", 1 );
+ set( "terminate_on_pause", 0 );
+ set( "buffer", 0 );
+
+ // We might need resize and rescale filters so we'll create them now
+ // NB: Try to use the best rescaler available here
+ Filter *resize = new Filter( profile, "resize" );
+ Filter *rescale = new Filter( profile, "mcrescale" );
+ if ( !rescale->is_valid( ) )
+ {
+ delete rescale;
+ rescale = new Filter( profile, "gtkrescale" );
+ }
+ if ( !rescale->is_valid( ) )
+ {
+ delete rescale;
+ rescale = new Filter( profile, "rescale" );
+ }
+
+ Filter *convert = new Filter( profile, "avcolour_space" );
+
+ set( "filter_convert", convert, 0, filter_destructor );
+ set( "filter_resize", resize, 0, filter_destructor );
+ set( "filter_rescale", rescale, 0, filter_destructor );
+ }
+}
+
+PushConsumer::~PushConsumer( )
+{
+}
+
+void PushConsumer::set_render( int width, int height, double aspect_ratio )
+{
+ set( "render_width", width );
+ set( "render_height", height );
+ set( "render_aspect_ratio", aspect_ratio );
+}
+
+int PushConsumer::connect( Service &/*service*/ )
+{
+ return -1;
+}
+
+int PushConsumer::push( Frame *frame )
+{
+ frame->inc_ref( );
+
+ // Here we have the option to process the frame at a render resolution (this will
+ // typically be PAL or NTSC) prior to scaling according to the consumers profile
+ // This is done to optimise quality, esp. with regard to compositing positions
+ if ( get_int( "render_width" ) )
+ {
+ // Process the projects render resolution first
+ mlt_image_format format = mlt_image_yuv422;
+ int w = get_int( "render_width" );
+ int h = get_int( "render_height" );
+ frame->set( "consumer_aspect_ratio", get_double( "render_aspect_ratio" ) );
+ frame->set( "consumer_deinterlace", get_int( "deinterlace" ) );
+ frame->set( "deinterlace_method", get_int( "deinterlace_method" ) );
+ frame->set( "rescale.interp", get( "rescale" ) );
+
+ // Render the frame
+ frame->get_image( format, w, h );
+
+ // Now set up the post image scaling
+ Filter *convert = ( Filter * )get_data( "filter_convert" );
+ mlt_filter_process( convert->get_filter( ), frame->get_frame( ) );
+ Filter *rescale = ( Filter * )get_data( "filter_rescale" );
+ mlt_filter_process( rescale->get_filter( ), frame->get_frame( ) );
+ Filter *resize = ( Filter * )get_data( "filter_resize" );
+ mlt_filter_process( resize->get_filter( ), frame->get_frame( ) );
+ }
+
+ return mlt_consumer_put_frame( ( mlt_consumer )get_service( ), frame->get_frame( ) );
+}
+
+int PushConsumer::push( Frame &frame )
+{
+ return push( &frame );
+}
+
+int PushConsumer::drain( )
+{
+ return 0;
+}
+
+// Convenience function - generates a frame with an image of a given size
+Frame *PushConsumer::construct( int size )
+{
+ mlt_frame f = mlt_frame_init( get_service() );
+ Frame *frame = new Frame( f );
+ uint8_t *buffer = ( uint8_t * )mlt_pool_alloc( size );
+ frame->set( "image", buffer, size, mlt_pool_release );
+ mlt_frame_close( f );
+ return frame;
+}
+
--- /dev/null
+/**
+ * MltPushConsumer.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MLTPP_PUSH_CONSUMER_H
+#define MLTPP_PUSH_CONSUMER_H
+
+#include "config.h"
+
+#include "MltConsumer.h"
+
+namespace Mlt
+{
+ class Frame;
+ class Service;
+ class PushPrivate;
+ class Profile;
+
+ class MLTPP_DECLSPEC PushConsumer : public Consumer
+ {
+ private:
+ PushPrivate *m_private;
+ public:
+ PushConsumer( Profile& profile, char *id , char *service = NULL );
+ virtual ~PushConsumer( );
+ void set_render( int width, int height, double aspect_ratio );
+ virtual int connect( Service &service );
+ int push( Frame *frame );
+ int push( Frame &frame );
+ int drain( );
+ Frame *construct( int );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltRepository.cpp - MLT Wrapper
+ * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltRepository.h"
+#include "MltProfile.h"
+#include "MltProperties.h"
+using namespace Mlt;
+
+Repository::Repository( const char* directory ) :
+ instance( NULL )
+{
+ instance = mlt_repository_init( directory );
+}
+
+Repository::Repository( mlt_repository repository ) :
+ instance( repository )
+{
+}
+
+Repository::~Repository( )
+{
+ if ( instance )
+ mlt_repository_close( instance );
+ instance = NULL;
+}
+
+void Repository::register_service( mlt_service_type service_type, const char *service, mlt_register_callback symbol )
+{
+ mlt_repository_register( instance, service_type, service, symbol );
+}
+
+void *Repository::create( Profile& profile, mlt_service_type type, const char *service, void *arg )
+{
+ return mlt_repository_create( instance, profile.get_profile(), type, service, arg );
+}
+
+Properties *Repository::consumers( ) const
+{
+ return new Properties( mlt_repository_consumers( instance ) );
+}
+
+Properties *Repository::filters( ) const
+{
+ return new Properties( mlt_repository_filters( instance ) );
+}
+
+Properties *Repository::producers( ) const
+{
+ return new Properties( mlt_repository_producers( instance ) );
+}
+
+Properties *Repository::transitions( ) const
+{
+ return new Properties( mlt_repository_transitions( instance ) );
+}
+
+void Repository::register_metadata( mlt_service_type type, const char *service, mlt_metadata_callback callback, void *callback_data )
+{
+ mlt_repository_register_metadata( instance, type, service, callback, callback_data );
+}
+
+Properties *Repository::metadata( mlt_service_type type, const char *service ) const
+{
+ return new Properties( mlt_repository_metadata( instance, type, service ) );
+}
--- /dev/null
+/**
+ * MltRepository.h - MLT Wrapper
+ * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_REPOSITORY_H_
+#define _MLTPP_REPOSITORY_H_
+
+#include "config.h"
+
+#ifdef SWIG
+#define MLTPP_DECLSPEC
+#endif
+
+#include <framework/mlt.h>
+
+namespace Mlt
+{
+ class Profile;
+ class Properties;
+
+ class MLTPP_DECLSPEC Repository
+ {
+ private:
+ mlt_repository instance;
+ Repository( ) { }
+ public:
+ Repository( const char* directory );
+ Repository( mlt_repository repository );
+ ~Repository();
+
+ void register_service( mlt_service_type service_type, const char *service, mlt_register_callback symbol );
+ void *create( Profile& profile, mlt_service_type type, const char *service, void *arg );
+ Properties *consumers( ) const;
+ Properties *filters( ) const;
+ Properties *producers( ) const;
+ Properties *transitions( ) const;
+ void register_metadata( mlt_service_type type, const char *service, mlt_metadata_callback, void *callback_data );
+ Properties *metadata( mlt_service_type type, const char *service ) const;
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltResponse.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include "MltResponse.h"
+using namespace Mlt;
+
+Response::Response( valerie_response response ) :
+ _response( response )
+{
+}
+
+Response::Response( int error, const char *message ) :
+ _response( NULL )
+{
+ _response = valerie_response_init( );
+ if ( _response != NULL )
+ valerie_response_set_error( _response, error, message );
+}
+
+Response::~Response( )
+{
+ valerie_response_close( _response );
+}
+
+valerie_response Response::get_response( )
+{
+ return _response;
+}
+
+int Response::error_code( )
+{
+ return valerie_response_get_error_code( get_response( ) );
+}
+
+const char *Response::error_string( )
+{
+ return valerie_response_get_error_string( get_response( ) );
+}
+
+char *Response::get( int index )
+{
+ return valerie_response_get_line( get_response( ), index );
+}
+
+int Response::count( )
+{
+ return valerie_response_count( get_response( ) );
+}
+
+int Response::write( const char *data )
+{
+ return valerie_response_write( get_response( ), data, strlen( data ) );
+}
+
--- /dev/null
+/**
+ * MltResponse.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_RESPONSE_H_
+#define _MLTPP_RESPONSE_H_
+
+#include <valerie/valerie_response.h>
+
+namespace Mlt
+{
+ class Response
+ {
+ private:
+ valerie_response _response;
+ public:
+ Response( valerie_response response );
+ Response( int error, const char *message );
+ ~Response( );
+ valerie_response get_response( );
+ int error_code( );
+ const char *error_string( );
+ char *get( int );
+ int count( );
+ int write( const char *data );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltService.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include "MltService.h"
+#include "MltFilter.h"
+#include "MltProfile.h"
+using namespace Mlt;
+
+Service::Service( ) :
+ Properties( false ),
+ instance( NULL )
+{
+}
+
+Service::Service( Service &service ) :
+ Properties( false ),
+ instance( service.get_service( ) )
+{
+ inc_ref( );
+}
+
+Service::Service( mlt_service service ) :
+ Properties( false ),
+ instance( service )
+{
+ inc_ref( );
+}
+
+Service::~Service( )
+{
+ mlt_service_close( instance );
+}
+
+mlt_service Service::get_service( )
+{
+ return instance;
+}
+
+mlt_properties Service::get_properties( )
+{
+ return mlt_service_properties( get_service( ) );
+}
+
+void Service::lock( )
+{
+ mlt_service_lock( get_service( ) );
+}
+
+void Service::unlock( )
+{
+ mlt_service_unlock( get_service( ) );
+}
+
+int Service::connect_producer( Service &producer, int index )
+{
+ return mlt_service_connect_producer( get_service( ), producer.get_service( ), index );
+}
+
+Service *Service::producer( )
+{
+ return new Service( mlt_service_producer( get_service( ) ) );
+}
+
+Service *Service::consumer( )
+{
+ return new Service( mlt_service_consumer( get_service( ) ) );
+}
+
+Profile *Service::profile( )
+{
+ return new Profile( mlt_service_profile( get_service() ) );
+}
+
+Frame *Service::get_frame( int index )
+{
+ mlt_frame frame = NULL;
+ mlt_service_get_frame( get_service( ), &frame, index );
+ Frame *result = new Frame( frame );
+ mlt_frame_close( frame );
+ return result;
+}
+
+mlt_service_type Service::type( )
+{
+ return mlt_service_identify( get_service( ) );
+}
+
+int Service::attach( Filter &filter )
+{
+ return mlt_service_attach( get_service( ), filter.get_filter( ) );
+}
+
+int Service::detach( Filter &filter )
+{
+ return mlt_service_detach( get_service( ), filter.get_filter( ) );
+}
+
+Filter *Service::filter( int index )
+{
+ mlt_filter result = mlt_service_filter( get_service( ), index );
+ return result == NULL ? NULL : new Filter( result );
+}
+
--- /dev/null
+/**
+ * MltService.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_SERVICE_H_
+#define _MLTPP_SERVICE_H_
+
+#include "config.h"
+
+#include <framework/mlt.h>
+
+#include "MltProperties.h"
+#include "MltFrame.h"
+
+namespace Mlt
+{
+ class Properties;
+ class Filter;
+ class Frame;
+ class Profile;
+
+ class MLTPP_DECLSPEC Service : public Properties
+ {
+ private:
+ mlt_service instance;
+ public:
+ Service( );
+ Service( Service &service );
+ Service( mlt_service service );
+ virtual ~Service( );
+ virtual mlt_service get_service( );
+ void lock( );
+ void unlock( );
+ virtual mlt_properties get_properties( );
+ int connect_producer( Service &producer, int index = 0 );
+ Service *consumer( );
+ Service *producer( );
+ Profile *profile( );
+ Frame *get_frame( int index = 0 );
+ mlt_service_type type( );
+ int attach( Filter &filter );
+ int detach( Filter &filter );
+ Filter *filter( int index );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * MltTokeniser.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdlib.h>
+#include "MltTokeniser.h"
+using namespace Mlt;
+
+Tokeniser::Tokeniser( char *text, char *delimiter )
+{
+ tokens = mlt_tokeniser_init( );
+ if ( text != NULL )
+ mlt_tokeniser_parse_new( tokens, text, delimiter );
+}
+
+Tokeniser::~Tokeniser( )
+{
+ mlt_tokeniser_close( tokens );
+}
+
+int Tokeniser::parse( char *text, char *delimiter )
+{
+ return mlt_tokeniser_parse_new( tokens, text, delimiter );
+}
+
+int Tokeniser::count( )
+{
+ return mlt_tokeniser_count( tokens );
+}
+
+char *Tokeniser::get( int index )
+{
+ return mlt_tokeniser_get_string( tokens, index );
+}
+
+char *Tokeniser::input( )
+{
+ return mlt_tokeniser_get_input( tokens );
+}
+
--- /dev/null
+/**
+ * MltTokeniser.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_TOKENISER_H
+#define _MLTPP_TOKENISER_H
+
+#include "config.h"
+
+#include <framework/mlt.h>
+
+namespace Mlt
+{
+ class MLTPP_DECLSPEC Tokeniser
+ {
+ private:
+ mlt_tokeniser tokens;
+ public:
+ Tokeniser( char *text = NULL, char *delimiter = " " );
+ ~Tokeniser( );
+ int parse( char *text, char *delimiter = " " );
+ int count( );
+ char *get( int index );
+ char *input( );
+ };
+}
+
+#endif
+
--- /dev/null
+/**
+ * MltTractor.cpp - Tractor wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltTractor.h"
+#include "MltMultitrack.h"
+#include "MltField.h"
+#include "MltTransition.h"
+#include "MltFilter.h"
+#include "MltPlaylist.h"
+using namespace Mlt;
+
+Tractor::Tractor( ) :
+ instance( mlt_tractor_new( ) )
+{
+}
+
+Tractor::Tractor( Service &tractor ) :
+ instance( NULL )
+{
+ if ( tractor.type( ) == tractor_type )
+ {
+ instance = ( mlt_tractor )tractor.get_service( );
+ inc_ref( );
+ }
+}
+
+Tractor::Tractor( mlt_tractor tractor ) :
+ instance( tractor )
+{
+ inc_ref( );
+}
+
+Tractor::Tractor( Tractor &tractor ) :
+ Mlt::Producer( tractor ),
+ instance( tractor.get_tractor( ) )
+{
+ inc_ref( );
+}
+
+Tractor::Tractor( Profile& profile, char *id, char *resource ) :
+ instance( NULL )
+{
+ Producer producer( profile, id, resource );
+ if ( producer.is_valid( ) && producer.type( ) == tractor_type )
+ {
+ instance = ( mlt_tractor )producer.get_producer( );
+ inc_ref( );
+ }
+ else if ( producer.is_valid( ) )
+ {
+ instance = mlt_tractor_new( );
+ set_track( producer, 0 );
+ }
+}
+
+Tractor::~Tractor( )
+{
+ mlt_tractor_close( instance );
+}
+
+mlt_tractor Tractor::get_tractor( )
+{
+ return instance;
+}
+
+mlt_producer Tractor::get_producer( )
+{
+ return mlt_tractor_producer( get_tractor( ) );
+}
+
+Multitrack *Tractor::multitrack( )
+{
+ return new Multitrack( mlt_tractor_multitrack( get_tractor( ) ) );
+}
+
+Field *Tractor::field( )
+{
+ return new Field( mlt_tractor_field( get_tractor( ) ) );
+}
+
+void Tractor::refresh( )
+{
+ return mlt_tractor_refresh( get_tractor( ) );
+}
+
+int Tractor::set_track( Producer &producer, int index )
+{
+ return mlt_tractor_set_track( get_tractor( ), producer.get_producer( ), index );
+}
+
+Producer *Tractor::track( int index )
+{
+ mlt_producer producer = mlt_tractor_get_track( get_tractor( ), index );
+ return producer != NULL ? new Producer( producer ) : NULL;
+}
+
+int Tractor::count( )
+{
+ return mlt_multitrack_count( mlt_tractor_multitrack( get_tractor( ) ) );
+}
+
+void Tractor::plant_transition( Transition &transition, int a_track, int b_track )
+{
+ mlt_field_plant_transition( mlt_tractor_field( get_tractor( ) ), transition.get_transition( ), a_track, b_track );
+}
+
+void Tractor::plant_transition( Transition *transition, int a_track, int b_track )
+{
+ if ( transition != NULL )
+ mlt_field_plant_transition( mlt_tractor_field( get_tractor( ) ), transition->get_transition( ), a_track, b_track );
+}
+
+void Tractor::plant_filter( Filter &filter, int track )
+{
+ mlt_field_plant_filter( mlt_tractor_field( get_tractor( ) ), filter.get_filter( ), track );
+}
+
+void Tractor::plant_filter( Filter *filter, int track )
+{
+ mlt_field_plant_filter( mlt_tractor_field( get_tractor( ) ), filter->get_filter( ), track );
+}
+
+bool Tractor::locate_cut( Producer *producer, int &track, int &cut )
+{
+ bool found = false;
+
+ for ( track = 0; producer != NULL && !found && track < count( ); track ++ )
+ {
+ Playlist playlist( ( mlt_playlist )mlt_tractor_get_track( get_tractor( ), track ) );
+ for ( cut = 0; !found && cut < playlist.count( ); cut ++ )
+ {
+ Producer *clip = playlist.get_clip( cut );
+ found = producer->get_producer( ) == clip->get_producer( );
+ delete clip;
+ }
+ }
+
+ track --;
+ cut --;
+
+ return found;
+}
--- /dev/null
+/**
+ * MltTractor.h - Tractor wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_TRACTOR_H_
+#define _MLTPP_TRACTOR_H_
+
+#include "config.h"
+
+#include <framework/mlt.h>
+
+#include "MltProducer.h"
+
+namespace Mlt
+{
+ class Producer;
+ class Field;
+ class Multitrack;
+ class Transition;
+ class Filter;
+ class Profile;
+
+ class MLTPP_DECLSPEC Tractor : public Producer
+ {
+ private:
+ mlt_tractor instance;
+ public:
+ Tractor( );
+ Tractor( Service &tractor );
+ Tractor( mlt_tractor tractor );
+ Tractor( Tractor &tractor );
+ Tractor( Profile& profile, char *id, char *arg = NULL );
+ virtual ~Tractor( );
+ virtual mlt_tractor get_tractor( );
+ mlt_producer get_producer( );
+ Multitrack *multitrack( );
+ Field *field( );
+ void refresh( );
+ int set_track( Producer &producer, int index );
+ Producer *track( int index );
+ int count( );
+ void plant_transition( Transition &transition, int a_track = 0, int b_track = 1 );
+ void plant_transition( Transition *transition, int a_track = 0, int b_track = 1 );
+ void plant_filter( Filter &filter, int track = 0 );
+ void plant_filter( Filter *filter, int track = 0 );
+ bool locate_cut( Producer *producer, int &track, int &cut );
+ };
+}
+
+#endif
+
--- /dev/null
+/**
+ * MltTransition.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "MltTransition.h"
+#include "MltProfile.h"
+using namespace Mlt;
+
+Transition::Transition( Profile& profile, const char *id, const char *arg ) :
+ instance( NULL )
+{
+ if ( arg != NULL )
+ {
+ instance = mlt_factory_transition( profile.get_profile(), id, arg );
+ }
+ else
+ {
+ if ( strchr( id, ':' ) )
+ {
+ char *temp = strdup( id );
+ char *arg = strchr( temp, ':' ) + 1;
+ *( arg - 1 ) = '\0';
+ instance = mlt_factory_transition( profile.get_profile(), temp, arg );
+ free( temp );
+ }
+ else
+ {
+ instance = mlt_factory_transition( profile.get_profile(), id, NULL );
+ }
+ }
+}
+
+Transition::Transition( Service &transition ) :
+ instance( NULL )
+{
+ if ( transition.type( ) == transition_type )
+ {
+ instance = ( mlt_transition )transition.get_service( );
+ inc_ref( );
+ }
+}
+
+Transition::Transition( Transition &transition ) :
+ Mlt::Service( transition ),
+ instance( transition.get_transition( ) )
+{
+ inc_ref( );
+}
+
+Transition::Transition( mlt_transition transition ) :
+ instance( transition )
+{
+ inc_ref( );
+}
+
+Transition::~Transition( )
+{
+ mlt_transition_close( instance );
+}
+
+mlt_transition Transition::get_transition( )
+{
+ return instance;
+}
+
+mlt_service Transition::get_service( )
+{
+ return mlt_transition_service( get_transition( ) );
+}
+
+void Transition::set_in_and_out( int in, int out )
+{
+ mlt_transition_set_in_and_out( get_transition( ), in, out );
+}
--- /dev/null
+/**
+ * MltTransition.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_TRANSITION_H_
+#define _MLTPP_TRANSITION_H_
+
+#include "config.h"
+
+#include <framework/mlt.h>
+#include "MltService.h"
+
+namespace Mlt
+{
+ class Service;
+ class Profile;
+
+ class MLTPP_DECLSPEC Transition : public Service
+ {
+ private:
+ mlt_transition instance;
+ public:
+ Transition( Profile& profile, const char *id, const char *arg = NULL );
+ Transition( Service &transition );
+ Transition( Transition &transition );
+ Transition( mlt_transition transition );
+ virtual ~Transition( );
+ virtual mlt_transition get_transition( );
+ mlt_service get_service( );
+ void set_in_and_out( int in, int out );
+ };
+}
+
+#endif
--- /dev/null
+/**
+ * config.h - Convenience header file for all mlt++ objects
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MLTPP_CONFIG_H_
+#define MLTPP_CONFIG_H_
+
+#ifdef WIN32
+ #ifdef MLTPP_EXPORTS
+ #define MLTPP_DECLSPEC __declspec( dllexport )
+ #else
+ #define MLTPP_DECLSPEC __declspec( dllimport )
+ #endif
+#else
+ #define MLTPP_DECLSPEC
+#endif
+
+#endif
--- /dev/null
+SUBDIRS = perl python ruby tcl
+
+all clean install:
+ list='$(SUBDIRS)'; \
+ for subdir in $$list; do \
+ if [ -f $$subdir/Makefile -a -f .$$subdir ] ; \
+ then $(MAKE) -C $$subdir $@ || exit 1; \
+ fi \
+ done
+
--- /dev/null
+#!/usr/bin/env sh
+
+which swig > /dev/null 2>&1
+[ $? != 0 ] && echo "Please install swig" && exit 1
+
+pkg-config mlt-framework --cflags > /dev/null 2>&1
+[ $? != 0 ] && echo "Please install mlt" && exit 1
+
+if [ "$1" = "all" ]
+then languages="perl php python ruby tcl"
+elif [ "$1" != "" ]
+then languages=$*
+else echo "Usage: ./configure [ all | language * ]"
+ exit 0
+fi
+
+for i in perl php python ruby tcl
+do
+ rm -f .$i
+done
+
+for i in $languages
+do
+ echo -n "Configuring $i ... "
+ if [ -d "$i" ]
+ then
+ cd $i &&
+ output=`./build 2>/dev/null`
+ if [ $? == 0 ]
+ then echo "OK"
+ touch ../.$i
+ elif [ "$output" == "" ]
+ then
+ echo "Failed"
+ else
+ echo $output
+ fi
+ cd ..
+ else
+ echo "Unknown"
+ fi
+done
--- /dev/null
+import net.sourceforge.mltpp.*;
+
+public class Play {
+
+ static {
+ System.loadLibrary("mltpp_java");
+ }
+
+ public static void main (String[] args) {
+
+ // Start the mlt system
+ Factory.init( null );
+
+ // Set the output profile
+ Profile profile = new Profile( "" );
+
+ // Create the producer
+ Producer p = new Producer( profile, args[0], null );
+
+ if ( p.is_valid() ) {
+
+ p.set ("eof", "loop");
+
+ // Create the consumer
+ Consumer c = new Consumer( profile, "sdl", null);
+
+ // Turn off the default rescaling
+ c.set("rescale", "none");
+
+ // Connect the producer to the consumer
+ c.connect(p);
+
+ // Start the consumer
+ c.start();
+
+ // Wait until the user stops the consumer
+ Object o = new Object();
+ while ( !c.is_stopped() ) {
+ synchronized (o) {
+ try {
+ o.wait(1000);
+ } catch (InterruptedException e) {
+ // ignored
+ }
+ }
+ }
+
+ // Stop it anyway
+ c.stop();
+ } else {
+ System.out.println ("Unable to open " + args[0]);
+ }
+ }
+}
--- /dev/null
+#!/bin/sh
+java -Djava.library.path=. -cp .:src_swig Play "$@"
--- /dev/null
+#!/bin/sh
+
+path=`which java 2> /dev/null`
+
+if [ $? = 0 ]
+then
+ # Locate the path for the include
+ path=`dirname $path`
+ path=`dirname $path`
+
+ # Change this as needed
+ export JAVA_INCLUDE="-I$path/include -I$path/include/linux"
+
+ ln -sf ../mltpp.i .
+
+ # Invoke swig
+ mkdir -p src_swig/net/sourceforge/mltpp
+ swig -c++ -I../../src `pkg-config mlt-framework --cflags` -java -outdir src_swig/net/sourceforge/mltpp -package net.sourceforge.mltpp mltpp.i || exit $?
+
+ # Compile the wrapper
+ g++ -D_GNU_SOURCE -c -rdynamic -pthread -I../../src `pkg-config mlt-framework --cflags` mltpp_wrap.cxx $JAVA_INCLUDE || exit $?
+
+ # Create the module
+ gcc -shared mltpp_wrap.o -L../../src -lmlt++ -o libmltpp_java.so || exit $?
+
+ # Compile the test
+ javac `find src_swig -name '*.java'` || exit $?
+
+ export CLASSPATH=`pwd`/src_swig
+ javac Play.java
+else
+ echo "Java command not found"
+ exit 1
+fi
--- /dev/null
+/**
+ * mltpp.i - Swig Bindings for mlt++
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+%module mltpp
+%include "carrays.i"
+%array_class(unsigned char, unsignedCharArray);
+
+%{
+#include <mlt++/Mlt.h>
+%}
+
+/** These methods return objects which should be gc'd.
+ */
+
+namespace Mlt {
+%newobject Factory::init( const char * );
+%newobject Factory::producer( Profile &, char *, char * );
+%newobject Factory::filter( Profile &, char *, char * );
+%newobject Factory::transition( Profile &, char *, char * );
+%newobject Factory::consumer( Profile &, char *, char * );
+%newobject Properties::listen( char *, void *, mlt_listener );
+%newobject Service::producer( );
+%newobject Service::consumer( );
+%newobject Service::get_frame( int );
+%newobject Service::filter( int );
+%newobject Producer::filter( int );
+%newobject Producer::cut( int, int );
+%newobject Playlist::current( );
+%newobject Playlist::clip_info( int );
+%newobject Playlist::get_clip( int );
+%newobject Multitrack::track( int );
+%newobject Tractor::multitrack( );
+%newobject Tractor::field( );
+%newobject Tractor::track( int );
+%newobject Frame::get_original_producer( );
+%newobject Miracle::execute( char * );
+%newobject Miracle::push( char *, Service & );
+%newobject Miracle::unit( int );
+%newobject Repository::consumers( );
+%newobject Repository::filters( );
+%newobject Repository::producers( );
+%newobject Repository::transitions( );
+%newobject Repository::metadata( mlt_service_type, const char * );
+}
+
+/** Classes to wrap.
+ */
+
+%include <framework/mlt_types.h>
+%include <framework/mlt_factory.h>
+%include <MltFactory.h>
+%include <MltRepository.h>
+%include <MltEvent.h>
+%include <MltProperties.h>
+%include <MltFrame.h>
+%include <MltGeometry.h>
+%include <MltService.h>
+%include <MltProducer.h>
+%include <MltProfile.h>
+%include <MltPlaylist.h>
+%include <MltConsumer.h>
+%include <MltFilter.h>
+%include <MltTransition.h>
+%include <MltMultitrack.h>
+%include <MltField.h>
+%include <MltTractor.h>
+%include <MltParser.h>
+%include <MltFilteredConsumer.h>
+%include <MltMiracle.h>
+%include <MltResponse.h>
+
+#if defined(SWIGRUBY)
+
+%{
+
+static void ruby_listener( mlt_properties owner, void *object );
+
+class RubyListener
+{
+ private:
+ VALUE callback;
+ Mlt::Event *event;
+
+ public:
+ RubyListener( Mlt::Properties &properties, char *id, VALUE callback ) :
+ callback( callback )
+ {
+ event = properties.listen( id, this, ( mlt_listener )ruby_listener );
+ }
+
+ ~RubyListener( )
+ {
+ delete event;
+ }
+
+ void mark( )
+ {
+ ((void (*)(VALUE))(rb_gc_mark))( callback );
+ }
+
+ void doit( )
+ {
+ ID method = rb_intern( "call" );
+ rb_funcall( callback, method, 0 );
+ }
+};
+
+static void ruby_listener( mlt_properties owner, void *object )
+{
+ RubyListener *o = static_cast< RubyListener * >( object );
+ o->doit( );
+}
+
+void markRubyListener( void* p )
+{
+ RubyListener *o = static_cast<RubyListener*>( p );
+ o->mark( );
+}
+
+%}
+
+// Ruby wrapper
+%rename( Listener ) RubyListener;
+%markfunc RubyListener "markRubyListener";
+
+class RubyListener
+{
+ public:
+ RubyListener( Mlt::Properties &properties, char *id, VALUE callback );
+};
+
+#endif
+
--- /dev/null
+#!/bin/env perl
+use ExtUtils::MakeMaker;
+
+my $CXX = $ENV{'CXX'} || 'g++';
+
+system( "ln -sf ../mltpp.i ." );
+system( "swig -c++ -I../../src `pkg-config mlt-framework --cflags` -perl5 mltpp.i" );
+WriteMakefile(
+ 'NAME' => 'mltpp',
+ 'CC' => '${CXX} `pkg-config mlt-framework --cflags` -I../../src',
+ 'OPTIMIZE' => '-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386',
+ 'LIBS' => ['-L../../src -lmlt++'],
+ 'OBJECT' => 'mltpp_wrap.o',
+ 'DESTDIR' => $ENV{'DESTDIR'},
+);
+
--- /dev/null
+#!/bin/sh
+perl Makefile.PL || exit 1
+make
--- /dev/null
+#!/usr/bin/env perl
+
+# Import required modules
+use mltpp;
+
+# Not sure why the mltpp::Factory.init method fails...
+mltpp::mlt_factory_init( undef );
+
+# Establish the MLT profile
+$profile = new mltpp::Profile( undef );
+
+# Create the producer
+$p = new mltpp::Producer( $profile, $ARGV[0] );
+
+if ( $p->is_valid( ) )
+{
+ # Loop the video
+ $p->set( "eof", "loop" );
+
+ # Create the consumer
+ $c = new mltpp::FilteredConsumer( $profile, "sdl" );
+
+ # Turn of the default rescaling
+ $c->set( "rescale", "none" );
+
+ # Connect the producer to the consumer
+ $c->connect( $p );
+
+ $e = $c->setup_wait_for( "consumer-stopped" );
+
+ # Start the consumer
+ $c->start;
+
+ # Wait until the user stops the consumer
+ $c->wait_for( $e );
+
+ $e = undef;
+ $c = undef;
+ $p = undef;
+}
+else
+{
+ print "Unable to open $ARGV[0]\n";
+}
+
+mltpp::mlt_factory_close( );
--- /dev/null
+#!/bin/sh
+
+ln -s ../mltpp.i
+swig -c++ -I../../src `pkg-config --cflags mlt-framework` -php5 -noproxy mltpp.i
+g++ -fPIC -DPIC -D_GNU_SOURCE -c -rdynamic -pthread `pkg-config --cflags mlt-framework` `php-config --includes` mltpp_wrap.cpp
+
--- /dev/null
+<?php
+$filename = $argv[1];
+dl("mltpp.so");
+mlt_factory_init(NULL);
+$profile = new_profile("dv_ntsc");
+$p = new_producer( $profile, $filename );
+if ( $p ) {
+ $c = new_consumer( $profile, "sdl" );
+ consumer_connect( $c, $p );
+ $e = properties_setup_wait_for( $c, "consumer-stopped" );
+ consumer_start( $c );
+ properties_wait_for( $c, $e );
+ consumer_stop( $c );
+ $e = NULL;
+ $c = NULL;
+}
+$p = NULL;
+$profile = NULL;
+mlt_factory_close();
+?>
+
--- /dev/null
+#!/bin/sh
+
+path=`which python 2> /dev/null`
+
+if [ $? = 0 ]
+then
+ # Change this as needed
+ export PYTHON_INCLUDE=`python -c "import sys;print \"%s/include/python%d.%d\"%(sys.prefix,sys.version_info[0],sys.version_info[1])"`
+
+ [ ! -d "$PYTHON_INCLUDE" ] && echo python development missing && exit 1
+
+ ln -sf ../mltpp.i .
+
+ # Invoke swig
+ swig -c++ -I../../src `pkg-config mlt-framework --cflags` -python mltpp.i || exit $?
+
+ # Compile the wrapper
+ g++ -fPIC -D_GNU_SOURCE -c -rdynamic -pthread `pkg-config mlt-framework --cflags` -I$PYTHON_INCLUDE mltpp_wrap.cxx || exit $?
+
+ # Create the module
+ gcc -shared mltpp_wrap.o -L../../src -lmlt++ -o _mltpp.so || exit $?
+else
+ echo Python not installed.
+ exit 1
+fi
--- /dev/null
+#!/usr/bin/env python
+
+# Import required modules
+import mltpp
+import time
+import sys
+
+# Start the mlt system
+mltpp.Factory().init( )
+
+# Establish a profile
+profile = mltpp.Profile( )
+
+# Create the producer
+p = mltpp.Producer( profile, sys.argv[1] )
+
+if p:
+ # Create the consumer
+ c = mltpp.Consumer( profile, "sdl" )
+
+ # Turn off the default rescaling
+ c.set( "rescale", "none" )
+
+ # Connect the producer to the consumer
+ c.connect( p )
+
+ # Start the consumer
+ c.start( )
+
+ # Wait until the user stops the consumer
+ while c.is_stopped( ) == 0:
+ time.sleep( 1 )
+else:
+ # Diagnostics
+ print "Unable to open ", sys.argv[ 1 ]
+
--- /dev/null
+#!/usr/bin/env ruby
+require 'mkmf'
+system( "ln -sf ../mltpp.i mltpp.i" )
+system( "swig -c++ -ruby -I../../src `pkg-config mlt-framework --cflags` mltpp.i" )
+$CFLAGS += " -I../../src `pkg-config mlt-framework --cflags`"
+$LDFLAGS += " -L../../src -lmlt++"
+create_makefile('mltpp')
+system( 'make' )
--- /dev/null
+#!/usr/bin/env ruby
+
+require 'mltpp'
+
+def command
+ puts "command"
+end
+
+def push
+ puts "push"
+end
+
+miracle = Mltpp::Miracle.new( "miracle-ruby", 5260 )
+miracle.start
+miracle.execute( "uadd sdl" )
+listener = Mltpp::Listener.new( miracle, "command-received", method( :command ) )
+listener = Mltpp::Listener.new( miracle, "push-received", method( :push ) )
+miracle.wait_for_shutdown
+
--- /dev/null
+#!/usr/bin/env ruby
+
+# Import required modules
+require 'mltpp'
+
+# Create the mlt system
+Mltpp::Factory::init
+
+# Establish the mlt profile
+profile = Mltpp::Profile.new
+
+# Get and check the argument
+file = ARGV.shift
+raise "Usage: test.rb file" if file.nil?
+
+# Create the producer
+producer = Mltpp::Factory::producer( profile, file )
+raise "Unable to load #{file}" if !producer.is_valid
+
+# Create the consumer
+consumer = Mltpp::Consumer.new( profile, "sdl" )
+raise "Unable to open sdl consumer" if !consumer.is_valid
+
+# Turn off the default rescaling
+consumer.set( "rescale", "none" )
+
+# Set up a 'wait for' event
+event = consumer.setup_wait_for( "consumer-stopped" )
+
+# Start the consumer
+consumer.start
+
+# Connect the producer to the consumer
+consumer.connect( producer )
+
+# Wait until the user stops the consumer
+consumer.wait_for( event )
+
+# Clean up consumer
+consumer.stop
+
--- /dev/null
+#!/usr/bin/env ruby
+
+# Required modules
+require 'mltpp'
+
+# Create the mlt system
+Mltpp::Factory::init
+
+# Establish the mlt profile
+profile = Mltpp::Profile.new( "quarter_pal" )
+
+# Get and check the argument
+file = ARGV.shift
+name = ARGV.shift
+size = ARGV.shift
+size = "176x144" if size.nil?
+raise "Usage: thumbs.rb file name [ size ]" if file.nil? || name.nil?
+
+# Create the producer
+producer = Mltpp::Producer.new( profile, file )
+raise "Unable to load #{file}" if !producer.is_valid
+
+# Construct the playlist
+playlist = Mltpp::Playlist.new( )
+
+# Get the out point
+out = producer.get_int( "out" );
+
+# Calculate position of frames
+[ 0, 0.25, 0.5, 0.75, 1 ].each { |x| playlist.append( producer, Integer(x*out), Integer(x*out) ) }
+
+# Create the thumb nail generator
+generator = Mltpp::Consumer.new( profile, "avformat", "#{name}%d.jpg" )
+generator.set( "real_time", "0" )
+generator.set( "progressive", "1" )
+generator.set( "s", size )
+
+# Connect the consumer
+generator.connect( playlist );
+generator.run
+
--- /dev/null
+#!/bin/sh
+
+path=`which tclsh 2>/dev/null`
+
+if [ "$path" != "" ]
+then
+ ln -sf ../mltpp.i .
+
+ # Invoke swig
+ swig -c++ -I../../src `pkg-config mlt-framework --cflags` -tcl mltpp.i || exit 1
+
+ # Compile the wrapper
+ g++ -D_GNU_SOURCE -c -rdynamic -pthread -I../../src `pkg-config mlt-framework --cflags` mltpp_wrap.cxx || exit 1
+
+ # Create the module
+ gcc -shared mltpp_wrap.o -L../../src -lmlt++ -o mltpp.so || exit 1
+else
+ echo "Unable to locate tclsh."
+ exit 1
+fi
+
--- /dev/null
+#!/usr/bin/env tclsh
+
+load mltpp.so
+mltpp.Factory.init
+set profile [Profile]
+set arg1 [lindex $argv 0]
+set p [factory_producer $profile fezzik $arg1]
+set c [factory_consumer $profile sdl ""]
+set r [mlt_consumer_properties $c]
+mlt_properties_set $r "rescale" "none"
+consumer_connect $c $p
+mlt_consumer_start $c
+while { ![mlt_consumer_is_stopped $c] } {
+ after 1000
+}
+mlt_consumer_close $c
+mlt_producer_close $p
+factory_close
--- /dev/null
+include ../config.mak
+
+CXXFLAGS+=-Wall -g `pkg-config mlt-framework --cflags` -I ../src
+LDFLAGS+=-L../src -lmlt++ -lmiracle -lvalerie `pkg-config mlt-framework --libs`
+CC=c++
+
+all: play server
+
+play: play.o
+
+play.o: play.cpp
+
+server: server.o
+
+server.o: server.cpp
+
+clean:
+ $(RM) play play.o
+ $(RM) server server.o
+
+distclean: clean
+
+install:
+
+uninstall:
--- /dev/null
+
+#include <Mlt.h>
+using namespace Mlt;
+
+int main( int, char **argv )
+{
+ Factory::init( NULL );
+ Profile profile;
+ Producer producer( profile, argv[ 1 ] );
+ Consumer consumer( profile );
+ consumer.set( "rescale", "none" );
+ consumer.connect( producer );
+ consumer.run( );
+ return 0;
+}
--- /dev/null
+#include <iostream>
+#include <string>
+#include <cstring>
+#include <sstream>
+using namespace std;
+
+#include <Mlt.h>
+using namespace Mlt;
+
+class Custom : public Miracle
+{
+ private:
+ Event *event;
+ Profile profile;
+
+ public:
+ Custom( char *name = "Custom", int port = 5290, char *config = NULL ) :
+ Miracle( name, port, config ),
+ event( NULL )
+ {
+ // Ensure that we receive the westley document before it's deserialised
+ set( "push-parser-off", 1 );
+ }
+
+ virtual ~Custom( )
+ {
+ delete event;
+ }
+
+ // Optional step - receive the westley document and do something with it
+ Response *received( char *command, char *document )
+ {
+ cerr << document << endl;
+ Producer producer( profile, "westley-xml", document );
+ return push( command, &producer );
+ }
+
+ // Push handling - clear the playlist, append, seek to beginning and play
+ Response *push( char*, Service *service )
+ {
+ Playlist playlist( ( mlt_playlist )( unit( 0 )->get_data( "playlist" ) ) );
+ Producer producer( *service );
+ if ( producer.is_valid( ) && playlist.is_valid( ) )
+ {
+ playlist.lock( );
+ playlist.clear( );
+ playlist.append( producer );
+ playlist.seek( 0 );
+ playlist.set_speed( 1 );
+ playlist.unlock( );
+ return new Response( 200, "OK" );
+ }
+ return new Response( 400, "Invalid" );
+ }
+
+ // Custom command execution
+ Response *execute( char *command )
+ {
+ Response *response = NULL;
+
+ if ( !strcmp( command, "debug" ) )
+ {
+ // Example of a custom command
+ response = new Response( 200, "Diagnostics output" );
+ for( int i = 0; unit( i ) != NULL; i ++ )
+ {
+ Properties *properties = unit( i );
+ stringstream output;
+ output << string( "Unit " ) << i << endl;
+ for ( int j = 0; j < properties->count( ); j ++ )
+ output << properties->get_name( j ) << " = " << properties->get( j ) << endl;
+ response->write( output.str( ).c_str( ) );
+ }
+ }
+ else
+ {
+ // Use the default command processing
+ response = Miracle::execute( command );
+ }
+
+ // If no event exists and the first unit has been added...
+ if ( event == NULL && unit( 0 ) != NULL )
+ {
+ // Set up the event handling
+ Consumer consumer( ( mlt_consumer )( unit( 0 )->get_data( "consumer" ) ) );
+ event = consumer.listen( "consumer-frame-render", this, ( mlt_listener )frame_render );
+
+ // In this custom case, we'll loop everything on the unit
+ Playlist playlist( ( mlt_playlist )( unit( 0 )->get_data( "playlist" ) ) );
+ playlist.set( "eof", "loop" );
+ }
+
+ return response;
+ }
+
+ // Callback for frame render notification
+ static void frame_render( mlt_consumer, Custom *self, mlt_frame frame_ptr )
+ {
+ Frame frame( frame_ptr );
+ self->frame_render_event( frame );
+ }
+
+ // Remove all supers and attributes
+ void frame_render_event( Frame &frame )
+ {
+ // Fetch the c double ended queue structure
+ mlt_deque deque = ( mlt_deque )frame.get_data( "data_queue" );
+
+ // While the deque isn't empty
+ while( deque != NULL && mlt_deque_peek_back( deque ) != NULL )
+ {
+ // Fetch the c properties structure
+ mlt_properties cprops = ( mlt_properties )mlt_deque_pop_back( deque );
+
+ // For fun, convert it to c++ and output it :-)
+ Properties properties( cprops );
+ properties.debug( );
+
+ // Wipe it
+ mlt_properties_close( cprops );
+ }
+ }
+};
+
+int main( int, char** )
+{
+ Custom server( "Server" );
+ server.start( );
+ server.execute( "uadd sdl" );
+ server.execute( "play u0" );
+ server.wait_for_shutdown( );
+ return 0;
+}
+