uint32_t frame_length, FILE *ofp, m4af_ctx_t *m4af,
int show_progress)
{
- uint8_t *ibuf = 0;
- int16_t *pcmbuf = 0;
- uint32_t pcmsize = 0;
+ int16_t *ibuf = 0;
uint8_t *obuf = 0;
uint32_t olen;
uint32_t osize = 0;
if ((nread = pcm_read_frames(reader, ibuf, frame_length)) < 0) {
fprintf(stderr, "ERROR: read failed\n");
goto END;
- } else if (nread > 0) {
- if (pcm_convert_to_native_sint16(fmt, ibuf, nread,
- &pcmbuf, &pcmsize) < 0) {
- fprintf(stderr, "ERROR: unsupported sample format\n");
- goto END;
- }
}
if (show_progress)
aacenc_progress_update(&progress, pcm_get_position(reader),
fmt->sample_rate * 2);
}
- if ((consumed = aac_encode_frame(encoder, fmt, pcmbuf, nread,
+ if ((consumed = aac_encode_frame(encoder, fmt, ibuf, nread,
&obuf, &olen, &osize)) < 0)
goto END;
if (olen > 0) {
rc = frames_written;
END:
if (ibuf) free(ibuf);
- if (pcmbuf) free(pcmbuf);
if (obuf) free(obuf);
return rc;
}
goto END;
}
}
+ return pcm_open_sint16_converter(reader);
END:
- return reader;
+ return 0;
}
int main(int argc, char **argv)