DJI Mobile SDK Documentation

      class DJICodecManager

      class DJICodecManager
      Package:dji.sdk.codec
      Description:

      Class that handles encoding and decoding of media.

      Class Members:
      Destroy Codec
      method
      method destroyCodec
      void destroyCodec()
      Package:dji.sdk.codec
      Description:

      Destroys the media codec.

      Create Codec
      method
      method DJICodecManager
      DJICodecManager(Context context, SurfaceTexture surfaceTexture,int width,int height)
      Package:dji.sdk.codec
      Description:

      Constructor for the class.

      Input Parameters:
      Context contextThe context.
      SurfaceTexture surfaceTextureThe surface texture view.
      int widthThe width of surface texture view.
      int heightThe height of surface texture view.
      Surface Holder
      method
      method DJICodecManager
      DJICodecManager(Context context, SurfaceHolder surfaceHolder, int width, int height)
      Package:dji.sdk.codec
      Description:

      Constructor for the class.

      Input Parameters:
      Context contextThe context.
      SurfaceHolder surfaceHolderThe surface view.
      int widthThe width of surface texture view.
      int heightThe height of surface texture view.
      Clean Surface
      method
      method cleanSurface
      void cleanSurface()
      Package:dji.sdk.codec
      Description:

      Cleans the surface from the codec manager.

      Send Data To Decoder
      method
      method sendDataToDecoder
      void sendDataToDecoder(byte[] videoBuffer, int size)
      Package:dji.sdk.codec
      Description:

      Sends H264 raw video data to the decoder.

      Input Parameters:
      byte[] videoBufferThe video buffer data.
      int sizeThe data size.
      method sendDataToDecoder
      void sendDataToDecoder(byte[] videoBuffer, int size,int source)
      Package:dji.sdk.codec
      Description:

      Sends H264 raw video data to the decoder with source id.

      Input Parameters:
      byte[] videoBufferThe video buffer data.
      int sizeThe data size.
      int sourcesource id.
      Get Video Width
      method
      method getVideoWidth
      Integer getVideoWidth()
      Package:dji.sdk.codec
      Description:

      Get the video width.

      Return:
      IntegerVideo width Integer value.
      Get Video Height
      method
      method getVideoHeight
      Integer getVideoHeight()
      Package:dji.sdk.codec
      Description:

      Get the video height.

      Return:
      IntegerVideo height Integer value.
      Enable Yuv Data
      method
      method enabledYuvData
      void enabledYuvData(Boolean enabled)
      Package:dji.sdk.codec
      Description:

      To enable the YUV data output to user which must set the surface as null to avoid native buffer.

      Input Parameters:
      Boolean enabledThe YUV data callback.
      Set Callback
      method
      method setYuvDataCallback
      void setYuvDataCallback(YuvDataCallback callback)
      Package:dji.sdk.codec
      Description:

      Sends YUV data from hardware decoder.

      Input Parameters:
      YuvDataCallback callbackThe YUV data callback.
      method getYuvDataCallback
      YuvDataCallback getYuvDataCallback()
      Package:dji.sdk.codec
      Description:

      Sends YUV data from hardware decoder.

      Return:
      YuvDataCallbackThe YUV data callback.
      State Updates
      interface
      interface YuvDataCallback
      interface YuvDataCallback
      Package:dji.sdk.codec
      Description:

      Interface for the YUV data callback.

      Interface Methods:

      Callback Method

      Yuv Data Received
      method
      method onYuvDataReceived
      void onYuvDataReceived(ByteBuffer yuvFrame, int dataSize, int width, int height)
      Package:dji.sdk.codec
      Description:

      Callback method for processing the yuv frame data from hardware decoder.

      Input Parameters:
      ByteBuffer yuvFrameYUV data buffer in the codec.
      int dataSizesize of the YUV data
      int widthwidth of the video
      int heightheight of the video