private VideoStream(VideoFileInfo openedfileInfo, string fileName) { m_OpenedFileInfo = openedfileInfo; m_FileName = fileName; }
//HRESULT TangraVideoOpenFile(char* fileName, VideoFileInfo* fileInfo); private static extern int TangraVideoOpenFile(string fileName, [In, Out] VideoFileInfo fileInfo);
public static VideoFileInfo OpenFile(string fileName) { string fileExtension = Path.GetExtension(fileName).ToLower().Trim('.'); if (fileExtension != "avi" && fileExtension != "avs") { throw new TangraVideoException(string.Format("'.{0}' video files are not supported.", fileExtension)); } VideoFileInfo fileInfo = new VideoFileInfo(); TangraVideoOpenFile(fileName, fileInfo); if (fileInfo.CountFrames == 0) { // TODO: Get an error message from TangraVideo throw new TangraVideoException("Tangra was unable to load this file. Check file format and integrity."); } s_fileInfo = new VideoFileInfo() { Width = fileInfo.Width, Height = fileInfo.Height, FrameRate = fileInfo.FrameRate, CountFrames = fileInfo.CountFrames, FirstFrame = fileInfo.FirstFrame, VideoEncodedBitmapImageSize = fileInfo.VideoEncodedBitmapImageSize, VideoFileTypeBuffer = fileInfo.VideoFileTypeBuffer, EngineBuffer = fileInfo.EngineBuffer }; return fileInfo; }
public static void CloseFile() { TangraVideoCloseFile(); s_fileInfo = null; }