Index: apps/codecs/aac.c =================================================================== --- apps/codecs/aac.c (revision 29173) +++ apps/codecs/aac.c (working copy) @@ -148,8 +148,18 @@ i = 0; if (file_offset > 0) { - if (alac_seek_raw(&demux_res, &input_stream, file_offset, - &sound_samples_done, (int*) &i)) { + /* When using alac_seek we need to set the desired sample index + position. We can estimate this from the byte position in the stream, + the overall bitrate and the samplerate. Important: We need to + subtract the m4a header length (mdat_offset) to not add any offset. + */ + file_offset -= demux_res.mdat_offset; + file_offset = (uint32_t)(((uint64_t)file_offset * 8) * + (ci->id3->frequency / 100) / + (ci->id3->bitrate * 10)); + if (alac_seek(&demux_res, &input_stream, + file_offset, + &sound_samples_done, (int*) &i)) { elapsed_time = (sound_samples_done * 10) / (ci->id3->frequency / 100); ci->set_elapsed(elapsed_time); } else { Index: apps/codecs/libm4a/m4a.c =================================================================== --- apps/codecs/libm4a/m4a.c (revision 29174) +++ apps/codecs/libm4a/m4a.c (working copy) @@ -327,6 +327,7 @@ return 0; } +#if 0 /* Seek to the sample containing file_loc. Return 1 on success (and modify * sound_samples_done and current_sample), 0 if failed. * @@ -429,3 +430,4 @@ return 0; } +#endif