https://code.videolan.org/videolan/vlc-unity
И Получить Текстуру От Него ! В Самом Коде Всё Устаревшее И Я Переделал По Ихним Переделкам ! Я Получаю Вот Эти Данные Из Payer - a :
Синтаксис:
Используется csharp
this.MediaPlayer.SetVideoFormatCallbacks(this.VideoFormat, this.CleanupVideo);
this.MediaPlayer.SetVideoCallbacks(LockVideo, null, DisplayVideo, IntPtr.Zero);
По Примеру Здесь :
https://github.com/ZeBobo5/Vlc.DotNet/blob/fb42e9a59950fcc27738d0f36477812727ee2152/src/Vlc.DotNet.Wpf/VlcVideoSourceProvider.cs#L111
И В Итоге Получаю IntPtr Из Которого Должен Получить Картинку ! Я Делаю Это Следующим Образом :
Синтаксис:
Используется csharp
Texture2D tex = Texture2D.CreateExternalTexture((int)width, (int)height, TextureFormat.ARGB32, false, true, chroma);
GetComponent<Renderer>().material.mainTexture = tex;
GetComponent<Renderer>().material.mainTexture = tex;
И Также Я Нашёл Библиотеку Тоже Получившая Из IntPtr Текстуру :
Синтаксис:
Используется csharp
// We'll also pass native pointer to a texture in Unity.
// The plugin will fill texture data from native code.
#if (UNITY_IOS || UNITY_TVOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport ("__Internal")]
#else
[DllImport("RenderingPlugin")]
#endif
private static extern void SetTextureFromUnity(System.IntPtr texture, int w, int h);
Texture2D tex = new Texture2D(256,256,TextureFormat.ARGB32,false);
// Set point filtering just so we can see the pixels clearly
tex.filterMode = FilterMode.Point;
// Call Apply() so it's actually uploaded to the GPU
tex.Apply();
// Set texture onto our material
GetComponent<Renderer>().material.mainTexture = tex;
// Pass texture pointer to the plugin
SetTextureFromUnity (tex.GetNativeTexturePtr(), tex.width, tex.height);
И В Обеих Случаях У Меня Падает Unity 3d ! Я Смотрел Log Там Говорилось О Агрессивной Обращение К WebSocket - у ! Я Ещё Пытался Получить Хоть Что - то Вот Так :
Синтаксис:
Используется csharp
var i = System.Windows.Interop.Imaging.CreateBitmapSourceFromMemorySection(chroma, 1, 2, System.Windows.Media.PixelFormats.Bgra32, 1, 0);
Но Странным Образом Образом Ведёт Себя Namespace ! В Visal Studio Не Пищит Проблемы С Namespace - ам А В Unity 3d Пишет ! И Перезагружал ! И Ещё Не Могу Сконвертировать BitMapSource В Texture ! Этот Вариант Не Подходит :
https://gamedev.stackexchange.com/quest ... -texture2d
Ребята Как Можно Получить Текстуру С Помощью IntPtr ?