there were a couple of different things that could cause trouble, color space, yv12 decoder, color depth and iirc even screen resolution. The functions taking care of it are:
Code:
string GetFourCC(int value)
{
byte[] bytes = BitConverter.GetBytes(value);
char[] chars = new char[4];
for (int i = 0; i < bytes.Length; i++)
chars[i] = Convert.ToChar(bytes[i]);
return new String(chars);
}
public void Open(string fileName)
{
try
{
AVIFileInit();
int OF_SHARE_DENY_WRITE = 32;
int result = AVIFileOpen(ref AviFile, fileName,
OF_SHARE_DENY_WRITE, 0);
if (result != 0)
throw new Exception("AVIFileOpen failed");
result = AVIFileGetStream(AviFile, out AviStream,
1935960438 /*FourCC for vids*/, 0);
if (result != 0)
throw new Exception("AVIFileGetStream failed");
FrameCountValue = AVIStreamLength(AviStream.ToInt32());
StreamInfo = new AVISTREAMINFO();
result = AVIStreamInfo(AviStream.ToInt32(), ref StreamInfo,
Marshal.SizeOf(StreamInfo));
if (result != 0)
throw new Exception("AVIStreamInfo failed");
if (GetFourCC(Convert.ToInt32(StreamInfo.fccHandler)) == "YV12")
FrameObject = AVIStreamGetFrameOpen(AviStream, 1);
else
FrameObject = AVIStreamGetFrameOpen(AviStream, 0);
if (FrameObject == IntPtr.Zero)
throw new Exception("AVIStreamGetFrameOpen failed");
}
catch (Exception ex)
{
MessageBox.Show("An error occurred. Maybe no YV12 decoder available, installing XviD, DivX or ffdshow might help.\r\n\r\n" +
ex.ToString(), Application.ProductName,
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
I don't know but you could ask Avery Lee