private void OnMediaPlayerSnapshotTakenInternal(IntPtr ptr) { var args = MarshalHelper.PtrToStructure <VlcEventArg>(ptr); var fileName = Utf8InteropStringConverter.Utf8InteropToString(args.eventArgsUnion.MediaPlayerSnapshotTaken.pszFilename); OnMediaPlayerSnapshotTaken(fileName); }
public IEnumerable <FilterModuleDescription> GetVideoFilters() { var module = Manager.GetVideoFilterList(); ModuleDescriptionStructure nextModule = MarshalHelper.PtrToStructure <ModuleDescriptionStructure>(module); var result = GetSubFilter(nextModule); if (module != IntPtr.Zero) { Manager.ReleaseModuleDescriptionInstance(module); } return(result); }
/// <summary> /// Return pthe specified sparse matrix element if it exists; otherwise, default(T). /// </summary> /// <param name="idx">Array of Mat::dims indices.</param> /// <param name="hashVal">If hashVal is not null, the element hash value is not computed but hashval is taken instead.</param> /// <returns></returns> public T Value <T>(int[] idx, long?hashVal = null) where T : struct { IntPtr p = Ptr(idx, false, hashVal); if (p == IntPtr.Zero) { return(default(T)); } return(MarshalHelper.PtrToStructure <T>(p)); }
/// <summary> /// Return pthe specified sparse matrix element if it exists; otherwise, null. /// </summary> /// <param name="idx">Array of Mat::dims indices.</param> /// <param name="hashVal">If hashVal is not null, the element hash value is not computed but hashval is taken instead.</param> /// <returns></returns> public T?Find <T>(int[] idx, long?hashVal = null) where T : struct { var p = Ptr(idx, false, hashVal); if (p == IntPtr.Zero) { return(null); } return(MarshalHelper.PtrToStructure <T>(p)); }
/// <summary> /// Return pthe specified sparse matrix element if it exists; otherwise, null. /// </summary> /// <param name="i0">Index along the dimension 0</param> /// <param name="i1">Index along the dimension 1</param> /// <param name="i2">Index along the dimension 2</param> /// <param name="hashVal">If hashVal is not null, the element hash value is not computed but hashval is taken instead.</param> /// <returns></returns> public T?Find <T>(int i0, int i1, int i2, long?hashVal = null) where T : struct { IntPtr p = Ptr(i0, i1, i2, false, hashVal); if (p == IntPtr.Zero) { return(null); } return(MarshalHelper.PtrToStructure <T>(p)); }
/// <summary> /// 2-dimensional indexer /// </summary> /// <param name="i0">Index along the dimension 0</param> /// <param name="i1">Index along the dimension 1</param> /// <returns>A value to the specified array element.</returns> public override T this[int i0, int i1] { get { var p = new IntPtr(ptrVal + (step * i0) + (sizeOfT * i1)); return(MarshalHelper.PtrToStructure <T>(p)); } set { var p = new IntPtr(ptrVal + (step * i0) + (sizeOfT * i1)); Marshal.StructureToPtr(value, p, false); } }
/// <summary> /// n-dimensional indexer /// </summary> /// <param name="idx">Array of Mat::dims indices.</param> /// <param name="hashVal">If hashVal is not null, the element hash value is not computed but hashval is taken instead.</param> /// <returns>A value to the specified array element.</returns> public override T this[int[] idx, long?hashVal = null] { get { IntPtr p = parent.Ptr(idx, true, hashVal); return(MarshalHelper.PtrToStructure <T>(p)); } set { IntPtr p = parent.Ptr(idx, true, hashVal); Marshal.StructureToPtr(value, p, false); } }
static void Main(string[] args) { Mat m = Mat.Eye(new Size(2, 2), MatType.CV_32FC3); for (int y = 0; y < m.Rows; y++) { for (int x = 0; x < m.Cols; x++) { int offset = (int)m.Step() * y + m.ElemSize() * x; // offset 지정 Vec3b i = MarshalHelper.PtrToStructure <Vec3b>(m.Ptr(0) + offset + 0); Console.WriteLine($"{offset} - ({y}, {x}) : {i.Item0}, {i.Item1}, {i.Item2}"); } } }
internal static List <TrackDescription> GetSubTrackDescription(IntPtr moduleRef) { var result = new List <TrackDescription>(); if (moduleRef != IntPtr.Zero) { var module = MarshalHelper.PtrToStructure <TrackDescriptionStructure>(moduleRef); var name = Utf8InteropStringConverter.Utf8InteropToString(module.Name); result.Add(new TrackDescription(module.Id, name)); var data = GetSubTrackDescription(module.NextTrackDescription); result.AddRange(data); } return(result); }
private List <FilterModuleDescription> GetSubFilter(ModuleDescriptionStructure module) { var result = new List <FilterModuleDescription>(); var filterModule = FilterModuleDescription.GetFilterModuleDescription(module); if (filterModule == null) { return(result); } result.Add(filterModule); if (module.NextModule != IntPtr.Zero) { ModuleDescriptionStructure nextModule = MarshalHelper.PtrToStructure <ModuleDescriptionStructure>(module.NextModule); var data = GetSubFilter(nextModule); if (data.Count > 0) { result.AddRange(data); } } return(result); }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public T GetValue <T>() where T : struct { return(MarshalHelper.PtrToStructure <T>(Value)); }
private void OnMediaPlayerBufferingInternal(IntPtr ptr) { var args = MarshalHelper.PtrToStructure <VlcEventArg>(ptr); OnMediaPlayerBuffering(args.eventArgsUnion.MediaPlayerBuffering.NewCache); }
private void OnMediaMetaChangedInternal(IntPtr ptr) { var args = MarshalHelper.PtrToStructure <VlcEventArg>(ptr); OnMediaMetaChanged(args.eventArgsUnion.MediaMetaChanged.MetaType); }
private void OnMediaSubItemTreeAddedInternal(IntPtr ptr) { var args = MarshalHelper.PtrToStructure <VlcEventArg>(ptr); OnMediaSubItemTreeAdded(new VlcMedia(myVlcMediaPlayer, VlcMediaInstance.New(myVlcMediaPlayer.Manager, args.eventArgsUnion.MediaSubItemTreeAdded.MediaInstance))); }
private void OnMediaPlayerAudioDeviceInternal(IntPtr ptr) { var args = MarshalHelper.PtrToStructure <VlcEventArg>(ptr); OnMediaPlayerAudioDevice(Utf8InteropStringConverter.Utf8InteropToString(args.eventArgsUnion.MediaPlayerAudioDevice.pszDevice)); }
private void OnMediaDurationChangedInternal(IntPtr ptr) { var args = MarshalHelper.PtrToStructure <VlcEventArg>(ptr); OnMediaDurationChanged(args.eventArgsUnion.MediaDurationChanged.NewDuration); }
private void OnMediaPlayerMediaChangedInternal(IntPtr ptr) { var args = MarshalHelper.PtrToStructure <VlcEventArg>(ptr); OnMediaPlayerMediaChanged(new VlcMedia(this, VlcMediaInstance.New(Manager, args.eventArgsUnion.MediaPlayerMediaChanged.MediaInstance))); }
private void OnMediaPlayerVideoOutChangedInternal(IntPtr ptr) { var args = MarshalHelper.PtrToStructure <VlcEventArg>(ptr); OnMediaPlayerVideoOutChanged(args.eventArgsUnion.MediaPlayerVideoOutChanged.NewCount); }
private void OnMediaPlayerAudioVolumeInternal(IntPtr ptr) { var args = MarshalHelper.PtrToStructure <VlcEventArg>(ptr); OnMediaPlayerAudioVolume(args.eventArgsUnion.MediaPlayerAudioVolume.volume); }
private void OnMediaPlayerScrambledChangedInternal(IntPtr ptr) { var args = MarshalHelper.PtrToStructure <VlcEventArg>(ptr); OnMediaPlayerScrambledChanged(args.eventArgsUnion.MediaPlayerScrambledChanged.NewScrambled); }
private void OnMediaPlayerLengthChangedInternal(IntPtr ptr) { var args = MarshalHelper.PtrToStructure <VlcEventArg>(ptr); OnMediaPlayerLengthChanged(args.eventArgsUnion.MediaPlayerLengthChanged.NewLength * 10000); }