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