/// <summary> /// Returns what the delta should be not to violate the trimming of this clip /// </summary> public static long HowMuchCanBeTrimmed(this VidkaClipVideo clip, TrimDirection side, long delta) { if (clip == null) { return(0); } if (side == TrimDirection.Left) { var frame = clip.FrameStart + delta; if (frame < 0) { return(-clip.FrameStart); // to make 0 } else if (frame >= clip.FrameEnd) { return(-clip.FrameStart + clip.FrameEnd - 1); // to make frameEnd-1 } return(delta); } else if (side == TrimDirection.Right) { var frame = clip.FrameEnd + delta; if (frame <= clip.FrameStart) { return(-clip.FrameEnd + clip.FrameStart + 1); // to male frameStart+1 } else if (frame >= clip.FileLengthFrames) { return(-clip.FrameEnd + clip.FileLengthFrames); // to make clip.LengthFrameCalc } return(delta); } return(0); }
/// <summary> /// Debug description /// </summary> public static string cxzxc(this VidkaClipVideo clip) { if (clip == null) { return("null"); } return(Path.GetFileName(clip.FileName)); }
/// <summary> /// The inverse of GetVideoClipIndexAtFrame. /// Instead returns the frame of the clip (left side) within project absolute frame space. /// Returns -1 if the clip is not even in the project /// </summary> public static long GetVideoClipAbsFramePositionLeft(this VidkaProj proj, VidkaClipVideo clip) { long totalFrames = 0; foreach (var ccc in proj.ClipsVideo) { if (ccc == clip) { return(totalFrames); } totalFrames += ccc.LengthFrameCalc; } return(-1); }
public int getScreenX1(VidkaClipVideo vclip) { long frameTotal = 0; foreach (var ccc in proj.ClipsVideo) { if (ccc == vclip) break; frameTotal += ccc.LengthFrameCalc; } return convert_Frame2ScreenX(frameTotal); }
public void SetCurrentVideoClip_ForceRepaint(VidkaClipVideo clip) { ___UiTransactionBegin(); UiObjects.SetActiveVideo(clip, Proj); UiObjects.SetHoverVideo(null); ___UiTransactionEnd(); }
private void dragAndDropMan_MetaReadyForOutstandingVideo(VidkaClipVideo vclip, VideoMetadataUseful meta) { ___UiTransactionBegin(); UpdateCanvasWidthFromProjAndDimdim(); ___UiTransactionEnd(); }
/// <summary> /// Returns clip being split, its index within video timeline /// and how many frames from its FrameStart to cut /// </summary> private bool DoVideoSplitCalculations( out VidkaClipVideo clip, out int clipIndex, out long frameOffsetStartOfVideo) { clip = null; clipIndex = Proj.GetVideoClipIndexAtFrame(UiObjects.CurrentMarkerFrame, out frameOffsetStartOfVideo); if (clipIndex == -1) { cxzxc("No clip here... Cannot split!"); return false; } clip = Proj.GetVideoClipAtIndex(clipIndex); if (frameOffsetStartOfVideo == clip.FrameStart) { cxzxc("On the seam... Cannot split!"); return false; } if (clip.IsLocked) { cxzxc("Clip locked... Cannot split!\nPress 'F' to unlock."); return false; } return true; }
/// <summary> /// The inverse of GetVideoClipIndexAtFrame. /// Instead returns the frame of the clip (left side) within project absolute frame space. /// Returns -1 if the clip is not even in the project /// </summary> public static long GetVideoClipAbsFramePositionLeft(this VidkaProj proj, VidkaClipVideo clip) { long totalFrames = 0; foreach (var ccc in proj.ClipsVideo) { if (ccc == clip) return totalFrames; totalFrames += ccc.LengthFrameCalc; } return -1; }
private void StartPlaybackOfClip(VidkaClipVideo clip, long? frameOffsetCustom = null) { mutex.CurClipAbsFrameLeft = mutex.Proj.GetVideoClipAbsFramePositionLeft(clip); mutex.CurClipStartFrame = clip.FrameStart; var clipSecStart = mutex.Proj.FrameToSec(frameOffsetCustom ?? clip.FrameStart); //hacky, i know var clipSecEnd = mutex.Proj.FrameToSec(clip.FrameEnd); //hacky, i know mutex.CurStopPositionSec = clipSecEnd; editor.SetCurrentVideoClip_ForceRepaint(clip); player.PlayVideoClip(clip.FileName, clipSecStart, clipSecEnd); }
internal void Clear() { Mode = EditorDraggyMode.None; Text = null; FrameLength = 0; MouseX = 0; MouseXOffset = 0; VideoClip = null; AudioClip = null; }