DJI Mobile SDK Documentation

      class DJICodecManager

      class DJICodecManager implements RecvDataCallback
      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.

      Switch Source
      method
      method switchSource
      void switchSource(VideoSource source)
      Package:dji.sdk.codec
      Description:

      Switches the video source of the decoder.

      Input Parameters:
      VideoSource sourceThe new video source.
      Decoder Status
      method
      method isDecoderOK
      boolean isDecoderOK()
      Package:dji.sdk.codec
      Description:

      Determines whether the decoding status is normal.

      Return:
      booleantrue if the decoding status is normal, false otherwise.
      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, VideoSource source)
      Package:dji.sdk.codec
      Description:

      Sends H264 raw video data to the decoder.

      Input Parameters:
      byte[] videoBufferThe video buffer data.
      int sizeThe data size.
      VideoSource sourceThe source of the data.
      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.
      Surface Size Changed
      method
      method onSurfaceSizeChanged
      void onSurfaceSizeChanged(int width, int height,int degree)
      Package:dji.sdk.codec
      Description:

      Resizes the surface when the size of the surface texture view has changed.

      Input Parameters:
      int widthThe new width of the surface
      int heightThe new height of the surface
      int degreeThe new degree of the surface
      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.
      Peak Focus Threshold
      method
      method setPeakFocusThresholdEnabled
      void setPeakFocusThresholdEnabled(boolean isEnabled)
      Package:dji.sdk.codec
      Description:

      Enable Peak Focus Threshold.

      Input Parameters:
      boolean isEnabledEnable/disable focus threshold.
      method setPeakFocusThreshold
      void setPeakFocusThreshold(float peakFocusThresholdValue)
      Package:dji.sdk.codec
      Description:

      Set the peak focus threshold value.

      Input Parameters:
      float peakFocusThresholdValueA float value representing peak focus threshold.
      Over Exposure Warning
      method
      method setOverexposureWarningEnabled
      void setOverexposureWarningEnabled(boolean isEnabled)
      Package:dji.sdk.codec
      Description:

      Enable or disable the over exposure warning.

      Input Parameters:
      boolean isEnabledEnable/Disable the over exposure warning.
      Codec Name
      method
      method setCodecName
      void setCodecName(final String codecName)
      Package:dji.sdk.codec
      Description:

      Set the codec name. For some mobile phones that cannot display video stream normally. You can set the codec name through this interface so that MSDK can call the correct decoder for decoding and display. You can call android API:MediaCodecList to get available codec names for testing.

      Input Parameters:
      final String codecName
      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.
      Get YUV Data
      method
      method getYuvData
      byte[] getYuvData(int width, int height)
      Package:dji.sdk.codec
      Description:

      Gets YUV data from hardware decoder. The obtained data of format is MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar and the width and height must be even.

      Input Parameters:
      int widthwidth of the video.
      int heightheight of the video.
      Return:
      byte[]The YUV data from the hardware decoder.
      Get Rgba Data
      method
      method getRgbaData
      byte[] getRgbaData(int width, int height)
      Package:dji.sdk.codec
      Description:

      Gets RGBA data from hardware decoder.

      Input Parameters:
      int widthwidth of the video.
      int heightheight of the video.
      Return:
      byte[]The RGBA data from the hardware decoder.
      State Updates
      class
      enum VideoSource
      enum VideoSource
      Package:dji.sdk.codec
      Description:

      The source of the video feed.

      Enum Members:
      CAMERAThe source of the video feed is the main camera.
      FPVThe source of the video feed is the FPV camera.
      SECONDARY_CAMERAThe source of the video feed is the secondary camera.
      UNKNOWNThe source of the video feed is unknown.
      Class Members: