]> git.sesse.net Git - mlt/blob - src/framework/mlt_producer.h
src/framework/*: improve the doxygen documentation (work in progress). This also...
[mlt] / src / framework / mlt_producer.h
1 /**
2  * \file mlt_producer.h
3  * \brief abstraction for all producer services
4  *
5  * Copyright (C) 2003-2008 Ushodaya Enterprises Limited
6  * \author Charles Yates <charles.yates@pandora.be>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #ifndef _MLT_PRODUCER_H_
24 #define _MLT_PRODUCER_H_
25
26 #include "mlt_service.h"
27 #include "mlt_filter.h"
28
29 /** \brief Producer abstract service class
30  *
31  * A producer is a service that generates audio, video, and metadata.
32  * Some day it may also generate text (subtitles). This is not to say
33  * a producer "synthesizes," rather that is an origin of data within the
34  * service network - that could be through synthesis or reading a stream.
35  *
36  * \extends mlt_service
37  * \event \em producer-changed
38  * \properties \em mlt_type the name of the service subclass, e.g. mlt_producer
39  * \properties \em mlt_service the name of a producer subclass
40  * \properties \em _position the current position of the play head, relative to the in point
41  * \properties \em _frame the current position of the play head, relative to the beginning of the resource
42  * \properties \em _speed the current speed factor, where 1.0 is normal
43  * \properties \em aspect_ratio sample aspect ratio
44  * \properties \em length the duration of the cut in frames
45  * \properties \em eof the end-of-file behavior, one of: pause, continue, loop
46  * \properties \em resource the file name, stream address, or the class name in angle brackets
47  * \properties \em _cut set if this producer is a "cut" producer
48  * \properties \em mlt_mix stores the data for a "mix" producer
49  * \properties \em _cut_parent holds a reference to the cut's parent producer
50  * \properties \em ignore_points Set this to temporarily disable the in and out points.
51  * \properties \em use_clone holds a reference to a clone's producer, as created by mlt_producer_optimise
52  * \properties \em _clone is the index of the clone in the list of clones stored on the clone's producer
53  * \properties \em _clones is the number of clones of the producer, as created by mlt_producer_optimise
54  * \properties \em _clone.{N} holds a reference to the N'th clone of the producer, as created by mlt_producer_optimise
55  * \properties \em meta.* holds metadata - there is a loose taxonomy to be defined
56  * \properties \em set.* holds properties to set on a frame produced
57  * \todo define the media metadata taxonomy
58  */
59
60 struct mlt_producer_s
61 {
62         /** A producer is a service. */
63         struct mlt_service_s parent;
64
65         /** Get a frame of data (virtual function).
66          *
67          * \param mlt_producer a producer
68          * \param mlt_frame_ptr a frame pointer by reference
69          * \param int an index
70          * \return true if there was an error
71          */
72         int ( *get_frame )( mlt_producer, mlt_frame_ptr, int );
73
74         /** the destructor virtual function */
75         mlt_destructor close;
76         void *close_object; /**< the object supplied to the close virtual function */
77
78         void *local; /**< \private instance object */
79         void *child; /**< \private the object of a subclass */
80 };
81
82 /*
83  *  Public final methods
84  */
85
86 #define MLT_PRODUCER_SERVICE( producer )        ( &( producer )->parent )
87 #define MLT_PRODUCER_PROPERTIES( producer )     MLT_SERVICE_PROPERTIES( MLT_PRODUCER_SERVICE( producer ) )
88
89 extern int mlt_producer_init( mlt_producer self, void *child );
90 extern mlt_producer mlt_producer_new( );
91 extern mlt_service mlt_producer_service( mlt_producer self );
92 extern mlt_properties mlt_producer_properties( mlt_producer self );
93 extern int mlt_producer_seek( mlt_producer self, mlt_position position );
94 extern mlt_position mlt_producer_position( mlt_producer self );
95 extern mlt_position mlt_producer_frame( mlt_producer self );
96 extern int mlt_producer_set_speed( mlt_producer self, double speed );
97 extern double mlt_producer_get_speed( mlt_producer self );
98 extern double mlt_producer_get_fps( mlt_producer self );
99 extern int mlt_producer_set_in_and_out( mlt_producer self, mlt_position in, mlt_position out );
100 extern int mlt_producer_clear( mlt_producer self );
101 extern mlt_position mlt_producer_get_in( mlt_producer self );
102 extern mlt_position mlt_producer_get_out( mlt_producer self );
103 extern mlt_position mlt_producer_get_playtime( mlt_producer self );
104 extern mlt_position mlt_producer_get_length( mlt_producer self );
105 extern void mlt_producer_prepare_next( mlt_producer self );
106 extern int mlt_producer_attach( mlt_producer self, mlt_filter filter );
107 extern int mlt_producer_detach( mlt_producer self, mlt_filter filter );
108 extern mlt_filter mlt_producer_filter( mlt_producer self, int index );
109 extern mlt_producer mlt_producer_cut( mlt_producer self, int in, int out );
110 extern int mlt_producer_is_cut( mlt_producer self );
111 extern int mlt_producer_is_mix( mlt_producer self );
112 extern int mlt_producer_is_blank( mlt_producer self );
113 extern mlt_producer mlt_producer_cut_parent( mlt_producer self );
114 extern int mlt_producer_optimise( mlt_producer self );
115 extern void mlt_producer_close( mlt_producer self );
116
117 #endif