private static extern bool ifoGetPGCICells(int v_IFO_handle, int v_Ptr, ref t_vs_vobcellid v_cells);
public TimeSpan Duration() { TitleTime tt = new TitleTime(); TimeSpan duration = TimeSpan.Zero; List <SimpleCell> SortedCells = new List <SimpleCell>(); int pgc_num = ifoGetNumPGCI(Handle); for (int i = 0; i < pgc_num; i++) { int num_cells = ifoGetPGCIInfo(Handle, i, ref tt); IntPtr ptr_cells = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(t_vs_vobcellid)) * num_cells); if (ptr_cells != IntPtr.Zero) { try { if (ifoGetPGCICells(Handle, i, ptr_cells)) { IntPtr ptr_cell = ptr_cells; for (int k = 0; k < num_cells; k++) { t_vs_vobcellid cell = (t_vs_vobcellid)Marshal.PtrToStructure(ptr_cell, typeof(t_vs_vobcellid)); ptr_cell = new IntPtr(ptr_cell.ToInt64() + Marshal.SizeOf(typeof(t_vs_vobcellid))); //ptr += offset //Сохраняем инфу от cell, если у нас такой еще нет (берутся только start\end_lba и time) SimpleCell obj = new SimpleCell() { start = cell.start_lba, end = cell.end_lba, time = cell.time }; if (!SortedCells.Contains(obj)) { SortedCells.Add(obj); } } } } finally { Marshal.FreeHGlobal(ptr_cells); } } } foreach (SimpleCell cell in SortedCells) { #region frames bits /* * 1 0 0 1 0 0 1 0 (73) * 1 0 0 1 0 0 0 0 (9, & 0x3f) 25fps * 0 0 0 0 0 0 1 0 (64, & ~0x3f) 25fps * * 0 1 0 1 0 0 0 0 (10, & 0x3f) 29fps * 0 0 0 0 0 0 1 1 (192, & ~0x3f) 29fps */ #endregion duration += TimeSpan.FromHours(cell.time.hours) + TimeSpan.FromMinutes(cell.time.minutes) + TimeSpan.FromSeconds(cell.time.seconds) + TimeSpan.FromMilliseconds((cell.time.frames & 0x3f) * //Перевод кадров в ms (((cell.time.frames & (1 << 7)) != 0) ? 1000.0 / (30000.0 / 1001.0) : 40.0)); } return(duration); }