Video picture multi-screen display method and device
Through the traversal system display device, the global and channel initialization of the channel, and the creation of the separation surface resources and transmission video data on demand, solve the deficiencies of traditional display technology in multi -screen and cross -screen display, realize the smooth multi -screen display of the video screen Essence
Patent Information
- Application Number
- CN202411347117.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-21
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional display technology has shortcomings in multi-screen display and cross-screen display, and cannot effectively support the smooth playback and multi-screen splicing display of multi-channel videos.
By calling the DirectDRAWENMmeralrateEx interface traversal system display device, save the display device handle and Guid, carry out global initialization and channel initialization, and traverse each display device to determine the display area and image data changes. Create off screen surface resources and transmission video data on demand. Multi -screen and cross -screen video screen display.
Realize the smooth playback of videos in a variety of scenarios, support multi -screen and cross -screen display, and improve the display effect and concurrency.
Smart Images

Figure CN119342264A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of front-end client development, and specifically provides a method and device for multi-screen display of video images. Background Art
[0002] With the development of Internet information technology, more and more personal computers are equipped with two or more display devices. In some project scenarios, there are also scenarios where PCs are connected to multiple screens for splicing display.
[0003] In traditional display technologies, Driect3D and OpenGL methods are used to render 3D scenes, and there is not much advantage in simply displaying 2D scenes; the DirectShow framework is more suitable for the playback and display of a small number of videos such as video players.
[0004] The traditional DirectDraw display method does not support cross-screen display, and because there is no targeted optimization, the number of video channels that can be played and displayed simultaneously in the same environment is limited. At this time, a display solution with multiple display channels, smooth display effects, and support for multiple and cross-screen is very necessary. Summary of the invention
[0005] The present invention aims at the above-mentioned deficiencies of the prior art and provides a highly practical method for multi-screen display of video images.
[0006] A further technical task of the present invention is to provide a multi-screen display device for video images that is rationally designed, safe and applicable.
[0007] The technical solution adopted by the present invention to solve the technical problem is:
[0008] A method for displaying a video image on multiple screens comprises the following steps:
[0009] S1, global initialization phase;
[0010] Call DirectDrawEnumerateEx interface to traverse the system display devices, save the display device handle hMonitor and display device GUID gMonitorGUID of each display device to the display device array;
[0011] S2, channel initialization stage;
[0012] When a new video display is created, the channel initialization phase is performed;
[0013] S3, display stage;
[0014] Loop through each display device and display the part of the picture on this display device;
[0015] S4, channel release stage;
[0016] The channel release phase is performed when one video display is closed;
[0017] S5, global release phase;
[0018] When exiting the APP, a global release phase is performed to release non-empty global resources associated with each display device.
[0019] Further, in step S1, when the APP is initialized, the DirectDrawEnumerateEx interface is called to traverse the system display devices, and the display device handle hMonitor and the display device GUID gMonitorGUID of each display device are saved to the display device array;
[0020] Traverse the display device array and call the GetMonitorInfoA interface to obtain display device information through hMonitor;
[0021] Traverse the display device array and create DirectDraw global resources associated with each display device.
[0022] Further, in step S2, a channel context is created and the context field is initialized to a null value.
[0023] Furthermore, in step S3, when displaying a frame of video, each display device is looped through and the portion of the picture on the display device is displayed. The following operations are performed on each display device:
[0024] (1) Determine whether part of the screen display area showRect in the desktop coordinate system is within the display range of the device;
[0025] (2) Determine whether the off-screen surface lpDDSOffScreen that manages this device under this channel is empty or whether the width and height of rectSrc have changed;
[0026] (3) Set the clipping range of lpClipperPrimary and lpClipperBack to rectDest.
[0027] Furthermore, in step (1), it is determined whether part of the screen display area showRect in the desktop coordinate system is within the display range of the device. If not, skip the device.
[0028] If yes, calculate the area rectSrc occupied by the picture in the original video picture and the screen coordinates rectDest of the picture in the display area of this device.
[0029] Further, in step (2), it is determined whether the off-screen surface lpDDSOffScreen managing the device under the channel is empty or whether the width and height of rectSrc have changed. If so, lpDDSOffScreen is created or rebuilt;
[0030] If there is no change, skip this step;
[0031] Fill the image data of the rectSrc area of the original image into lpDDSOffScreen. At this time, the image data will be transferred from the memory to the video memory.
[0032] Furthermore, in step (3), the clipping range of lpClipperPrimary and lpClipperBack is set to rectDest, and the lpDDSOffScreen data is Blted to the rectDest area of lpDDSBack. At this time, image scaling and pixel format conversion operations are performed, and Blt is firstly performed to the backup surface.
[0033] Blt the rectDest area of lpDDSBack to the rectDest area of lpClipperPrimary;
[0034] At this time, the picture is displayed on this display device, completing the steps of displaying this video on this display device.
[0035] Furthermore, the method for determining the display area is as follows:
[0036] a. Determine whether the horizontal coordinates of showRect and monitorRect intersect;
[0037] b. Determine whether the ordinates of showRect and monitorRect intersect;
[0038] c. Determine whether the display area intersects with the screen area.
[0039] Furthermore, in step S4, when one channel of video display is turned off, the resources associated with the channel are released, including lpDDSOffScreen associated with each display device;
[0040] In step S5, when exiting the APP, the display device array is traversed to release the non-empty global resources associated with each display device.
[0041] A multi-screen display device for video images, comprising: at least one memory and at least one processor;
[0042] The at least one memory is used to store a machine-readable program;
[0043] The at least one processor is used to call the machine-readable program to execute a method for multi-screen display of video images.
[0044] Compared with the prior art, the video image multi-screen display method and device of the present invention have the following outstanding beneficial effects:
[0045] The present invention can achieve smooth video playback in various scenarios such as single-screen multi-channel high-definition playback, single-screen large-channel ordinary picture quality playback, multi-screen multi-channel high-definition playback, and multi-screen splicing playback. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Attached Figure 1 The invention is a flowchart of a method for displaying a video image on multiple screens. DETAILED DESCRIPTION
[0048] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] A best embodiment is given below:
[0050] like Figure 1 As shown, a method for displaying multiple video images on multiple screens in this embodiment comprises the following steps:
[0051] S1, global initialization phase;
[0052] In this stage, when the APP is initialized, the following operations are performed:
[0053] Call the DirectDrawEnumerateEx interface to traverse the system display devices and save the hMonitor (display device handle) and gMonitorGUID (display device GUID) of each display device to the display device array.
[0054] Traverse the display device array and call the GetMonitorInfoA interface to obtain the display device information through hMonitor, mainly including monitorRect (the range of the display device desktop coordinate system).
[0055] Traverse the display device array and create DirectDraw global resources associated with each display device, including lpDD (DirectDraw object), lpDDSPrimary (DirectDraw primary surface), lpDDSBack (DirectDraw backup surface), lpClipperPrimary (primary surface clipper), lpClipperBack (backup surface clipper), etc.
[0056] S2, channel initialization stage;
[0057] When creating a new video display, the following operations are performed:
[0058] Create a channel context and initialize the context fields to null values.
[0059] S3, display stage;
[0060] This is performed when displaying a frame of video. This stage loops through each display device and displays the part of the picture on this display device. The following operations are performed on each display device:
[0061] Determine whether part of showRect (the screen display area in the desktop coordinate system) is within the display range of this device. If not, skip this device. If yes, calculate rectSrc (the area occupied by the screen in the original video screen) and rectDest (the screen coordinates of the screen display area of this device).
[0062] Determine whether lpDDSOffScreen (the off-screen surface that manages this device under this channel) is empty or whether the width and height of rectSrc have changed. If so, create or rebuild lpDDSOffScreen; if not, skip this step.
[0063] Fill the image data of the rectSrc area of the original image into lpDDSOffScreen. At this time, the image data will be transferred from the memory to the video memory.
[0064] Set the clipping range of lpClipperPrimary and lpClipperBack to rectDest.
[0065] Blt the lpDDSOffScreen data to the rectDest area of lpDDSBack. At this time, image scaling and pixel format conversion will be performed, which takes a relatively long time. Therefore, Blt to the backup surface first to prevent display tearing.
[0066] Blt the rectDest area of lpDDSBack to the rectDest area of lpClipperPrimary.
[0067] At this time, the picture is displayed on this display device, completing the steps of displaying this video on this display device.
[0068] The display area determination method is as follows:
[0069] a. Determine whether the horizontal coordinates of showRect and monitorRect intersect;
[0070] bool xCross = showRect.left <monitorRect.right&&
[0071] monitorRect.left <showRect.right;
[0072] b. Determine whether the ordinates of showRect and monitorRect intersect;
[0073] bool yCross = showRect.top <monitorRect.bottom&&monitorRect.top<showRect.bottom;
[0074] c. Determine whether the display area intersects with the screen area;
[0075] bool cross=xCross&&yCross;
[0076] In the above display method, assuming that the width and height of the source video are imageWidth and imageHeight respectively, the calculation methods of rectSrc and rectDest are as follows:
[0077] (1) Calculate the desktop coordinate system range rectDestTemp corresponding to the area of rectDest;
[0078] rectDestTemp = showRect
[0079] rectDestTemp.left=max(rectDestTemp.left,monitorRect.left)
[0080] rectDestTemp.left = min(rectDestTemp.left, monitorRect.right)
[0081] rectDestTemp.right = max(rectDestTemp.right, monitorRect.left)
[0082] rectDestTemp.right = min(rectDestTemp.right, monitorRect.right)
[0083] rectDestTemp.top = max(rectDestTemp.top, monitorRect.top)
[0084] rectDestTemp.top = min(rectDestTemp.top, monitorRect.bottom)
[0085] rectDestTemp.bottom = max(rectDestTemp.bottom, monitorRect.top)
[0086] rectDestTemp.bottom = min(rectDestTemp.bottom, monitorRect.bottom)
[0087] (2) Calculate rectSrc
[0088] int showWidth = showRect.right - showRect.left
[0089] int showHeight = showRect.bottom - showRect.top
[0090] rectSrc.left = (rectDestTemp.left - showRect.left) * imageWidth / showWidth
[0091] rectSrc.right = (rectDestTemp.right - showRect.left) * imageWidth / showWidth
[0092] rectSrc.top=(rectDestTemp.top-showRect.top)*imageHeight / showHeight
[0093] rectSrc.bottom=(rectDestTemp.bottom-showRect.top)*imageHeight / showHeight
[0094] (3) Calculate rectDest
[0095] rectDest.left=rectDestTemp.left-monitorRect.left
[0096] rectDest.right=rectDestTemp.right-monitorRect.left
[0097] rectDest.top=rectDestTemp.top-monitorRect.top
[0098] rectDest.bottom=rectDestTemp.bottom-monitorRect.top
[0099] S4, channel release stage;
[0100] This stage is performed when one video display is turned off, and the following operations are performed:
[0101] Release the resources associated with this channel, mainly lpDDSOffScreen associated with each display device.
[0102] S5, global release phase;
[0103] Traverse the display device array and release the non-empty global resources associated with each display device, mainly lpDD, lpDDSPrimary, lpDDSBack, lpClipperPrimary, lpClipperBack, etc.
[0104] In the global initialization phase, all display devices are enumerated, and the associated handles of each display device and the rectangular coordinates of its display range in the desktop coordinate system are recorded, and an associated DirectDraw object instance is created for each display device.
[0105] During the display phase, loop through each display device to determine whether the display area intersects with the actual device area. Only when there is an intersection, create offline surface resources in the intersection area to achieve on-demand creation and reduce resource usage such as video memory; only transmit video data in the intersection area to the off-screen surface to achieve on-demand transmission and reduce resource usage such as bus bandwidth.
[0106] In short, this method precisely controls the creation and operation of DirectShow resources through the application layer, reduces the creation and data transmission of redundant resources under the default usage mode, and thus achieves the required display effect at the lowest cost, thereby ensuring the display effect and improving concurrency.
[0107] Based on the above method, a multi-screen display device for video images in this embodiment includes: at least one memory and at least one processor;
[0108] The at least one memory is used to store a machine-readable program;
[0109] The at least one processor is used to call the machine-readable program to execute a method for multi-screen display of video images.
[0110] The above-mentioned specific implementations are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above-mentioned specific implementations. Any technical solutions that comply with the claims of the present invention and any appropriate changes or substitutions made by ordinary technicians in the relevant technical field shall fall within the patent protection scope of the present invention.
[0111] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for displaying a video image on multiple screens, characterized in that: The steps are as follows: S1, global initialization phase; Call DirectDrawEnumerateEx interface to traverse the system display devices, save the display device handle hMonitor and display device GUID gMonitorGUID of each display device to the display device array; S2, channel initialization stage; When a new video display is created, the channel initialization phase is performed; S3, display stage; Loop through each display device and display the part of the picture on this display device; S4, channel release stage; The channel release phase is performed when one video display is closed; S5, global release phase; When exiting the APP, a global release phase is performed to release non-empty global resources associated with each display device.
2. A method for multi-screen display of video images according to claim 1, characterized in that: In step S1, when the APP is initialized, the DirectDrawEnumerateEx interface is called to traverse the system display devices, and the display device handle hMonitor and the display device GUID gMonitorGUID of each display device are saved to the display device array; Traverse the display device array and call the GetMonitorInfoA interface to obtain display device information through hMonitor; Traverse the display device array and create DirectDraw global resources associated with each display device.
3. A method for multi-screen display of video images according to claim 2, characterized in that: In step S2, a channel context is created and the context fields are initialized to null values.
4. According to claim 3, a method for displaying a video image on multiple screens is characterized in that: In step S3, when displaying a frame of video, each display device is looped through and the portion of the image on the display device is displayed. The following operations are performed on each display device: (1) Determine whether part of the screen display area showRect in the desktop coordinate system is within the display range of the device; (2) Determine whether the off-screen surface lpDDSOffScreen that manages this device under this channel is empty or whether the width and height of rectSrc have changed; (3) Set the clipping range of lpClipperPrimary and lpClipperBack to rectDest.
5. According to claim 4, a method for displaying a video image on multiple screens is characterized in that: In step (1), determine whether part of the screen display area showRect in the desktop coordinate system is within the display range of the device. If not, skip the device. If yes, calculate the area rectSrc occupied by the picture in the original video picture and the screen coordinates rectDest of the picture in the display area of this device.
6. A method for multi-screen display of video images according to claim 5, characterized in that: In step (2), determine whether the off-screen surface lpDDSOffScreen that manages this device under this channel is empty or whether the width and height of rectSrc have changed. If so, create or rebuild lpDDSOffScreen; If there is no change, skip this step; Fill the image data of the rectSrc area of the original image into lpDDSOffScreen. At this time, the image data will be transferred from the memory to the video memory.
7. A method for multi-screen display of video images according to claim 6, characterized in that: In step (3), set the clipping range of lpClipperPrimary and lpClipperBack to rectDest, and Blt the lpDDSOffScreen data to the rectDest area of lpDDSBack. At this time, image scaling and pixel format conversion operations will be performed, and Blt to the backup surface first; Blt the rectDest area of lpDDSBack to the rectDest area of lpClipperPrimary; At this time, the picture is displayed on this display device, completing the steps of displaying this video on this display device.
8. A method for multi-screen display of video images according to claim 7, characterized in that: The method for determining the display area is as follows: a. Determine whether the horizontal coordinates of showRect and monitorRect intersect; b. Determine whether the ordinates of showRect and monitorRect intersect; c. Determine whether the display area intersects with the screen area.
9. A method for multi-screen display of video images according to claim 7, characterized in that: In step S4, when one channel of video display is turned off, the resources associated with the channel are released, including lpDDSOffScreen associated with each display device; In step S5, when exiting the APP, the display device array is traversed to release the non-empty global resources associated with each display device.
10. A multi-screen video display device, characterized in that: include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Windowing controller based on large screen liquid crystal splicing display
CN102542933A
Multiple-screen multiple-video micro-view scheduling system and scheduling operation method
CN102938834A
Multi-projection autocorrection display system based on camera
CN103209311A
Multi-dimensional PIP (Picture in Picture) display method
CN107483913A
Method and system for controlling picture display of multi-channel video
CN114286115A