public IComposition AddComposition(string name, int priority)
        {
            OnAddingComposition();

            IComposition composition =
                TimelineBuilder.AddCompositionToCollection(this, _desTimeline, _timelineComposition, _compositions, name,
                                                           priority);

            composition.AddingEffect    += child_BeforeEffectAdded;
            composition.AddedEffect     += child_AfterEffectAdded;
            composition.AddedClip       += child_AfterClipAdded;
            composition.AddingClip      += child_BeforeClipAdded;
            composition.AddedTransition +=
                child_AfterTransitionAdded;
            composition.AddingTransition  += child_BeforeTransitionAdded;
            composition.AddingTrack       += child_BeforeTrackAdded;
            composition.AddedTrack        += child_AfterTrackAdded;
            composition.AddingComposition += child_BeforeCompositionAdded;
            composition.AddedComposition  +=
                child_AfterCompositionAdded;

            OnAddedComposition(composition);

            return(composition);
        }
Exemple #2
0
        public IClip AddClip(string name, string fileName, GroupMediaType mediaType, InsertPosition position,
                             double offset,
                             double clipStart, double clipEnd, bool manageLifespan)
        {
            CheckMediaTypeAgainstGroup(mediaType);

            OnAddingClip();

            if ((clipEnd < 0) && (mediaType == GroupMediaType.Image))
            {
                clipEnd = DefaultImageDisplayDuration + clipStart;
            }

            long durationInUnits;

            var mediaFile = new MediaFile(fileName, manageLifespan);

            double absoluteOffset = position == InsertPosition.Absolute ? offset : Duration + offset;

            IList <IDisposable> activeAssistants = null;

            IAMTimelineSrc timelineSrc = null;

            try
            {
                activeAssistants = FetchAssistants(mediaFile);

                timelineSrc = CreateMedia(mediaFile,
                                          mediaType,
                                          TimelineBuilder.ToUnits(absoluteOffset),
                                          TimelineBuilder.ToUnits(clipStart),
                                          TimelineBuilder.ToUnits(clipEnd),
                                          out durationInUnits);
            }
            finally
            {
                DisposeOfAssistants(activeAssistants);
            }

            if (!string.IsNullOrEmpty(name))
            {
                ((IAMTimelineObj)timelineSrc).SetUserName(name);
            }

            IClip clip =
                new Clip(this, _timeline, timelineSrc, name, absoluteOffset, TimelineBuilder.ToSeconds(durationInUnits),
                         clipStart, mediaFile);

            clip.AddingEffect += clip_BeforeEffectAdded;
            clip.AddedEffect  += clip_AfterEffectAdded;

            _clips.Add(clip);

            _virtualClips.AddVirtualClip(clip);

            OnAddedClip(clip);

            return(clip);
        }
Exemple #3
0
        public IEffect AddEffect(string name, int priority, double offset, double duration,
                                 EffectDefinition effectDefinition)
        {
            OnAddingEffects();

            IEffect effect =
                TimelineBuilder.AddEffectToCollection(this, _timeline, (IAMTimelineEffectable)_timelineSource, _effects,
                                                      name,
                                                      priority, offset, duration, effectDefinition);

            OnAddedEffect(effect);

            return(effect);
        }
Exemple #4
0
        public ITransition AddTransition(string name, double offset, double duration,
                                         TransitionDefinition transitionDefinition, bool swapInputs)
        {
            OnAddingTransition();

            ITransition transition =
                TimelineBuilder.AddTransitionToCollection(this, _timeline, (IAMTimelineTransable)_track, _transitions,
                                                          name,
                                                          offset, duration, transitionDefinition, swapInputs);

            OnAddedTransition(transition);

            return(transition);
        }
        public ITrack AddTrack(string name, int priority)
        {
            OnAddingTrack();

            ITrack track =
                TimelineBuilder.AddTrackToCollection(this, _desTimeline, _timelineComposition, _tracks, name, priority);

            track.AddingEffect     += child_BeforeEffectAdded;
            track.AddedEffect      += child_AfterEffectAdded;
            track.AddedClip        += child_AfterClipAdded;
            track.AddingClip       += child_BeforeClipAdded;
            track.AddedTransition  += child_AfterTransitionAdded;
            track.AddingTransition += child_BeforeTransitionAdded;

            OnAddedTrack(track);

            return(track);
        }
Exemple #6
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="type">The type of group this is</param>
        /// <param name="mediaType">Media type of the new group</param>
        /// <param name="timeline">Timeline to use for the group</param>
        /// <param name="fps">Fps for the group</param>
        public Group(ITimeline timeline, GroupType type, AMMediaType mediaType, string name, double fps)
            : base(timeline, name, -1)
        {
            if (timeline == null)
            {
                throw new ArgumentNullException("timeline");
            }
            if (mediaType == null)
            {
                throw new ArgumentNullException("mediaType");
            }
            if (fps <= 0)
            {
                throw new SplicerException(Resources.ErrorFramesPerSecondMustBeGreaterThenZero);
            }

            _timeline = timeline;
            _type     = type;
            _fps      = fps;

            _group = TimelineBuilder.InsertGroup(_timeline.DesTimeline, mediaType, name);
            TimelineComposition = (IAMTimelineComp)_group;
        }