]> git.sesse.net Git - mlt/blob - src/framework/mlt_types.h
Let DOUBLE_MLT_POSITION be defined in CFLAGS.
[mlt] / src / framework / mlt_types.h
1 /**
2  * \file mlt_types.h
3  * \brief Provides forward definitions of all public types
4  *
5  * Copyright (C) 2003-2012 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_TYPES_H_
24 #define _MLT_TYPES_H_
25
26 #ifndef GCC_VERSION
27 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
28 #endif
29
30 #include <inttypes.h>
31 #include <limits.h>
32 #include "mlt_pool.h"
33
34 #ifndef PATH_MAX
35 #define PATH_MAX 4096
36 #endif
37
38 /** The set of supported image formats */
39
40 typedef enum
41 {
42         mlt_image_none = 0,/**< image not available */
43         mlt_image_rgb24,   /**< 8-bit RGB */
44         mlt_image_rgb24a,  /**< 8-bit RGB with alpha channel */
45         mlt_image_yuv422,  /**< 8-bit YUV 4:2:2 packed */
46         mlt_image_yuv420p, /**< 8-bit YUV 4:2:0 planar */
47         mlt_image_opengl,  /**< (deprecated) suitable for OpenGL texture */
48         mlt_image_glsl,    /**< for opengl module internal use only */
49         mlt_image_glsl_texture /**< an OpenGL texture name */
50 }
51 mlt_image_format;
52
53 /** The set of supported audio formats */
54
55 typedef enum
56 {
57         mlt_audio_none = 0,/**< audio not available */
58         mlt_audio_pcm = 1, /**< \deprecated signed 16-bit interleaved PCM */
59         mlt_audio_s16 = 1, /**< signed 16-bit interleaved PCM */
60         mlt_audio_s32,     /**< signed 32-bit non-interleaved PCM */
61         mlt_audio_float,   /**< 32-bit non-interleaved floating point */
62         mlt_audio_s32le,   /**< signed 32-bit interleaved PCM */
63         mlt_audio_f32le,   /**< 32-bit interleaved floating point */
64         mlt_audio_u8       /**< unsigned 8-bit interleaved PCM */
65 }
66 mlt_audio_format;
67
68 /** The time string formats */
69
70 typedef enum
71 {
72         mlt_time_frames = 0, /**< frame count */
73         mlt_time_clock,      /**< SMIL clock-value as [[hh:]mm:]ss[.fraction] */
74         mlt_time_smpte       /**< SMPTE timecode as [[[hh:]mm:]ss:]frames */
75 }
76 mlt_time_format;
77
78 /** Interpolation methods for animation keyframes */
79
80 typedef enum {
81         mlt_keyframe_discrete = 0, /**< non-interpolated; value changes instantaneously at the key frame */
82         mlt_keyframe_linear,       /**< simple, constant pace from this key frame to the next */
83         mlt_keyframe_smooth        /**< eased pacing from this keyframe to the next using a Catmull-Rom spline */
84 }
85 mlt_keyframe_type;
86
87 /** The relative time qualifiers */
88
89 typedef enum
90 {
91         mlt_whence_relative_start = 0, /**< relative to the beginning */
92         mlt_whence_relative_current,   /**< relative to the current position */
93         mlt_whence_relative_end        /**< relative to the end */
94 }
95 mlt_whence;
96
97 /** The recognized subclasses of mlt_service */
98
99 typedef enum
100 {
101         invalid_type = 0,           /**< invalid service */
102         unknown_type,               /**< unknown class */
103         producer_type,              /**< Producer class */
104         tractor_type,               /**< Tractor class */
105         playlist_type,              /**< Playlist class */
106         multitrack_type,            /**< Multitrack class */
107         filter_type,                /**< Filter class */
108         transition_type,            /**< Transition class */
109         consumer_type,              /**< Consumer class */
110         field_type                  /**< Field class */
111 }
112 mlt_service_type;
113
114 /* I don't want to break anyone's applications without warning. -Zach */
115 #ifdef DOUBLE_MLT_POSITION
116 #define MLT_POSITION_FMT "%f"
117 #define MLT_POSITION_MOD(A, B) (A - B * ((int)(A / B)))
118 typedef double mlt_position;
119 #else
120 #define MLT_POSITION_MOD(A, B) A % B
121 #define MLT_POSITION_FMT "%d"
122 typedef int32_t mlt_position;
123 #endif
124
125 /** A rectangle type with coordinates, size, and opacity */
126
127 typedef struct {
128         double x; /**< X coordinate */
129         double y; /**< Y coordinate */
130         double w; /**< width */
131         double h; /**< height */
132         double o; /**< opacity / mix-level */
133 }
134 mlt_rect;
135
136 /** A tuple of color components */
137
138 typedef struct {
139         uint8_t r; /**< red */
140         uint8_t g; /**< green */
141         uint8_t b; /**< blue */
142         uint8_t a; /**< alpha */
143 }
144 mlt_color;
145
146 typedef struct mlt_frame_s *mlt_frame, **mlt_frame_ptr; /**< pointer to Frame object */
147 typedef struct mlt_property_s *mlt_property;            /**< pointer to Property object */
148 typedef struct mlt_properties_s *mlt_properties;        /**< pointer to Properties object */
149 typedef struct mlt_event_struct *mlt_event;             /**< pointer to Event object */
150 typedef struct mlt_service_s *mlt_service;              /**< pointer to Service object */
151 typedef struct mlt_producer_s *mlt_producer;            /**< pointer to Producer object */
152 typedef struct mlt_playlist_s *mlt_playlist;            /**< pointer to Playlist object */
153 typedef struct mlt_multitrack_s *mlt_multitrack;        /**< pointer to Multitrack object */
154 typedef struct mlt_filter_s *mlt_filter;                /**< pointer to Filter object */
155 typedef struct mlt_transition_s *mlt_transition;        /**< pointer to Transition object */
156 typedef struct mlt_tractor_s *mlt_tractor;              /**< pointer to Tractor object */
157 typedef struct mlt_field_s *mlt_field;                  /**< pointer to Field object */
158 typedef struct mlt_consumer_s *mlt_consumer;            /**< pointer to Consumer object */
159 typedef struct mlt_parser_s *mlt_parser;                /**< pointer to Properties object */
160 typedef struct mlt_deque_s *mlt_deque;                  /**< pointer to Deque object */
161 typedef struct mlt_geometry_s *mlt_geometry;            /**< pointer to Geometry object */
162 typedef struct mlt_geometry_item_s *mlt_geometry_item;  /**< pointer to Geometry Item object */
163 typedef struct mlt_profile_s *mlt_profile;              /**< pointer to Profile object */
164 typedef struct mlt_repository_s *mlt_repository;        /**< pointer to Repository object */
165 typedef struct mlt_cache_s *mlt_cache;                  /**< pointer to Cache object */
166 typedef struct mlt_cache_item_s *mlt_cache_item;        /**< pointer to CacheItem object */
167 typedef struct mlt_animation_s *mlt_animation;          /**< pointer to Property Animation object */
168
169 typedef void ( *mlt_destructor )( void * );             /**< pointer to destructor function */
170 typedef char *( *mlt_serialiser )( void *, int length );/**< pointer to serialization function */
171
172 #define MLT_SERVICE(x)    ( ( mlt_service )( x ) )      /**< Cast to a Service pointer */
173 #define MLT_PRODUCER(x)   ( ( mlt_producer )( x ) )     /**< Cast to a Producer pointer */
174 #define MLT_MULTITRACK(x) ( ( mlt_multitrack )( x ) )   /**< Cast to a Multitrack pointer */
175 #define MLT_PLAYLIST(x)   ( ( mlt_playlist )( x ) )     /**< Cast to a Playlist pointer */
176 #define MLT_TRACTOR(x)    ( ( mlt_tractor )( x ) )      /**< Cast to a Tractor pointer */
177 #define MLT_FILTER(x)     ( ( mlt_filter )( x ) )       /**< Cast to a Filter pointer */
178 #define MLT_TRANSITION(x) ( ( mlt_transition )( x ) )   /**< Cast to a Transition pointer */
179 #define MLT_CONSUMER(x) ( ( mlt_consumer )( x ) )       /**< Cast to a Consumer pointer */
180 #define MLT_FRAME(x)      ( ( mlt_frame )( x ) )        /**< Cast to a Frame pointer */
181
182 #ifdef WIN32
183 #include <pthread.h>
184 /* Win32 compatibility function declarations */
185 extern int usleep(unsigned int useconds);
186 extern int nanosleep( const struct timespec * rqtp, struct timespec * rmtp );
187 extern int setenv(const char *name, const char *value, int overwrite);
188 #endif
189
190 #endif