libannodex  0.7.3
anx_import.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 Commonwealth Scientific and Industrial Research
3  Organisation (CSIRO) Australia
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions
7  are met:
8 
9  - Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11 
12  - Redistributions in binary form must reproduce the above copyright
13  notice, this list of conditions and the following disclaimer in the
14  documentation and/or other materials provided with the distribution.
15 
16  - Neither the name of CSIRO Australia nor the names of its
17  contributors may be used to endorse or promote products derived from
18  this software without specific prior written permission.
19 
20  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
24  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 
33 #ifndef __ANX_IMPORT_H__
34 #define __ANX_IMPORT_H__
35 
36 #include <annodex/anx_types.h>
37 #include <annodex/anx_core.h>
38 
67 typedef struct _AnxImporter AnxImporter;
68 
73 
78 typedef struct _AnxSource AnxSource;
79 
92 typedef AnxSource* (*AnxImporterOpenFunc) (const char * path, const char * id,
93  int ignore_raw,
94  double start_time, double end_time,
95  AnxImportCallbacks * import_callbacks);
96 
110 typedef AnxSource * (*AnxImporterOpenFDFunc) (int fd, const char * id,
111  int ignore_raw,
112  double start_time, double end_time,
113  AnxImportCallbacks * import_callbacks);
114 
122 typedef long (*AnxImporterReadFunc) (AnxSource * source, unsigned char * buf,
123  long n, long bound);
124 
130 typedef long (*AnxImporterSizeofNextReadFunc) (AnxSource * source, long bound);
131 
136 typedef int (*AnxImporterCloseFunc) (AnxSource * source);
137 
138 struct _AnxImporter {
139  AnxImporterOpenFunc open;
140  AnxImporterOpenFDFunc openfd;
141  AnxImporterCloseFunc close;
142  AnxImporterReadFunc read;
143  AnxImporterSizeofNextReadFunc sizeof_next_read;
144  char * content_type;
145 };
146 
148  char * id;
149  char * content_type;
150  long nr_header_packets;
151  anx_int64_t granule_rate_n;
152  anx_int64_t granule_rate_d;
153  anx_int64_t start_granule;
154  anx_int64_t end_granule;
155  anx_int64_t current_granule;
156  int eos;
157  anx_int64_t basegranule;/*< Base granule */
158  int preroll; /*< Preroll */
159  int granuleshift; /*< Granuleshift */
160 };
161 
162 struct _AnxSource {
163  AnxImporter * importer;
164  AnxList * tracks;
165  AnxSourceTrack * current_track; /* points within tracks,
166  managed by importer */
167 
168  int eos;
169  double start_time;
170  double end_time;
171  void * custom_data;
172  double current_time;
173  int written_secondaries;
174  double duration;
175  long byte_length;
176 };
177 
178 #ifdef __cplusplus
179 extern "C" {
180 #endif
181 
187 int anx_importer_register (AnxImporter * importer);
188 
194 int anx_importer_unregister (AnxImporter * importer);
195 
196 
203 AnxImporter *anx_importer_find (char * content_type);
204 
205 #ifdef __cplusplus
206 }
207 #endif
208 
209 #endif /* __ANX_IMPORT_H__ */
Definition: anx_list.h:47
int64_t anx_int64_t
This typedef was determined on the system on which the documentation was generated.
Definition: anx_int64.h:93
int anx_importer_unregister(AnxImporter *importer)
Unregister an AnxImporter previously registered with libannodex.
Definition: anx_import.h:147
Public structures and datatypes.
AnxImporter * anx_importer_find(char *content_type)
Find the AnxImporter registered with the given content type.
Definition: anx_types.h:149
int(* AnxImporterCloseFunc)(AnxSource *source)
Signature of a function to close a source object.
Definition: anx_import.h:136
Core datatypes etc.
Definition: anx_import.h:138
int anx_importer_register(AnxImporter *importer)
Register an AnxImporter object with libannodex.
long(* AnxImporterSizeofNextReadFunc)(AnxSource *source, long bound)
Signature of a function to return the preferred next read size.
Definition: anx_import.h:130
AnxSource *(* AnxImporterOpenFunc)(const char *path, const char *id, int ignore_raw, double start_time, double end_time, AnxImportCallbacks *import_callbacks)
Signature of a function for opening a source object by filename.
Definition: anx_import.h:92
Definition: anx_import.h:162
AnxSource *(* AnxImporterOpenFDFunc)(int fd, const char *id, int ignore_raw, double start_time, double end_time, AnxImportCallbacks *import_callbacks)
Signature of a function for opening a source object attached to an open file descriptor.
Definition: anx_import.h:110
long(* AnxImporterReadFunc)(AnxSource *source, unsigned char *buf, long n, long bound)
Signature of a function for reading bytes from a source object.
Definition: anx_import.h:122