file: Prevents from accidentally closing standard streams by
[L-SMASH.git] / importer / importer.h
blob668cdf8cb65b994795cc4abb8a4bc7455c4588b1
1 /*****************************************************************************
2 * importer.h
3 *****************************************************************************
4 * Copyright (C) 2010-2017 L-SMASH project
6 * Authors: Takashi Hirata <silverfilain@gmail.com>
7 * Contributors: Yusuke Nakamura <muken.the.vfrmaniac@gmail.com>
9 * Permission to use, copy, modify, and/or distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 *****************************************************************************/
22 /* This file is available under an ISC license. */
24 #ifndef LSMASH_IMPORTER_H
25 #define LSMASH_IMPORTER_H
27 /***************************************************************************
28 importer
29 ***************************************************************************/
30 typedef struct importer_tag importer_t;
32 #ifdef LSMASH_IMPORTER_INTERNAL
34 #include "core/box.h"
35 #include "codecs/description.h"
37 typedef void ( *importer_cleanup ) ( importer_t * );
38 typedef int ( *importer_get_accessunit ) ( importer_t *, uint32_t, lsmash_sample_t ** );
39 typedef int ( *importer_probe ) ( importer_t * );
40 typedef uint32_t ( *importer_get_last_duration ) ( importer_t *, uint32_t );
41 typedef int ( *importer_construct_timeline )( importer_t *, uint32_t );
43 typedef enum
45 IMPORTER_ERROR = -1,
46 IMPORTER_OK = 0,
47 IMPORTER_CHANGE = 1,
48 IMPORTER_EOF = 2,
49 } importer_status;
51 typedef struct
53 lsmash_class_t class;
54 int detectable;
55 importer_probe probe;
56 importer_get_accessunit get_accessunit;
57 importer_get_last_duration get_last_delta;
58 importer_cleanup cleanup;
59 importer_construct_timeline construct_timeline;
60 } importer_functions;
62 struct importer_tag
64 const lsmash_class_t *class;
65 lsmash_log_level log_level;
66 importer_status status;
67 lsmash_root_t *root; /* pointer to a referenced ROOT */
68 lsmash_file_t *file; /* pointer to a file which this importer handles */
69 lsmash_bs_t *bs;
70 lsmash_file_parameters_t file_param;
71 void *info; /* importer internal status information. */
72 importer_functions funcs;
73 lsmash_entry_list_t *summaries;
74 int is_adhoc_open; /* If set to 1, it means this importer is not allocated by lsmash_read_file().
75 * This is a poor design due to historical implementation between the importer
76 * framework and ISOBMFF demuxer framework. The importer shall be hidden inside
77 * the file handling abstraction layer. That'll achieve integration of the muxer
78 * and the remuxer CLIs. */
81 int lsmash_importer_make_fake_movie
83 importer_t *importer
86 int lsmash_importer_make_fake_track
88 importer_t *importer,
89 lsmash_media_type media_type,
90 uint32_t *track_ID
93 void lsmash_importer_break_fake_movie
95 importer_t *importer
98 #else
100 int lsmash_importer_set_file
102 importer_t *importer,
103 lsmash_file_t *file
106 /* importing functions */
107 importer_t *lsmash_importer_alloc
109 lsmash_root_t *root
112 void lsmash_importer_destroy
114 importer_t *importer
117 int lsmash_importer_find
119 importer_t *importer,
120 const char *format,
121 int auto_detect
124 importer_t *lsmash_importer_open
126 lsmash_root_t *root,
127 const char *identifier,
128 const char *format
131 void lsmash_importer_close
133 importer_t *importer
136 int lsmash_importer_get_access_unit
138 importer_t *importer,
139 uint32_t track_number,
140 lsmash_sample_t **p_sample
143 uint32_t lsmash_importer_get_last_delta
145 importer_t *importer,
146 uint32_t track_number
149 int lsmash_importer_construct_timeline
151 importer_t *importer,
152 uint32_t track_number
155 uint32_t lsmash_importer_get_track_count
157 importer_t *importer
160 lsmash_summary_t *lsmash_duplicate_summary
162 importer_t *importer,
163 uint32_t track_number
166 #endif /* #ifdef LSMASH_IMPORTER_INTERNAL */
168 #endif /* #ifndef LSMASH_IMPORTER_H */