public void Init(IUnityContainer container, odm.ui.views.CustomAnalytics.SynesisAnalyticsConfigView.SynesisAnalyticsModel model, IVideoInfo videoInfo){//, string profToken) {
            this.model = model;
            this.container = container;
            this.videoInfo = videoInfo;

			BindData();
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new instance of Video.
        /// </summary>
        /// <param name="isAnalysis">true if the video is the result of an analysis.</param>
        /// <param name="vidPath">filepath to the video</param>
        /// This can be created by the VideoHandler using user input to its propertiesView.</param>
        /// <param name="processedBy">a list of MacroEntries describing through which operations this video was created.</param>
        /// <remarks>Note that optional parameters are used (for vidInfo and processedBy). If you do not
        /// need them just dont mention them in the invocation, else see <see cref="http://msdn.microsoft.com/de-de/library/dd264739.aspx"/>
        /// </remarks>
        public Video(bool isAnalysis, string vidPath, IVideoInfo vidInfo = null,List<IMacroEntry> processedBy = null)
        {
            this.isAnalysis = isAnalysis;
            this.vidPath = vidPath;

            this.vidInfo =vidInfo;
            this.processedBy = processedBy;
        }
		public bool Init(IUnityContainer container, StreamInfoArgs args, odm.ui.activities.ConfigureAnalyticView.ModuleDescriptor modulDescr) {
			this.modulDescr = modulDescr;
			this.container = container;

			this.videoDescr = new ConfigureAnalyticView.AnalyticsVideoDescriptor() {
				videoInfo = new VideoInfo() { MediaUri = args.streamUri, Resolution = new Size() { Width = args.sourceResolution.Width, Height = args.sourceResolution.Height } },
				videoSourceResolution = new Size() { Width = args.encoderResolution.Width, Height = args.encoderResolution.Height }
			};

			this.videoInfo = videoDescr.videoInfo;


			try {
				modulDescr.schema.GlobalTypes.Values.ForEach(x => {
					var val = x as global::System.Xml.Schema.XmlSchemaSimpleType;
					if (val == null)
						return;
					if (val.QualifiedName.Name == "sensitivity") {
						var tm1 = val.Content as System.Xml.Schema.XmlSchemaSimpleTypeRestriction;
						if (tm1 == null)
							return;
						var tm2 = tm1.Facets as System.Collections.CollectionBase;
						if (tm2 == null)
							return;

						tm2.ForEach(xx => {
							var min = xx as System.Xml.Schema.XmlSchemaMinInclusiveFacet;
							if (min != null) {
								int mval = 0;
								Int32.TryParse(min.Value, out mval);
								valueSensitivity.Minimum = mval;
							}
							var max = xx as System.Xml.Schema.XmlSchemaMaxInclusiveFacet;
							if (max != null) {
								int mval = 0;
								Int32.TryParse(max.Value, out mval);
								valueSensitivity.Maximum = mval;
							}
						});
					}
				});
			} catch (Exception err) {
				dbg.Error(err);
			}
			try {
				VideoStartup(args);
				InitApproEditor();
			} catch (Exception err) {
				dbg.Error(err);
				return false;
			}

			return true;
		}
        public void Init(IUnityContainer container, odm.ui.views.CustomAnalytics.SynesisAnalyticsConfigView.SynesisAnalyticsModel model, IVideoInfo videoInfo) {//, string profToken) {
            this.model = model;
            this.container = container;
            this.videoInfo = videoInfo;
		
			//VideoStartup(videoInfo, profToken);
            BindData();
            if (isLoaded) {
                InitRegionEditor();
            }
            isReady = true;
        }
		void VideoStartup(IVideoInfo iVideo) {
			playerEngine = new HostedPlayer();
			
			var account = AccountManager.Instance.CurrentAccount;
			UserNameToken usToken = null;
			if (!account.IsAnonymous) {
				usToken = new UserNameToken(account.Name, account.Password);
			}
			playerEngine.SetMetadataReciever(new MetadataFramer((stream) => {
				using (Disposable.Create(() => stream.Dispose())) {
					var xml = new XmlDocument();
					try {
						xml.Load(stream);
						if (xml.DocumentElement != null && xml.DocumentElement.HasChildNodes) {
							
							//TODO: possible incorrect behaviour when multiple instances of odm are running
							if (AppDefaults.visualSettings.EventsCollect_IsEnabled) {
								try {
									using (var sw = AppDefaults.MetadataFileInfo.AppendText()) {
										using (var xw = XmlWriter.Create(sw, new XmlWriterSettings() { Indent = true, CloseOutput = false })) {
											xml.DocumentElement.WriteTo(xw);
										}
										sw.WriteLine();
										sw.WriteLine("<!--------------------------------------------------------------------------------!>");
									}
								} catch {
									//swallow error
								}
							}

							MetadataReceived(xml);
						}
					} catch (Exception err) {

						//TODO: possible incorrect behaviour when multiple instances of odm are running
						if (AppDefaults.visualSettings.EventsCollect_IsEnabled) {
							try {
								using (var sw = AppDefaults.MetadataFileInfo.AppendText()) {
									sw.WriteLine("<!---------------------------------------------------------------------------------");
									sw.WriteLine("ERROR: {0}", err.Message);
									sw.WriteLine("---------------------------------------------------------------------------------!>");
								}
							} catch {
								//swallow error
								dbg.Error(err);
							}
						}

						dbg.Error(err);
					}
				}
			}));
			var vs = AppDefaults.visualSettings;
			MediaStreamInfo.Transport medtranp = MediaStreamInfo.Transport.Tcp;
			switch(vs.Transport_Type){
				case TransportProtocol.http:
					medtranp = MediaStreamInfo.Transport.Http;
					break;
				case TransportProtocol.rtsp:
					medtranp = MediaStreamInfo.Transport.Tcp;
					break;
				case TransportProtocol.tcp:
					medtranp = MediaStreamInfo.Transport.Tcp;
					break;
				case TransportProtocol.udp:
					medtranp = MediaStreamInfo.Transport.Udp;
					break;
			}
			
			MediaStreamInfo mstreamInfo = new MediaStreamInfo(iVideo.MediaUri, medtranp, usToken);
			playerEngine.Play(mstreamInfo, this);

			disposables.Add(playerEngine);
		}
Esempio n. 6
0
		public VideoStreamingButton(IEventAggregator eventAggregator, INvtSession session, String channelToken, Profile profile, Account currentAccount, IVideoInfo videoInfo)
            : base(eventAggregator, session, currentAccount, channelToken, profile, videoInfo) {
            Init();
        }
Esempio n. 7
0
		public NVAButtonBase(IEventAggregator eventAggregator, INvtSession session, Account currentAccount, AnalyticsEngine engine, AnalyticsEngineControl control, IVideoInfo videoInfo = null)
            : base(eventAggregator, session, currentAccount) {
            this.engine = engine;
            this.control = control;
            this.videoInfo = videoInfo;
	    }
        public void Init(IUnityContainer container, odm.ui.views.CustomAnalytics.SynesisAnalyticsConfigView.SynesisAnalyticsModel model, IVideoInfo videoInfo){//, string profToken) {
            this.model = model;
            this.container = container;
            this.videoInfo = videoInfo;
			
            calibrationMarkers = new UnitedMarkerCalibration(model.Markers);

			InitViewPort();
            FillData();
            InitDepthEditor();
        }
 public string GetNextUrl(IVideoInfo info, string next)
 {
     return("https://api.twitch.tv/v5/videos/" + info.VideoId + "/comments?cursor=" + next);
 }
Esempio n. 10
0
 private bool isContained(IVideoInfo vi)
 {
     return(_dictVideoVMS.ContainsKey(buildKey(vi)));
 }
Esempio n. 11
0
 void add(IVideoInfo vi)
 {
     _diplayer.Add(vi.VideoId, vi.StreamId);
 }
Esempio n. 12
0
 public VideoInfo(IVideoInfo videoInfo) : this(videoInfo.VideoId, videoInfo.StreamId, videoInfo.VideoName)
 {
 }
Esempio n. 13
0
 public VideoInfoEventArgs(IVideoInfo video_info)
 {
     this.video_info = video_info;
 }
        public void Init(IUnityContainer container, odm.ui.views.CustomAnalytics.SynesisAnalyticsConfigView.SynesisAnalyticsModel model, IVideoInfo videoInfo) //, string profToken) {
        {
            this.model     = model;
            this.container = container;
            this.videoInfo = videoInfo;

            calibrationMarkers = new UnitedMarkerCalibration(model.Markers);

            InitViewPort();
            FillData();
            InitDepthEditor();
        }
Esempio n. 15
0
        public bool Init(IUnityContainer container, StreamInfoArgs args, odm.ui.activities.ConfigureAnalyticView.ModuleDescriptor modulDescr)
        {
            this.modulDescr = modulDescr;
            this.container  = container;

            this.videoDescr = new ConfigureAnalyticView.AnalyticsVideoDescriptor()
            {
                videoInfo = new VideoInfo()
                {
                    MediaUri = args.streamUri, Resolution = new Size()
                    {
                        Width = args.sourceResolution.Width, Height = args.sourceResolution.Height
                    }
                },
                videoSourceResolution = new Size()
                {
                    Width = args.encoderResolution.Width, Height = args.encoderResolution.Height
                }
            };

            this.videoInfo = videoDescr.videoInfo;


            try {
                modulDescr.schema.GlobalTypes.Values.ForEach(x => {
                    var val = x as global::System.Xml.Schema.XmlSchemaSimpleType;
                    if (val == null)
                    {
                        return;
                    }
                    if (val.QualifiedName.Name == "sensitivity")
                    {
                        var tm1 = val.Content as System.Xml.Schema.XmlSchemaSimpleTypeRestriction;
                        if (tm1 == null)
                        {
                            return;
                        }
                        var tm2 = tm1.Facets as System.Collections.CollectionBase;
                        if (tm2 == null)
                        {
                            return;
                        }

                        tm2.ForEach(xx => {
                            var min = xx as System.Xml.Schema.XmlSchemaMinInclusiveFacet;
                            if (min != null)
                            {
                                int mval = 0;
                                Int32.TryParse(min.Value, out mval);
                                valueSensitivity.Minimum = mval;
                            }
                            var max = xx as System.Xml.Schema.XmlSchemaMaxInclusiveFacet;
                            if (max != null)
                            {
                                int mval = 0;
                                Int32.TryParse(max.Value, out mval);
                                valueSensitivity.Maximum = mval;
                            }
                        });
                    }
                });
            } catch (Exception err) {
                dbg.Error(err);
            }
            try {
                VideoStartup(args);
                InitApproEditor();
            } catch (Exception err) {
                dbg.Error(err);
                return(false);
            }

            return(true);
        }
Esempio n. 16
0
 public VideoBaseInfomParam(IVideoInfo videoInfo, ITimePeriod ti)
     : this(videoInfo.VideoId, videoInfo.StreamId, videoInfo.VideoName, ti.BeginTime, ti.EndTime)
 {
 }
		public bool Init(IUnityContainer container, StreamInfoArgs args, odm.ui.activities.ConfigureAnalyticView.ModuleDescriptor modulDescr) {
			this.modulDescr = modulDescr;
			this.container = container;

			this.videoDescr = new ConfigureAnalyticView.AnalyticsVideoDescriptor() {
				videoInfo = new VideoInfo() { MediaUri = args.streamUri, Resolution = new Size() { Width = args.sourceResolution.Width, Height = args.sourceResolution.Height } },
				videoSourceResolution = new Size() { Width = args.encoderResolution.Width, Height = args.encoderResolution.Height }
			};

			this.videoInfo = videoDescr.videoInfo;

			videoSourceSize = new Size(videoDescr.videoSourceResolution.Width, videoDescr.videoSourceResolution.Height);
			videoEncoderSize = new Size(videoDescr.videoInfo.Resolution.Width, videoDescr.videoInfo.Resolution.Height);

			model = new SynesisRegionRuleModel();

			try {
				FillElementItems(modulDescr.config.parameters.elementItem, model);
			} catch (Exception err) {
				dbg.Error(err);
				return false;
			}
			try {
				BindData();
				VideoStartup(args);
			} catch (Exception err) {
				dbg.Error(err);
				return false;
			}
			return true;
		}
        public void Init(IUnityContainer container, odm.ui.views.CustomAnalytics.SynesisAnalyticsConfigView.SynesisAnalyticsModel model, IVideoInfo videoInfo) //, string profToken) {
        {
            this.model     = model;
            this.container = container;
            this.videoInfo = videoInfo;

            BindData();
        }
Esempio n. 19
0
 public StorageFlagParam(IVideoInfo vi, bool isStartUpStorage)
     : base(vi)
 {
     StorageOn = isStartUpStorage;
 }
 public VideoControlViewModel(LocalDownloadInfoPacket localDownInfo, DateTime begin, DateTime end, ITimeProcess playProcess)
     : this(begin, end, playProcess)
 {
     VideoInfo    = localDownInfo.Info;
     DisplayModel = new VideoDisplayViewModel(localDownInfo, begin, end, _playProcess);
 }
Esempio n. 21
0
 void remove(IVideoInfo vi)
 {
     _diplayer.Remove(vi.VideoId, vi.StreamId);
 }
Esempio n. 22
0
 private string buildKey(IVideoInfo vi)
 {
     return($"{vi.VideoId}|{vi.StreamId}");
 }
 public VideoControlViewModel(DownloadInfoParam downloadInfo, ITimeProcess playProcess) : this(downloadInfo.BeginTime, downloadInfo.EndTime, playProcess)
 {
     VideoInfo         = downloadInfo;
     TotalMilliSeconds = (downloadInfo.EndTime - downloadInfo.BeginTime).TotalMilliseconds;
     DisplayModel      = new VideoDisplayViewModel(downloadInfo, _playProcess);
 }
Esempio n. 24
0
 public DownloadInfoParam(ISourceInfo sourceInfo, ITimePeriod tp, IVideoInfo vi, string downPath)
     : this(sourceInfo.SourceIp, sourceInfo.SourcePort, tp.BeginTime, tp.EndTime, vi.VideoId, vi.StreamId, downPath, vi.VideoName)
 {
 }
 public string GetStartUrl(IVideoInfo info)
 {
     return("https://api.twitch.tv/v5/videos/" + info.VideoId + "/comments?content_offset_seconds=0");
 }
Esempio n. 26
0
 public ChannelButtonBase(IEventAggregator eventAggregator, INvtSession session, Account currentAccount, String channelToken, Profile profile, IVideoInfo videoInfo)
     : base(eventAggregator, session, currentAccount)
 {
     this.channelToken = channelToken;
     this.profile      = profile;
     this.videoInfo    = videoInfo;
 }
Esempio n. 27
0
        public bool ResumeOrPlay(VM_AnimeEpisode_User episode)
        {
            try
            {
                // get the list if FileLocal records for this AnimeEpisode
                List <VM_VideoDetailed> fileLocalList = episode.FilesForEpisode;

                if (fileLocalList.Count == 0)
                {
                    return(false);
                }
                VM_VideoDetailed fileToPlay = null;
                if (fileLocalList.Count == 1)
                {
                    fileToPlay = fileLocalList[0];
                }
                else
                {
                    // ask the user which file they want to play
                    IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                    dlg.Reset();
                    dlg.SetHeading("Select File");
                    GUIListItem pItem = null;

                    foreach (VM_VideoDetailed fl in fileLocalList)
                    {
                        pItem = new GUIListItem(fl.FileSelectionDisplay);
                        dlg.Add(pItem);
                    }

                    dlg.DoModal(GUIWindowManager.ActiveWindow);

                    if (dlg.SelectedId > 0)
                    {
                        fileToPlay = fileLocalList[dlg.SelectedId - 1];
                    }
                }

                if (fileToPlay == null)
                {
                    return(false);
                }
                previous    = current;
                previousUri = currentUri;
                current     = fileToPlay;
                BaseConfig.MyAnimeLog.Write("Filetoplay: {0}", fileToPlay.FileName);


                if (!fileToPlay.IsLocalOrStreaming() == null)
                {
                    Utils.DialogMsg("Error", "File could not be found!");
                    return(false);
                }
                BaseConfig.MyAnimeLog.Write("Getting time stopped for : {0}", fileToPlay.FileName);
                _timeMovieStopped = (int)(fileToPlay.VideoLocal_ResumePosition / 1000);
                BaseConfig.MyAnimeLog.Write("Time stopped for : {0} - {1}", fileToPlay.FileName, _timeMovieStopped);

                prevEpisode = curEpisode;
                curEpisode  = episode;



                #region Ask user to Resume
                if (_timeMovieStopped > 0)
                {
                    //MPTVSeriesLog.Write("Asking user to resume episode from: " + Utils.SecondsToHMSString(timeMovieStopped));
                    GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);

                    if (null != dlgYesNo)
                    {
                        dlgYesNo.SetHeading(GUILocalizeStrings.Get(900)); //resume movie?
                        dlgYesNo.SetLine(1, episode.EpisodeName);
                        dlgYesNo.SetLine(2, GUILocalizeStrings.Get(936) + " " + MediaPortal.Util.Utils.SecondsToHMSString(_timeMovieStopped));
                        dlgYesNo.SetDefaultToYes(true);
                        dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);
                        if (!dlgYesNo.IsConfirmed) // reset resume data in DB
                        {
                            _timeMovieStopped = 0;
                            //MPTVSeriesLog.Write("User selected to start episode from beginning", MPTVSeriesLog.LogLevel.Debug);
                        }
                    }
                }
                #endregion



                Play(_timeMovieStopped, curEpisode.DefaultAudioLanguage, curEpisode.DefaultSubtitleLanguage);
                return(true);
            }
            catch (Exception e)
            {
                BaseConfig.MyAnimeLog.Write("ResumeOrPlay: {0}", e.ToString());
                return(false);
            }
        }
Esempio n. 28
0
 public NVAButtonBase(IEventAggregator eventAggregator, INvtSession session, Account currentAccount, AnalyticsEngine engine, AnalyticsEngineControl control, IVideoInfo videoInfo = null)
     : base(eventAggregator, session, currentAccount)
 {
     this.engine    = engine;
     this.control   = control;
     this.videoInfo = videoInfo;
 }
Esempio n. 29
0
        public ChannelButtonBase(IEventAggregator eventAggregator, INvtSession session, Account currentAccount, String channelToken, Profile profile, IVideoInfo videoInfo)
            : base(eventAggregator, session, currentAccount) {
            this.channelToken = channelToken;
            this.profile = profile;
            this.videoInfo = videoInfo;
	    }
Esempio n. 30
0
 public NVASettingsButton(IEventAggregator eventAggregator, INvtSession session, AnalyticsEngine engine, AnalyticsEngineControl control, Account currentAccount, IVideoInfo videoInfo = null)
     : base(eventAggregator, session, currentAccount, engine, control, videoInfo)
 {
     Init();
 }
Esempio n. 31
0
		public NVASettingsButton(IEventAggregator eventAggregator, INvtSession session, AnalyticsEngine engine, AnalyticsEngineControl control, Account currentAccount, IVideoInfo videoInfo = null)
			: base(eventAggregator, session, currentAccount, engine, control, videoInfo) {
			Init();
		}
Esempio n. 32
0
 public VideoStreamingButton(IEventAggregator eventAggregator, INvtSession session, String channelToken, Profile profile, Account currentAccount, IVideoInfo videoInfo)
     : base(eventAggregator, session, currentAccount, channelToken, profile, videoInfo)
 {
     Init();
 }
Esempio n. 33
0
		public UITestButton(IEventAggregator eventAggregator, INvtSession session, String channelToken, Profile profile, Account currentAccount, IVideoInfo videoInfo)
			: base(eventAggregator, session, currentAccount, channelToken, profile, videoInfo) {
			this.profile = profile;
			Init();
		}
Esempio n. 34
0
 public UITestButton(IEventAggregator eventAggregator, INvtSession session, String channelToken, Profile profile, Account currentAccount, IVideoInfo videoInfo)
     : base(eventAggregator, session, currentAccount, channelToken, profile, videoInfo)
 {
     this.profile = profile;
     Init();
 }
		private void Init(Model model) {
			this.DataContext = model;
			this.model = model;
			if (model.topicSet != null && model.topicSet.Any != null) {
				ExploreNamespaces(model.topicSet.Any);
			}
			
			InitializeComponent();

			//TODO: possible incorrect behaviour when multiple instances of odm are running
			if (AppDefaults.visualSettings.EventsCollect_IsEnabled) {
				var fi = AppDefaults.MetadataFileInfo;
				if (fi.Exists) {
					fi.Delete();
				}
			}

			ExpressionArguments args = new ExpressionArguments(
				model.messageContentFilterDialects, model.messageContentFilters,
				model.topicExpressionDialects, model.topicExpressionFilters, model.topicSet, namespaces);
			expressionFilters.Init(args);

			//commands
			OnCompleted += () => {
				disposables.Dispose();
				subscription.Dispose();
			};
			ApplyCmd = new DelegateCommand(
				() => {
					FillModel();
					Success(new Result.Apply(model)); 
				},() => true
			);

			//Start meta stream
			profile = activityContext.container.Resolve<Profile>();
			dispatch = Dispatcher.CurrentDispatcher;
			MetaData = new ObservableCollection<MetadataUnit>();

			VideoInfo = activityContext.container.Resolve<IVideoInfo>();
			VideoInfo.Resolution = new Size(800, 600);
			Reload(activityContext.container.Resolve<INvtSession>());

			includeAnalitycs.CreateBinding(CheckBox.IsCheckedProperty, model, x => x.includeAnalitycs, (m, v) => { m.includeAnalitycs = v; });
			includePtzPosition.CreateBinding(CheckBox.IsCheckedProperty, model, x => x.includePtzPosition, (m, v) => { m.includePtzPosition = v; });
			includePtzStatus.CreateBinding(CheckBox.IsCheckedProperty, model, x => x.includePtzStatus, (m, v) => { m.includePtzStatus = v; });
			expressionFilters.CreateBinding(ExpressionFilterControl.IsIncludeEventsProperty, model, x => { return x.includeEvents; }, (m, v) => { m.includeEvents = v; });
			//includeEvents.CreateBinding(CheckBox.IsCheckedProperty, model, x => x.includeEvents, (m, v) => { m.includeEvents = v; });

			includePtzPosition.CreateBinding(CheckBox.VisibilityProperty, model, x => x.isPtzPositionSupported ? Visibility.Visible : Visibility.Collapsed);
			includePtzStatus.CreateBinding(CheckBox.VisibilityProperty, model, x => x.isPtzStatusSupported ? Visibility.Visible : Visibility.Collapsed);
		}
Esempio n. 36
0
        public CreateAndEnqueueJobReturnValue CreateAndEnqueueJob(StreamService service, string id, IVideoInfo info = null)
        {
            IVideoJob job;

            switch (service)
            {
            case StreamService.Twitch:
                job = new TwitchVideoJob(id);
                break;

            case StreamService.TwitchChatReplay:
                job = new TwitchChatReplayJob(id);
                break;

            case StreamService.Hitbox:
                job = new HitboxVideoJob(id);
                break;

            case StreamService.Youtube:
                job = new YoutubeVideoJob(id);
                break;

            case StreamService.RawUrl:
                job = new GenericFileJob(id);
                break;

            case StreamService.FFMpegJob:
                job = new FFMpegReencodeJob(id);
                break;

            default:
                throw new Exception(service.ToString() + " isn't a known service.");
            }

            if (info != null)
            {
                job.VideoInfo = info;
            }

            bool success = EnqueueJob(job);

            return(new CreateAndEnqueueJobReturnValue {
                Success = success, Job = job
            });
        }
Esempio n. 37
0
        public void setWriteContext(string filepath, IVideoInfo info)
        {
            // check if values ok (more or less)
            if (info == null)
                throw new ArgumentException("Problems occured by switching context to given video." +
                    "There could be different causes to this, the first is that the given path does " +
                    "not describe a valid yuv video file and the second if the given IVideoInfo object " +
                    "is not initialized properly.");

            this.writePath = filepath;
            writeVidInfo = info;

            // Flush has to happen after a VALID vidInfo is set.
            flushWriter();
        }
Esempio n. 38
0
 public CreateAndEnqueueJobReturnValue CreateAndEnqueueJob(IVideoInfo info)
 {
     return(CreateAndEnqueueJob(info.Service, info.VideoId, info));
 }