Storage

[English]

1. Function Overview

To facilitate the verification of the functions of taking photos and storing video streams on the card, a series of CLI commands have been designed, mainly including taking photos and storing H.264 video streams.

2. Code Path

Path: ap/components/multimedia/cli/media_cli.c

3. Introduction to CLI Commands

The supported commands are as follows:

  1. storage open
    • Function Description

      Used to test whether the card storage function can be opened normally.

    • Command Format

      storage open [param1]

    Param

    Value

    param1

    Whether to use the callback function. If the callback function is used, the image will be notified via the callback and will not be saved to the SD card.

    • Test Case

      Test opening the image storage function: storage open

  2. storage close
    • Function Description

      Used to test the function of closing the image storage.

    • Command Format

      storage close

    • No parameters

    • Test Case

      Close the card storage function: storage close

  3. storage capture
    • Function Description

      Used to test whether the photo - taking function works normally.

    • Command Format

      storage capture [param1] [param2]

    Param

    Value

    param1

    Picture name, optional parameter

    param2

    Image format, optional parameter, output image format (h264/h265), default is mjpeg

    • Test Case

      Test taking a JPEG image and naming it test.jpg: storage capture test.jpg

  4. storage stream_open
    • Function Description

      Used to test the function of storing H.264 streams.

    • Command Format

      storage stream_open [param1] [param2]

    Param

    Value

    param1

    Picture name, optional parameter

    param2

    Image format, optional parameter, output image format (h264/h265), default is mjpeg

    • Test Case

      Start storing the H.264 video stream and name it test.h264: storage stream_open test.h264 h264

  5. storage stream_close
    • Function Description

      Used to test the function of closing the stream storage.

    • Command Format

      storage stream_close

    • No parameters

    • Test Case

      Close the continuous stream storage: storage stream_close

Note

Before using the card storage function, ensure that the current system has the streams you need to store. If you are storing a JPEG image but there is no JPEG stream in the system, the card storage will fail. Additionally, the system currently supports returning the read images to the user via a callback. In this case, the user can perform their own operations on the images, but note that the callback function must not be blocked; otherwise, the system will freeze.

When calling these interfaces, you first need to enable the card storage function, and then call the photo - taking function or the continuous video stream storage function. For the continuous video stream storage function, you need to call the corresponding closing interface. Finally, when you no longer use the card storage function, call the interface to close the entire card storage function. To enable this part of the functionality, you need to enable the macro: CONFIG_IMAGE_STORAGE.