Video playing method and device for realizing same-screen multi-display and double-screen different displayTechnical Field
The invention relates to the technical field related to video playing, in particular to a video playing method and device for realizing same-screen multi-display and double-screen different display.
Background
With the change of information technology, the updating of information equipment gradually changes from indoor to outdoor, and public screen equipment is more and more common in domestic large and medium-sized cities. The elevator screen is visible everywhere, and public screens of all large streets, core blocks and squares are more and more. The public screen has gradually replaced the original poster propaganda, becomes a new means of information propaganda and advertisement propaganda, and the information propaganda is easy to manage and convenient to update by using the public screen. The medium with the richest information carrying quantity, such as video, can be used for achieving better information promotion effect.
At present, new public screens on the market are all Android operating systems based on Google, and the public screen devices are generally strip-shaped devices, and the appearance of the public screen devices is similar to that of vertical screens of mobile phones. Meanwhile, the public screen is generally provided with an auxiliary screen and comprises two screens of a main screen and the auxiliary screen. The screen content display mainly comprises a main screen for displaying videos and an auxiliary screen for displaying characters or static pictures. The Android operating system version 4.2.2 later provides a Presentation interface to perform multi-screen operation, most of the current network videos are 16:9 and 4:3, the width is larger than the height, the public screen is a vertical screen, and most of the current network videos are 9:16, the width is smaller than the height, so that the traditional videos are displayed on the public screen and have black edges or are displayed in a cut mode. The vertical screen video for the public screen must be specially re-created for perfect matching. This may increase the cost of video advertisement placement or may not be effective in display.
Disclosure of Invention
The invention provides a video playing method and a video playing device for realizing same-screen multi-display and double-screen different display by utilizing public screen resources to the maximum extent in order to overcome the defects in the prior art.
In order to achieve the purpose, the invention adopts the following technical scheme:
a video playing device for realizing the same-screen multi-display and double-screen different display comprises a playing control module, a player module, a screen and window management module and a mirror image same-display module; the playing control module is mainly responsible for playing control of the whole public screen and managing playing addresses; the player module is mainly responsible for receiving, analyzing, decoding and synchronizing video data; the screen and window management module is responsible for the management of the main screen window and the management of the main screen and the auxiliary screen; the mirror image simultaneous display module is responsible for displaying video image data on demand under the condition of mirror image simultaneous display requirement; the playing control module is connected with the screen and window management module, and the screen and window management module is respectively connected with the player module and the mirror image co-display module.
Preferably, a plurality of player instances are arranged in the player module, and the player module is responsible for the creation, use and management of the player instances; each video source corresponds to a player instance for playing video, and the player instances are all created, used and managed by the player module.
The invention also provides a video playing method for realizing the same-screen multi-display and double-screen different display, which specifically comprises the following steps:
(1) when the program is started, the playing control module is started first, and the playing configuration information is analyzed first after the playing control module is started;
(2) according to the playing configuration information, if only one playing address is available and the width of the playing source is larger than the width of the playing source, the main screen multi-window playing mode is used, and the secondary screen can select the mirror image to be displayed simultaneously and the secondary screen not to be displayed;
(3) according to the playing configuration information, if only one playing address is provided and the height of the playing source is larger than the width, the main screen performs single-window full-screen display, and the auxiliary screen can select mirror image simultaneous display and auxiliary screen non-display;
(4) according to the playing configuration information, if there are two playing addresses, there are two options: one is that the main and auxiliary screens respectively play an address, and a single window of the auxiliary screen is displayed in full screen; one is that the main screen plays two addresses in multiple windows, and the mirror image of the auxiliary screen displays one of the addresses or the auxiliary screen does not display the other address;
(5) according to the playing configuration information, if the playing address exceeds more than two, two options are available: one is that the main screen and the auxiliary screen respectively play, the auxiliary screen plays an address, a single window of the auxiliary screen displays in full screen, the main screen plays other addresses in multiple windows, each address corresponds to one window, and the layout of the windows can be configured; one is that the main screen multi-window plays all addresses, each address corresponds to a window, the window layout is configurable, and the secondary screen mirror image is displayed on one of the main screen multi-window or the secondary screen is not displayed;
(6) and calling the screen and window management module according to the configuration information, and after the screen and window management module is started, associating the player module and the mirror image display module according to the display mode required by the playing configuration information so as to distribute the display of the main screen display window and the auxiliary screen display.
Wherein: when the mirror images of the auxiliary screen are displayed simultaneously, the auxiliary screen can only display one window on the main screen. The invention can realize the multi-window video source with the horizontal screen effect on the public screen main screen in the vertical screen mode, and simultaneously can realize the video display of the main screen and the auxiliary screen, thereby realizing the double-screen simultaneous display and the double-screen separate display. Namely: the invention can fully utilize the characteristics of the public screen equipment, realize the configurable video playing and displaying of the main screen and the auxiliary screen of the public screen, and can realize the conventional single-window video playing, the multi-window simultaneous display and the multi-window different display of the main screen and the mirror image simultaneous display and different display of the auxiliary screen according to the relation between the data source resolution and the public screen equipment resolution, thereby greatly enriching the public screen advertisement and other video information releasing modes, greatly improving the equipment utilization rate and further enhancing the releasing effect of the advertisement and other video information on the public screen.
Preferably, in the step (4), under the condition that the main screen and the auxiliary screen respectively play an address, the main screen can be configured with multi-window mirror images to display simultaneously; at this time, if the playing source width of the main screen is larger than the high width, the main screen multi-window playing mode is used; and if the playing source height of the main screen is larger than the width, the main screen performs single-window full-screen display, and the auxiliary screen performs single-window full-screen display.
Preferably, the number of the multiple windows of the main screen and the size of the windows are determined by the width and height of the playing source and the width and height of the main screen, the width and height of the main screen are specified to be screen width and screen height, the width and height of the data source are specified to be video width and video height, and then the method for calculating the number of the windows of the main screen, the width and height of the windows, and the width and height of the windows and the window distance, is as follows:
windWidth=screenWidth;
windHeight=screenWidth*videoHieght/videoWidth;
windNumb=screenHeight/windHeight;
windOffset=(screenHeight–windHeight*windNumb)/(windNumb-1);
wherein: the window number of the main screen, window width, width height of the window, and window interval, window offset, are integers and cannot be negative, and the window interval, window offset, may be 0.
Preferably, in step (6), the method of allocating the main screen display window and the sub screen display window is as follows:
(61) when the secondary screen needs to independently display a video source, the screen and window management module creates a canvas, associates the canvas with the secondary screen and the player instance of the current video source, directly renders data to the canvas by the player instance after association, and displays the canvas on the secondary screen;
(62) when the secondary screen needs to mirror and display the data of the primary screen, firstly, the screen and window management module creates a canvas for the primary screen window which displays the mirror image of the secondary screen and associates the canvas with the mirror image display module and the player instance, then the screen and window management module creates a canvas for the secondary screen and associates the canvas with the mirror image display module, and the mirror image display module is responsible for rendering the data mirror image to the canvas of the secondary screen;
(63) when a main screen needs to perform multi-window mirror image simultaneous display, firstly, a screen and window management module creates a canvas for the main screen, associates the canvas with a mirror image simultaneous display module and a player instance, sets coordinate information of a plurality of windows to the mirror image simultaneous display module, and after the mirror image simultaneous display module receives player instance decoding data, the mirror image simultaneous display module performs multi-window logical division on the canvas according to the coordinate information of the plurality of windows and renders the same frame data to all mirror image simultaneous display logical windows respectively;
(64) when the main screen needs to perform multi-window different display, firstly, the screen and window management module creates a canvas for each window independently, and then the canvas is associated with the player instances of each playing source in a one-to-one correspondence manner, so that each window has an independent player instance for playing.
The invention has the beneficial effects that: according to the relation between the data source resolution and the public screen equipment resolution, conventional single-window video playing can be achieved, main screen multi-window simultaneous display and multi-window different display can also be achieved, and mirror images of the auxiliary screen can be displayed simultaneously and differently, so that the public screen advertisement and other video information releasing modes are greatly enriched, the equipment utilization rate is greatly improved, and the advertisement and other video information releasing effects on the public screen are further enhanced.
Drawings
FIG. 1 is a logic diagram of the dual screen display of the present invention;
FIG. 2 is a logic diagram of the dual screen co-display of the present invention.
Detailed Description
The invention is further described with reference to the following figures and detailed description.
A video playing device for realizing the same-screen multi-display and double-screen different display comprises a playing control module, a player module, a screen and window management module and a mirror image same-display module; the playing control module is mainly responsible for playing control of the whole public screen and managing playing addresses; the player module is mainly responsible for receiving, analyzing, decoding and synchronizing video data; the screen and window management module is responsible for the management of the main screen window and the management of the main screen and the auxiliary screen; the mirror image simultaneous display module is responsible for displaying video image data on demand under the condition of mirror image simultaneous display requirement; the playing control module is connected with the screen and window management module, and the screen and window management module is respectively connected with the player module and the mirror image co-display module. The player module is internally provided with a plurality of player examples and is responsible for the creation, use and management of the player examples; each video source corresponds to a player instance for playing video, and the player instances are all created, used and managed by the player module.
The invention also provides a video playing method for realizing the same-screen multi-display and double-screen different display, which specifically comprises the following steps:
(1) when the program is started, the playing control module is started first, and the playing configuration information is analyzed first after the playing control module is started;
(2) according to the playing configuration information, if only one playing address is available and the width of the playing source is larger than the width of the playing source, the main screen multi-window playing mode is used, and the secondary screen can select the mirror image to be displayed simultaneously and the secondary screen not to be displayed;
(3) according to the playing configuration information, if only one playing address is provided and the height of the playing source is larger than the width, the main screen performs single-window full-screen display, and the auxiliary screen can select mirror image simultaneous display and auxiliary screen non-display;
(4) according to the playing configuration information, if there are two playing addresses, there are two options: one is that the main and auxiliary screens respectively play an address, and a single window of the auxiliary screen is displayed in full screen; one is that the main screen plays two addresses in multiple windows, and the mirror image of the auxiliary screen displays one of the addresses or the auxiliary screen does not display the other address; under the condition that the main screen and the auxiliary screen respectively play an address, the main screen can be configured with multi-window mirror images to display simultaneously; at this time, if the playing source width of the main screen is larger than the high width, the main screen multi-window playing mode is used; if the playing source height of the main screen is larger than the width, the main screen performs single-window full-screen display, and the auxiliary screen performs single-window full-screen display;
(5) according to the playing configuration information, if the playing address exceeds more than two, two options are available: one is that the main screen and the auxiliary screen respectively play, the auxiliary screen plays an address, a single window of the auxiliary screen displays in full screen, the main screen plays other addresses in multiple windows, each address corresponds to one window, and the layout of the windows can be configured; one is that the main screen multi-window plays all addresses, each address corresponds to a window, the window layout is configurable, and the secondary screen mirror image is displayed on one of the main screen multi-window or the secondary screen is not displayed;
wherein: for the case that the main screen plays only one address in the steps (4) and (5), the situation that the playing source width is larger than the height and the height is larger than the width needs to be considered, and if the main screen plays a plurality of addresses, because each address corresponds to one window, the situation that the width is larger than the height and the height is larger than the width does not need to be considered.
(6) Calling a screen and window management module according to the configuration information, and after the screen and window management module is started, associating a player module and a mirror image display module according to a display mode required by playing configuration information so as to distribute a main screen display window and an auxiliary screen for display; as shown in fig. 1 and 2, the method for allocating the display window of the main screen and the display window of the sub screen is as follows:
(61) when the secondary screen needs to independently display a video source, the screen and window management module creates a canvas, associates the canvas with the secondary screen and the player instance of the current video source, directly renders data to the canvas by the player instance after association, and displays the canvas on the secondary screen;
when the auxiliary screen is to independently display a video source, the auxiliary screen corresponds to an independent player instance, then the auxiliary screen corresponds to an independent canvas, the canvas is directly associated with the player instance, the player instance directly renders data onto the canvas, and the mirror image display module is not needed to participate under the condition.
(62) When the secondary screen needs to mirror image and display the data of the primary screen, firstly, the screen and window management module creates a canvas for the primary screen window which displays the mirror image and the secondary screen window, and associates the canvas with the mirror image and display module and the player example, then the screen and window management module creates a canvas for the secondary screen and associates the canvas with the mirror image and display module, the mirror image and display module can be responsible for rendering the data mirror image to the secondary screen canvas, at the moment, the player example does not need to be associated, the mirror image and display does not need to create the player example, but directly shares the image data which is decoded by using the mirror image source, and therefore, the resource consumption is greatly reduced.
When the secondary screen is to mirror image and display a certain window picture of the main screen, the secondary screen does not have a corresponding player instance, the secondary screen can correspond to an independent canvas, the canvas can be associated with the mirror image and display module of the main screen, and the mirror image and display module can be responsible for rendering the mirror image of the played picture to the canvas of the secondary screen.
(63) When a main screen needs to perform multi-window mirror image simultaneous display, firstly, a screen and window management module creates a canvas for the main screen, associates the canvas with a mirror image simultaneous display module and a player instance, sets coordinate information of a plurality of windows to the mirror image simultaneous display module, and after the mirror image simultaneous display module receives player instance decoding data, the mirror image simultaneous display module performs multi-window logical division on the canvas according to the coordinate information of the plurality of windows and renders the same frame data to all mirror image simultaneous display logical windows respectively; the multi-window mirror image simultaneous display is characterized in that only one player instance and only one canvas are provided, and a plurality of logic windows are divided on the canvas, so that the multi-window effect is achieved.
When the main screen is used for carrying out multi-window mirror image simultaneous display, the main screen corresponds to a single player instance and a canvas; then, the player instance is associated with the mirror image display module, the main screen canvas is associated with the mirror image display module, and multi-window coordinate data is set to the mirror image display module; therefore, when the player instance runs, the mirror image display module can acquire the data of the player instance, then the mirror image display module carries out multi-window logic division on the canvas according to the window coordinate data, and finally the same frame of video data is sequentially rendered into a plurality of logic windows in a mirror image mode.
(64) When the main screen needs to perform multi-window different display, firstly, the screen and window management module creates a canvas for each window independently, and then the canvas is associated with the player instances of each playing source in a one-to-one correspondence manner, so that each window has an independent player instance for playing. The multi-window heterogeneous display is characterized by multiple player instances and multiple canvases, namely, one player instance is correspondingly established for each data source, and one canvas is correspondingly established for each player instance.
When the main screen is used for multi-window different display, each video source corresponds to an independent player instance, each player instance corresponds to an independent canvas, each player instance is associated with an independent canvas, when the player instances play, the player instances directly render video data onto the associated canvas, and under the condition, a mirror image same-display module is not needed to participate.
The main screen multi-window quantity and the window size are determined by the width and the height of a playing source and the width and the height of a main screen, the width and the height of the main screen are specified to be screen width and screen height, the width and the height of a data source are video width and video height, and then the window quantity of the main screen, the width and the height of the window and the window distance, the window and the window are calculated by the following steps:
windWidth=screenWidth;
windHeight=screenWidth*videoHieght/videoWidth;
windNumb=screenHeight/windHeight;
windOffset=(screenHeight–windHeight*windNumb)/(windNumb-1);
wherein: the window number of the main screen, window width, width height of the window, and window interval, window offset, are integers and cannot be negative, and the window interval, window offset, may be 0.
Wherein: when the mirror images of the auxiliary screen are displayed simultaneously, the auxiliary screen can only display one window on the main screen. The player module is characterized by being capable of automatically selecting hardware decoding and software decoding, and preferentially using hardware decoding capability of the device. The public screen equipment is provided with a video decoding chip, the hardware decoding of the equipment is preferentially used from the aspect of performance, and the software decoding is automatically used if the hardware decoding fails, so that the smooth playing under the condition of multi-video source multi-window display is realized by using the equipment performance to the maximum extent.
The invention can make full use of the characteristics of the public screen equipment to realize the configurable video playing and displaying of the main screen and the auxiliary screen of the public screen. According to the relation between the data source resolution and the public screen equipment resolution, the conventional single-window video playing can be realized, and the main screen multi-window simultaneous display and multi-window different display as well as the mirror image simultaneous display and different display of the auxiliary screen can also be realized. Therefore, the public screen advertisement and other video information releasing modes are greatly enriched, the equipment utilization rate is greatly improved, and the advertisement and other video information releasing effects on the public screen are further enhanced.