[go: up one dir, main page]

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, device and storage medium

技术领域technical field

本申请涉及计算机领域,尤其涉及一种视频的处理方法、装置及存储介质。The present application relates to the computer field, and in particular to a video processing method, device and storage medium.

背景技术Background technique

现有技术中实现首页小窗口播放视频,是主页与播放器存在于同一进程内,由于播放器加载释放大量消耗性能和资源,由于在同一进程中导致阻塞了主页操作,即主页操作不流畅,以及启播加载播放资源时卡住主页操作及消息分发、主页用户界面(UserInterface,UI)绘制或功能加载缓慢。In the prior art, the small window on the homepage plays video because the homepage and the player exist in the same process. Because the player loads and releases a large amount of performance and resources, the operation of the homepage is blocked in the same process, that is, the operation of the homepage is not smooth. And the home page operation and message distribution are stuck when the broadcast starts to load playback resources, and the home page user interface (UserInterface, UI) drawing or function loading is slow.

针对相关技术中的上述问题,目前尚未存在有效的解决方案。For the above-mentioned problems in related technologies, there is no effective solution at present.

发明内容Contents of the invention

本申请提供了一种视频的处理方法、装置及存储介质,以解决现有技术中主页进程和播放器进程存在于同一进程中,由于播放器加载消耗大量资源影响主页的操作流畅度和加载速度的问题。This application provides a video processing method, device and storage medium to solve the problem that in the prior art, the home page process and the player process exist in the same process, and the operation fluency and loading speed of the home page are affected due to the player loading and consuming a lot of resources The problem.

第一方面,本申请提供了一种视频的处理方法,包括:基于主进程向服务器所申请的内存空间创建子进程,其中,所述子进程用于视频播放;在所述子进程上创建播放视频所需的画布surface,并在所述画布上绘制UI元素;获取视频播放能力,并基于所述视频播放能力在所述主进程中显示所述子进程的画布上所绘制的UI元素。In the first aspect, the present application provides a video processing method, including: creating a sub-process based on the memory space applied by the main process to the server, wherein the sub-process is used for video playback; creating a playback process on the sub-process The canvas surface required by the video, and draw UI elements on the canvas; obtain the video playback capability, and display the UI elements drawn on the canvas of the sub-process in the main process based on the video playback capability.

第二方面,本申请提供了一种视频的处理装置,包括:创建模块,用于基于主进程向服务器所申请的内存空间创建子进程,其中,所述子进程用于视频播放;第一处理模块,用于在所述子进程上创建播放视频所需的画布surface,并在所述画布上绘制UI元素;第二处理模块,用于获取视频播放能力,并基于所述视频播放能力在所述主进程中显示所述子进程的画布上所绘制的UI元素。In a second aspect, the present application provides a video processing device, including: a creation module for creating a sub-process based on the memory space applied by the main process to the server, wherein the sub-process is used for video playback; the first processing A module, configured to create a canvas surface required for playing video on the subprocess, and draw UI elements on the canvas; a second processing module, configured to obtain video playback capabilities, and based on the video playback capabilities in the The UI elements drawn on the canvas of the sub-process are displayed in the main process.

第三方面,提供了一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;In a third aspect, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete mutual communication through the communication bus;

存储器,用于存放计算机程序;memory for storing computer programs;

处理器,用于执行存储器上所存放的程序时,实现第一方面任一项实施例所述的方法步骤。The processor is configured to implement the method steps described in any one embodiment of the first aspect when executing the program stored in the memory.

第四方面,提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如第一方面任一项实施例所述的方法步骤。In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the method steps described in any one embodiment of the first aspect are implemented.

本申请实施例提供的上述技术方案与现有技术相比具有如下优点:Compared with the prior art, the above-mentioned technical solutions provided by the embodiments of the present application have the following advantages:

本申请实施例提供的该方法,在本申请实施例中用于播放视频的子进程与主进程是两个单独的进程,并在单独的子进程上创建画布,并在画布上绘制UI元素,通过获取视频播放能力后可以在主进程中显示子进程的画布上所绘制的UI元素,也就是说,子进程可以单独进行视频播放并不会消耗或占用主进程的资源,在一定程度上提升了主进程加载的流畅和操作的丝滑,从而解决了现有技术中主页进程和播放器进程存在于同一进程中,由于播放器加载消耗大量资源影响主页的操作流畅度和加载速度的问题。In the method provided by the embodiment of the present application, in the embodiment of the present application, the sub-process and the main process used to play the video are two separate processes, and a canvas is created on the separate sub-process, and UI elements are drawn on the canvas, After obtaining the video playback capability, the UI elements drawn on the canvas of the sub-process can be displayed in the main process. That is to say, the sub-process can play video independently without consuming or occupying the resources of the main process, which improves to a certain extent. The main process loads smoothly and the operation is silky smooth, thereby solving the problem in the prior art that the home page process and the player process exist in the same process, and the operation fluency and loading speed of the home page are affected due to the large amount of resources consumed by the player loading.

附图说明Description of 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 technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, In other words, other drawings can also be obtained from these drawings without paying creative labor.

图1为本申请实施例提供的一种视频的处理方法的流程示意图;FIG. 1 is a schematic flowchart of a video processing method provided in an embodiment of the present application;

图2为本申请实施例提供的一种视频的处理装置的结构示意图;FIG. 2 is a schematic structural diagram of a video processing device provided in an embodiment of the present application;

图3为本申请实施例提供的一种电子设备的结构示意图。FIG. 3 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.

具体实施方式Detailed ways

为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请的一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purposes, 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 in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments It is a part of the embodiments of this application, but not all of them. Based on the embodiments in the present application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present application.

图1为本申请实施例提供的一种视频的处理方法的流程示意图,如图1所示,该方法的步骤包括:Fig. 1 is a schematic flow chart of a video processing method provided in the embodiment of the present application. As shown in Fig. 1, the steps of the method include:

步骤102,基于主进程向服务器所申请的内存空间创建子进程,其中,子进程用于视频播放;Step 102, create a sub-process based on the memory space applied by the main process to the server, wherein the sub-process is used for video playback;

需要说明的是,本申请实施例中的主进程和子进程的应用场景可以是主页(主进程)上的窗口(子进程),该窗口可以主页弹窗,也可以是主页上的多个窗口中的其中之一,以电视主页为例,目前电视主页上会有多个窗口以显示多个内容,例如有一部分窗口显示当前热播的电视剧,一部分窗口显示当前热播的综艺,还有部分窗口推送广告等。也就是说,本申请实施例中的主进程就是电视主页,子进程就是显示电视剧、综艺的窗口。也就是说,本申请实施例中的主进程可以为多个子进程分别申请内存空间,即每一个子进程都可以有一个单独的内存空间。另外,本申请实施例中的主进程和子进程为安卓系统中的进程。It should be noted that the application scenario of the main process and the sub-process in the embodiment of the present application can be a window (sub-process) on the home page (main process), and the window can be a pop-up window on the home page, or it can be in multiple windows on the home page One of them, taking the TV homepage as an example, currently there will be multiple windows on the TV homepage to display multiple contents, for example, some windows display the currently popular TV series, some windows display the current popular variety shows, and some windows Push advertisements, etc. That is to say, the main process in the embodiment of the present application is the TV homepage, and the sub-processes are windows for displaying TV dramas and variety shows. That is to say, the main process in the embodiment of the present application can separately apply for memory space for multiple sub-processes, that is, each sub-process can have a separate memory space. In addition, the main process and sub-processes in the embodiment of the present application are processes in the Android system.

步骤104,在子进程上创建播放视频所需的画布surface,并在画布上绘制UI元素;Step 104, create a canvas surface required for playing video on the child process, and draw UI elements on the canvas;

需要说明的是,Surface就是指向显存的一个物体,用来被绘制到屏幕上,所有你能看见的窗口都拥有可以在上面绘制的Surface,在安卓中,系统使用Surface Flinger服务来把Surface按照正确的深度信息渲染到最终的屏幕上。一个Surface一般拥有超过一个(通常是2个)buffer单元(back buffer(后置缓冲)与front buffer(前置缓冲)),系统通常在back buffer中进行渲染,完成之后与front buffer交换,这样显示到屏幕上,以实现流畅显示的效果。It should be noted that Surface is an object pointing to video memory and used to be drawn on the screen. All the windows you can see have Surfaces that can be drawn on them. In Android, the system uses Surface Flinger service to set Surface according to The depth information is rendered to the final screen. A Surface generally has more than one (usually 2) buffer units (back buffer (back buffer) and front buffer (front buffer)), the system usually renders in the back buffer, and exchanges with the front buffer after completion, so that the display to the screen for smooth display.

UI元素就是窗口里的View,一个窗口只拥有一个View Hierarchy(视图层级),这些View Hierarchy提供了窗口里的所有表现。The UI element is the View in the window. A window has only one View Hierarchy (view hierarchy), and these View Hierarchies provide all the performance in the window.

步骤106,获取视频播放能力,并基于视频播放能力在主进程中显示子进程的画布上所绘制的UI元素。Step 106, acquire the video playback capability, and display the UI elements drawn on the canvas of the sub-process in the main process based on the video playback capability.

需要说明的是,该视频播放能力是指对视频的解码能力,该视频的解码能力是从系统的本地native层获取该视频播放能力。It should be noted that the video playback capability refers to the video decoding capability, and the video decoding capability is obtained from the local native layer of the system.

通过上述步骤102至步骤106,在本申请实施例中用于播放视频的子进程与主进程是两个单独的进程,并在单独的子进程上创建画布,并在画布上绘制UI元素,通过获取视频播放能力后可以在主进程中显示子进程的画布上所绘制的UI元素,也就是说,子进程可以单独进行视频播放并不会消耗或占用主进程的资源,在一定程度上提升了主进程加载的流畅和操作的丝滑,从而解决了现有技术中主页进程和播放器进程存在于同一进程中,由于播放器加载消耗大量资源影响主页的操作流畅度和加载速度的问题。Through the above steps 102 to 106, in the embodiment of the present application, the sub-process and the main process used to play video are two separate processes, and a canvas is created on a separate sub-process, and UI elements are drawn on the canvas, through After obtaining the video playback capability, the UI elements drawn on the canvas of the sub-process can be displayed in the main process. That is to say, the sub-process can play video independently without consuming or occupying the resources of the main process, which improves the process to a certain extent. The smooth loading of the main process and the smooth operation solve the problem in the prior art that the home page process and the player process exist in the same process, and the operation fluency and loading speed of the home page are affected due to the large amount of resources consumed by the player loading.

在本申请实施例的可选实施方式中,对于上述步骤106中涉及到的获取视频播放能力的方式,进一步可以包括:从本地服务中获取视频的解码能力,并将解码能力绘制在画布中。In an optional implementation of the embodiment of the present application, the manner of obtaining the video playback capability involved in the above step 106 may further include: obtaining the video decoding capability from a local service, and drawing the decoding capability on the canvas.

需要说明的是,该视频解码能力包括视频解码包括视频解码能力(VideoCodec,VCodec)和音频解码能力(AudioCodec,ACodec),并将该解码能力绘制在画布中,进而使得子进程具有媒体播放器的功能。It should be noted that the video decoding capability includes video decoding capability (VideoCodec, VCodec) and audio decoding capability (AudioCodec, ACodec), and the decoding capability is drawn on the canvas, so that the child process has the Function.

在本申请实施例的可选实施方式中,对于上述步骤106中涉及到的基于视频播放能力在主进程中显示子进程的画布上所绘制的UI元素的方式,进一步可以包括:In an optional implementation of the embodiment of the present application, the method of displaying the UI elements drawn on the canvas of the sub-process in the main process based on the video playback capability involved in the above step 106 may further include:

步骤11,创建安卓接口定义语言(Android Interface Definition Language,AIDL),并基于AIDL关联子进程和主进程,其中,关联后的子进程和主进程可进行通信交互与数据交互;Step 11, create an Android Interface Definition Language (Android Interface Definition Language, AIDL), and associate subprocesses and main processes based on AIDL, wherein the associated subprocesses and main processes can perform communication interaction and data interaction;

步骤12,基于AIDL在主进程中显示子进程的画布上所绘制的UI元素。Step 12, display the UI elements drawn on the canvas of the sub-process in the main process based on AIDL.

需要说明的是,为了使其他的应用程序也可以访问本应用程序提供的服务,Android系统采用了远程过程调用(Remote Procedure Call,RPC)方式来实现。在本申请实施例中与很多其他的基于RPC的解决方案一样,如果主进程和子进程应用于安卓,则安卓可以使用接口定义语言(Interface Definition Language,IDL)来公开服务的接口,例如可以使用安卓中的4个Android应用程序组件:Activity、BroadcastReceiver、ContentProvider和Service可以进行跨进程访问。进一步地,对于service可以通过bindservice来绑定主进程和子进程。It should be noted that, in order to enable other application programs to access the services provided by this application program, the Android system adopts a remote procedure call (Remote Procedure Call, RPC) method to implement. Like many other RPC-based solutions in this embodiment of the application, if the main process and sub-processes are applied to Android, then Android can use Interface Definition Language (Interface Definition Language, IDL) to expose the interface of the service, for example, you can use Android The four Android application components in: Activity, BroadcastReceiver, ContentProvider and Service can be accessed across processes. Further, for service, the main process and child process can be bound through bindservice.

进一步地,对于上述步骤11中涉及到的基于AIDL关联子进程和主进程的方式,进一步可以是:基于AIDL为子进程创建播放器封装接口和操作接口。Further, for the method of associating the sub-process and the main process based on AIDL involved in the above step 11, it may further be: create a player encapsulation interface and an operation interface for the sub-process based on AIDL.

基于该封装接口以实现对在子进程绘制播放器能力之后对其进行封装,操作接口可以是在子进程和主进程关联之后实现主进程对子进程的操作,例如如果对当前子进程中播放的视频进行加速,则可以通过主进程控制子进程加速播放视频,又或者需要暂停当前子进程中播放的视频,则可以通过主进程控制子进程暂停播放视频。也就是说,在关联主进程和子进程后可以通过主进程来控制子进程。Based on this encapsulation interface, it is possible to encapsulate the ability of the player after the child process draws it. The operation interface can be to realize the operation of the main process on the child process after the child process is associated with the main process. For example, if the player is played in the current child process To accelerate the video, the main process can control the sub-process to accelerate the playback of the video, or if you need to pause the video played in the current sub-process, you can control the sub-process to pause the video through the main process. That is to say, after associating the main process and the sub-process, the sub-process can be controlled through the main process.

在本申请实施例的可选实施方式中,对于上述步骤104中涉及到的创建播放视频所需的画布surface,并在画布上绘制UI元素的方式,进一步可以包括:In an optional implementation of the embodiment of the present application, the method of creating the canvas surface required to play the video involved in the above step 104 and drawing UI elements on the canvas may further include:

步骤21,绘制子进程所需的UI元素,并基于UI元素创建播放器容器View;Step 21, draw the UI elements required by the child process, and create a player container View based on the UI elements;

步骤22,创建与播放器容器View关联的画布,并在画布上绘制播放器容器View。Step 22, create a canvas associated with the player container View, and draw the player container View on the canvas.

基于上述步骤21和步骤22,在视频播放的过程中可以将子进程播放界面两个区域:播放器容器View和内容View。播放器容器为列表和详情页共享。在子进程面首次启动的时候,创建一个只含有播放器容器View的surface,在播放视频的时候,将内容Vie绘制到播放器容器中,来实现列表播放;当运行子进程的时候,播放器容器View动画移动到顶部,创建并加载详情页内容view;当不运行子进程的时候,将详情页内容View从surface中移除,播放器容器移动到列表中对应的位置。Based on the above steps 21 and 22, during the video playback process, the sub-process can play two areas of the interface: the player container View and the content View. The player container is shared between list and detail pages. When the child process surface starts for the first time, create a surface that only contains the player container View. When playing the video, draw the content Vie into the player container to realize the list playback; when the child process is running, the player The container View animation moves to the top, creates and loads the content view of the details page; when the child process is not running, removes the content View of the details page from the surface, and moves the player container to the corresponding position in the list.

下面结合本申请实施例的具体实施方式对本申请进行解释说明,该具体实施方式提供了一种跨进程的视频播放方法,该方法的步骤包括:The following describes the application in conjunction with the specific implementation of the embodiment of the application. The specific implementation provides a cross-process video playback method. The steps of the method include:

步骤201,客户端(主进程)申请内存空间,以创建播放器进程(子进程);Step 201, the client (main process) applies for memory space to create a player process (subprocess);

其中可以通过processbuilder申请开辟内存村空,以创建新的进程。Among them, the memory village can be opened up through the processbuilder application to create a new process.

步骤202,绘制安卓标准的UI,并创建播放器容器view;Step 202, draw Android standard UI, and create player container view;

步骤203,基于播放器容器view创建surface;Step 203, create a surface based on the player container view;

步骤204,在surface中绘制视频的播放能力,以得到在播放器进程中的播放器;Step 204, drawing the playback capability of the video in the surface, to obtain the player in the player process;

步骤205,创建AIDL以提供播放器进程与客户端进程之间的通信服务和数据交互服务;Step 205, creating AIDL to provide communication services and data interaction services between the player process and the client process;

步骤206,在客户端进程中展示绘制在播放器进程中的UI。Step 206, displaying the UI drawn in the player process in the client process.

通过上述步骤201至步骤206可知,在该具体实施方式中由于客户端进程和播放器进程是两个单独的进程,辟依附于客户端进程的单独的进程实现播放器操作以及渲染绘制影片播放,从而剥离了播放器资源消耗对客户端进程的影响,使得播放器资源消耗,不会被播放器大量占用、阻塞。因此,通过本申请该具体实施方式使得加载更加流畅以及操作更加丝滑,而且在该具体实施方式中可脱离主页应用的进行播放器进程的悬浮播放。It can be seen from the above steps 201 to 206 that in this specific embodiment, since the client process and the player process are two separate processes, the separate process attached to the client process realizes player operation and rendering and drawing movie playback, Thus, the impact of player resource consumption on the client process is stripped away, so that player resource consumption will not be heavily occupied and blocked by the player. Therefore, the specific implementation of the present application makes the loading smoother and the operation more silky, and in this specific implementation, the player progress can be played separately from the home page application.

对应于上述图1,本申请实施例还提供了一种视频的处理装置,如图2所示,该装置包括:Corresponding to the above-mentioned Figure 1, the embodiment of the present application also provides a video processing device, as shown in Figure 2, the device includes:

创建模块22,用于基于主进程向服务器所申请的内存空间创建子进程,其中,子进程用于视频播放;Creating module 22, for creating sub-processes based on the memory space applied by the main process to the server, wherein the sub-processes are used for video playback;

第一处理模块24,用于在子进程上创建播放视频所需的画布surface,并在画布上绘制UI元素;The first processing module 24 is used to create a canvas surface required for playing video on the subprocess, and draw UI elements on the canvas;

第二处理模块26,用于获取视频播放能力,并基于视频播放能力在主进程中显示子进程的画布上所绘制的UI元素。The second processing module 26 is configured to obtain the video playback capability, and display the UI elements drawn on the canvas of the sub-process in the main process based on the video playback capability.

在本申请实施例中用于播放视频的子进程与主进程是两个单独的进程,并在单独的子进程上创建画布,并在画布上绘制UI元素,通过获取视频播放能力后可以在主进程中显示子进程的画布上所绘制的UI元素,也就是说,子进程可以单独进行视频播放并不会消耗或占用主进程的资源,在一定程度上提升了主进程加载的流畅和操作的丝滑,从而解决了现有技术中主页进程和播放器进程存在于同一进程中,由于播放器加载消耗大量资源影响主页的操作流畅度和加载速度的问题In the embodiment of this application, the sub-process and the main process used to play video are two separate processes, and a canvas is created on a separate sub-process, and UI elements are drawn on the canvas. After obtaining the video playback capability, the main process can be The UI elements drawn on the canvas of the sub-process are displayed in the process, that is to say, the sub-process can play video independently without consuming or occupying the resources of the main process, which improves the smooth loading and operation of the main process to a certain extent. Silky smooth, thereby solving the problem that the home page process and the player process exist in the same process in the prior art, and the operation fluency and loading speed of the home page are affected because the player loads and consumes a lot of resources

可选地,本申请实施例中的第二处理模块26进一步可以包括:第一处理单元,用于从本地服务中获取视频的解码能力,并将解码能力绘制在画布中。Optionally, the second processing module 26 in the embodiment of the present application may further include: a first processing unit, configured to acquire video decoding capabilities from local services, and draw the decoding capabilities on the canvas.

需要说明的是,该视频解码能力包括视频解码包括视频解码能力(VideoCodec,VCodec)和音频解码能力(AudioCodec,ACodec),并将该解码能力绘制在画布中,进而使得子进程具有媒体播放器的功能。It should be noted that the video decoding capability includes video decoding capability (VideoCodec, VCodec) and audio decoding capability (AudioCodec, ACodec), and the decoding capability is drawn on the canvas, so that the child process has the Function.

可选地,本申请实施例中的第二处理模块26进一步可以包括:第二处理单元,用于创建安卓接口定义语言AIDL,并基于AIDL关联子进程和主进程,其中,关联后的子进程和主进程可进行通信交互与数据交互;显示单元,用于基于AIDL在主进程中显示子进程的画布上所绘制的UI元素。Optionally, the second processing module 26 in the embodiment of the present application may further include: a second processing unit, configured to create the Android interface definition language AIDL, and associate the subprocess and the main process based on the AIDL, wherein the associated subprocess It can communicate and interact with the main process and interact with data; the display unit is used to display UI elements drawn on the canvas of the sub-process in the main process based on AIDL.

需要说明的是,为了使其他的应用程序也可以访问本应用程序提供的服务,Android系统采用了远程过程调用(Remote Procedure Call,RPC)方式来实现。在本申请实施例中与很多其他的基于RPC的解决方案一样,如果主进程和子进程应用于安卓,则安卓可以使用接口定义语言(Interface Definition Language,IDL)来公开服务的接口,例如可以使用安卓中的4个Android应用程序组件:Activity、BroadcastReceiver、ContentProvider和Service可以进行跨进程访问。进一步地,对于service可以通过bindservice来绑定主进程和子进程。It should be noted that, in order to enable other application programs to access the services provided by this application program, the Android system adopts a remote procedure call (Remote Procedure Call, RPC) method to implement. In the embodiment of the present application, like many other RPC-based solutions, if the main process and sub-processes are applied to Android, then Android can use Interface Definition Language (Interface Definition Language, IDL) to expose the interface of the service, for example, you can use Android The four Android application components in: Activity, BroadcastReceiver, ContentProvider and Service can be accessed across processes. Further, for service, the main process and child process can be bound through bindservice.

可选地,本申请实施例中的第二处理单元进一步可以包括:基于AIDL为子进程创建播放器封装接口和操作接口。Optionally, the second processing unit in the embodiment of the present application may further include: creating a player encapsulation interface and an operation interface for the sub-process based on AIDL.

基于该封装接口以实现对在子进程绘制播放器能力之后对其进行封装,操作接口可以是在子进程和主进程关联之后实现主进程对子进程的操作,例如如果对当前子进程中播放的视频进行加速,则可以通过主进程控制子进程加速播放视频,又或者需要暂停当前子进程中播放的视频,则可以通过主进程控制子进程暂停播放视频。也就是说,在关联主进程和子进程后可以通过主进程来控制子进程。Based on this encapsulation interface, it is possible to encapsulate the ability of the player after the child process draws it. The operation interface can be to realize the operation of the main process on the child process after the child process is associated with the main process. For example, if the player is played in the current child process To accelerate the video, the main process can control the sub-process to accelerate the playback of the video, or if you need to pause the video played in the current sub-process, you can control the sub-process to pause the video through the main process. That is to say, after associating the main process and the sub-process, the sub-process can be controlled through the main process.

可选地,本申请实施例中的第一处理模块包括:第三处理单元,用于绘制子进程所需的UI元素,并基于UI元素创建播放器容器View;第四处理单元,用于创建与播放器容器View关联的画布,并在画布上绘制播放器容器View。Optionally, the first processing module in the embodiment of the present application includes: a third processing unit, configured to draw UI elements required by the sub-process, and create a player container View based on the UI elements; a fourth processing unit, configured to create The canvas associated with the player container View, and the player container View is drawn on the canvas.

可见,在视频播放的过程中可以将子进程播放界面两个区域:播放器容器View和内容View。播放器容器为列表和详情页共享。在子进程面首次启动的时候,创建一个只含有播放器容器View的surface,在播放视频的时候,将内容Vie绘制到播放器容器中,来实现列表播放;当运行子进程的时候,播放器容器View动画移动到顶部,创建并加载详情页内容view;当不运行子进程的时候,将详情页内容View从surface中移除,播放器容器移动到列表中对应的位置。It can be seen that during the video playback process, the child process can play two areas of the interface: the player container View and the content View. The player container is shared between list and detail pages. When the child process surface starts for the first time, create a surface that only contains the player container View. When playing the video, draw the content Vie into the player container to realize the list playback; when the child process is running, the player The container View animation moves to the top, creates and loads the content view of the details page; when the child process is not running, removes the content View of the details page from the surface, and moves the player container to the corresponding position in the list.

如图3所示,本申请实施例提供了一种电子设备,包括处理器111、通信接口112、存储器113和通信总线114,其中,处理器111,通信接口112,存储器113通过通信总线114完成相互间的通信,As shown in Figure 3, the embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein, the processor 111, the communication interface 112, and the memory 113 are completed through the communication bus 114 mutual communication,

存储器113,用于存放计算机程序;Memory 113, used to store computer programs;

在本申请一个实施例中,处理器111,用于执行存储器113上所存放的程序时,实现前述任意一个方法实施例提供的视频的处理方法,其所起到的作用也是类似的,在此不再赘述。In one embodiment of the present application, the processor 111 is used to implement the video processing method provided by any one of the foregoing method embodiments when executing the program stored in the memory 113, and its functions are similar, here No longer.

本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如前述任意一个方法实施例提供的视频的处理方法的步骤。The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the video processing method provided in any one of the foregoing method embodiments are implemented.

需要说明的是,在本文中,诸如“第一”和“第二”等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relative terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these No such actual relationship or order exists between entities or operations. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

以上所述仅是本发明的具体实施方式,使本领域技术人员能够理解或实现本发明。对这些实施例的多种修改对本领域的技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所申请的原理和新颖特点相一致的最宽的范围。The above descriptions are only specific embodiments of the present invention, so that those skilled in the art can understand or implement the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Accordingly, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118540545A (en) * 2024-06-21 2024-08-23 广州虎牙科技有限公司 Method, device, equipment and storage medium for rendering video in client interface

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103064680A (en) * 2012-12-25 2013-04-24 北京奇虎科技有限公司 Plug-in playing method and device in browser
US20160328486A1 (en) * 2013-06-28 2016-11-10 Guangzhou Ucweg Computer Tecnology Co., Ltd. Canvas element rendering method and apparatus implemented on android system based on gpu
CN113365150A (en) * 2021-06-04 2021-09-07 上海哔哩哔哩科技有限公司 Video processing method and video processing device
US20220060607A1 (en) * 2020-06-02 2022-02-24 Oneplus Technology (Shenzhen) Co., Ltd. Method for controlling video playing, computer device and storage medium thereof
CN114245192A (en) * 2021-12-20 2022-03-25 北京数码视讯软件技术发展有限公司 Multi-process decoding playing method and device
CN114942809A (en) * 2022-05-19 2022-08-26 麒麟合盛网络技术股份有限公司 Animation display method and device
CN115022725A (en) * 2022-05-25 2022-09-06 京东城市(北京)数字科技有限公司 Video playing method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103064680A (en) * 2012-12-25 2013-04-24 北京奇虎科技有限公司 Plug-in playing method and device in browser
US20160328486A1 (en) * 2013-06-28 2016-11-10 Guangzhou Ucweg Computer Tecnology Co., Ltd. Canvas element rendering method and apparatus implemented on android system based on gpu
US20220060607A1 (en) * 2020-06-02 2022-02-24 Oneplus Technology (Shenzhen) Co., Ltd. Method for controlling video playing, computer device and storage medium thereof
CN113365150A (en) * 2021-06-04 2021-09-07 上海哔哩哔哩科技有限公司 Video processing method and video processing device
CN114245192A (en) * 2021-12-20 2022-03-25 北京数码视讯软件技术发展有限公司 Multi-process decoding playing method and device
CN114942809A (en) * 2022-05-19 2022-08-26 麒麟合盛网络技术股份有限公司 Animation display method and device
CN115022725A (en) * 2022-05-25 2022-09-06 京东城市(北京)数字科技有限公司 Video playing method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118540545A (en) * 2024-06-21 2024-08-23 广州虎牙科技有限公司 Method, device, equipment and storage medium for rendering video in client interface

Similar Documents

Publication Publication Date Title
KR102710712B1 (en) Method and device for displaying live broadcast data, device and storage medium
US11178448B2 (en) Method, apparatus for processing video, electronic device and computer-readable storage medium
JP7013466B2 (en) Application data processing methods, equipment, and computer programs
AU781357B2 (en) Methods and apparatus for managing an application according to an application lifecycle
US20040075670A1 (en) Method and system for receiving interactive dynamic overlays through a data stream and displaying it over a video content
CN111625214B (en) Audio control method, device, equipment and storage medium
CN110070496B (en) Method and device for generating image special effect and hardware device
CN106412466B (en) A kind of intelligent television system
EP1142306A1 (en) A stream device management system for multimedia clients in a broadcast network architecture
US7716685B2 (en) Pluggable window manager architecture using a scene graph system
CN109361950A (en) Video processing method, device, electronic device and storage medium
CN111741367A (en) Video interaction method and device, electronic equipment and computer readable storage medium
CN117041623A (en) Digital person live broadcasting method and device
CN110727825A (en) Animation playing control method, device, server and storage medium
CN115695888A (en) Video processing method and device and storage medium
CN113411660B (en) Video data processing method and device and electronic equipment
US7257812B1 (en) Methods and apparatus for managing an application
CN110278479A (en) A kind of image display method and television set
CN110362375A (en) Display methods, device, equipment and the storage medium of desktop data
CN116546228B (en) Plug flow method, device, equipment and storage medium for virtual scene
CN112749033B (en) Display device and system notification calling method
CN112367295B (en) Plug-in display method and device, storage medium and electronic equipment
CN115934974A (en) Multimedia data processing method, device, equipment and medium
CN113559503A (en) Video generation method, apparatus and computer readable medium
CN112433696A (en) Wallpaper display method, device, equipment and medium

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