@@ -131,18 +131,28 @@ class ContainerMP4 : public AudioDecoder {
131
131
stream_atom = streamAtom;
132
132
}
133
133
134
+ ContainerMP4 (AudioDecoder &decoder, const char *streamAtom = " mdat" ) {
135
+ stream_atom = streamAtom;
136
+ p_decoder = &decoder;
137
+ }
138
+
139
+ ContainerMP4 (AudioDecoder *decoder, const char *streamAtom = " mdat" ) {
140
+ stream_atom = streamAtom;
141
+ p_decoder = decoder;
142
+ }
143
+
134
144
// / starts the processing
135
145
void begin () override {
136
146
current_pos = 0 ;
137
147
assert (p_print!=nullptr );
138
- decoder. setOutput (*p_print);
139
- decoder. begin ();
148
+ p_decoder-> setOutput (*p_print);
149
+ p_decoder-> begin ();
140
150
is_active = true ;
141
151
}
142
152
143
153
// / ends the processing
144
154
void end () override {
145
- decoder. end ();
155
+ p_decoder-> end ();
146
156
is_active = false ;
147
157
}
148
158
@@ -213,7 +223,8 @@ class ContainerMP4 : public AudioDecoder {
213
223
int stream_out_open = 0 ;
214
224
bool is_sound = false ;
215
225
bool is_active = false ;
216
- AACDecoderHelix decoder{false };
226
+ AACDecoderHelix aac_decoder{false };
227
+ AudioDecoder* p_decoder = &aac_decoder;
217
228
const char *stream_atom;
218
229
int current_pos = 0 ;
219
230
const char *current_atom = nullptr ;
@@ -224,7 +235,7 @@ class ContainerMP4 : public AudioDecoder {
224
235
225
236
// / output of audio mdat to helix decoder;
226
237
size_t decode (const uint8_t *data, size_t len) {
227
- return decoder. write (data, len);
238
+ return p_decoder-> write (data, len);
228
239
}
229
240
230
241
// / Defines the size of open data that will be written directly w/o parsing
@@ -273,7 +284,7 @@ class ContainerMP4 : public AudioDecoder {
273
284
info.logInfo ();
274
285
container.setAudioInfo (info);
275
286
// init raw output
276
- container.decoder . setAudioInfo (info);
287
+ container.p_decoder -> setAudioInfo (info);
277
288
}
278
289
279
290
// / output of mdat to decoder;
@@ -303,6 +314,9 @@ void MP4Atom::setHeader(uint8_t *data, int len) {
303
314
total_size = ntohl (*p_size);
304
315
data_size = total_size - 8 ;
305
316
memcpy (atom, data + 4 , 4 );
317
+ if (total_size==1 ){
318
+
319
+ }
306
320
307
321
is_header_atom = container->isHeader (this , data);
308
322
}
0 commit comments