ex
Fork of mbed-os-example-mbed5-blinky by
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp4ff/mp4ff.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: mp4ff.h,v 1.27 2009/01/29 00:41:08 menno Exp $ |
| TMBOY | 47:9e361da97763 | 29 | **/ |
| TMBOY | 47:9e361da97763 | 30 | |
| TMBOY | 47:9e361da97763 | 31 | #ifndef MP4FF_H |
| TMBOY | 47:9e361da97763 | 32 | #define MP4FF_H |
| TMBOY | 47:9e361da97763 | 33 | |
| TMBOY | 47:9e361da97763 | 34 | #include "mp4ffint.h" |
| TMBOY | 47:9e361da97763 | 35 | |
| TMBOY | 47:9e361da97763 | 36 | #ifdef __cplusplus |
| TMBOY | 47:9e361da97763 | 37 | extern "C" { |
| TMBOY | 47:9e361da97763 | 38 | #endif /* __cplusplus */ |
| TMBOY | 47:9e361da97763 | 39 | #define HAVE_STDINT_H |
| TMBOY | 47:9e361da97763 | 40 | #ifdef HAVE_STDINT_H |
| TMBOY | 47:9e361da97763 | 41 | #include <stdint.h> |
| TMBOY | 47:9e361da97763 | 42 | #else |
| TMBOY | 47:9e361da97763 | 43 | #include "mp4ff_int_types.h" |
| TMBOY | 47:9e361da97763 | 44 | #endif |
| TMBOY | 47:9e361da97763 | 45 | |
| TMBOY | 47:9e361da97763 | 46 | #if 0 |
| TMBOY | 47:9e361da97763 | 47 | /* file callback structure */ |
| TMBOY | 47:9e361da97763 | 48 | typedef struct |
| TMBOY | 47:9e361da97763 | 49 | { |
| TMBOY | 47:9e361da97763 | 50 | uint32_t (*read)(void *user_data, void *buffer, uint32_t length); |
| TMBOY | 47:9e361da97763 | 51 | uint32_t (*write)(void *udata, void *buffer, uint32_t length); |
| TMBOY | 47:9e361da97763 | 52 | uint32_t (*seek)(void *user_data, uint64_t position); |
| TMBOY | 47:9e361da97763 | 53 | uint32_t (*truncate)(void *user_data); |
| TMBOY | 47:9e361da97763 | 54 | void *user_data; |
| TMBOY | 47:9e361da97763 | 55 | } mp4ff_callback_t; |
| TMBOY | 47:9e361da97763 | 56 | |
| TMBOY | 47:9e361da97763 | 57 | /* mp4 main file structure */ |
| TMBOY | 47:9e361da97763 | 58 | typedef void* mp4ff_t; |
| TMBOY | 47:9e361da97763 | 59 | #endif |
| TMBOY | 47:9e361da97763 | 60 | |
| TMBOY | 47:9e361da97763 | 61 | /* API */ |
| TMBOY | 47:9e361da97763 | 62 | |
| TMBOY | 47:9e361da97763 | 63 | mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f); |
| TMBOY | 47:9e361da97763 | 64 | mp4ff_t *mp4ff_open_read_metaonly(mp4ff_callback_t *f); |
| TMBOY | 47:9e361da97763 | 65 | void mp4ff_close(mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 66 | int32_t mp4ff_get_sample_duration(const mp4ff_t *f, const int32_t track, const int32_t sample); |
| TMBOY | 47:9e361da97763 | 67 | int32_t mp4ff_get_sample_duration_use_offsets(const mp4ff_t *f, const int32_t track, const int32_t sample); |
| TMBOY | 47:9e361da97763 | 68 | int64_t mp4ff_get_sample_position(const mp4ff_t *f, const int32_t track, const int32_t sample); |
| TMBOY | 47:9e361da97763 | 69 | int32_t mp4ff_get_sample_offset(const mp4ff_t *f, const int32_t track, const int32_t sample); |
| TMBOY | 47:9e361da97763 | 70 | int32_t mp4ff_find_sample(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip); |
| TMBOY | 47:9e361da97763 | 71 | int32_t mp4ff_find_sample_use_offsets(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip); |
| TMBOY | 47:9e361da97763 | 72 | |
| TMBOY | 47:9e361da97763 | 73 | int32_t mp4ff_read_sample(mp4ff_t *f, const int track, const int sample, |
| TMBOY | 47:9e361da97763 | 74 | unsigned char **audio_buffer, unsigned int *bytes); |
| TMBOY | 47:9e361da97763 | 75 | |
| TMBOY | 47:9e361da97763 | 76 | int32_t mp4ff_set_position(mp4ff_t *f, const int64_t position); |
| TMBOY | 47:9e361da97763 | 77 | |
| TMBOY | 47:9e361da97763 | 78 | int32_t rda_mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample, |
| TMBOY | 47:9e361da97763 | 79 | uint8_t **audio_buffer, uint32_t *bytes);//add by bolv |
| TMBOY | 47:9e361da97763 | 80 | int32_t rda_mp4ff_read_sample_adts(mp4ff_t *f, const int32_t track, const int32_t sample, |
| TMBOY | 47:9e361da97763 | 81 | uint8_t **audio_buffer, uint32_t *bytes);//add by bolv |
| TMBOY | 47:9e361da97763 | 82 | int32_t mp4ff_read_sample_v2(mp4ff_t *f, const int track, const int sample,unsigned char *buffer);//returns 0 on error, number of bytes read on success, use mp4ff_read_sample_getsize() to check buffer size needed |
| TMBOY | 47:9e361da97763 | 83 | int32_t mp4ff_read_sample_getsize(mp4ff_t *f, const int track, const int sample);//returns 0 on error, buffer size needed for mp4ff_read_sample_v2() on success |
| TMBOY | 47:9e361da97763 | 84 | int32_t rda_mp4ff_fill_stsz_table(mp4ff_t *f, const int32_t track, const int32_t sample);//add by bolv |
| TMBOY | 47:9e361da97763 | 85 | int32_t rda_mp4ff_refill_stsz_table(mp4ff_t *f, const int32_t track, const int32_t sample, const int32_t numSamples);//add by bolv |
| TMBOY | 47:9e361da97763 | 86 | 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 | 87 | |
| TMBOY | 47:9e361da97763 | 88 | int32_t mp4ff_get_decoder_config(const mp4ff_t *f, const int track, |
| TMBOY | 47:9e361da97763 | 89 | unsigned char** ppBuf, unsigned int* pBufSize); |
| TMBOY | 47:9e361da97763 | 90 | int32_t mp4ff_get_track_type(const mp4ff_t *f, const int track); |
| TMBOY | 47:9e361da97763 | 91 | int32_t mp4ff_total_tracks(const mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 92 | int32_t rda_mp4ff_get_aac_track(const mp4ff_t *f);//add by bolv |
| TMBOY | 47:9e361da97763 | 93 | int32_t mp4ff_num_samples(const mp4ff_t *f, const int track); |
| TMBOY | 47:9e361da97763 | 94 | int32_t mp4ff_time_scale(const mp4ff_t *f, const int track); |
| TMBOY | 47:9e361da97763 | 95 | |
| TMBOY | 47:9e361da97763 | 96 | uint32_t mp4ff_get_avg_bitrate(const mp4ff_t *f, const int32_t track); |
| TMBOY | 47:9e361da97763 | 97 | uint32_t mp4ff_get_max_bitrate(const mp4ff_t *f, const int32_t track); |
| TMBOY | 47:9e361da97763 | 98 | int64_t mp4ff_get_track_duration(const mp4ff_t *f, const int32_t track); //returns (-1) if unknown |
| TMBOY | 47:9e361da97763 | 99 | int64_t mp4ff_get_track_duration_use_offsets(const mp4ff_t *f, const int32_t track); //returns (-1) if unknown |
| TMBOY | 47:9e361da97763 | 100 | uint32_t mp4ff_get_sample_rate(const mp4ff_t *f, const int32_t track); |
| TMBOY | 47:9e361da97763 | 101 | uint32_t mp4ff_get_channel_count(const mp4ff_t * f,const int32_t track); |
| TMBOY | 47:9e361da97763 | 102 | uint32_t mp4ff_get_audio_type(const mp4ff_t * f,const int32_t track); |
| TMBOY | 47:9e361da97763 | 103 | |
| TMBOY | 47:9e361da97763 | 104 | |
| TMBOY | 47:9e361da97763 | 105 | /* metadata */ |
| TMBOY | 47:9e361da97763 | 106 | int mp4ff_meta_get_num_items(const mp4ff_t *f); |
| TMBOY | 47:9e361da97763 | 107 | int mp4ff_meta_get_by_index(const mp4ff_t *f, unsigned int index, |
| TMBOY | 47:9e361da97763 | 108 | char **item, char **value); |
| TMBOY | 47:9e361da97763 | 109 | int mp4ff_meta_get_title(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 110 | int mp4ff_meta_get_artist(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 111 | int mp4ff_meta_get_writer(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 112 | int mp4ff_meta_get_album(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 113 | int mp4ff_meta_get_date(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 114 | int mp4ff_meta_get_tool(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 115 | int mp4ff_meta_get_comment(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 116 | int mp4ff_meta_get_genre(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 117 | int mp4ff_meta_get_track(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 118 | int mp4ff_meta_get_disc(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 119 | int mp4ff_meta_get_totaltracks(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 120 | int mp4ff_meta_get_totaldiscs(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 121 | int mp4ff_meta_get_compilation(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 122 | int mp4ff_meta_get_tempo(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 123 | int32_t mp4ff_meta_get_coverart(const mp4ff_t *f, char **value); |
| TMBOY | 47:9e361da97763 | 124 | #ifdef USE_TAGGING |
| TMBOY | 47:9e361da97763 | 125 | |
| TMBOY | 47:9e361da97763 | 126 | /* metadata tag structure */ |
| TMBOY | 47:9e361da97763 | 127 | typedef struct |
| TMBOY | 47:9e361da97763 | 128 | { |
| TMBOY | 47:9e361da97763 | 129 | char *item; |
| TMBOY | 47:9e361da97763 | 130 | char *value; |
| TMBOY | 47:9e361da97763 | 131 | } mp4ff_tag_t; |
| TMBOY | 47:9e361da97763 | 132 | |
| TMBOY | 47:9e361da97763 | 133 | /* metadata list structure */ |
| TMBOY | 47:9e361da97763 | 134 | typedef struct |
| TMBOY | 47:9e361da97763 | 135 | { |
| TMBOY | 47:9e361da97763 | 136 | mp4ff_tag_t *tags; |
| TMBOY | 47:9e361da97763 | 137 | uint32_t count; |
| TMBOY | 47:9e361da97763 | 138 | } mp4ff_metadata_t; |
| TMBOY | 47:9e361da97763 | 139 | |
| TMBOY | 47:9e361da97763 | 140 | int32_t mp4ff_meta_update(mp4ff_callback_t *f,const mp4ff_metadata_t * data); |
| TMBOY | 47:9e361da97763 | 141 | |
| TMBOY | 47:9e361da97763 | 142 | #endif |
| TMBOY | 47:9e361da97763 | 143 | |
| TMBOY | 47:9e361da97763 | 144 | |
| TMBOY | 47:9e361da97763 | 145 | #ifdef __cplusplus |
| TMBOY | 47:9e361da97763 | 146 | } |
| TMBOY | 47:9e361da97763 | 147 | #endif /* __cplusplus */ |
| TMBOY | 47:9e361da97763 | 148 | |
| TMBOY | 47:9e361da97763 | 149 | #endif |
