ex
Fork of mbed-os-example-mbed5-blinky by
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp4ff/mp4ffint.h@47:9e361da97763, 2017-07-18 (annotated)
- Committer:
- TMBOY
- Date:
- Tue Jul 18 16:54:45 2017 +0800
- Revision:
- 47:9e361da97763
?
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| TMBOY | 47:9e361da97763 | 1 | /* |
| TMBOY | 47:9e361da97763 | 2 | ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding |
| TMBOY | 47:9e361da97763 | 3 | ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com |
| TMBOY | 47:9e361da97763 | 4 | ** |
| TMBOY | 47:9e361da97763 | 5 | ** This program is free software; you can redistribute it and/or modify |
| TMBOY | 47:9e361da97763 | 6 | ** it under the terms of the GNU General Public License as published by |
| TMBOY | 47:9e361da97763 | 7 | ** the Free Software Foundation; either version 2 of the License, or |
| TMBOY | 47:9e361da97763 | 8 | ** (at your option) any later version. |
| TMBOY | 47:9e361da97763 | 9 | ** |
| TMBOY | 47:9e361da97763 | 10 | ** This program is distributed in the hope that it will be useful, |
| TMBOY | 47:9e361da97763 | 11 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| TMBOY | 47:9e361da97763 | 12 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| TMBOY | 47:9e361da97763 | 13 | ** GNU General Public License for more details. |
| TMBOY | 47:9e361da97763 | 14 | ** |
| TMBOY | 47:9e361da97763 | 15 | ** You should have received a copy of the GNU General Public License |
| TMBOY | 47:9e361da97763 | 16 | ** along with this program; if not, write to the Free Software |
| TMBOY | 47:9e361da97763 | 17 | ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| TMBOY | 47:9e361da97763 | 18 | ** |
| TMBOY | 47:9e361da97763 | 19 | ** Any non-GPL usage of this software or parts of this software is strictly |
| TMBOY | 47:9e361da97763 | 20 | ** forbidden. |
| TMBOY | 47:9e361da97763 | 21 | ** |
| TMBOY | 47:9e361da97763 | 22 | ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 |
| TMBOY | 47:9e361da97763 | 23 | ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" |
| TMBOY | 47:9e361da97763 | 24 | ** |
| TMBOY | 47:9e361da97763 | 25 | ** Commercial non-GPL licensing of this software is possible. |
| TMBOY | 47:9e361da97763 | 26 | ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. |
| TMBOY | 47:9e361da97763 | 27 | ** |
| TMBOY | 47:9e361da97763 | 28 | ** $Id: mp4ffint.h,v 1.26 2009/01/25 20:14:34 menno Exp $ |
| TMBOY | 47:9e361da97763 | 29 | **/ |
| TMBOY | 47:9e361da97763 | 30 | |
| TMBOY | 47:9e361da97763 | 31 | #ifndef MP4FF_INTERNAL_H |
| TMBOY | 47:9e361da97763 | 32 | #define MP4FF_INTERNAL_H |
| TMBOY | 47:9e361da97763 | 33 | |
| TMBOY | 47:9e361da97763 | 34 | #ifdef __cplusplus |
| TMBOY | 47:9e361da97763 | 35 | extern "C" { |
| TMBOY | 47:9e361da97763 | 36 | #endif /* __cplusplus */ |
| TMBOY | 47:9e361da97763 | 37 | |
| TMBOY | 47:9e361da97763 | 38 | #include "mp4ff_int_types.h" |
| TMBOY | 47:9e361da97763 | 39 | #include <stdlib.h> |
| TMBOY | 47:9e361da97763 | 40 | |
| TMBOY | 47:9e361da97763 | 41 | //#define MAX_TRACKS 1024 |
| TMBOY | 47:9e361da97763 | 42 | #define MAX_TRACKS 128 //modify by bolv |
| TMBOY | 47:9e361da97763 | 43 | #define TRACK_UNKNOWN 0 |
| TMBOY | 47:9e361da97763 | 44 | #define TRACK_AUDIO 1 |
| TMBOY | 47:9e361da97763 | 45 | #define TRACK_VIDEO 2 |
| TMBOY | 47:9e361da97763 | 46 | #define TRACK_SYSTEM 3 |
| TMBOY | 47:9e361da97763 | 47 | |
| TMBOY | 47:9e361da97763 | 48 | |
| TMBOY | 47:9e361da97763 | 49 | #define SUBATOMIC 128 |
| TMBOY | 47:9e361da97763 | 50 | |
| TMBOY | 47:9e361da97763 | 51 | /* atoms without subatoms */ |
| TMBOY | 47:9e361da97763 | 52 | #define ATOM_FTYP 129 |
| TMBOY | 47:9e361da97763 | 53 | #define ATOM_MDAT 130 |
| TMBOY | 47:9e361da97763 | 54 | #define ATOM_MVHD 131 |
| TMBOY | 47:9e361da97763 | 55 | #define ATOM_TKHD 132 |
| TMBOY | 47:9e361da97763 | 56 | #define ATOM_TREF 133 |
| TMBOY | 47:9e361da97763 | 57 | #define ATOM_MDHD 134 |
| TMBOY | 47:9e361da97763 | 58 | #define ATOM_VMHD 135 |
| TMBOY | 47:9e361da97763 | 59 | #define ATOM_SMHD 136 |
| TMBOY | 47:9e361da97763 | 60 | #define ATOM_HMHD 137 |
| TMBOY | 47:9e361da97763 | 61 | #define ATOM_STSD 138 |
| TMBOY | 47:9e361da97763 | 62 | #define ATOM_STTS 139 |
| TMBOY | 47:9e361da97763 | 63 | #define ATOM_STSZ 140 |
| TMBOY | 47:9e361da97763 | 64 | #define ATOM_STZ2 141 |
| TMBOY | 47:9e361da97763 | 65 | #define ATOM_STCO 142 |
| TMBOY | 47:9e361da97763 | 66 | #define ATOM_STSC 143 |
| TMBOY | 47:9e361da97763 | 67 | #define ATOM_MP4A 144 |
| TMBOY | 47:9e361da97763 | 68 | #define ATOM_MP4V 145 |
| TMBOY | 47:9e361da97763 | 69 | #define ATOM_MP4S 146 |
| TMBOY | 47:9e361da97763 | 70 | #define ATOM_ESDS 147 |
| TMBOY | 47:9e361da97763 | 71 | #define ATOM_META 148 /* iTunes Metadata box */ |
| TMBOY | 47:9e361da97763 | 72 | #define ATOM_NAME 149 /* iTunes Metadata name box */ |
| TMBOY | 47:9e361da97763 | 73 | #define ATOM_DATA 150 /* iTunes Metadata data box */ |
| TMBOY | 47:9e361da97763 | 74 | #define ATOM_CTTS 151 |
| TMBOY | 47:9e361da97763 | 75 | #define ATOM_FRMA 152 |
| TMBOY | 47:9e361da97763 | 76 | #define ATOM_IVIV 153 |
| TMBOY | 47:9e361da97763 | 77 | #define ATOM_PRIV 154 |
| TMBOY | 47:9e361da97763 | 78 | #define ATOM_USER 155 |
| TMBOY | 47:9e361da97763 | 79 | #define ATOM_KEY 156 |
| TMBOY | 47:9e361da97763 | 80 | |
| TMBOY | 47:9e361da97763 | 81 | #define ATOM_ALBUM_ARTIST 157 |
| TMBOY | 47:9e361da97763 | 82 | #define ATOM_CONTENTGROUP 158 |
| TMBOY | 47:9e361da97763 | 83 | #define ATOM_LYRICS 159 |
| TMBOY | 47:9e361da97763 | 84 | #define ATOM_DESCRIPTION 160 |
| TMBOY | 47:9e361da97763 | 85 | #define ATOM_NETWORK 161 |
| TMBOY | 47:9e361da97763 | 86 | #define ATOM_SHOW 162 |
| TMBOY | 47:9e361da97763 | 87 | #define ATOM_EPISODENAME 163 |
| TMBOY | 47:9e361da97763 | 88 | #define ATOM_SORTTITLE 164 |
| TMBOY | 47:9e361da97763 | 89 | #define ATOM_SORTALBUM 165 |
| TMBOY | 47:9e361da97763 | 90 | #define ATOM_SORTARTIST 166 |
| TMBOY | 47:9e361da97763 | 91 | #define ATOM_SORTALBUMARTIST 167 |
| TMBOY | 47:9e361da97763 | 92 | #define ATOM_SORTWRITER 168 |
| TMBOY | 47:9e361da97763 | 93 | #define ATOM_SORTSHOW 169 |
| TMBOY | 47:9e361da97763 | 94 | #define ATOM_SEASON 170 |
| TMBOY | 47:9e361da97763 | 95 | #define ATOM_EPISODE 171 |
| TMBOY | 47:9e361da97763 | 96 | #define ATOM_PODCAST 172 |
| TMBOY | 47:9e361da97763 | 97 | |
| TMBOY | 47:9e361da97763 | 98 | #define ATOM_UNKNOWN 255 |
| TMBOY | 47:9e361da97763 | 99 | #define ATOM_FREE ATOM_UNKNOWN |
| TMBOY | 47:9e361da97763 | 100 | #define ATOM_SKIP ATOM_UNKNOWN |
| TMBOY | 47:9e361da97763 | 101 | |
| TMBOY | 47:9e361da97763 | 102 | /* atoms with subatoms */ |
| TMBOY | 47:9e361da97763 | 103 | #define ATOM_MOOV 1 |
| TMBOY | 47:9e361da97763 | 104 | #define ATOM_TRAK 2 |
| TMBOY | 47:9e361da97763 | 105 | #define ATOM_EDTS 3 |
| TMBOY | 47:9e361da97763 | 106 | #define ATOM_MDIA 4 |
| TMBOY | 47:9e361da97763 | 107 | #define ATOM_MINF 5 |
| TMBOY | 47:9e361da97763 | 108 | #define ATOM_STBL 6 |
| TMBOY | 47:9e361da97763 | 109 | #define ATOM_UDTA 7 |
| TMBOY | 47:9e361da97763 | 110 | #define ATOM_ILST 8 /* iTunes Metadata list */ |
| TMBOY | 47:9e361da97763 | 111 | #define ATOM_TITLE 9 |
| TMBOY | 47:9e361da97763 | 112 | #define ATOM_ARTIST 10 |
| TMBOY | 47:9e361da97763 | 113 | #define ATOM_WRITER 11 |
| TMBOY | 47:9e361da97763 | 114 | #define ATOM_ALBUM 12 |
| TMBOY | 47:9e361da97763 | 115 | #define ATOM_DATE 13 |
| TMBOY | 47:9e361da97763 | 116 | #define ATOM_TOOL 14 |
| TMBOY | 47:9e361da97763 | 117 | #define ATOM_COMMENT 15 |
| TMBOY | 47:9e361da97763 | 118 | #define ATOM_GENRE1 16 |
| TMBOY | 47:9e361da97763 | 119 | #define ATOM_TRACK 17 |
| TMBOY | 47:9e361da97763 | 120 | #define ATOM_DISC 18 |
| TMBOY | 47:9e361da97763 | 121 | #define ATOM_COMPILATION 19 |
| TMBOY | 47:9e361da97763 | 122 | #define ATOM_GENRE2 20 |
| TMBOY | 47:9e361da97763 | 123 | #define ATOM_TEMPO 21 |
| TMBOY | 47:9e361da97763 | 124 | #define ATOM_COVER 22 |
| TMBOY | 47:9e361da97763 | 125 | #define ATOM_DRMS 23 |
| TMBOY | 47:9e361da97763 | 126 | #define ATOM_SINF 24 |
| TMBOY | 47:9e361da97763 | 127 | #define ATOM_SCHI 25 |
| TMBOY | 47:9e361da97763 | 128 | |
| TMBOY | 47:9e361da97763 | 129 | #ifdef HAVE_CONFIG_H |
| TMBOY | 47:9e361da97763 | 130 | #include "../../config.h" |
| TMBOY | 47:9e361da97763 | 131 | #endif |
| TMBOY | 47:9e361da97763 | 132 | |
| TMBOY | 47:9e361da97763 | 133 | #if !(defined(_WIN32) || defined(_WIN32_WCE)) |
| TMBOY | 47:9e361da97763 | 134 | #define stricmp strcasecmp |
| TMBOY | 47:9e361da97763 | 135 | #else |
| TMBOY | 47:9e361da97763 | 136 | #define stricmp _stricmp |
| TMBOY | 47:9e361da97763 | 137 | #define strdup _strdup |
| TMBOY | 47:9e361da97763 | 138 | #endif |
| TMBOY | 47:9e361da97763 | 139 | |
| TMBOY | 47:9e361da97763 | 140 | /* file callback structure */ |
| TMBOY | 47:9e361da97763 | 141 | typedef struct |
| TMBOY | 47:9e361da97763 | 142 | { |
| TMBOY | 47:9e361da97763 | 143 | uint32_t (*read)(void *user_data, void *buffer, uint32_t length); |
| TMBOY | 47:9e361da97763 | 144 | uint32_t (*write)(void *udata, void *buffer, uint32_t length); |
| TMBOY | 47:9e361da97763 | 145 | uint32_t (*seek)(void *user_data, uint64_t position); |
| TMBOY | 47:9e361da97763 | 146 | uint32_t (*truncate)(void *user_data); |
| TMBOY | 47:9e361da97763 | 147 | void *user_data; |
| TMBOY | 47:9e361da97763 | 148 | } mp4ff_callback_t; |
| TMBOY | 47:9e361da97763 | 149 | |
| TMBOY | 47:9e361da97763 | 150 | |
| TMBOY | 47:9e361da97763 | 151 | /* metadata tag structure */ |
| TMBOY | 47:9e361da97763 | 152 | typedef struct |
| TMBOY | 47:9e361da97763 | 153 | { |
| TMBOY | 47:9e361da97763 | 154 | char *item; |
| TMBOY | 47:9e361da97763 | 155 | char *value; |
| TMBOY | 47:9e361da97763 | 156 | } mp4ff_tag_t; |
| TMBOY | 47:9e361da97763 | 157 | |
| TMBOY | 47:9e361da97763 | 158 | /* metadata list structure */ |
| TMBOY | 47:9e361da97763 | 159 | typedef struct |
| TMBOY | 47:9e361da97763 | 160 | { |
| TMBOY | 47:9e361da97763 | 161 | mp4ff_tag_t *tags; |
| TMBOY | 47:9e361da97763 | 162 | uint32_t count; |
| TMBOY | 47:9e361da97763 | 163 | } mp4ff_metadata_t; |
| TMBOY | 47:9e361da97763 | 164 | |
| TMBOY | 47:9e361da97763 | 165 | |
| TMBOY | 47:9e361da97763 | 166 | typedef struct |
| TMBOY | 47:9e361da97763 | 167 | { |
| TMBOY | 47:9e361da97763 | 168 | int32_t type; |
| TMBOY | 47:9e361da97763 | 169 | int32_t channelCount; |
| TMBOY | 47:9e361da97763 | 170 | int32_t sampleSize; |
| TMBOY | 47:9e361da97763 | 171 | uint16_t sampleRate; |
| TMBOY | 47:9e361da97763 | 172 | int32_t audioType; |
| TMBOY | 47:9e361da97763 | 173 | |
| TMBOY | 47:9e361da97763 | 174 | /* stsd */ |
| TMBOY | 47:9e361da97763 | 175 | int32_t stsd_entry_count; |
| TMBOY | 47:9e361da97763 | 176 | |
| TMBOY | 47:9e361da97763 | 177 | /* stsz */ |
| TMBOY | 47:9e361da97763 | 178 | int32_t stsz_sample_size; |
| TMBOY | 47:9e361da97763 | 179 | int32_t stsz_sample_count; |
| TMBOY | 47:9e361da97763 | 180 | int32_t *stsz_table; |
| TMBOY | 47:9e361da97763 | 181 | /* add by bolv */ |
| TMBOY | 47:9e361da97763 | 182 | int32_t stsz_table_offset;//the offset of the start of stsz_table into the file |
| TMBOY | 47:9e361da97763 | 183 | /* add by bolv */ |
| TMBOY | 47:9e361da97763 | 184 | |
| TMBOY | 47:9e361da97763 | 185 | /* stts */ |
| TMBOY | 47:9e361da97763 | 186 | int32_t stts_entry_count; |
| TMBOY | 47:9e361da97763 | 187 | int32_t *stts_sample_count; |
| TMBOY | 47:9e361da97763 | 188 | int32_t *stts_sample_delta; |
| TMBOY | 47:9e361da97763 | 189 | |
| TMBOY | 47:9e361da97763 | 190 | /* stsc */ |
| TMBOY | 47:9e361da97763 | 191 | int32_t stsc_entry_count; |
| TMBOY | 47:9e361da97763 | 192 | int32_t *stsc_first_chunk; |
| TMBOY | 47:9e361da97763 | 193 | int32_t *stsc_samples_per_chunk; |
| TMBOY | 47:9e361da97763 | 194 | int32_t *stsc_sample_desc_index; |
| TMBOY | 47:9e361da97763 | 195 | |
| TMBOY | 47:9e361da97763 | 196 | /* stco */ |
| TMBOY | 47:9e361da97763 | 197 | int32_t stco_entry_count; |
| TMBOY | 47:9e361da97763 | 198 | int32_t *stco_chunk_offset; |
| TMBOY | 47:9e361da97763 | 199 | /* add by bolv */ |
| TMBOY | 47:9e361da97763 | 200 | int32_t stco_current_chunk; //Current chunk ID,the minimum is 1 |
| TMBOY | 47:9e361da97763 | 201 | int32_t stco_current_chunk_first_sample; |
| TMBOY | 47:9e361da97763 | 202 | int32_t stco_current_chunk_samples; |
| TMBOY | 47:9e361da97763 | 203 | int32_t stco_current_chunk_offset; |
| TMBOY | 47:9e361da97763 | 204 | /* add by bolv */ |
| TMBOY | 47:9e361da97763 | 205 | |
| TMBOY | 47:9e361da97763 | 206 | /* ctts */ |
| TMBOY | 47:9e361da97763 | 207 | int32_t ctts_entry_count; |
| TMBOY | 47:9e361da97763 | 208 | int32_t *ctts_sample_count; |
| TMBOY | 47:9e361da97763 | 209 | int32_t *ctts_sample_offset; |
| TMBOY | 47:9e361da97763 | 210 | |
| TMBOY | 47:9e361da97763 | 211 | /* esde */ |
| TMBOY | 47:9e361da97763 | 212 | uint8_t *decoderConfig; |
| TMBOY | 47:9e361da97763 | 213 | int32_t decoderConfigLen; |
| TMBOY | 47:9e361da97763 | 214 | |
| TMBOY | 47:9e361da97763 | 215 | uint32_t maxBitrate; |
| TMBOY | 47:9e361da97763 | 216 | uint32_t avgBitrate; |
| TMBOY | 47:9e361da97763 | 217 | |
| TMBOY | 47:9e361da97763 | 218 | uint32_t timeScale; |
| TMBOY | 47:9e361da97763 | 219 | uint64_t duration; |
| TMBOY | 47:9e361da97763 | 220 | |
| TMBOY | 47:9e361da97763 | 221 | } mp4ff_track_t; |
| TMBOY | 47:9e361da97763 | 222 | |
| TMBOY | 47:9e361da97763 | 223 | /* mp4 main file structure */ |
| TMBOY | 47:9e361da97763 | 224 | typedef struct |
| TMBOY | 47:9e361da97763 | 225 | { |
| TMBOY | 47:9e361da97763 | 226 | /* stream to read from */ |
| TMBOY | 47:9e361da97763 | 227 | mp4ff_callback_t *stream; |
| TMBOY | 47:9e361da97763 | 228 | int64_t current_position; |
| TMBOY | 47:9e361da97763 | 229 | int64_t last_position;//add by bolv |
| TMBOY | 47:9e361da97763 | 230 | |
| TMBOY | 47:9e361da97763 | 231 | int32_t moov_read; |
| TMBOY | 47:9e361da97763 | 232 | uint64_t moov_offset; |
| TMBOY | 47:9e361da97763 | 233 | uint64_t moov_size; |
| TMBOY | 47:9e361da97763 | 234 | uint8_t last_atom; |
| TMBOY | 47:9e361da97763 | 235 | uint64_t file_size; |
| TMBOY | 47:9e361da97763 | 236 | |
| TMBOY | 47:9e361da97763 | 237 | /* mvhd */ |
| TMBOY | 47:9e361da97763 | 238 | int32_t time_scale; |
| TMBOY | 47:9e361da97763 | 239 | int32_t duration; |
| TMBOY | 47:9e361da97763 | 240 | |
| TMBOY | 47:9e361da97763 | 241 | /* incremental track index while reading the file */ |
| TMBOY | 47:9e361da97763 | 242 | int32_t total_tracks; |
| TMBOY | 47:9e361da97763 | 243 | |
| TMBOY | 47:9e361da97763 | 244 | /* track data */ |
| TMBOY | 47:9e361da97763 | 245 | mp4ff_track_t *track[MAX_TRACKS]; |
| TMBOY | 47:9e361da97763 | 246 | |
| TMBOY | 47:9e361da97763 | 247 | /* metadata */ |
| TMBOY | 47:9e361da97763 | 248 | mp4ff_metadata_t tags; |
| TMBOY | 47:9e361da97763 | 249 | } mp4ff_t; |
| TMBOY | 47:9e361da97763 | 250 | |
| TMBOY | 47:9e361da97763 | 251 | |
| TMBOY | 47:9e361da97763 | 252 | |
| TMBOY | 47:9e361da97763 | 253 | |
| TMBOY | 47:9e361da97763 | 254 | /* mp4util.c */ |
| TMBOY | 47:9e361da97763 | 255 | int32_t mp4ff_read_data(mp4ff_t *f, int8_t *data, uint32_t size); |
| TMBOY | 47:9e361da97763 | 256 | int32_t mp4ff_write_data(mp4ff_t *f, int8_t *data, uint32_t size); |
| TMBOY | 47:9e361da97763 | 257 | uint64_t mp4ff_read_int64(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 258 | uint32_t mp4ff_read_int32(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 259 | uint32_t mp4ff_read_int24(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 260 | uint16_t mp4ff_read_int16(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 261 | uint8_t mp4ff_read_char(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 262 | int32_t mp4ff_write_int32(mp4ff_t *f,const uint32_t data); |
| TMBOY | 47:9e361da97763 | 263 | uint32_t mp4ff_read_mp4_descr_length(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 264 | int64_t mp4ff_position(const mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 265 | int32_t mp4ff_set_position(mp4ff_t *f, const int64_t position); |
| TMBOY | 47:9e361da97763 | 266 | int32_t mp4ff_truncate(mp4ff_t * f); |
| TMBOY | 47:9e361da97763 | 267 | char * mp4ff_read_string(mp4ff_t * f,uint32_t length); |
| TMBOY | 47:9e361da97763 | 268 | |
| TMBOY | 47:9e361da97763 | 269 | /* mp4atom.c */ |
| TMBOY | 47:9e361da97763 | 270 | static int32_t mp4ff_atom_get_size(const int8_t *data); |
| TMBOY | 47:9e361da97763 | 271 | static int32_t mp4ff_atom_compare(const int8_t a1, const int8_t b1, const int8_t c1, const int8_t d1, |
| TMBOY | 47:9e361da97763 | 272 | const int8_t a2, const int8_t b2, const int8_t c2, const int8_t d2); |
| TMBOY | 47:9e361da97763 | 273 | static uint8_t mp4ff_atom_name_to_type(const int8_t a, const int8_t b, const int8_t c, const int8_t d); |
| TMBOY | 47:9e361da97763 | 274 | uint64_t mp4ff_atom_read_header(mp4ff_t *f, uint8_t *atom_type, uint8_t *header_size); |
| TMBOY | 47:9e361da97763 | 275 | static int32_t mp4ff_read_stsz(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 276 | static int32_t rda_mp4ff_read_stsz(mp4ff_t *f);//add by bolv |
| TMBOY | 47:9e361da97763 | 277 | static int32_t mp4ff_read_esds(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 278 | static int32_t mp4ff_read_mp4a(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 279 | static int32_t mp4ff_read_stsd(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 280 | static int32_t mp4ff_read_stsc(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 281 | static int32_t mp4ff_read_stco(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 282 | static int32_t mp4ff_read_stts(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 283 | #ifdef USE_TAGGING |
| TMBOY | 47:9e361da97763 | 284 | static int32_t mp4ff_read_meta(mp4ff_t *f, const uint64_t size); |
| TMBOY | 47:9e361da97763 | 285 | #endif |
| TMBOY | 47:9e361da97763 | 286 | int32_t mp4ff_atom_read(mp4ff_t *f, const int32_t size, const uint8_t atom_type); |
| TMBOY | 47:9e361da97763 | 287 | |
| TMBOY | 47:9e361da97763 | 288 | /* mp4sample.c */ |
| TMBOY | 47:9e361da97763 | 289 | static int32_t mp4ff_chunk_of_sample(const mp4ff_t *f, const int32_t track, const int32_t sample, |
| TMBOY | 47:9e361da97763 | 290 | int32_t *chunk_sample, int32_t *chunk); |
| TMBOY | 47:9e361da97763 | 291 | int32_t rda_mp4ff_chunk_of_sample(const mp4ff_t *f, const int32_t track, const int32_t sample);//add by bolv |
| TMBOY | 47:9e361da97763 | 292 | |
| TMBOY | 47:9e361da97763 | 293 | static int32_t mp4ff_chunk_to_offset(const mp4ff_t *f, const int32_t track, const int32_t chunk); |
| TMBOY | 47:9e361da97763 | 294 | int32_t rda_mp4ff_chunk_to_offset(const mp4ff_t *f, const int32_t track, const int32_t chunk);//add by bolv |
| TMBOY | 47:9e361da97763 | 295 | static int32_t mp4ff_sample_range_size(const mp4ff_t *f, const int32_t track, |
| TMBOY | 47:9e361da97763 | 296 | const int32_t chunk_sample, const int32_t sample); |
| TMBOY | 47:9e361da97763 | 297 | static int32_t rda_mp4ff_sample_range_size(const mp4ff_t *f, const int32_t track, |
| TMBOY | 47:9e361da97763 | 298 | const int32_t chunk_sample, const int32_t sample);//add by bolv |
| TMBOY | 47:9e361da97763 | 299 | static int32_t mp4ff_sample_to_offset(const mp4ff_t *f, const int32_t track, const int32_t sample); |
| TMBOY | 47:9e361da97763 | 300 | int32_t mp4ff_audio_frame_size(const mp4ff_t *f, const int32_t track, const int32_t sample); |
| TMBOY | 47:9e361da97763 | 301 | int32_t rda_mp4ff_audio_frame_size(const mp4ff_t *f, const int32_t track, const int32_t sample);//add by bolv |
| TMBOY | 47:9e361da97763 | 302 | int32_t mp4ff_set_sample_position(mp4ff_t *f, const int32_t track, const int32_t sample); |
| TMBOY | 47:9e361da97763 | 303 | int32_t rda_mp4ff_set_sample_position(mp4ff_t *f, const int32_t track, const int32_t sample);//add by bolv |
| TMBOY | 47:9e361da97763 | 304 | int32_t rda_mp4ff_get_sample_position_and_size(mp4ff_t *f, const int32_t track, const int32_t sample, int32_t *offset, int32_t *size);//add by bolv |
| TMBOY | 47:9e361da97763 | 305 | |
| TMBOY | 47:9e361da97763 | 306 | #ifdef USE_TAGGING |
| TMBOY | 47:9e361da97763 | 307 | /* mp4meta.c */ |
| TMBOY | 47:9e361da97763 | 308 | static int32_t mp4ff_tag_add_field(mp4ff_metadata_t *tags, const char *item, const char *value); |
| TMBOY | 47:9e361da97763 | 309 | static int32_t mp4ff_tag_set_field(mp4ff_metadata_t *tags, const char *item, const char *value); |
| TMBOY | 47:9e361da97763 | 310 | static int32_t mp4ff_set_metadata_name(mp4ff_t *f, const uint8_t atom_type, char **name); |
| TMBOY | 47:9e361da97763 | 311 | static int32_t mp4ff_parse_tag(mp4ff_t *f, const uint8_t parent_atom_type, const int32_t size); |
| TMBOY | 47:9e361da97763 | 312 | static int32_t mp4ff_meta_find_by_name(const mp4ff_t *f, const char *item, char **value); |
| TMBOY | 47:9e361da97763 | 313 | int32_t mp4ff_parse_metadata(mp4ff_t *f, const int32_t size); |
| TMBOY | 47:9e361da97763 | 314 | int32_t mp4ff_tag_delete(mp4ff_metadata_t *tags); |
| TMBOY | 47:9e361da97763 | 315 | int32_t mp4ff_meta_get_num_items(const mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 316 | int32_t mp4ff_meta_get_by_index(const mp4ff_t *f, uint32_t index, |
| TMBOY | 47:9e361da97763 | 317 | char **item, char **value); |
| TMBOY | 47:9e361da97763 | 318 | int32_t mp4ff_meta_get_title(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 319 | int32_t mp4ff_meta_get_artist(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 320 | int32_t mp4ff_meta_get_writer(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 321 | int32_t mp4ff_meta_get_album(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 322 | int32_t mp4ff_meta_get_date(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 323 | int32_t mp4ff_meta_get_tool(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 324 | int32_t mp4ff_meta_get_comment(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 325 | int32_t mp4ff_meta_get_genre(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 326 | int32_t mp4ff_meta_get_track(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 327 | int32_t mp4ff_meta_get_disc(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 328 | int32_t mp4ff_meta_get_compilation(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 329 | int32_t mp4ff_meta_get_tempo(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 330 | int32_t mp4ff_meta_get_coverart(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 331 | #endif |
| TMBOY | 47:9e361da97763 | 332 | |
| TMBOY | 47:9e361da97763 | 333 | /* mp4ff.c */ |
| TMBOY | 47:9e361da97763 | 334 | mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f); |
| TMBOY | 47:9e361da97763 | 335 | #ifdef USE_TAGGING |
| TMBOY | 47:9e361da97763 | 336 | mp4ff_t *mp4ff_open_edit(mp4ff_callback_t *f); |
| TMBOY | 47:9e361da97763 | 337 | #endif |
| TMBOY | 47:9e361da97763 | 338 | void mp4ff_close(mp4ff_t *ff); |
| TMBOY | 47:9e361da97763 | 339 | //void mp4ff_track_add(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 340 | int32_t parse_sub_atoms(mp4ff_t *f, const uint64_t total_size,int meta_only); |
| TMBOY | 47:9e361da97763 | 341 | int32_t parse_atoms(mp4ff_t *f,int meta_only); |
| TMBOY | 47:9e361da97763 | 342 | |
| TMBOY | 47:9e361da97763 | 343 | int32_t mp4ff_get_sample_duration(const mp4ff_t *f, const int32_t track, const int32_t sample); |
| TMBOY | 47:9e361da97763 | 344 | int64_t mp4ff_get_sample_position(const mp4ff_t *f, const int32_t track, const int32_t sample); |
| TMBOY | 47:9e361da97763 | 345 | int32_t mp4ff_get_sample_offset(const mp4ff_t *f, const int32_t track, const int32_t sample); |
| TMBOY | 47:9e361da97763 | 346 | int32_t mp4ff_find_sample(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip); |
| TMBOY | 47:9e361da97763 | 347 | |
| TMBOY | 47:9e361da97763 | 348 | int32_t mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample, |
| TMBOY | 47:9e361da97763 | 349 | uint8_t **audio_buffer, uint32_t *bytes); |
| TMBOY | 47:9e361da97763 | 350 | int32_t rda_mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample, |
| TMBOY | 47:9e361da97763 | 351 | uint8_t **audio_buffer, uint32_t *bytes);//add by bolv |
| TMBOY | 47:9e361da97763 | 352 | int32_t rda_mp4ff_read_sample_adts(mp4ff_t *f, const int32_t track, const int32_t sample, |
| TMBOY | 47:9e361da97763 | 353 | uint8_t **audio_buffer, uint32_t *bytes);//add by bolv |
| TMBOY | 47:9e361da97763 | 354 | int32_t mp4ff_get_decoder_config(const mp4ff_t *f, const int32_t track, |
| TMBOY | 47:9e361da97763 | 355 | uint8_t** ppBuf, uint32_t* pBufSize); |
| TMBOY | 47:9e361da97763 | 356 | int32_t mp4ff_total_tracks(const mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 357 | int32_t rda_mp4ff_get_aac_track(const mp4ff_t *f);//add by bolv |
| TMBOY | 47:9e361da97763 | 358 | int32_t mp4ff_time_scale(const mp4ff_t *f, const int32_t track); |
| TMBOY | 47:9e361da97763 | 359 | int32_t mp4ff_num_samples(const mp4ff_t *f, const int32_t track); |
| TMBOY | 47:9e361da97763 | 360 | |
| TMBOY | 47:9e361da97763 | 361 | uint32_t mp4ff_meta_genre_to_index(const char * genrestr);//returns 1-based index, 0 if not found |
| TMBOY | 47:9e361da97763 | 362 | const char * mp4ff_meta_index_to_genre(uint32_t idx);//returns pointer to static string |
| TMBOY | 47:9e361da97763 | 363 | |
| TMBOY | 47:9e361da97763 | 364 | |
| TMBOY | 47:9e361da97763 | 365 | #ifdef __cplusplus |
| TMBOY | 47:9e361da97763 | 366 | } |
| TMBOY | 47:9e361da97763 | 367 | #endif /* __cplusplus */ |
| TMBOY | 47:9e361da97763 | 368 | |
| TMBOY | 47:9e361da97763 | 369 | #endif |
