mlt_tractor.[ch], mlt_multitrack.[ch]: improve doxygen documentation for the tractor...
[melted] / src / framework / mlt_service.h
1 /**
2 * \file mlt_service.h
3 * \brief interface declaration for all service classes
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_SERVICE_H_
24 #define _MLT_SERVICE_H_
25
26 #include "mlt_properties.h"
27 #include "mlt_profile.h"
28
29 /** \brief Service abstract base class
30 *
31 * \extends mlt_properties
32 * The service is the base class for all of the interesting classes and
33 * plugins for MLT. A service can have multiple inputs connections to
34 * other services called its "producers" but only a single output to another
35 * service called its "consumer." A service that has both producer and
36 * consumer connections is called a filter. Any service can have zero or more
37 * filters "attached" to it. We call any collection of services and their
38 * connections a "service network," which is similar to what DirectShow calls
39 * a filter graph or what gstreamer calls an element pipeline.
40 *
41 * \event \em service-changed
42 * \event \em property-changed
43 * \properties \em mlt_type identifies the subclass
44 * \properties \em _mlt_service_hidden a flag that indicates whether to hide the mlt_service
45 * \properties \em mlt_service is the name of the implementation of the service
46 * \properties \em resource is either the stream identifier or grandchild-class
47 * \properties \em in when to start, what is started is service-specific
48 * \properties \em out when to stop
49 * \properties \em _filter_private Set this on a service to ensure that attached filters are handled privately.
50 * See modules/core/filter_region.c and modules/core/filter_watermark.c for examples.
51 * \properties \em disable Set this on a filter to disable it while keeping it in the object model.
52 * \properties \em _profile stores the mlt_profile for a service
53 * \properties \em _unique_id is a unique identifier
54 */
55
56 struct mlt_service_s
57 {
58 struct mlt_properties_s parent; /**< \private */
59
60 /** Get a frame of data (virtual function).
61 *
62 * \param mlt_producer a producer
63 * \param mlt_frame_ptr a frame pointer by reference
64 * \param int an index
65 * \return true if there was an error
66 */
67 int ( *get_frame )( mlt_service self, mlt_frame_ptr frame, int index );
68
69 /** the destructor virtual function */
70 mlt_destructor close;
71 void *close_object; /**< the object supplied to the close virtual function */
72
73 void *local; /**< \private instance object */
74 void *child; /**< \private the object of a subclass */
75 };
76
77 #define MLT_SERVICE_PROPERTIES( service ) ( &( service )->parent )
78
79 extern int mlt_service_init( mlt_service self, void *child );
80 extern void mlt_service_lock( mlt_service self );
81 extern void mlt_service_unlock( mlt_service self );
82 extern mlt_service_type mlt_service_identify( mlt_service self );
83 extern int mlt_service_connect_producer( mlt_service self, mlt_service producer, int index );
84 extern mlt_service mlt_service_get_producer( mlt_service self );
85 extern int mlt_service_get_frame( mlt_service self, mlt_frame_ptr frame, int index );
86 extern mlt_properties mlt_service_properties( mlt_service self );
87 extern mlt_service mlt_service_consumer( mlt_service self );
88 extern mlt_service mlt_service_producer( mlt_service self );
89 extern int mlt_service_attach( mlt_service self, mlt_filter filter );
90 extern int mlt_service_detach( mlt_service self, mlt_filter filter );
91 extern void mlt_service_apply_filters( mlt_service self, mlt_frame frame, int index );
92 extern mlt_filter mlt_service_filter( mlt_service self, int index );
93 extern mlt_profile mlt_service_profile( mlt_service self );
94 extern void mlt_service_close( mlt_service self );
95
96 #endif
97