summaryrefslogtreecommitdiffstats
path: root/debian/transcode/transcode-1.1.7/libtc/tcmodule-info.h
blob: 5787b6bfe565d93043b5acf8d5d4e2e5d9622cf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/*
 * tcmodule-info.h -- module data (capabilities) and helper functions.
 * (C) 2005-2010 - Francesco Romani <fromani -at- gmail -dot- com>
 *
 * This file is part of transcode, a video stream processing tool.
 *
 * transcode is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * transcode is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef TCMODULEINFO_H
#define TCMODULEINFO_H

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <stdint.h>

#include "tccodecs.h"
#include "tcformats.h"

/* FIXME: move to a enum? */
/* actions */
#define TC_MODULE_FEATURE_NONE          0x00000000

#define TC_MODULE_FEATURE_FILTER        0x00000001
#define TC_MODULE_FEATURE_DECODE        0x00000002
#define TC_MODULE_FEATURE_ENCODE        0x00000004
#define TC_MODULE_FEATURE_DEMULTIPLEX   0x00000020
#define TC_MODULE_FEATURE_MULTIPLEX     0x00000040
/* targets */
#define TC_MODULE_FEATURE_VIDEO         0x00010000
#define TC_MODULE_FEATURE_AUDIO         0x00020000
#define TC_MODULE_FEATURE_EXTRA         0x00040000

#define TC_MODULE_FLAG_NONE             0x00000000
#define TC_MODULE_FLAG_RECONFIGURABLE   0x00000001
/* module can be reconfigured multiple times */
#define TC_MODULE_FLAG_DELAY            0x00000002
/* module require more than one input frame to work */
#define TC_MODULE_FLAG_BUFFERING        0x00000004
/* module require extra internal buffering 
 * (XXX: this flag will hopefully vanish soon) */
#define TC_MODULE_FLAG_CONVERSION       0x00000010
/* module requires an unavoidable csp conversion)
 * (XXX: this flag will hopefully vanish soon) */

/*
 * this structure will hold all the interesting informations
 * both for user and for transcode itself of a given module.
 */
typedef struct tcmoduleinfo_ TCModuleInfo;
struct tcmoduleinfo_ {
    uint32_t features; /* what this module can do? */
    uint32_t flags; /* quirks */

    const char *name;
    const char *version;
    const char *description;

    /*
     * the following two MUST point to an array of TC_CODEC_*
     * terminated by a TC_CODEC_ERROR value
     */
    const TCCodecID *codecs_in;
    const TCCodecID *codecs_out;

    /*
     * the following two MUST point to an array of TC_FORMAT_*
     * terminated by a TC_FORMAT_ERROR value
     */
    const TCFormatID *formats_in;
    const TCFormatID *formats_out;
};

/*
 * tc_module_info_match:
 *     scan the given informations about two modules, and tell if the
 *     two modules can be chained together using the given codec.
 *
 * Parameters:
 *     tc_codec:
 *         codec_id to be used.
 *     head:
 *         the first given module information structure;
 *         'head' output is supposed to fit in 'tail' input.
 *     tail:
 *         the second given module information structure;
 *         tail' input is supposed to be given by 'head' output.
 *
 * Return value:
 *     1 if 'head' can feed 'tail' safely,
 *     0 otherwise
 *
 * Side effects:
 *     none
 *
 * Preconditions:
 *     none
 *
 * Postconditions:
 *     none
 */
int tc_module_info_match(int tc_codec,
                         const TCModuleInfo *head,
                         const TCModuleInfo *tail);

/*
 * tc_module_info_log:
 *     pretty-print the content of a given module information structure
 *     using functions of tc_log_*() family.
 *
 * Parameters:
 *     info:
 *         module information structure to dump
 *     verbose:
 *         level of detail of description, ranging to TC_QUIET to TC_STATS.
 *         Other values will be ignored
 *
 * Return value:
 *     none
 *
 * Side effects:
 *     some informations are printed using tc_log_*()
 *
 * Preconditions:
 *     'verbose' must be in range TC_QUIET ... TC_STATS
 *
 * Postconditions:
 *     none
 */
void tc_module_info_log(const TCModuleInfo *info, int verbose);

/*
 * tc_module_info_copy:
 *     create an exact copy of 'src' in 'dst', allocating new fields.
 *     PLEASE NOTE: this is an 'hard' (real) copy, which makes two
 *     TCModuleInfo identical but indipendent.
 *     For a 'soft' (reference) copy, just memcpy() the two structures.
 *
 * Parameters:
 *     src: TCModuleInfo structure to be copied
 *     dst: pointer to structure that will hold the copy.
 *
 * Return value:
 *     0  successfull
 *     -1 given (at least) a bad TCModuleInfo reference
 *     1  not enough memory to perform a full copy
 *
 * Side effects:
 *     memory in 'dst' is allocated, usinc tc_* helpers, to hold data
 *     provided by 'src'.
 *
 * Preconditions:
 *     'src' and 'dst' must point to valid TCModuleInfo structures.
 *
 * Postconditions:
 *     'dst' is an exact copy of 'src'.
 */
int tc_module_info_copy(const TCModuleInfo *src, TCModuleInfo *dst);

/*
 * tc_module_info_free:
 *     free all resources (memory) acquired when copying a TCModuleInfo
 *     structure into another one.
 *
 * Parameters:
 *     info: structure copied to be freed
 *
 * Return value:
 *     none
 *
 * Side effects:
 *     none
 *
 * Preconditions:
 *     'info' must be obtained as result of 'tc_module_info_copy' function,
 *     as 'dst' parameter. Applying this function to a structure obtained
 *     in a different way will cause an undefined behaviour, most likely
 *     a memory corruption or a crash
 *
 * Postconditions:
 *     all resources (memory) acquired by 'info' are released.
 *
 */
void tc_module_info_free(TCModuleInfo *info);

/*************************************************************************/

#endif  /* TCMODULEINFO_H */

/*
 * Local variables:
 *   c-file-style: "stroustrup"
 *   c-file-offsets: ((case-label . *) (statement-case-intro . *))
 *   indent-tabs-mode: nil
 * End:
 *
 * vim: expandtab shiftwidth=4:
 */