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