importer: Allocate sample buffer in individual importers.
[L-SMASH.git] / cli / importer.h
blob6a0cb519b3f52f2789f8615ffc4d95bf88a4cfe4
1 /*****************************************************************************
2 * importer.h:
3 *****************************************************************************
4 * Copyright (C) 2010-2014 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 ***************************************************************************/
31 #ifdef LSMASH_IMPORTER_INTERNAL
33 #include "core/box.h"
34 #include "codecs/description.h"
36 struct importer_tag;
38 typedef void ( *importer_cleanup ) ( struct importer_tag * );
39 typedef int ( *importer_get_accessunit ) ( struct importer_tag *, uint32_t, lsmash_sample_t ** );
40 typedef int ( *importer_probe ) ( struct importer_tag * );
41 typedef uint32_t ( *importer_get_last_duration )( struct importer_tag *, 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_functions;
61 typedef struct importer_tag
63 const lsmash_class_t *class;
64 lsmash_log_level log_level;
65 importer_status status;
66 lsmash_bs_t *bs;
67 int is_stdin;
68 void *info; /* importer internal status information. */
69 importer_functions funcs;
70 lsmash_entry_list_t *summaries;
71 } importer_t;
73 #else
75 typedef void importer_t;
77 /* importing functions */
78 importer_t *lsmash_importer_open
80 const char *identifier,
81 const char *format
84 void lsmash_importer_close
86 importer_t *importer
89 int lsmash_importer_get_access_unit
91 importer_t *importer,
92 uint32_t track_number,
93 lsmash_sample_t **p_sample
96 uint32_t lsmash_importer_get_last_delta
98 importer_t *importer,
99 uint32_t track_number
102 uint32_t lsmash_importer_get_track_count
104 importer_t *importer
107 lsmash_summary_t *lsmash_duplicate_summary
109 importer_t *importer,
110 uint32_t track_number
113 #endif /* #ifdef LSMASH_IMPORTER_INTERNAL */
115 #endif /* #ifndef LSMASH_IMPORTER_H */