Red5Pro Android Client SDK

 10.0.0
Core SDK for Android
com.red5pro.streaming.source.R5Camera Class Reference

Inherits com.red5pro.streaming.source.R5VideoSource, and Camera.PreviewCallback.

Public Member Functions

 R5Camera (Camera camera, int preferedWidth, int preferedHeight)
 
int ALIGN (int number, int size)
 
void onPreviewFrame (byte[] data, Camera camera)
 
void setPreviewDisplay (SurfaceHolder holder)
 
void startEncoding ()
 
void stopEncoding ()
 
Camera getCamera ()
 
void setCamera (Camera camera)
 
- Public Member Functions inherited from com.red5pro.streaming.source.R5VideoSource
void close ()
 
boolean isMuted ()
 
void setMuted (boolean isMuted)
 
void setOrientation (int rotation)
 
void InitSubSource (int localBitrate)
 
synchronized void encode (byte[] input, long time, boolean reset)
 
boolean drain ()
 
long getLastEncodeTime ()
 
void RequestKeyFrame ()
 
void setFrameType (int frameType)
 
void prepareFrame (byte[] input, byte[] output)
 
int getFrameSize ()
 
IDataSink getClient ()
 
void setClient (IDataSink client)
 
void setSDPTrack (SDPTrack track)
 
SDPTrack getSDPTrack ()
 
String getName ()
 
int getFramerate ()
 
void setFramerate (int framerate)
 
int getKeyFramerate ()
 
void setKeyFramerate (int keyFramerate)
 
int getBitrate ()
 
void setBitrate (int bitrate)
 
int getWidth ()
 
int getHeight ()
 
float getDisplayAspect ()
 
int getOrientation ()
 
void setWidth (int width)
 
void setHeight (int height)
 
void setFrameListener (R5FrameListener listener)
 
abstract void setPreviewDisplay (SurfaceHolder holder)
 
abstract void startEncoding ()
 
abstract void stopEncoding ()
 

Static Public Member Functions

static Camera.Size getBestPreviewSize (final int width, final int height, Camera.Parameters parameters)
 
- Static Public Member Functions inherited from com.red5pro.streaming.source.R5VideoSource
static byte[] YV12toYUV420Planar (byte[] input, byte[] output, int width, int height)
 
static byte[] SwapYV12toI420 (byte[] input, byte[] output, int width, int height)
 
static byte[] YV12ToSemiPlanar (byte[] input, byte[] output, int width, int height)
 
static byte[] YV12toNV21 (final byte[] input, final byte[] output, final int width, final int height)
 
static byte[] YV12toYUV420PackedSemiPlanar (final byte[] input, final byte[] output, final int width, final int height)
 

Protected Member Functions

void initSource ()
 

Additional Inherited Members

- Protected Attributes inherited from com.red5pro.streaming.source.R5VideoSource
boolean customFrameHandled = false
 

Detailed Description

R5Camera / R5VideoSource class hierarchy demonstrates how Red5 Professional enables rapid streaming development.
. The baseclass handles the preparation of the hardware encoder, and the subclass provides the source images used for streaming.
Extenders of Red5VideoSource must provide YV12 image data in byte buffers. You can also override the size used in the 'open' method.


initSource(){
setFrameType(ImageFormat.YV12);
width=320;
height=240;
}



At runtime, acquire the YV12 image data, and convert it to the required MediaCodec frame type.
prepareFrame(inptYV12, output);

To send a frame, encode it.
encode(output, nanoTime, false);//if the frame size changes, reset must be true.

Author
Andy Shaules

Constructor & Destructor Documentation

◆ R5Camera()

com.red5pro.streaming.source.R5Camera.R5Camera ( Camera  camera,
int  preferedWidth,
int  preferedHeight 
)
inline

Initiate a camera with a desired resolution. It will try to pick a resolution as close as it can.
It is preferable to iterate the supported preview resolutions and choose one brfore hand.

Parameters
camera
preferedWidth
preferedHeight

Member Function Documentation

◆ onPreviewFrame()

void com.red5pro.streaming.source.R5Camera.onPreviewFrame ( byte[]  data,
Camera  camera 
)
inline

Override of camera preview to render

Parameters
dataFrame data
cameraCamera being rendered

◆ setCamera()

void com.red5pro.streaming.source.R5Camera.setCamera ( Camera  camera)
inline

Set the camera to encode. camera.startPreview();
r5camera.setCamera(camera);

Parameters
camera

◆ setPreviewDisplay()

void com.red5pro.streaming.source.R5Camera.setPreviewDisplay ( SurfaceHolder  holder)
inline

◆ startEncoding()

void com.red5pro.streaming.source.R5Camera.startEncoding ( )
inline

◆ stopEncoding()

void com.red5pro.streaming.source.R5Camera.stopEncoding ( )
inline

The documentation for this class was generated from the following file: