]> iEval git - fdkaac.git/blame - src/m4af.h
rename basename() -> aacenc_basename() and move to compat layer
[fdkaac.git] / src / m4af.h
CommitLineData
48e2f01c 1/*
2 * Copyright (C) 2013 nu774
3 * For conditions of distribution and use, see copyright notice in COPYING
4 */
5#ifndef M4AF_H
6#define M4AF_H
7
8#define M4AF_FOURCC(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d))
9
10enum m4af_error_code {
11 M4AF_IO_ERROR = 1,
12 M4AF_NO_MEMORY,
13};
14
15enum m4af_itmf_tag {
16 M4AF_TAG_TITLE = M4AF_FOURCC('\xa9','n','a','m'),
17 M4AF_TAG_ARTIST = M4AF_FOURCC('\xa9','A','R','T'),
18 M4AF_TAG_ALBUM = M4AF_FOURCC('\xa9','a','l','b'),
19 M4AF_TAG_GENRE = M4AF_FOURCC('\xa9','g','e','n'),
20 M4AF_TAG_DATE = M4AF_FOURCC('\xa9','d','a','y'),
21 M4AF_TAG_COMPOSER = M4AF_FOURCC('\xa9','w','r','t'),
22 M4AF_TAG_GROUPING = M4AF_FOURCC('\xa9','g','r','p'),
23 M4AF_TAG_COMMENT = M4AF_FOURCC('\xa9','c','m','t'),
24 M4AF_TAG_LYRICS = M4AF_FOURCC('\xa9','l','y','r'),
25 M4AF_TAG_TOOL = M4AF_FOURCC('\xa9','t','o','o'),
26 M4AF_TAG_ALBUM_ARTIST = M4AF_FOURCC('a','A','R','T'),
27 M4AF_TAG_TRACK = M4AF_FOURCC('t','r','k','n'),
28 M4AF_TAG_DISK = M4AF_FOURCC('d','i','s','k'),
29 M4AF_TAG_GENRE_ID3 = M4AF_FOURCC('g','n','r','e'),
30 M4AF_TAG_TEMPO = M4AF_FOURCC('t','m','p','o'),
31 M4AF_TAG_DESCRIPTION = M4AF_FOURCC('d','e','s','c'),
32 M4AF_TAG_LONG_DESCRIPTION = M4AF_FOURCC('l','d','e','s'),
33 M4AF_TAG_COPYRIGHT = M4AF_FOURCC('c','p','r','t'),
34 M4AF_TAG_COMPILATION = M4AF_FOURCC('c','p','i','l'),
35 M4AF_TAG_ARTWORK = M4AF_FOURCC('c','o','v','r'),
36};
37
38enum m4af_itmf_type_code {
39 M4AF_IMPLICIT = 0,
40 M4AF_UTF8 = 1,
41 M4AF_GIF = 12,
42 M4AF_JPEG = 13,
43 M4AF_PNG = 14,
44 M4AF_INTEGER = 21,
45};
46
47enum m4af_codec_type {
48 M4AF_CODEC_MP4A = M4AF_FOURCC('m','p','4','a'),
49 M4AF_CODEC_ALAC = M4AF_FOURCC('a','l','a','c'),
50 M4AF_CODEC_TEXT = M4AF_FOURCC('t','e','x','t'),
51};
52
53typedef int (*m4af_write_callback)(void *cookie, const void *data,
54 uint32_t size);
55typedef int (*m4af_seek_callback)(void *cookie, int64_t off, int whence);
56typedef int64_t (*m4af_tell_callback)(void *cookie);
57
58typedef struct m4af_io_callbacks_t {
59 m4af_write_callback write;
60 m4af_seek_callback seek;
61 m4af_tell_callback tell;
62} m4af_io_callbacks_t;
63
64typedef struct m4af_writer_t m4af_writer_t;
65
66m4af_writer_t *m4af_create(uint32_t codec, uint32_t timescale,
67 m4af_io_callbacks_t *io, void *io_cookie);
68
69void m4af_teardown(m4af_writer_t **ctx);
70
71int m4af_begin_write(m4af_writer_t *ctx);
72
73int m4af_finalize(m4af_writer_t *ctx);
74
75/* can be called before m4af_write_sample() */
76void m4af_set_fixed_frame_duration(m4af_writer_t *ctx, int track_idx,
77 uint32_t length);
78
79/* can be called between mfa4_begin_write() and m4af_finalize() */
80int m4af_write_sample(m4af_writer_t *ctx, int track_idx, const void *data,
81 uint32_t size, uint32_t duration);
82
83
84/* the following can be called at anytime before m4af_finalize() */
85
86int m4af_decoder_specific_info(m4af_writer_t *ctx, int track_idx,
87 uint8_t *data, uint32_t size);
88
89void m4af_set_priming(m4af_writer_t *ctx, int track_idx,
90 uint32_t encoder_delay, uint32_t padding);
91
92int m4af_add_itmf_long_tag(m4af_writer_t *ctx, const char *name,
93 const char *data);
94
95int m4af_add_itmf_short_tag(m4af_writer_t *ctx, uint32_t type,
96 uint32_t type_code, const void *data,
97 uint32_t data_size);
98
99int m4af_add_itmf_string_tag(m4af_writer_t *ctx, uint32_t type,
100 const char *data);
101
102int m4af_add_itmf_int8_tag(m4af_writer_t *ctx, uint32_t type, int value);
103
104int m4af_add_itmf_int16_tag(m4af_writer_t *ctx, uint32_t type, int value);
105
c5c45908 106int m4af_add_itmf_int32_tag(m4af_writer_t *ctx, uint32_t type, uint32_t value);
107
108int m4af_add_itmf_int64_tag(m4af_writer_t *ctx, uint32_t type, uint64_t value);
48e2f01c 109
110int m4af_add_itmf_track_tag(m4af_writer_t *ctx, int track, int total);
111
112int m4af_add_itmf_disk_tag(m4af_writer_t *ctx, int disk, int total);
113
114int m4af_add_itmf_genre_tag(m4af_writer_t *ctx, int genre);
115
116#endif
This page took 0.032073 seconds and 4 git commands to generate.