リビジョン | cd39daec25c424d9cd7033368c472c75947734d2 (tree) |
---|---|
日時 | 2021-10-05 01:06:59 |
作者 | yyagi <yyagi.dtxmania@gmai...> |
コミッター | yyagi |
#42987 Fixed failing to seek the tail of mp4 video (by using DTXCreator + DTXMania). (thanks to joe21121)
@@ -6,6 +6,7 @@ using System.Threading.Tasks; | ||
6 | 6 | using System.Runtime.InteropServices; |
7 | 7 | using DirectShowLib; |
8 | 8 | using SharpDX; |
9 | +using System.Diagnostics; | |
9 | 10 | |
10 | 11 | namespace FDK |
11 | 12 | { |
@@ -142,8 +143,11 @@ namespace FDK | ||
142 | 143 | |
143 | 144 | public void Seek(int timeInMs) |
144 | 145 | { |
145 | - int hr = seeker.SetPositions(new DsLong(timeInMs * 10000), AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning); | |
146 | - DsError.ThrowExceptionForHR(hr); | |
146 | + int hr = seeker.SetPositions( DsLong.FromInt64((long)(timeInMs * 10000)), AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning); | |
147 | + if ( (uint)hr != 0x80070057 ) // E_INVALIDARG. It tend to occur in seeking to the tail-part in mp4 file. Even if we ignore the error, the seek seems success, | |
148 | + { | |
149 | + DsError.ThrowExceptionForHR(hr); | |
150 | + } | |
147 | 151 | hr = control.GetState(timeOutMs, out state); // state is Running |
148 | 152 | DsError.ThrowExceptionForHR(hr); |
149 | 153 | } |