public bool AddFileToPool(string MediaPath, IMediaMetadataReader immr) { if (SupportFormat.AllQualified(Path.GetExtension(MediaPath))) { AllMusic.AddMusic(immr.CreateEntity(MediaPath)); return(true); } return(false); }
public void AddToPool(string dirpath, IMediaMetadataReader immr) { foreach (string fi in Directory.GetFiles(dirpath)) { if (SupportFormat.AllQualified(Path.GetExtension(fi))) { AllMusic.AddMusic(immr.CreateEntity(fi)); } } }
/// <summary> /// 把本库支持的视频帧格式转换为SlimDX支持的帧类型 /// </summary> /// <param name="format">视频帧格式</param> /// <returns></returns> public static Format ConvertToD3D(SupportFormat format) { switch (format) { case SupportFormat.YV12: return D3DFormatYV12; case SupportFormat.NV12: return D3DFormatNV12; default: throw new ArgumentException("unknown pixel format"); } }
public void AddToPool(string dirpath, IMediaMetadataReader immr) { Catalogue pathCatalogue = new Catalogue(dirpath) { isLocationClassified = true }; foreach (string fi in Directory.GetFiles(dirpath)) { if (SupportFormat.AllQualified(Path.GetExtension(fi))) { MusicEntity me = immr.CreateEntity(fi); AllMusic.AddMusic(me); pathCatalogue.AddMusic(me); } } CPool.AddCatalogue(pathCatalogue); }
private async void loadFileAsync(String location, SupportFormat format) { string handler = "KLEditor.Utils." + TitleCase(format.ToString()) + "Handler"; Type type = Type.GetType(handler); var con = type.GetConstructor(new Type[] { typeof(String) }); file = con.Invoke(new Object[] { location }) as IFileOperator; var stream = await file.GetInputStream(); richTextBox.Invoke(new Action(() => { using (stream) { richTextBox.LoadFile(stream, file.RTBType); } })); }
/// <summary> /// 创建显示相关的参数信息 /// </summary> /// <param name="videoWidth"></param> /// <param name="videoHeight"></param> /// <param name="format"></param> /// <returns></returns> public bool SetupSurface(int videoWidth, int videoHeight, SupportFormat format) { Format d3dFormat = Utilities.ConvertToD3D(format); if (!this.CheckFormat(d3dFormat)) { return false; } this._frameFormat = format; switch (format) { case SupportFormat.YV12: this._yStride = videoWidth; this._yHeight = videoHeight; this._ySize = videoHeight * videoWidth; this._uvStride = this._yStride >> 1; this._uvHeight = this._yHeight >> 1; this._uvSize = this._ySize >> 2; break; case SupportFormat.NV12: this._yStride = videoWidth; this._yHeight = videoHeight; this._ySize = videoHeight * videoWidth; this._uvStride = this._yStride; this._uvHeight = this._yHeight >> 1; this._uvSize = this._ySize >> 1; break; default: break; } this.ReleaseResource(); this.CreateResource(d3dFormat, videoWidth, videoHeight); return true; }