Constness changes
[melted] / src / framework / mlt_producer.h
1 /**
2 * \file mlt_producer.h
3 * \brief abstraction for all producer services
4 * \see mlt_producer_s
5 *
6 * Copyright (C) 2003-2009 Ushodaya Enterprises Limited
7 * \author Charles Yates <charles.yates@pandora.be>
8 *
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.
13 *
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.
18 *
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
22 */
23
24 #ifndef _MLT_PRODUCER_H_
25 #define _MLT_PRODUCER_H_
26
27 #include "mlt_service.h"
28 #include "mlt_filter.h"
29
30 /** \brief Producer abstract service class
31 *
32 * A producer is a service that generates audio, video, and metadata.
33 * Some day it may also generate text (subtitles). This is not to say
34 * a producer "synthesizes," rather that is an origin of data within the
35 * service network - that could be through synthesis or reading a stream.
36 *
37 * \extends mlt_service
38 * \event \em producer-changed
39 * \properties \em mlt_type the name of the service subclass, e.g. mlt_producer
40 * \properties \em mlt_service the name of a producer subclass
41 * \properties \em _position the current position of the play head, relative to the in point
42 * \properties \em _frame the current position of the play head, relative to the beginning of the resource
43 * \properties \em _speed the current speed factor, where 1.0 is normal
44 * \properties \em aspect_ratio sample aspect ratio
45 * \properties \em length the duration of the cut in frames
46 * \properties \em eof the end-of-file behavior, one of: pause, continue, loop
47 * \properties \em resource the file name, stream address, or the class name in angle brackets
48 * \properties \em _cut set if this producer is a "cut" producer
49 * \properties \em mlt_mix stores the data for a "mix" producer
50 * \properties \em _cut_parent holds a reference to the cut's parent producer
51 * \properties \em ignore_points Set this to temporarily disable the in and out points.
52 * \properties \em use_clone holds a reference to a clone's producer, as created by mlt_producer_optimise
53 * \properties \em _clone is the index of the clone in the list of clones stored on the clone's producer
54 * \properties \em _clones is the number of clones of the producer, as created by mlt_producer_optimise
55 * \properties \em _clone.{N} holds a reference to the N'th clone of the producer, as created by mlt_producer_optimise
56 * \properties \em meta.* holds metadata - there is a loose taxonomy to be defined
57 * \properties \em set.* holds properties to set on a frame produced
58 * \todo define the media metadata taxonomy
59 */
60
61 struct mlt_producer_s
62 {
63 /** A producer is a service. */
64 struct mlt_service_s parent;
65
66 /** Get a frame of data (virtual function).
67 *
68 * \param mlt_producer a producer
69 * \param mlt_frame_ptr a frame pointer by reference
70 * \param int an index
71 * \return true if there was an error
72 */
73 int ( *get_frame )( mlt_producer, mlt_frame_ptr, int );
74
75 /** the destructor virtual function */
76 mlt_destructor close;
77 void *close_object; /**< the object supplied to the close virtual function */
78
79 void *local; /**< \private instance object */
80 void *child; /**< \private the object of a subclass */
81 };
82
83 /*
84 * Public final methods
85 */
86
87 #define MLT_PRODUCER_SERVICE( producer ) ( &( producer )->parent )
88 #define MLT_PRODUCER_PROPERTIES( producer ) MLT_SERVICE_PROPERTIES( MLT_PRODUCER_SERVICE( producer ) )
89
90 extern int mlt_producer_init( mlt_producer self, void *child );
91 extern mlt_producer mlt_producer_new( );
92 extern mlt_service mlt_producer_service( mlt_producer self );
93 extern mlt_properties mlt_producer_properties( mlt_producer self );
94 extern int mlt_producer_seek( mlt_producer self, mlt_position position );
95 extern mlt_position mlt_producer_position( mlt_producer self );
96 extern mlt_position mlt_producer_frame( mlt_producer self );
97 extern int mlt_producer_set_speed( mlt_producer self, double speed );
98 extern double mlt_producer_get_speed( mlt_producer self );
99 extern double mlt_producer_get_fps( mlt_producer self );
100 extern int mlt_producer_set_in_and_out( mlt_producer self, mlt_position in, mlt_position out );
101 extern int mlt_producer_clear( mlt_producer self );
102 extern mlt_position mlt_producer_get_in( mlt_producer self );
103 extern mlt_position mlt_producer_get_out( mlt_producer self );
104 extern mlt_position mlt_producer_get_playtime( mlt_producer self );
105 extern mlt_position mlt_producer_get_length( mlt_producer self );
106 extern void mlt_producer_prepare_next( mlt_producer self );
107 extern int mlt_producer_attach( mlt_producer self, mlt_filter filter );
108 extern int mlt_producer_detach( mlt_producer self, mlt_filter filter );
109 extern mlt_filter mlt_producer_filter( mlt_producer self, int index );
110 extern mlt_producer mlt_producer_cut( mlt_producer self, int in, int out );
111 extern int mlt_producer_is_cut( mlt_producer self );
112 extern int mlt_producer_is_mix( mlt_producer self );
113 extern int mlt_producer_is_blank( mlt_producer self );
114 extern mlt_producer mlt_producer_cut_parent( mlt_producer self );
115 extern int mlt_producer_optimise( mlt_producer self );
116 extern void mlt_producer_close( mlt_producer self );
117
118 #endif