# GlStreamInterface

@RequiresApi(api = 18)
class GlStreamInterface(context: Context) : SurfaceTexture.OnFrameAvailableListener, GlInterface

Created by pedro on 14/3/22.

## Constructors

GlStreamInterface
Link copied to clipboard
constructor(context: Context)

## Properties

autoHandleOrientation
Link copied to clipboard
var autoHandleOrientation: Boolean
encoderSize
Link copied to clipboard
open override val encoderSize: Point
isRunning
Link copied to clipboard
open override val isRunning: Boolean
isVideoMuted
Link copied to clipboard
open override val isVideoMuted: Boolean
surface
Link copied to clipboard
open override val surface: Surface
surfaceTexture
Link copied to clipboard
open override val surfaceTexture: SurfaceTexture

## Functions

addFilter
Link copied to clipboard
open override fun addFilter(baseFilterRender: BaseFilterRender)

Appends the specified filter to the end. You can modify filter's parameters after set it to stream.

open override fun addFilter(filterPosition: Int, baseFilterRender: BaseFilterRender)

Inserts the specified filter at the specified position. You can modify filter's parameters after set it to stream.

addMediaCodecRecordSurface
Link copied to clipboard
open override fun addMediaCodecRecordSurface(surface: Surface)
addMediaCodecSurface
Link copied to clipboard
open override fun addMediaCodecSurface(surface: Surface)

Set surface from MediaCodec class to Opengl. This surface is used to copy pixels from Opengl surface to this surface and encode this pixels.

addMultiPreviewSurface
Link copied to clipboard
fun addMultiPreviewSurface(surface: Surface, config: MultiPreviewConfig)

Add a multi-preview surface

attachPreview
Link copied to clipboard
fun attachPreview(surface: Surface)
clearFilters
Link copied to clipboard
open override fun clearFilters()

Remove all filters

deAttachPreview
Link copied to clipboard
fun deAttachPreview()
filtersCount
Link copied to clipboard
open override fun filtersCount(): Int
forceFpsLimit
Link copied to clipboard
open override fun forceFpsLimit(fps: Int)

Force stream to work with fps selected in prepareVideo method. Must be called before prepareVideo. This is not recommend because could produce fps problems.

forceOrientation
Link copied to clipboard
fun forceOrientation(forced: OrientationForced)
getEncoderSize
Link copied to clipboard
open override fun getEncoderSize(): Point
getMultiPreviewSurfaceCount
Link copied to clipboard
fun getMultiPreviewSurfaceCount(): Int
getSurface
Link copied to clipboard
open override fun getSurface(): Surface

Get Surface generated by Opengl. This should be called after start render.

getSurfaceTexture
Link copied to clipboard
open override fun getSurfaceTexture(): SurfaceTexture

Get SurfaceTexture generated by Opengl. This should be called after start render.

hasMultiPreviewSurface
Link copied to clipboard
fun hasMultiPreviewSurface(surface: Surface): Boolean
isRunning
Link copied to clipboard
open override fun isRunning(): Boolean
isVideoMuted
Link copied to clipboard
open override fun isVideoMuted(): Boolean
muteVideo
Link copied to clipboard
open override fun muteVideo()

This produce send black image all time. This affect to stream and record result.

onFrameAvailable
Link copied to clipboard
open override fun onFrameAvailable(surfaceTexture: SurfaceTexture?)
removeAllMultiPreviewSurfaces
Link copied to clipboard
fun removeAllMultiPreviewSurfaces()
removeFilter
Link copied to clipboard
open override fun removeFilter(baseFilterRender: BaseFilterRender)

Removes the first occurrence of the specified element from this list, if it is present.

open override fun removeFilter(filterPosition: Int)

Remove the filter at the specified position.

removeMediaCodecRecordSurface
Link copied to clipboard
open override fun removeMediaCodecRecordSurface()
removeMediaCodecSurface
Link copied to clipboard
open override fun removeMediaCodecSurface()

Remove surface generated from MediaCodec.

removeMultiPreviewSurface
Link copied to clipboard
fun removeMultiPreviewSurface(surface: Surface)
setAspectRatioMode
Link copied to clipboard
fun setAspectRatioMode(aspectRatioMode: AspectRatioMode)
setCameraOrientation
Link copied to clipboard
fun setCameraOrientation(orientation: Int)
setEncoderRecordSize
Link copied to clipboard
open override fun setEncoderRecordSize(width: Int, height: Int)
setEncoderSize
Link copied to clipboard
open override fun setEncoderSize(width: Int, height: Int)

Set video encoder size use to Opengl

setFilter
Link copied to clipboard
open override fun setFilter(baseFilterRender: BaseFilterRender)

Replace the filter in position 0 or add the filter if list is empty. You can modify filter's parameters after set it to stream.

open override fun setFilter(filterPosition: Int, baseFilterRender: BaseFilterRender)

Replaces the filter at the specified position with the specified filter. You can modify filter's parameters after set it to stream.

setForceRender
Link copied to clipboard
open override fun setForceRender(enabled: Boolean)
open override fun setForceRender(enabled: Boolean, fps: Int)
setIsPortrait
Link copied to clipboard
fun setIsPortrait(isPortrait: Boolean)
setIsPreviewHorizontalFlip
Link copied to clipboard
open override fun setIsPreviewHorizontalFlip(flip: Boolean)

When true, flips only the preview horizontally

setIsPreviewVerticalFlip
Link copied to clipboard
open override fun setIsPreviewVerticalFlip(flip: Boolean)

When true, flips only the preview vertically

setIsStreamHorizontalFlip
Link copied to clipboard
open override fun setIsStreamHorizontalFlip(flip: Boolean)

When true, flips only the stream horizontally

setIsStreamVerticalFlip
Link copied to clipboard
open override fun setIsStreamVerticalFlip(flip: Boolean)

When true, flips only the stream vertically

setOrientationConfig
Link copied to clipboard
fun setOrientationConfig(orientationConfig: OrientationConfig)
setPreviewIsPortrait
Link copied to clipboard
fun setPreviewIsPortrait(isPortrait: Boolean)
setPreviewResolution
Link copied to clipboard
fun setPreviewResolution(width: Int, height: Int)
setPreviewRotation
Link copied to clipboard
fun setPreviewRotation(orientation: Int)
setPreviewViewPort
Link copied to clipboard
fun setPreviewViewPort(viewPort: ViewPort?)
setRenderErrorCallback
Link copied to clipboard
open override fun setRenderErrorCallback(callback: RenderErrorCallback?)
setRotation
Link copied to clipboard
open override fun setRotation(rotation: Int)
setStreamIsPortrait
Link copied to clipboard
fun setStreamIsPortrait(isPortrait: Boolean)
setStreamRotation
Link copied to clipboard
open override fun setStreamRotation(orientation: Int)
setStreamViewPort
Link copied to clipboard
fun setStreamViewPort(viewPort: ViewPort?)
start
Link copied to clipboard
open override fun start()

INTERNAL METHOD. Start Opengl rendering.

stop
Link copied to clipboard
open override fun stop()

INTERNAL METHOD. Stop Opengl rendering.

takePhoto
Link copied to clipboard
open override fun takePhoto(takePhotoCallback: TakePhotoCallback?)

Capture an Image from Opengl.

unMuteVideo
Link copied to clipboard
open override fun unMuteVideo()
updateMultiPreviewConfig
Link copied to clipboard
fun updateMultiPreviewConfig(surface: Surface, config: MultiPreviewConfig): Boolean