コード例 #1
0
        /// <summary>
        /// Starts rendering the remote video stream to the provided textures.
        /// Only kI420 is currently supported.
        ///
        /// Calling this will override anything that is currently
        /// subscribed to the FrameReady call back on the VideoTrack.
        ///
        /// It is not necessary to send a textures array, if none is specified
        /// or a texture array of the wrong size is specified, the TextureSizeChanged
        /// callback will be fired and the textures can be updated with UpdateRemoteTextures.
        /// </summary>
        /// <param name="format"></param>
        /// <param name="textures"></param>
        public void EnableRemoteVideo(VideoKind format, TextureDesc[] textures)
        {
            if (textures != null)
            {
                UpdateRemoteTextures(format, textures);
            }

            NativeVideoInterop.EnableRemoteVideo(_nativeVideoHandle, format);
        }
コード例 #2
0
ファイル: Video.cs プロジェクト: hartl3y94/ShikimoriSharp
 public NewVideo(VideoKind kind, string name, string url)
 {
     video.Add("video", new Dictionary <string, string>
     {
         { "kind", kind.ToString() },
         { "name", name },
         { "url", url }
     });
 }
コード例 #3
0
        /// <summary>
        /// Starts renderering the local video stream to the provided textures.
        /// Only kI420 is currently supported.
        /// </summary>
        /// <param name="format"></param>
        /// <param name="textures"></param>
        public void EnableLocalVideo(VideoKind format, TextureDesc[] textures)
        {
            var interopTextures = textures.Select(item => new NativeVideoInterop.TextureDesc
            {
                texture = item.texture,
                width   = item.width,
                height  = item.height
            }).ToArray();

            NativeVideoInterop.EnableLocalVideo(_nativeVideoHandle, format, interopTextures, interopTextures.Length);
        }
コード例 #4
0
        private bool ValidateFrameTextures(VideoKind format, TextureDesc[] textures)
        {
            if (format == VideoKind.I420 && textures.Length != 3)
            {
                Debug.LogWarning("VideoKind.I420 expects three textures.");
                return(false);
            }

            if (format == VideoKind.ARGB)
            {
                Debug.LogWarning("ARGB not implemented.");
                return(false);
            }

            return(true);
        }
コード例 #5
0
        public void UpdateRemoteTextures(VideoKind format, TextureDesc[] textures)
        {
            if (!ValidateFrameTextures(format, textures))
            {
                return;
            }

            var interopTextures = textures.Select(item => new NativeVideoInterop.TextureDesc
            {
                texture = item.texture,
                width   = item.width,
                height  = item.height
            }).ToArray();

            NativeVideoInterop.UpdateRemoteTextures(_nativeVideoHandle, format, interopTextures, interopTextures.Length);
        }
コード例 #6
0
        List <VideoInfo> getVideoList(string path, string search, bool recursive)
        {
            List <VideoInfo> loVideoInfoList = new List <VideoInfo>();

            if (!(string.IsNullOrEmpty(path)))
            {
                FileInfo[] files = new DirectoryInfo(path).GetFiles(search, recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);

                foreach (FileInfo file in files)
                {
                    if (IsPossibleVideo(file.Name) && PassesAgeCheck(file.FullName))
                    {
                        string       description_xml = "";
                        string       airdate_xml     = "";
                        string       title_xml       = "";
                        TrackingInfo ti = new TrackingInfo();
                        // read info from Matroska Xml File if available
                        if (File.Exists(Path.ChangeExtension(file.FullName, ".xml")))
                        {
                            var matroskaTagsXmlDoc = XDocument.Load(Path.ChangeExtension(file.FullName, ".xml"));
                            foreach (var tagNode in matroskaTagsXmlDoc.Document.Descendants("Tag"))
                            {
                                var targetType = tagNode.Descendants("TargetTypeValue").First <XElement>().Value;
                                switch (targetType)
                                {
                                case "70":
                                {
                                    ti.VideoKind = VideoKind.TvSeries;
                                    ti.Title     = tagNode.Descendants("String").First <XElement>().Value;
                                    break;
                                }

                                case "60":
                                {
                                    ti.Season = Convert.ToUInt32(tagNode.Descendants("String").First <XElement>().Value);
                                    break;
                                }

                                case "50":
                                {
                                    foreach (var simpleNode in tagNode.Descendants("Simple"))
                                    {
                                        if (simpleNode.Element("Name").Value == "TITLE")
                                        {
                                            title_xml = simpleNode.Element("String").Value;
                                        }
                                        else if (simpleNode.Element("Name").Value == "DESCRIPTION")
                                        {
                                            description_xml = simpleNode.Element("String").Value;
                                        }
                                        else if (simpleNode.Element("Name").Value == "DATE_RELEASED")
                                        {
                                            airdate_xml = simpleNode.Element("String").Value;
                                            UInt32 year;
                                            if (UInt32.TryParse(airdate_xml, out year))
                                            {
                                                ti.Year = year;
                                            }
                                        }
                                        else if (simpleNode.Element("Name").Value == "PART_NUMBER")
                                        {
                                            ti.Episode = Convert.ToUInt32(simpleNode.Element("String").Value);
                                        }
                                        else if (simpleNode.Element("Name").Value == "CONTENT_TYPE")
                                        {
                                            VideoKind kind;
                                            if (VideoKind.TryParse(simpleNode.Element("String").Value, out kind))
                                            {
                                                ti.VideoKind = kind;
                                            }
                                        }
                                        else if (simpleNode.Element("Name").Value == "IMDB")
                                        {
                                            ti.ID_IMDB = simpleNode.Element("String").Value;
                                        }
                                    }
                                    break;
                                }
                                }
                            }
                        }
                        if (ti.VideoKind == VideoKind.Movie)
                        {
                            ti.Title = title_xml;
                        }
                        VideoInfo loVideoInfo = new VideoInfo();
                        loVideoInfo.VideoUrl    = file.FullName;
                        loVideoInfo.Thumb       = file.FullName.Substring(0, file.FullName.LastIndexOf(".")) + ".jpg";
                        loVideoInfo.Title       = string.IsNullOrEmpty(title_xml) ? file.Name : title_xml;
                        loVideoInfo.Length      = string.Format("{0} MB", (file.Length / 1024 / 1024).ToString("N0"));
                        loVideoInfo.Airdate     = string.IsNullOrEmpty(airdate_xml) ? file.LastWriteTime.ToString("g", OnlineVideoSettings.Instance.Locale) : airdate_xml;
                        loVideoInfo.Description = description_xml;
                        loVideoInfo.Other       = new ExtraVideoInfo(file, ti);
                        loVideoInfoList.Add(loVideoInfo);
                    }
                }

                switch (lastSort)
                {
                case "name":
                    loVideoInfoList.Sort((Comparison <VideoInfo>) delegate(VideoInfo v1, VideoInfo v2)
                    {
                        return(v1.Title.CompareTo(v2.Title));
                    });
                    break;

                case "date":
                    loVideoInfoList.Sort((Comparison <VideoInfo>) delegate(VideoInfo v1, VideoInfo v2)
                    {
                        return((v2.Other as ExtraVideoInfo).Item1.LastWriteTime.CompareTo((v1.Other as ExtraVideoInfo).Item1.LastWriteTime));
                    });
                    break;

                case "size":
                    loVideoInfoList.Sort((Comparison <VideoInfo>) delegate(VideoInfo v1, VideoInfo v2)
                    {
                        return((v2.Other as ExtraVideoInfo).Item1.Length.CompareTo((v1.Other as ExtraVideoInfo).Item1.Length));
                    });
                    break;
                }
            }
            else
            {
                foreach (DownloadInfo di in DownloadManager.Instance.GetAll())
                {
                    if (PassesAgeCheck(di.LocalFile))
                    {
                        VideoInfo loVideoInfo = new VideoInfo();
                        loVideoInfo.Title            = string.IsNullOrEmpty(di.Title) ? di.VideoInfo.Title : di.Title;
                        loVideoInfo.Thumb            = string.IsNullOrEmpty(di.ThumbFile) ? (string.IsNullOrEmpty(di.VideoInfo.ThumbnailImage) ? di.VideoInfo.Thumb : di.VideoInfo.ThumbnailImage) : di.ThumbFile;
                        loVideoInfo.Airdate          = di.Start.ToString("HH:mm:ss");
                        loVideoInfo.Length           = di.ProgressInfo;
                        loVideoInfo.Description      = string.Format("{0}\n{1}", di.Url, di.LocalFile);
                        loVideoInfo.Other            = di;
                        loVideoInfo.PropertyChanged += (s, e) =>
                        {
                            if (e.PropertyName == "Other")
                            {
                                (s as VideoInfo).Length = ((s as VideoInfo).Other as DownloadInfo).ProgressInfo;
                                (s as VideoInfo).NotifyPropertyChanged("Length");
                            }
                        };
                        loVideoInfoList.Add(loVideoInfo);
                    }
                }
            }
            return(loVideoInfoList);
        }
コード例 #7
0
 public static extern uint EnableRemoteVideo(IntPtr nativeVideoHandle, VideoKind format, TextureDesc[] textures, int textureCount);
コード例 #8
0
 public static extern uint EnableRemoteVideo(IntPtr nativeVideoHandle, VideoKind format);