/// <summary> /// add Source to video group /// </summary> private void AddSource(IAMTimelineTrack myTrack, string SourceFile, long StartTime, long EndTime) { int hr; IAMTimelineObj pSource1Obj; // create the timeline source object hr = m_pTimeline.CreateEmptyNode(out pSource1Obj, TimelineMajorType.Source); DESError.ThrowExceptionForHR(hr); try { // set up source length hr = pSource1Obj.SetStartStop(StartTime, EndTime); DESError.ThrowExceptionForHR(hr); IAMTimelineSrc pSource1Src = (IAMTimelineSrc)pSource1Obj; // Set the file name hr = pSource1Src.SetMediaName(SourceFile); DESError.ThrowExceptionForHR(hr); // Set the start/end hr = pSource1Src.SetMediaLength(EndTime - StartTime); DESError.ThrowExceptionForHR(hr); hr = pSource1Src.SetStretchMode(0); // Set the times, get back the times adjusted to fit the frame rate hr = pSource1Src.FixMediaTimes(ref StartTime, ref EndTime); DESError.ThrowExceptionForHR(hr); // Connect the track to the source hr = myTrack.SrcAdd(pSource1Obj); DESError.ThrowExceptionForHR(hr); } finally { Marshal.ReleaseComObject(pSource1Obj); } }
private void TestStretchMode() { int hr; ResizeFlags sm; hr = m_pSource1Src.SetStretchMode(ResizeFlags.Crop); DESError.ThrowExceptionForHR(hr); hr = m_pSource1Src.GetStretchMode(out sm); DESError.ThrowExceptionForHR(hr); Debug.Assert(sm == ResizeFlags.Crop, "StretchMode"); }