/// <summary>
        /// Initializes a new instance of the <see cref="EncoderSettingsPresentationModel"/> class.
        /// </summary>
        public EncoderSettingsPresentationModel(IEncoderSettingsView view, IProjectService projectService, IOutputServiceFacade outputServiceFacade, IConfigurationService configurationService)
        {
            this.View                 = view;
            this.projectService       = projectService;
            this.outputServiceFacade  = outputServiceFacade;
            this.configurationService = configurationService;
            this.outputServiceFacade.GenerateOuputCompleted += this.OnGenerateOutputCompleted;
            this.outputServiceFacade.GenerateCompositestreamManifestCompleted += this.OnGenerateCompositestreamManifestCompleted;

            this.Metadata = new OutputMetadata
            {
                Settings = new OutputSettings(),
                WindowsMediaHeaderProperties = new WindowsMediaHeaderProperties()
            };

            this.GenerateOutputCommand = new DelegateCommand <object>(this.GenerateOutput);

            this.ResizeModeOptions = new List <string> {
                "Stretch", "Letterbox"
            };

            this.AspectRatioOptions = new List <string> {
                "Custom", "16:9", "4:3"
            };

            this.FrameRateOptions = new List <double> {
                23.976, 24, 25, 29.97, 30
            };

            this.PbpDataStreamName = "PBP";
            this.AdsDataStreamName = "AD";

            this.View.Model = this;
        }
        public ManifestMediaModel(
            IOutputServiceFacade outputServiceFacade,
            [Dependency("PrimaryCache")] ICache primaryCache,
            ISequenceRegistry sequenceRegistry,
            IPersistenceService persistenceService,
            Func <ITransitionsManager> transitionsManagerFactory,
            Func <IRubberBandingManager> rubberBandingManagerFactory,
            IConfigurationService configurationService)
        {
            this.outputServiceFacade = outputServiceFacade;
            this.primaryCache        = primaryCache;
            this.sequenceRegistry    = sequenceRegistry;
            this.persistenceService  = persistenceService;
            this.outputServiceFacade.PersistManifestCompleted += this.OnPersistManifestCompleted;
            this.mediaDataByTrackId     = new Dictionary <int, ManifestPlayableMediaData>();
            this.maxNumberOfAudioTracks = configurationService.GetParameterValueAsInt("MaxNumberOfAudioTracks").GetValueOrDefault(1);

            this.transitionsManagers   = new List <ITransitionsManager>();
            this.rubberBandingManagers = new List <IRubberBandingManager>();

            for (int i = 0; i < this.maxNumberOfAudioTracks + 1; i++)
            {
                ITransitionsManager   transitionsManager   = transitionsManagerFactory();
                IRubberBandingManager rubberBandingManager = rubberBandingManagerFactory();

                transitionsManager.IsAudioOnly = i != 0;

                VolumeOrchestrator.Bind(transitionsManager, rubberBandingManager);

                this.transitionsManagers.Add(transitionsManager);
                this.rubberBandingManagers.Add(rubberBandingManager);
            }

            this.InitializeMediaData();

            this.SetPluginForManagers();

            this.SubcribeToPlayingStateChanged();

            this.pendingPersists = new List <int>();
            this.timer           = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(UtilityHelper.PositionUpdateIntervalMillis)
            };
            this.timer.Tick += this.OnFrameRendered;
            this.timer.Start();
        }