Skip to content

Commit 74e5a7d

Browse files
committed
ffmpeg: Support positive Offset
So far, seeking to `_sampleOffset` has not been implemented in the CUETools ffmpeg plugin. Seeking is required in case of positive offsets. Negative offsets have been working before. - Resolves #352
1 parent 7f48316 commit 74e5a7d

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

CUETools.Codecs.ffmpeg/AudioDecoder.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,10 @@ public long Position
264264

265265
set
266266
{
267-
throw new NotSupportedException();
268-
//_bufferOffset = 0;
269-
//_bufferLength = 0;
270-
//_sampleOffset = value;
271-
//int res = MACLibDll.c_APEDecompress_Seek(pAPEDecompress, (int)value);
272-
//if (0 != res)
273-
// throw new Exception("unable to seek:" + res.ToString());
267+
_sampleOffset = value;
268+
int res = ffmpeg.av_seek_frame(fmt_ctx, stream->index, _sampleOffset, ffmpeg.AVSEEK_FLAG_FRAME);
269+
if (0 != res)
270+
throw new Exception("unable to seek:" + res.ToString());
274271
}
275272
}
276273

0 commit comments

Comments
 (0)