A method, device and storage medium for invoking a multimedia device
By defining a unique call communication interface in the multimedia device and using serialization and reflection mechanisms, the cross-process and cross-device call compatibility issues are resolved, the maintenance process is simplified, and the calling efficiency and compatibility of the multimedia device are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- FUJIAN STAR NET EVIDEO INFORMATION SYST CO LTD
- Filing Date
- 2023-12-28
- Publication Date
- 2026-06-12
AI Technical Summary
Multimedia device function calls cannot simultaneously support cross-process and cross-device calls, resulting in poor compatibility and a large maintenance workload during system upgrades.
Define a unique call communication interface, transmit call information through a serialized byte array, communicate using a cross-process language or TCP/HTTP protocol, and call functions through reflection. Function code is automatically generated and packaged and provided as an AAR package or cloud repository.
It achieves cross-process and cross-device call compatibility and flexibility, reduces the maintenance workload during system upgrades, and improves function call efficiency and compatibility.
Smart Images

Figure CN117998164B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a multimedia device, a calling method, and a storage medium. Background Technology
[0002] In multimedia devices (such as set-top boxes and other video-on-demand devices), in addition to basic song selection functions, various auxiliary applications related to song selection are also installed. Furthermore, to improve the ease of use of song selection and other operations, in addition to performing song selection and other operations directly on the multimedia device, users can also connect to the multimedia device via tablets, mobile phones, and other devices to perform song selection and related auxiliary operations.
[0003] Therefore, multimedia devices need to provide functions (i.e., interfaces) that can be called externally to facilitate access by other devices (such as tablets and mobile phones) or applications. In existing technologies, the functions provided by multimedia devices cannot simultaneously satisfy both cross-process and cross-device remote calls; that is, only one of these two options can be chosen. Furthermore, the compatibility of these functions is poor. When the multimedia device system is upgraded, devices that rely on the interfaces provided by the system need to be recompiled and upgraded, resulting in a significant maintenance workload. Summary of the Invention
[0004] In view of the above problems, this application provides a multimedia device, a calling method, and a storage medium to solve the technical problems of poor flexibility in using functions that allow external calls and huge maintenance workload.
[0005] To achieve the above objectives, the inventors provide a method for invoking a multimedia device, comprising the following steps:
[0006] The multimedia device defines a call communication interface, which transmits call information through a serialized byte array.
[0007] The multimedia device receives the call information through the call communication interface and performs deserialization processing on the call information to obtain the name and parameters of the function to be called;
[0008] The multimedia device calls the function according to the function name, obtains the function's execution result, and returns the execution result to the requesting end after serialization processing through the call communication interface.
[0009] Furthermore, the communication interface is invoked using a cross-process language for communication or using the TCP / HTTP protocol for cross-device communication.
[0010] Furthermore, the multimedia device defines a unique call communication interface.
[0011] Furthermore, the functions that can be invoked in the multimedia device are automatically generated through the following steps:
[0012] Add callable annotations to functions that are allowed to be called in multimedia devices;
[0013] During the code compilation phase of the multimedia device, javapoet and / or annotationProcessor are used to compile functions annotated with the aforementioned annotations to generate function call code.
[0014] Furthermore, the multimedia device encapsulates the function call code in an AAR package for the requesting client to call; or the multimedia device mounts the function call code in a cloud repository for the requesting client to call.
[0015] Furthermore, the serialization process includes any one of JSON, Protocol Buffers, or a custom serialization method.
[0016] Furthermore, it also includes the following steps:
[0017] The multimedia device actively pushes callback information to the requesting client through the communication interface based on the subscription information of the requesting client.
[0018] The requesting end deserializes the callback information to obtain the callback function name and parameters; executes the callback function, and serializes the result of the callback function before sending it to the multimedia device.
[0019] To address the aforementioned technical problems, this application also provides another technical solution:
[0020] A multimedia device, the multimedia device defining a call communication interface, the call communication interface transmitting call information through a serialized byte array;
[0021] The system receives call information from the call communication interface and performs deserialization on the call information to obtain the name and parameters of the function to be called.
[0022] The function is called according to the function name, the result of the function is obtained, and the result is serialized through the call communication interface and returned to the requesting end.
[0023] Furthermore, the communication interface is invoked using a cross-process language for communication or using the TCP / HTTP protocol for cross-device communication.
[0024] Furthermore, the multimedia device defines a unique communication interface.
[0025] Furthermore, the multimedia device includes multiple functions that can be called, and the functions that can be called are annotated with callable annotations;
[0026] The call code for the permitted functions is generated during the code compilation phase of the multimedia device by using javapoet and / or annotationProcessor to compile functions annotated with the aforementioned annotations.
[0027] Furthermore, the multimedia device encapsulates the function call code in an AAR package for the requesting client to call; or the multimedia device mounts the function call code in a cloud repository for the requesting client to call.
[0028] Furthermore, the multimedia device is also used to actively push callback information to the requesting end through the communication interface based on the subscription information of the requesting end; and to receive the execution result of the callback function sent by the requesting end.
[0029] To address the aforementioned technical problems, this application also provides another technical solution:
[0030] A computer-readable storage medium storing a computer program, which, when executed, performs a method for invoking a multimedia device as described in any of the technical solutions.
[0031] Unlike existing technologies, the above-mentioned technical solution defines a unique call communication interface for multimedia devices. That is, only this one call communication interface is defined. The call communication interface transmits call information using a serialized byte array, thereby ensuring the security of call information during transmission. This call communication interface can choose to use a cross-process language for communication or use the TCP / HTTP protocol for cross-device communication, depending on the relationship between the call requesting end and the multimedia device, thus being compatible with both cross-process calls and cross-device remote calls.
[0032] Furthermore, after deserializing the byte array to obtain the name of the function to be called, this technical solution calls the corresponding function through reflection (i.e., finding and calling the function based on its name). Therefore, when upgrading multimedia device systems, there is no need to rewrite and upgrade devices that depend on these functions, which can improve function compatibility and facilitate daily maintenance.
[0033] The above description of the invention is merely an overview of the technical solution of this application. In order to enable those skilled in the art to better understand the technical solution of this application and to implement it based on the description and drawings, and to make the above-mentioned objectives and other objectives, features and advantages of this application easier to understand, the following description is provided in conjunction with the specific embodiments and drawings of this application. Attached Figure Description
[0034] The accompanying drawings are only used to illustrate the principles, implementation methods, applications, features, and effects of specific embodiments of the present invention and other related contents, and should not be considered as limitations on this application.
[0035] In the accompanying drawings of the instruction manual:
[0036] Figure 1 A flowchart illustrating the method for invoking the multimedia device as described in a specific implementation;
[0037] Figure 2 This is an interactive flowchart of the function call process described in a specific implementation method;
[0038] Figure 3 This is a flowchart illustrating the interaction process when actively pushing callback information, as described in the specific implementation method.
[0039] Figure 4 This is a schematic diagram of the multimedia device described in a specific embodiment;
[0040] Figure 5 A schematic diagram of the computer-readable storage medium described in a specific embodiment;
[0041] The reference numerals used in the above figures are explained as follows:
[0042] 400. Multimedia devices; 500. Computer-readable storage media; Detailed Implementation
[0043] To illustrate the possible application scenarios, technical principles, implementable specific solutions, and achievable objectives and effects of this application in detail, the following description, in conjunction with the listed specific embodiments and accompanying drawings, provides a detailed explanation. The embodiments described herein are merely illustrative of the technical solutions of this application and are therefore intended to limit the scope of protection of this application.
[0044] In this document, the term "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The term "embodiment" appearing in various places throughout the specification does not necessarily refer to the same embodiment, nor does it specifically limit its independence or connection with other embodiments. In principle, in this application, as long as there are no technical contradictions or conflicts, the technical features mentioned in each embodiment can be combined in any way to form corresponding implementable technical solutions.
[0045] Unless otherwise defined, the technical terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the use of related terms herein is merely for the purpose of describing particular embodiments and is not intended to limit this application.
[0046] In the description of this application, the term "and / or" is used to describe the logical relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A exists, B exists, and A and B exist simultaneously. Additionally, the character " / " in this document generally indicates that the preceding and following objects have an "or" logical relationship.
[0047] In this application, terms such as “first” and “second” are used only to distinguish one entity or operation from another, and do not necessarily require or imply any actual quantity, hierarchy or order relationship between these entities or operations.
[0048] Without further limitations, the use of terms such as “comprising,” “including,” “having,” or other similar open-ended expressions in this application is intended to cover non-exclusive inclusion, which does not exclude the presence of additional elements in a process, method, or product that includes the stated elements, such that a process, method, or product that includes a list of elements may include not only those defined elements but also other elements not expressly listed, or elements inherent to such a process, method, or product.
[0049] Similar to the understanding in the Examination Guidelines, in this application, expressions such as "greater than," "less than," and "exceeding" are understood to exclude the stated number; expressions such as "above," "below," and "within" are understood to include the stated number. Furthermore, in the description of the embodiments in this application, "multiple" means two or more (including two), and similar expressions related to "multiple" are also understood in this way, such as "multiple groups" and "multiple times," unless otherwise explicitly specified.
[0050] In the description of the embodiments of this application, the space-related expressions used, such as "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "vertical," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential," indicate the orientation or positional relationship based on the orientation or positional relationship shown in the specific embodiments or drawings. They are only for the purpose of describing the specific embodiments of this application or for the reader's understanding, and do not indicate or imply that the device or component referred to must have a specific position, a specific orientation, or be constructed or operated in a specific orientation. Therefore, they should not be construed as limitations on the embodiments of this application.
[0051] Unless otherwise expressly specified or limited, the terms "installation," "connection," "linking," "fixing," and "setting," as used in the description of the embodiments of this application, should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral setting; it can be a mechanical connection, an electrical connection, or a communication connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be the internal connection of two components or the interaction between two components. For those skilled in the art to which this application pertains, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.
[0052] This embodiment provides a method for invoking a multimedia device. This method can be applied to on-demand devices or other multimedia playback devices, such as set-top boxes. The multimedia device can be used in digital entertainment venues like KTVs and bars, as well as in homes.
[0053] Please see Figure 1 The method for invoking a multimedia device in this embodiment includes the following steps:
[0054] S101. The multimedia device defines a call communication interface, which transmits call information through a serialized byte array.
[0055] S102. The multimedia device receives the call information through the call communication interface and performs deserialization processing on the call information to obtain the name and parameters of the function to be called.
[0056] S103. The multimedia device calls a function according to the function name, obtains the running result of the function, and returns the running result to the requesting end of the call after serialization processing through the call communication interface.
[0057] In some preferred embodiments, the multimedia device in step S101 may define a unique call communication interface. A unique call communication interface means that the multimedia device has only one call communication interface, rather than multiple different call communication interfaces. The call communication interface refers to the communication port used for interface calls; all interface calls on this multimedia device are implemented through this call communication interface. It should be noted that the multimedia device may have multiple other communication interfaces. For example, for networking, the multimedia device may have a network interface, or for connecting to other devices such as speakers, the multimedia device may have a serial port or a USB port, etc.
[0058] In step S101, the call communication interface transmits call information through a serialized byte array, wherein the byte array includes multiple bytes, and different bytes are defined to record the function name, parameters, verification information, etc. of the called function.
[0059] In use, the function name, parameters, and verification information of the function to be called are filled into the byte array of the communication interface, and then serialized before being transmitted through the communication interface. The serialization process includes any one of JSON, Protocol Buffers, or a custom serialization method. In step S102, after the multimedia device receives the call information through the communication interface, it performs deserialization to obtain the original byte array, from which it retrieves information related to the interface call, such as the function name, parameters, and verification information. Using a serialized byte array to transmit call information through the communication interface improves the security of call information transmission and reduces the probability of tampering.
[0060] In one specific embodiment, the communication interface call in step S101 uses either a cross-process language for communication or the TCP / HTTP protocol for cross-device communication. After obtaining the original byte array, the multimedia device determines whether to perform a cross-process call or a cross-device call based on the function name to be called. When a cross-process call is required, a cross-process language is used for communication; when a cross-device call is required, the TCP / HTTP protocol is used for cross-device communication. TCP is a connection-oriented, reliable, byte-stream-based transport layer communication protocol. TCP packages user data into segments, and after sending them, it starts a timer. The receiving end acknowledges the received data, reorders out-of-order data, and discards duplicate data.
[0061] Inter-process communication (IPC) is a language that enables communication between processes, especially in scenarios involving multiple concurrent processes. AIDL allows a process to access data in another process and even call its methods. Therefore, in this embodiment, calling the communication interface can simultaneously support cross-process or cross-device communication.
[0062] like Figure 2 The diagram illustrates a function call flowchart between a multimedia device and a client in a specific embodiment. The server is the multimedia device, and the client can be a smartphone, tablet, or other smart device. Before making a function call, the server (i.e., the multimedia device) predefines the communication interface. During the function call, the client fills the function name, parameter list, and other information into a byte array, serializes the byte data, and sends the serialized byte array to the server. Upon receiving the call information, the server first deserializes the byte array to obtain the original text, then extracts the function name from it; finally, it uses reflection to retrieve the function to be called based on the function name. This reflection involves comparing the function name with the functions allowed by the server to ultimately obtain the function that matches the name.
[0063] After receiving the function call, the server runs the function and imports the parameter list to obtain the result. The server then serializes the return value and sends it to the client. In some embodiments, the function call may not return a value; the result is directly displayed on the server. For example, when the client calls the song-switching function, the server simply switches the playing song to the next one without generating a return value and sending it to the client.
[0064] In this embodiment, the multimedia device can use a single communication interface for convenient and unified management. Furthermore, by using a byte array to transmit call information, the number of bytes can be modified only when information such as the function name is changed, ensuring compatibility and flexibility in function calls. The communication interface can also support cross-process or cross-device communication simultaneously.
[0065] Assuming each function defines a corresponding communication interface, if a multimedia device adds or removes a function, a device relying on the old function interface will encounter an undefined exception if it calls the removed interface. Furthermore, if AIDL implements multiple communication interfaces, the interface calls are related to the order in which they are defined, depending on the implementation mechanism. If interfaces are added or removed, devices relying on the old AIDL interfaces must be recompiled to correctly call the correct interface, significantly increasing the workload.
[0066] This invention ensures that call information is transmitted to the multimedia device and a definite result is returned by using only a single interactive call communication interface. Simultaneously, the called function can be controlled within this single call communication interface to prevent the invocation of outdated functions that could affect system stability.
[0067] Multimedia devices typically include multiple functions (i.e., external interfaces) that can be called externally. These include functions like song selection, song skipping, and volume control. During use, the mobile phone is bound to the multimedia device, and these functions are invoked via the communication interface to perform operations such as song selection, song skipping, and volume control. However, in current technology, writing extensive code is required to call these functions, and the functionality may fail when the functions are modified or changed.
[0068] Therefore, in order to reduce the workload of writing functions and facilitate later maintenance, in one embodiment, the functions that can be called in the multimedia device are automatically generated through the following steps:
[0069] Add callable annotations to functions that are allowed to be called in multimedia devices;
[0070] During the code compilation phase of the multimedia device, javapoet and / or annotationProcessor are used to compile functions annotated with the aforementioned annotations to generate function call code.
[0071] Javapoet is a Java API used to generate Java source files. During code comment processing, it can directly generate code without writing boilerplate code, reducing the amount of code writing. Furthermore, Javapoet retains a single, true source for the original data, ensuring that the function can still be called even if it changes. The annotationProcessor is a tool of javac used to scan and process annotations at compile time. Through annotationProcessor, relevant information about the annotation and the annotated object can be obtained, and Java code can be automatically generated based on the annotation, eliminating manual writing and improving coding efficiency. Therefore, in this embodiment, annotation and code generation technologies simplify the client's interface calling process and improve code maintainability.
[0072] In one embodiment, the multimedia device encapsulates the function call code in an AAR package for the requesting client to call; or the multimedia device mounts the function call code in a cloud repository for the requesting client to call.
[0073] The aar (Android Archive) package is a binary archive file of an Android library project. It encapsulates the functions that can be called into an aar package, allowing for quick use of the corresponding code so that it can be called by clients or other applications.
[0074] The cloud repository can be a Maven repository. Users can remotely access the Maven repository and call the corresponding functions by entering the function name and parameters. Maven can obtain the function's JAR file through a configuration file (pom.xml), eliminating the need to manually add the function's JAR file. During use, the Maven repository only needs to declare the coordinates of these functions. When needed (e.g., during compilation), Maven will automatically find the function in the repository based on its coordinates and use it. Therefore, in this embodiment, function calling efficiency can be improved, and later maintenance is also facilitated.
[0075] like Figure 3 As shown, in one embodiment, the method for invoking a multimedia device further includes the step of:
[0076] The multimedia device actively pushes callback information to the requesting client through the communication interface based on the subscription information of the requesting client.
[0077] The requesting end deserializes the callback information to obtain the callback function name and parameters; executes the callback function, and serializes the result of the callback function before sending it to the multimedia device.
[0078] Once a client subscribes to information from the server, the server can implement a subscription-push mechanism. This mechanism allows the client to proactively receive information from the server and, based on this, enables the server to call back to the client's interface, i.e., the server to call functions that are allowed to be invoked on the client.
[0079] like Figure 4 As shown, in one embodiment, a multimedia device 400 is provided. The multimedia device 400 defines a call communication interface, which transmits call information through a serialized byte array.
[0080] The system receives call information from the call communication interface and performs deserialization on the call information to obtain the name and parameters of the function to be called.
[0081] The function is called according to the function name, the result of the function is obtained, and the result is serialized through the call communication interface and returned to the requesting end.
[0082] In one embodiment, the communication interface is invoked to communicate using a cross-process language or to communicate across devices using the TCP / HTTP protocol, as required.
[0083] The multimedia device 400 can define a unique call communication interface. A unique call communication interface means that the multimedia device has only one call communication interface, rather than multiple different call communication interfaces. The call communication interface transmits call information through a serialized byte array, where the byte array includes multiple bytes, and different bytes are defined to record the function name, parameters, verification information, etc., of the called function.
[0084] When using this service, the function name, parameters, and verification information of the function to be called are filled into the byte array of the communication interface. Then, the data undergoes serialization before being transmitted via the communication interface. The serialization process includes any one of JSON, Protocol Buffers, or a custom serialization method.
[0085] After receiving the original byte array, the multimedia device will determine whether to perform a cross-process call or a cross-device call based on the name of the function to be called. When a cross-process call is required, a cross-process language is used for communication; when a cross-device call is required, the TCP / HTTP protocol is used for cross-device communication.
[0086] In one embodiment, the multimedia device employs a unique call communication interface, which enables function calls to be compatible and flexible, and the call communication interface can simultaneously support cross-process or cross-device communication.
[0087] In one embodiment, the multimedia device includes a plurality of callable functions, each of which is annotated with a callable annotation;
[0088] The call code for the permitted functions is generated during the code compilation phase of the multimedia device by using javapoet and / or annotationProcessor to compile functions annotated with the aforementioned annotations.
[0089] In this embodiment, annotation and code generation techniques are used to simplify the process of client calling the interface and improve code maintainability.
[0090] In one embodiment, the multimedia device encapsulates the function call code in an AAR package for the requesting client to call; or the multimedia device mounts the function call code in a cloud repository for the requesting client to call.
[0091] In this embodiment, the functions that can be called are encapsulated in an AAR package or mounted in a cloud repository, allowing for quick use of the corresponding code to facilitate calls by clients or other applications.
[0092] In one embodiment, the multimedia device is further configured to proactively push callback information to the requesting end through the communication interface based on the subscription information of the requesting end; and to receive the execution result of the callback function sent by the requesting end.
[0093] like Figure 5 As shown, in another embodiment, a computer-readable storage medium 500 is provided, which stores a computer program. When the computer program is run, it executes the multimedia device invocation method described in any of the above embodiments.
[0094] Finally, it should be noted that although the above embodiments have been described in the text and drawings of this application, this should not limit the scope of patent protection of this application. Any technical solutions that are based on the essential concept of this application and utilize the content described in the text and drawings of this application, resulting in equivalent structural or procedural substitutions or modifications, as well as the direct or indirect application of the technical solutions of the above embodiments to other related technical fields, are all included within the scope of patent protection of this application.
Claims
1. A method for invoking a multimedia device, characterized in that, Includes the following steps: The multimedia device defines a unique call communication interface. All interface calls on this multimedia device are implemented through the call communication interface. The call communication interface transmits call information through a serialized byte array. The serialization process includes any one of JSON, Protocol Buffers, or a custom serialization method. The multimedia device receives the call information through the call communication interface and performs deserialization processing on the call information to obtain the name and parameters of the function to be called; The multimedia device calls a function according to the function name, obtains the function's execution result, and returns the execution result to the requesting end after serialization through the call communication interface. The communication interface is used for communication via a cross-process language or for cross-device communication via TCP / HTTP protocol. The multimedia device determines whether to make a cross-process call or a cross-device call based on the name of the function to be called. When a cross-process call is required, a cross-process language is used for communication; when a cross-device call is required, TCP / HTTP protocol is used for cross-device communication.
2. The method for invoking a multimedia device according to claim 1, characterized in that, The functions that can be invoked in the multimedia device are automatically generated through the following steps: Add callable annotations to functions that are allowed to be called in multimedia devices; During the code compilation phase of the multimedia device, javapoet and / or annotationProcessor are used to compile functions annotated with the aforementioned annotations to generate function call code.
3. The method for invoking a multimedia device according to claim 2, characterized in that, The multimedia device encapsulates the function call code in an aar package for the requesting end to call; Alternatively, the multimedia device may mount the function's calling code in a cloud repository so that the requesting end can invoke it.
4. The method for invoking a multimedia device according to claim 1, characterized in that, It also includes the following steps: The multimedia device actively pushes callback information to the requesting client through the communication interface based on the subscription information of the requesting client. After the requesting end performs deserialization processing on the callback information, it obtains the callback function name and parameters; The callback function is executed, and the result of the callback function is serialized and sent to the multimedia device.
5. A multimedia device, characterized in that, The multimedia device defines a unique call communication interface. All interface calls on this multimedia device are implemented through the call communication interface. The call communication interface transmits call information through a serialized byte array. The serialization process includes any one of JSON, Protocol Buffers, or a custom serialization method. The system receives call information from the call communication interface and performs deserialization on the call information to obtain the name and parameters of the function to be called. The function is called according to the function name, the result of the function is obtained, and the result is serialized through the call communication interface and returned to the requesting end. The communication interface is used for communication via a cross-process language or for cross-device communication via TCP / HTTP protocol. The multimedia device determines whether to make a cross-process call or a cross-device call based on the name of the function to be called. When a cross-process call is required, a cross-process language is used for communication; when a cross-device call is required, TCP / HTTP protocol is used for cross-device communication.
6. The multimedia device according to claim 5, characterized in that, The multimedia device includes multiple functions that are allowed to be called, and the functions that are allowed to be called are marked with annotations indicating that they can be called; The call code for the permitted functions is generated during the code compilation phase of the multimedia device by using javapoet and / or annotationProcessor to compile functions annotated with the aforementioned annotations.
7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is run, it executes the method for invoking the multimedia device as described in any one of claims 1 to 4.