PUPANVR-Record main business objects (5)

        In the product, according to the habit of NVR camera configuration, there is the concept of channel. When configuring recording, the connected camera is defined as an accessed channel, and the camera is bound to a channel, so it is abstracted into a channel. The object (TVideoChannel), at the same time, the connected device may be a camera, or it may be just a video stream, or a channel for video playback, in which case the source is a video file. So here we abstract a TVideoSource object, and use polymorphism to implement video sources: camera source, MP4 source, etc. For channels in the system, if configured, they will generally be in an open operation state, and the life cycle will generally be maintained. For example, in video recording operations, there is a concept of a decoder at the hardware or software level for video playback preview. We define the object concept of a player. Players are not necessarily bound to the same channel or turned on for a long time. Generally, the codec performance of hardware is limited, so the player object must consider multi-channel multiplexing or It is dynamically bound and created in real time. At the same time, its life cycle is generally not like that of a channel that runs all the time as long as it is configured. The player object is also an isolated abstraction of the software and hardware decoders.

Based on the above idea, the following objects need to appear in the system:

Video Channel -TVideoChannel

It is mainly used to operate the video, which is called the video channel. In fact, the pictures in the product should also be displayed using this decoding.

Video Source -TVideoSource

The source can be a video, a camera device, an MP4 file, etc.;

Player -TPlayView

Realize the playback of channel video objects and realize decoding, display, and control functions. The player object is also an isolated abstraction of the software and hardware decoders;

Based on the above objects, for NVR, we implement a unified management class: TRecordManage, which manages the life cycle of the channel. Each channel then aggregates and binds its own video source and binds its own playback device.

The relationship is as follows:

 

Of course, there are many small object pairs above that are used by these large objects, such as cache management, video file decoding, packetization, network stream objects, and display of different modes during preview. We need to implement a video The display splitter manages the display of TPlayView, etc. Later, we will slowly decompose the abstract real image!

Guess you like

Origin blog.csdn.net/jhting/article/details/121756358