Moved code for frame skipping to acinerella (native code)

This commit is contained in:
lukeIam committed 2016-02-06 12:52:10 +01:00
1 parent 216375ab10
commit be3d27adfb
1 file changed
+3 -24
+3 -24
View File
@@ -434,37 +434,16 @@ namespace Vocaluxe.Lib.Video.Acinerella
} }
} }
[DllImport(_AcDll, EntryPoint = "ac_skip_package", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] [DllImport(_AcDll, EntryPoint = "ac_skip_frames", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
private static extern Int32 _ac_skip_package(IntPtr pAcInstance, IntPtr pAcDecoder); private static extern Int32 _ac_skip_frames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num);
public static bool AcSkipFrames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num) public static bool AcSkipFrames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num)
{
int skipedFrames = 0;
while (skipedFrames < num)
{ {
lock (_GetLockToken(pAcDecoder)) lock (_GetLockToken(pAcDecoder))
{ {
var pckt = _ac_read_package(pAcInstance); return _ac_skip_frames(pAcInstance, pAcDecoder, num) != 0;
if (pckt != IntPtr.Zero)
{
if (pAcDecoder != IntPtr.Zero)
{
// Decode the package to figure out if its completing a frame
if (_ac_skip_package(pckt, pAcDecoder) != 0)
{
skipedFrames++;
} }
} }
ac_free_package(pckt);
}
else
{
return false;
}
}
}
return true;
}
// Seeks to the given target position in the file. The seek funtion is not able to seek a single audio/video stream // Seeks to the given target position in the file. The seek funtion is not able to seek a single audio/video stream
// but seeks the whole file forward. The deocder parameter is only used as an timecode reference. // but seeks the whole file forward. The deocder parameter is only used as an timecode reference.