Advertisement
Guest User

Untitled

a guest
May 14th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.82 KB | None | 0 0
  1. package ru.simlabs.stream.unreal
  2.  
  3. import android.view.Surface
  4. import ru.simlabs.stream.StreamDecoder
  5.  
  6. class AndroidMediaTextureUpdater() : ()->StreamDecoder {
  7.     private val bitmapRenderer: BitmapRenderer = BitmapRenderer(false)
  8.     private var textureID: Int = -1
  9.     private var width: Int = 0
  10.     private var height: Int = 0
  11.  
  12.     public fun setTexture(textureID: Int, width: Int, height: Int) {
  13.         this.textureID = textureID
  14.         this.height = height
  15.         this.width = width
  16.         bitmapRenderer.setSize(width, height)
  17.     }
  18.  
  19.     public override fun invoke(): StreamDecoder {
  20.         return StreamDecoder(false, bitmapRenderer.surface, width, height)
  21.     }
  22.  
  23.     public fun updateTexture() {
  24.         if (textureID != -1) {
  25.             bitmapRenderer.updateFrameData(textureID)
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement