CN115695888A - Video processing method and device and storage medium - Google Patents

Video processing method and device and storage medium Download PDF

Info

Publication number
CN115695888A
CN115695888A CN202211149067.2A CN202211149067A CN115695888A CN 115695888 A CN115695888 A CN 115695888A CN 202211149067 A CN202211149067 A CN 202211149067A CN 115695888 A CN115695888 A CN 115695888A
Authority
CN
China
Prior art keywords
sub
canvas
video
creating
main process
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211149067.2A
Other languages
Chinese (zh)
Inventor
丁淼林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Coocaa Network Technology Co Ltd
Original Assignee
Shenzhen Coocaa Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Coocaa Network Technology Co Ltd filed Critical Shenzhen Coocaa Network Technology Co Ltd
Priority to CN202211149067.2A priority Critical patent/CN115695888A/en
Publication of CN115695888A publication Critical patent/CN115695888A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The application relates to a video processing method, a video processing device and a storage medium, wherein the method comprises the following steps: creating a sub-process for a memory space applied by a server based on a main process, wherein the sub-process is used for video playing; creating canvas surface required by video playing on the sub-process, and drawing UI elements on the canvas; and acquiring video playing capacity, and displaying the UI elements drawn on the canvas of the sub-process in the main process based on the video playing capacity. By the method and the device, the problem that in the prior art, the homepage process and the player process exist in the same process, and the player loading consumes a large number of resources to influence the operation smoothness and the loading speed of the homepage is solved.

Description

Video processing method and device and storage medium
Technical Field
The present application relates to the field of computers, and in particular, to a method and an apparatus for processing a video, and a storage medium.
Background
In the prior art, the video playing of the home page small window is realized, a home page and a player exist in the same process, because the player loads and releases a large amount of consumption performance and resources, the home page operation is blocked in the same process, namely, the home page operation is not smooth, and the home page operation, message distribution, home page User Interface (UI) drawing or function loading is slow when the playing resources are started and loaded.
There is no effective solution to the above problems in the related art.
Disclosure of Invention
The application provides a video processing method, a video processing device and a video processing storage medium, which are used for solving the problems that in the prior art, a homepage process and a player process exist in the same process, and the operating smoothness and the loading speed of the homepage are influenced due to the fact that a large number of resources are consumed by player loading.
In a first aspect, the present application provides a video processing method, including: creating a sub-process for a memory space applied by a server based on a main process, wherein the sub-process is used for video playing; creating canvas surface required by video playing on the sub-process, and drawing UI elements on the canvas; and acquiring video playing capacity, and displaying the UI elements drawn on the canvas of the sub-process in the main process based on the video playing capacity.
In a second aspect, the present application provides a video processing apparatus, including: the system comprises a creating module, a processing module and a display module, wherein the creating module is used for creating a subprocess to a memory space applied by a server based on a main process, and the subprocess is used for playing videos; the first processing module is used for creating a canvas surface required by video playing on the subprocess and drawing a UI element on the canvas; and the second processing module is used for acquiring the video playing capacity and displaying the UI elements drawn on the canvas of the sub-process in the main process based on the video playing capacity.
In a third aspect, an electronic device is provided, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor adapted to perform the method steps of any of the embodiments of the first aspect when executing a program stored in the memory.
In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the method steps of any of the embodiments of the first aspect.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
according to the method provided by the embodiment of the application, the sub-process and the main process used for playing the video are two independent processes, the canvas is created on the independent sub-process, the UI element is drawn on the canvas, and the UI element drawn on the canvas of the sub-process can be displayed in the main process after the video playing capability is obtained, namely, the sub-process can be used for independently playing the video and does not consume or occupy the resources of the main process, the smoothness of loading and the smoothness of operation of the main process are improved to a certain extent, and therefore the problems that in the prior art, the main page process and the player process exist in the same process, and the smoothness of operation and the loading speed of the main page are influenced due to the fact that a large number of resources are consumed by the player loading are solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flowchart of a video processing method according to an embodiment of the present disclosure;
fig. 2 is a schematic structural diagram of a video processing apparatus according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a schematic flowchart of a video processing method according to an embodiment of the present application, and as shown in fig. 1, the method includes the steps of:
102, creating a sub-process to a memory space applied by a server based on a main process, wherein the sub-process is used for video playing;
it should be noted that the application scenarios of the main process and the sub-process in the embodiment of the present application may be a window (sub-process) on a main page (main process), and the window may be a pop-up window of the main page, or one of a plurality of windows on the main page. That is, the main process in the embodiment of the present application is a tv main page, and the sub-processes are windows displaying a tv drama and an art. That is to say, the main process in the embodiment of the present application may apply for the memory space for the plurality of sub-processes, respectively, that is, each sub-process may have a separate memory space. In addition, the main process and the sub-process in the embodiment of the application are processes in an android system.
104, creating a canvas surface required by playing a video on the subprocess, and drawing a UI element on the canvas;
it should be noted that a Surface is an object pointing to a display memory, and is used to be drawn on a screen, all windows that you can see have a Surface that can be drawn on it, and in an android, a system uses a Surface flicker service to render the Surface on a final screen according to correct depth information. A Surface generally has more than one (usually 2) buffer units (back buffer and front buffer), and the system usually performs rendering in the back buffer, and exchanges with the front buffer after the rendering is completed, so as to display on a screen to achieve the effect of smooth display.
The UI elements are views in the window, and a window only has one View Hierarchy, and the View hierarchies provide all the representations in the window.
And 106, acquiring the video playing capability, and displaying the UI elements drawn on the canvas of the sub-process in the main process based on the video playing capability.
It should be noted that the video playing capability refers to a video decoding capability, and the video decoding capability is obtained from a native layer of a system.
Through the steps 102 to 106, in the embodiment of the present application, the sub-process and the main process for playing the video are two separate processes, the canvas is created on the separate sub-process, the UI element is drawn on the canvas, and the UI element drawn on the canvas of the sub-process can be displayed in the main process after the video playing capability is obtained, that is, the sub-process can play the video alone and does not consume or occupy the resources of the main process, and the smoothness of the main process loading and the smoothness of the operation are improved to a certain extent, thereby solving the problem that the main process and the player process exist in the same process in the prior art, and the smoothness of the operation and the loading speed of the main process are affected due to the fact that a large amount of resources are consumed by the player loading.
In an optional implementation manner of the embodiment of the present application, regarding the manner of obtaining the video playing capability in step 106, further includes: the decoding capability of the video is obtained from a local service and drawn into a canvas.
It should be noted that the video decoding capability includes a video decoding capability (VideoCodec, VCodec) and an audio decoding capability (AudioCodec, ACodec), and the decoding capabilities are drawn in the canvas, so that the sub-process has the function of the media player.
In an optional implementation manner of this embodiment of the present application, regarding the manner of displaying, in the main process, the UI element drawn on the canvas of the sub-process based on the video playing capability, which is referred to in the above step 106, further includes:
step 11, creating an Android Interface Definition Language (AIDL), and associating the sub-process and the main process based on the AIDL, wherein the associated sub-process and the main process can perform communication interaction and data interaction;
and step 12, displaying the UI elements drawn on the canvas of the sub-process in the main process based on AIDL.
It should be noted that, in order to enable other application programs to access the service provided by the application program, the Android system is implemented in a Remote Procedure Call (RPC) manner. In the embodiment of the present application, as with many other RPC-based solutions, if the main process and the sub-process are applied to Android, the Android may use an Interface Definition Language (IDL) to disclose an Interface of a service, for example, 4 Android application components in the Android may be used: activity, broadcastReceiver, contentProvider and Service may perform cross-process access. Further, the main process and the sub-process can be bound through bindservice for the service.
Further, as to the manner of associating the sub-process and the main process based on the aid id in step 11, the following may be further performed: and creating a player packaging interface and an operation interface for the sub-process based on AIDL.
The player capability is packaged after the subprocess is drawn on the basis of the packaging interface, the operation interface can be the operation of the subprocess realized by the main process after the subprocess is associated with the main process, for example, if the video played in the current subprocess is accelerated, the video can be accelerated and played by controlling the subprocess through the main process, or the video played in the current subprocess needs to be paused, and the video can be paused and played by controlling the subprocess through the main process. That is, the sub-process may be controlled by the main process after the main process and the sub-process are associated.
In an optional implementation manner of the embodiment of the present application, regarding the manner, involved in the step 104, of creating a canvas surface required for playing a video and drawing a UI element on the canvas, the manner further may include:
step 21, drawing UI elements required by the sub-process, and creating a player container View based on the UI elements;
and step 22, creating a canvas associated with the player container View, and drawing the player container View on the canvas.
Based on the above steps 21 and 22, in the process of playing the video, two areas of the sub-process playing interface can be: a player container View and a content View. The player container is shared for lists and detail pages. When a subprocess surface is started for the first time, creating a surface only containing a player container View, and drawing a content View into the player container when a video is played to realize list playing; when a sub-process is operated, the player container View animation moves to the top, and the detailed page content View is created and loaded; when the sub-process is not running, the detail page content View is removed from the surface and the player container is moved to the corresponding location in the list.
The present application is explained below with reference to a specific implementation manner of an embodiment of the present application, which provides a cross-process video playing method, and the method includes the following steps:
step 201, a client (main process) applies for a memory space to create a player process (sub-process);
wherein, the memory can be applied and opened by processbuilder to create a new process.
Step 202, drawing a UI of an android standard, and creating a player container view;
step 203, creating a surface based on the player container view;
step 204, drawing the playing capability of the video in the surface to obtain a player in the player process;
step 205, creating AIDL to provide communication service and data interaction service between the player process and the client process;
step 206, the UI drawn in the player process is presented in the client process.
As can be seen from the foregoing steps 201 to 206, in this embodiment, because the client process and the player process are two separate processes, and the separate process attached to the client process is used to implement player operation and movie rendering and playing, the influence of player resource consumption on the client process is eliminated, so that player resource consumption is not greatly occupied and blocked by the player. Therefore, the loading is smoother and the operation is smoother through the embodiment of the application, and the floating playing of the player process can be performed away from the homepage application in the embodiment.
Corresponding to fig. 1, an embodiment of the present application further provides a video processing apparatus, as shown in fig. 2, the apparatus includes:
a creating module 22, configured to create a sub-process for the memory space applied by the server based on the main process, where the sub-process is used for playing a video;
the first processing module 24 is configured to create a canvas surface required for playing a video on the sub-process, and draw a UI element on the canvas;
and the second processing module 26 is used for acquiring the video playing capability and displaying the UI element drawn on the canvas of the sub-process in the main process based on the video playing capability.
In the embodiment of the application, the sub-process and the main process for playing the video are two independent processes, the canvas is created on the independent sub-process, the UI element is drawn on the canvas, and the UI element drawn on the canvas of the sub-process can be displayed in the main process after the video playing capability is obtained, namely, the sub-process can play the video independently and does not consume or occupy the resources of the main process, and the smoothness of loading of the main process and the smoothness of operation are improved to a certain extent, so that the problem that the smoothness of operation and the loading speed of the main process are influenced by the fact that the main process and the player process exist in the same process due to the fact that a large number of resources are consumed by player loading in the prior art is solved
Optionally, the second processing module 26 in this embodiment may further include: and the first processing unit is used for acquiring the decoding capability of the video from the local service and drawing the decoding capability in the canvas.
It should be noted that the video decoding capability includes a video decoding capability (VideoCodec, VCodec) and an audio decoding capability (AudioCodec, ACodec), and the decoding capabilities are drawn in the canvas, so that the sub-process has the function of the media player.
Optionally, the second processing module 26 in this embodiment of the present application further includes: the second processing unit is used for creating an android interface definition language AIDL and associating the sub-process and the main process based on the AIDL, wherein the associated sub-process and the main process can carry out communication interaction and data interaction; and the display unit is used for displaying the UI elements drawn on the canvas of the sub-process in the main process based on the AIDL.
It should be noted that, in order to enable other applications to access the service provided by the application, the Android system is implemented in a Remote Procedure Call (RPC) manner. In the embodiment of the present application, as with many other RPC-based solutions, if the main process and the sub-process are applied to Android, the Android may use an Interface Definition Language (IDL) to disclose an Interface of a service, for example, 4 Android application components in the Android may be used: activity, broadcastReceiver, contentProvider and Service may perform cross-process access. Further, the main process and the sub-process can be bound through bindservice for the service.
Optionally, the second processing unit in this embodiment of the application further may include: and creating a player packaging interface and an operation interface for the sub-process based on AIDL.
The player capability is packaged after the subprocess is drawn on the basis of the packaging interface, the operation interface can be the operation of the subprocess realized by the main process after the subprocess is associated with the main process, for example, if the video played in the current subprocess is accelerated, the video can be accelerated and played by controlling the subprocess through the main process, or the video played in the current subprocess needs to be paused, and the video can be paused and played by controlling the subprocess through the main process. That is, the sub-process may be controlled by the main process after the main process and the sub-process are associated.
Optionally, the first processing module in this embodiment of the present application includes: the third processing unit is used for drawing the UI elements required by the sub-process and creating a player container View based on the UI elements; and the fourth processing unit is used for creating a canvas associated with the player container View and drawing the player container View on the canvas.
Therefore, in the process of video playing, two areas of the sub-process playing interface can be used: a player container View and a content View. The player container is shared for lists and detail pages. When a subprocess surface is started for the first time, creating a surface only containing a player container View, and drawing a content View into the player container when a video is played to realize list playing; when a sub-process is operated, the player container View animation moves to the top, and the detailed page content View is created and loaded; when the sub-process is not running, the detail page content View is removed from the surface and the player container is moved to the corresponding location in the list.
As shown in fig. 3, an electronic device according to an embodiment of the present application includes a processor 111, a communication interface 112, a memory 113, and a communication bus 114, where the processor 111, the communication interface 112, and the memory 113 complete mutual communication via the communication bus 114,
a memory 113 for storing a computer program;
in an embodiment of the present application, when the processor 111 is configured to execute the program stored in the memory 113, the functions of the video processing method provided in any one of the foregoing method embodiments are also similar, and are not described herein again.
The present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the video processing method provided in any one of the foregoing method embodiments.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for processing video, comprising:
creating a sub-process for a memory space applied by a server based on a main process, wherein the sub-process is used for video playing;
creating canvas surface required by video playing on the sub-process, and drawing UI elements on the canvas;
and acquiring video playing capacity, and displaying the UI elements drawn on the canvas of the sub-process in the main process based on the video playing capacity.
2. The method of claim 1, wherein the obtaining the video playing capability comprises:
and acquiring the decoding capability of the video from a local service, and drawing the decoding capability in the canvas.
3. The method of claim 1, wherein displaying the UI element drawn on the canvas of the child process in the host process based on the video playback capability comprises:
creating an android interface definition language AIDL, and associating the sub-process and the main process based on the AIDL, wherein the associated sub-process and the main process can perform communication interaction and data interaction;
and displaying the UI elements drawn on the canvas of the sub-process in the main process based on the AIDL.
4. The method of claim 3, wherein the associating the sub-process and the master-process based on the AIDL comprises:
and creating a player packaging interface and an operation interface for the sub-process based on the AIDL.
5. The method of claim 1, wherein creating a canvas surface required for playing a video and drawing a UI element on the canvas comprises:
drawing UI elements required by the sub-process, and creating a player container View based on the UI elements;
creating the canvas associated with the player container View, and drawing the player container View on the canvas.
6. An apparatus for processing video, comprising:
the system comprises a creation module, a storage module and a processing module, wherein the creation module is used for creating a subprocess to a memory space applied by a server based on a main process, and the subprocess is used for playing videos;
the first processing module is used for creating a canvas surface required by video playing on the subprocess and drawing a UI element on the canvas;
and the second processing module is used for acquiring the video playing capacity and displaying the UI elements drawn on the canvas of the sub-process in the main process based on the video playing capacity.
7. The apparatus of claim 6, wherein the second processing module comprises:
and the first processing unit is used for acquiring the decoding capability of the video from a local service and drawing the decoding capability in the canvas.
8. The apparatus of claim 6, wherein the second processing module comprises:
the second processing unit is used for creating an android interface definition language AIDL and associating the sub-process with the main process based on the AIDL, wherein the associated sub-process and the main process can perform communication interaction and data interaction;
and the display unit is used for displaying the UI elements drawn on the canvas of the sub-process in the main process based on the AIDL.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 5 when executing a program stored in the memory.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method steps of any one of claims 1 to 5.
CN202211149067.2A 2022-09-20 2022-09-20 Video processing method and device and storage medium Pending CN115695888A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211149067.2A CN115695888A (en) 2022-09-20 2022-09-20 Video processing method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211149067.2A CN115695888A (en) 2022-09-20 2022-09-20 Video processing method and device and storage medium

Publications (1)

Publication Number Publication Date
CN115695888A true CN115695888A (en) 2023-02-03

Family

ID=85061726

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211149067.2A Pending CN115695888A (en) 2022-09-20 2022-09-20 Video processing method and device and storage medium

Country Status (1)

Country Link
CN (1) CN115695888A (en)

Similar Documents

Publication Publication Date Title
US11178448B2 (en) Method, apparatus for processing video, electronic device and computer-readable storage medium
US9176757B2 (en) Method, system and an executable piece of code for the virtualization of a hardware resource associated with a computer system
US8214754B2 (en) Registration of applications and complimentary features for interactive user interfaces
CN111625214B (en) Audio control method, device, equipment and storage medium
US20100325527A1 (en) Overlay for digital annotations
CN103562862A (en) Global composition system
CN110070496B (en) Method and device for generating image special effect and hardware device
CN111124668A (en) Memory release method and device, storage medium and terminal
TW201826109A (en) Method and apparatus for page presentation
CN112604289B (en) Game map generation method, device, equipment and storage medium
CN106131643A (en) A kind of barrage processing method, processing means and electronic equipment thereof
CN112165641A (en) Display device
CN103514924A (en) Method and device for playing videos in mobile terminal Widget, and player
CN111324398B (en) Method, device, terminal and storage medium for processing latest content
Lee et al. A-mash: providing single-app illusion for multi-app use through user-centric UI mashup
CN112799801B (en) Method, device, equipment and medium for drawing simulated mouse pointer
CN116546228B (en) Plug flow method, device, equipment and storage medium for virtual scene
CN111309210B (en) Method, device, terminal and storage medium for executing system functions
CN115695888A (en) Video processing method and device and storage medium
CN112367295B (en) Plug-in display method and device, storage medium and electronic equipment
CN112433696A (en) Wallpaper display method, device, equipment and medium
CN111273972A (en) Window management method, device, storage medium and terminal
CN112749033B (en) Display device and system notification calling method
CN114025218B (en) Card type video interaction method, device, equipment and storage medium
CN113779466B (en) Page display method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination