13 Encapsulation of media storage 1

overview

        IPCs generally have local storage requirements. After inserting a TF card or SD card, the video files will be stored in the card. There are generally two ways of video storage: file storage and streaming storage.

        File storage has the following three problems: First, the last video file may be lost or unusable due to abnormal power failure; second, video files are generally in mp4 format, and mp4 files have certain limitations, such as: only AAC encoding format is supported , does not support ADPCM, G711A and other encoding formats; third, it is inconvenient to obtain the continuous time period of the video file (for the client to display the time axis).

        Streaming storage has the following four problems: First, it needs to cache all media data for several seconds at once, which consumes a lot of memory; second, it needs to ensure the synchronization of all media data. Once it is not synchronized, the data will be discontinuous; third, Because the video is strongly related to time, it is not easy to delete or expand (such as: support for faces, mark the importance of video, or new requirements), modifying the time may cause loss of video (when modifying the time forward, or will When the time is modified later) or discontinuously; Fourth, the disk adopts a private format, and files cannot be saved on the disk (for example: it is not easy to support TF card/SD card upgrade firmware).

        Based on the above two reasons, a new media data storage mechanism is designed. TF card/SD card adopts FAT32 or EXT4 file system, which is used to avoid some disadvantages of streaming storage. At the same time, a specific directory structure is adopted, and video files are stored using bare streams (encrypted streams are optional), without the concept of containers such as mp4, avi, etc., to avoid some disadvantages of file storage.

Media Storage Interface Class

        The media storage interface class needs to export the following interfaces:

        1. Initialization interface, used to pass in initialization parameters.

Guess you like

Origin blog.csdn.net/hope_wisdom/article/details/130859213