Mercurial > audlegacy-plugins
annotate src/aac/mp4ff/mp4ff.c @ 3203:f5456241bff9 default tip
changed include path from audacious to audlegacy.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Tue, 10 Nov 2009 05:19:25 +0900 |
parents | 8c884237cecd |
children |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
3 ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
4 ** |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 ** This program is free software; you can redistribute it and/or modify |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 ** it under the terms of the GNU General Public License as published by |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 ** the Free Software Foundation; either version 2 of the License, or |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 ** (at your option) any later version. |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
9 ** |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 ** This program is distributed in the hope that it will be useful, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 ** GNU General Public License for more details. |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
14 ** |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 ** You should have received a copy of the GNU General Public License |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
16 ** along with this program; if not, write to the Free Software |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 ** |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 ** Any non-GPL usage of this software or parts of this software is strictly |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 ** forbidden. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
21 ** |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
22 ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
23 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
24 ** |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 ** Commercial non-GPL licensing of this software is possible. |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
26 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 ** |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
28 ** $Id: mp4ff.c,v 1.22 2009/01/26 23:01:40 menno Exp $ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 **/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 #include <stdlib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 #include <string.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 #include "mp4ffint.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 mp4ff_t *ff = malloc(sizeof(mp4ff_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 memset(ff, 0, sizeof(mp4ff_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 ff->stream = f; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
43 parse_atoms(ff,0); |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
44 |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
45 return ff; |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
46 } |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
47 |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
48 mp4ff_t *mp4ff_open_read_metaonly(mp4ff_callback_t *f) |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
49 { |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
50 mp4ff_t *ff = malloc(sizeof(mp4ff_t)); |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
51 |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
52 memset(ff, 0, sizeof(mp4ff_t)); |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
53 |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
54 ff->stream = f; |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
55 |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
56 parse_atoms(ff,1); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
57 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 return ff; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
59 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
60 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
61 void mp4ff_close(mp4ff_t *ff) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
63 int32_t i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
64 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
65 for (i = 0; i < ff->total_tracks; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
66 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
67 if (ff->track[i]) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
68 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
69 if (ff->track[i]->stsz_table) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
70 free(ff->track[i]->stsz_table); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 if (ff->track[i]->stts_sample_count) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
72 free(ff->track[i]->stts_sample_count); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
73 if (ff->track[i]->stts_sample_delta) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
74 free(ff->track[i]->stts_sample_delta); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
75 if (ff->track[i]->stsc_first_chunk) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 free(ff->track[i]->stsc_first_chunk); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 if (ff->track[i]->stsc_samples_per_chunk) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
78 free(ff->track[i]->stsc_samples_per_chunk); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 if (ff->track[i]->stsc_sample_desc_index) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
80 free(ff->track[i]->stsc_sample_desc_index); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 if (ff->track[i]->stco_chunk_offset) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 free(ff->track[i]->stco_chunk_offset); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 if (ff->track[i]->decoderConfig) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 free(ff->track[i]->decoderConfig); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 if (ff->track[i]->ctts_sample_count) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 free(ff->track[i]->ctts_sample_count); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 if (ff->track[i]->ctts_sample_offset) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
88 free(ff->track[i]->ctts_sample_offset); |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
89 #ifdef ITUNES_DRM |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
90 if (ff->track[i]->p_drms) |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
91 drms_free(ff->track[i]->p_drms); |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
92 #endif |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
93 free(ff->track[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
94 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
95 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
96 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
97 #ifdef USE_TAGGING |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
98 mp4ff_tag_delete(&(ff->tags)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
99 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
100 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
101 if (ff) free(ff); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
102 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
103 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
104 void mp4ff_track_add(mp4ff_t *f) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
105 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
106 f->total_tracks++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
107 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
108 f->track[f->total_tracks - 1] = malloc(sizeof(mp4ff_track_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
109 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 memset(f->track[f->total_tracks - 1], 0, sizeof(mp4ff_track_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
111 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
112 |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
113 static int need_parse_when_meta_only(uint8_t atom_type) |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
114 { |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
115 switch(atom_type) |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
116 { |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
117 case ATOM_EDTS: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
118 // case ATOM_MDIA: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
119 // case ATOM_MINF: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
120 case ATOM_DRMS: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
121 case ATOM_SINF: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
122 case ATOM_SCHI: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
123 // case ATOM_STBL: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
124 // case ATOM_STSD: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
125 case ATOM_STTS: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
126 case ATOM_STSZ: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
127 case ATOM_STZ2: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
128 case ATOM_STCO: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
129 case ATOM_STSC: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
130 // case ATOM_CTTS: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
131 case ATOM_FRMA: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
132 case ATOM_IVIV: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
133 case ATOM_PRIV: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
134 return 0; |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
135 default: |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
136 return 1; |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
137 } |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
138 } |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
139 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
140 /* parse atoms that are sub atoms of other atoms */ |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
141 int32_t parse_sub_atoms(mp4ff_t *f, const uint64_t total_size,int meta_only) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
142 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
143 uint64_t size; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
144 uint8_t atom_type = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
145 uint64_t counted_size = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
146 uint8_t header_size = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
147 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
148 while (counted_size < total_size) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
149 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
150 size = mp4ff_atom_read_header(f, &atom_type, &header_size); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
151 counted_size += size; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
152 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
153 /* check for end of file */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
154 if (size == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
155 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
156 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
157 /* we're starting to read a new track, update index, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
158 * so that all data and tables get written in the right place |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
159 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
160 if (atom_type == ATOM_TRAK) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
161 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
162 mp4ff_track_add(f); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
163 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
164 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
165 /* parse subatoms */ |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
166 if (meta_only && !need_parse_when_meta_only(atom_type)) |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
167 { |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
168 mp4ff_set_position(f, mp4ff_position(f)+size-header_size); |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
169 } else if (atom_type < SUBATOMIC) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
170 { |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
171 parse_sub_atoms(f, size-header_size,meta_only); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
172 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
173 mp4ff_atom_read(f, (uint32_t)size, atom_type); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
175 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
176 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
177 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
178 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
179 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
180 /* parse root atoms */ |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
181 int32_t parse_atoms(mp4ff_t *f,int meta_only) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
182 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
183 uint64_t size; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
184 uint8_t atom_type = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
185 uint8_t header_size = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
186 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
187 f->file_size = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
188 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
189 while ((size = mp4ff_atom_read_header(f, &atom_type, &header_size)) != 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
190 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
191 f->file_size += size; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
192 f->last_atom = atom_type; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
193 |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
194 if (atom_type == ATOM_MDAT && f->moov_read) |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
195 { |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
196 /* moov atom is before mdat, we can stop reading when mdat is encountered */ |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
197 /* file position will stay at beginning of mdat data */ |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
198 // break; |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
199 } |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
200 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 if (atom_type == ATOM_MOOV && size > header_size) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 f->moov_read = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
204 f->moov_offset = mp4ff_position(f)-header_size; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
205 f->moov_size = size; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
207 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
208 /* parse subatoms */ |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
209 if (meta_only && !need_parse_when_meta_only(atom_type)) |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
210 { |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
211 mp4ff_set_position(f, mp4ff_position(f)+size-header_size); |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
212 } else if (atom_type < SUBATOMIC) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
213 { |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
214 parse_sub_atoms(f, size-header_size,meta_only); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
215 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
216 /* skip this atom */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
217 mp4ff_set_position(f, mp4ff_position(f)+size-header_size); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
219 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
220 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
221 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
222 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
223 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
224 int32_t mp4ff_get_decoder_config(const mp4ff_t *f, const int32_t track, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
225 uint8_t** ppBuf, uint32_t* pBufSize) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
226 { |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
227 if (track >= f->total_tracks) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
228 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
229 *ppBuf = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 *pBufSize = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
231 return 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
233 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
234 if (f->track[track]->decoderConfig == NULL || f->track[track]->decoderConfigLen == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
235 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 *ppBuf = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
237 *pBufSize = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
239 *ppBuf = malloc(f->track[track]->decoderConfigLen); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
240 if (*ppBuf == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
241 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
242 *pBufSize = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 return 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 memcpy(*ppBuf, f->track[track]->decoderConfig, f->track[track]->decoderConfigLen); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 *pBufSize = f->track[track]->decoderConfigLen; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 int32_t mp4ff_get_track_type(const mp4ff_t *f, const int track) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 { |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
254 return f->track[track]->type; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
255 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 int32_t mp4ff_total_tracks(const mp4ff_t *f) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 return f->total_tracks; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
262 int32_t mp4ff_time_scale(const mp4ff_t *f, const int32_t track) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
263 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
264 return f->track[track]->timeScale; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
265 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
267 uint32_t mp4ff_get_avg_bitrate(const mp4ff_t *f, const int32_t track) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
268 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
269 return f->track[track]->avgBitrate; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
270 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
271 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 uint32_t mp4ff_get_max_bitrate(const mp4ff_t *f, const int32_t track) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
273 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
274 return f->track[track]->maxBitrate; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
275 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
276 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 int64_t mp4ff_get_track_duration(const mp4ff_t *f, const int32_t track) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
278 { |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
279 return f->track[track]->duration; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
280 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
281 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
282 int64_t mp4ff_get_track_duration_use_offsets(const mp4ff_t *f, const int32_t track) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
283 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 int64_t duration = mp4ff_get_track_duration(f,track); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
285 if (duration!=-1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
286 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
287 int64_t offset = mp4ff_get_sample_offset(f,track,0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
288 if (offset > duration) duration = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
289 else duration -= offset; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
290 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
291 return duration; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
292 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
293 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 int32_t mp4ff_num_samples(const mp4ff_t *f, const int32_t track) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 { |
3137
8c884237cecd
mp4ff_num_samples(): check for track -1, cause that's not a good thing.
William Pitcock <nenolod@atheme.org>
parents:
3005
diff
changeset
|
296 int32_t i; |
8c884237cecd
mp4ff_num_samples(): check for track -1, cause that's not a good thing.
William Pitcock <nenolod@atheme.org>
parents:
3005
diff
changeset
|
297 int32_t total = 0; |
8c884237cecd
mp4ff_num_samples(): check for track -1, cause that's not a good thing.
William Pitcock <nenolod@atheme.org>
parents:
3005
diff
changeset
|
298 |
8c884237cecd
mp4ff_num_samples(): check for track -1, cause that's not a good thing.
William Pitcock <nenolod@atheme.org>
parents:
3005
diff
changeset
|
299 if (track < 0) |
8c884237cecd
mp4ff_num_samples(): check for track -1, cause that's not a good thing.
William Pitcock <nenolod@atheme.org>
parents:
3005
diff
changeset
|
300 return -1; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 |
3137
8c884237cecd
mp4ff_num_samples(): check for track -1, cause that's not a good thing.
William Pitcock <nenolod@atheme.org>
parents:
3005
diff
changeset
|
302 for (i = 0; i < f->track[track]->stts_entry_count; i++) |
8c884237cecd
mp4ff_num_samples(): check for track -1, cause that's not a good thing.
William Pitcock <nenolod@atheme.org>
parents:
3005
diff
changeset
|
303 { |
8c884237cecd
mp4ff_num_samples(): check for track -1, cause that's not a good thing.
William Pitcock <nenolod@atheme.org>
parents:
3005
diff
changeset
|
304 total += f->track[track]->stts_sample_count[i]; |
8c884237cecd
mp4ff_num_samples(): check for track -1, cause that's not a good thing.
William Pitcock <nenolod@atheme.org>
parents:
3005
diff
changeset
|
305 } |
8c884237cecd
mp4ff_num_samples(): check for track -1, cause that's not a good thing.
William Pitcock <nenolod@atheme.org>
parents:
3005
diff
changeset
|
306 |
8c884237cecd
mp4ff_num_samples(): check for track -1, cause that's not a good thing.
William Pitcock <nenolod@atheme.org>
parents:
3005
diff
changeset
|
307 return total; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
309 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 uint32_t mp4ff_get_sample_rate(const mp4ff_t *f, const int32_t track) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
311 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
312 return f->track[track]->sampleRate; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 uint32_t mp4ff_get_channel_count(const mp4ff_t * f,const int32_t track) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
317 return f->track[track]->channelCount; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
319 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
320 uint32_t mp4ff_get_audio_type(const mp4ff_t * f,const int32_t track) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
321 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 return f->track[track]->audioType; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 int32_t mp4ff_get_sample_duration_use_offsets(const mp4ff_t *f, const int32_t track, const int32_t sample) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
327 int32_t d,o; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
328 d = mp4ff_get_sample_duration(f,track,sample); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 if (d!=-1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
330 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 o = mp4ff_get_sample_offset(f,track,sample); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
332 if (o>d) d = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
333 else d -= o; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
335 return d; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
336 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
337 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 int32_t mp4ff_get_sample_duration(const mp4ff_t *f, const int32_t track, const int32_t sample) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
339 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
340 int32_t i, co = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
341 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
342 for (i = 0; i < f->track[track]->stts_entry_count; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
343 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
344 int32_t delta = f->track[track]->stts_sample_count[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
345 if (sample < co + delta) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
346 return f->track[track]->stts_sample_delta[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
347 co += delta; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
348 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
349 return (int32_t)(-1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
350 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
351 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
352 int64_t mp4ff_get_sample_position(const mp4ff_t *f, const int32_t track, const int32_t sample) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
353 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
354 int32_t i, co = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
355 int64_t acc = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
356 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
357 for (i = 0; i < f->track[track]->stts_entry_count; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
358 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
359 int32_t delta = f->track[track]->stts_sample_count[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
360 if (sample < co + delta) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
361 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
362 acc += f->track[track]->stts_sample_delta[i] * (sample - co); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
363 return acc; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
364 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
365 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
366 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
367 acc += f->track[track]->stts_sample_delta[i] * delta; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
368 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
369 co += delta; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
370 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
371 return (int64_t)(-1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
372 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
373 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
374 int32_t mp4ff_get_sample_offset(const mp4ff_t *f, const int32_t track, const int32_t sample) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
375 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
376 int32_t i, co = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
377 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
378 for (i = 0; i < f->track[track]->ctts_entry_count; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
379 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
380 int32_t delta = f->track[track]->ctts_sample_count[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
381 if (sample < co + delta) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
382 return f->track[track]->ctts_sample_offset[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
383 co += delta; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
384 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
385 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
386 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
387 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
388 int32_t mp4ff_find_sample(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
389 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
390 int32_t i, co = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
391 int64_t offset_total = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
392 mp4ff_track_t * p_track = f->track[track]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
393 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
394 for (i = 0; i < p_track->stts_entry_count; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
395 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
396 int32_t sample_count = p_track->stts_sample_count[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
397 int32_t sample_delta = p_track->stts_sample_delta[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
398 int64_t offset_delta = (int64_t)sample_delta * (int64_t)sample_count; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 if (offset < offset_total + offset_delta) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
400 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
401 int64_t offset_fromstts = offset - offset_total; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
402 if (toskip) *toskip = (int32_t)(offset_fromstts % sample_delta); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
403 return co + (int32_t)(offset_fromstts / sample_delta); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
404 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
405 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
406 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
407 offset_total += offset_delta; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
408 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
409 co += sample_count; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
410 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
411 return (int32_t)(-1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
412 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
413 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
414 int32_t mp4ff_find_sample_use_offsets(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
415 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
416 return mp4ff_find_sample(f,track,offset + mp4ff_get_sample_offset(f,track,0),toskip); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
417 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
418 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
419 int32_t mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 uint8_t **audio_buffer, uint32_t *bytes) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
421 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
422 int32_t result = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
423 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
424 *bytes = mp4ff_audio_frame_size(f, track, sample); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
425 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
426 if (*bytes==0) return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
427 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
428 *audio_buffer = (uint8_t*)malloc(*bytes); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
429 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
430 mp4ff_set_sample_position(f, track, sample); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
431 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
432 result = mp4ff_read_data(f, *audio_buffer, *bytes); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
433 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
434 if (!result) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
435 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
436 free(*audio_buffer); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
437 *audio_buffer = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
438 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
439 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
440 |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
441 #ifdef ITUNES_DRM |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
442 if (f->track[track]->p_drms != NULL) |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
443 { |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
444 drms_decrypt(f->track[track]->p_drms, (uint32_t*)*audio_buffer, *bytes); |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
445 } |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
446 #endif |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
447 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
448 return *bytes; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
449 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
450 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
451 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
452 int32_t mp4ff_read_sample_v2(mp4ff_t *f, const int track, const int sample,unsigned char *buffer) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
453 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
454 int32_t result = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
455 int32_t size = mp4ff_audio_frame_size(f,track,sample); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
456 if (size<=0) return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
457 mp4ff_set_sample_position(f, track, sample); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
458 result = mp4ff_read_data(f,buffer,size); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
459 |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
460 #ifdef ITUNES_DRM |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
461 if (f->track[track]->p_drms != NULL) |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
462 { |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
463 drms_decrypt(f->track[track]->p_drms, (uint32_t*)buffer, size); |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
464 } |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
465 #endif |
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
451
diff
changeset
|
466 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
467 return result; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
468 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
470 int32_t mp4ff_read_sample_getsize(mp4ff_t *f, const int track, const int sample) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
472 int32_t temp = mp4ff_audio_frame_size(f, track, sample); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
473 if (temp<0) temp = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
474 return temp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 } |