[go: up one dir, main page]

CN108600826B - Method and device for playing TS (transport stream) - Google Patents

Method and device for playing TS (transport stream) Download PDF

Info

Publication number
CN108600826B
CN108600826B CN201810496351.4A CN201810496351A CN108600826B CN 108600826 B CN108600826 B CN 108600826B CN 201810496351 A CN201810496351 A CN 201810496351A CN 108600826 B CN108600826 B CN 108600826B
Authority
CN
China
Prior art keywords
stream
playing
audio
video
multicast
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.)
Active
Application number
CN201810496351.4A
Other languages
Chinese (zh)
Other versions
CN108600826A (en
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 Ipanel TV Inc
Original Assignee
Shenzhen Ipanel TV Inc
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 Ipanel TV Inc filed Critical Shenzhen Ipanel TV Inc
Priority to CN201810496351.4A priority Critical patent/CN108600826B/en
Publication of CN108600826A publication Critical patent/CN108600826A/en
Application granted granted Critical
Publication of CN108600826B publication Critical patent/CN108600826B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/434Disassembling of a multiplex stream, e.g. demultiplexing audio and video streams, extraction of additional data from a video stream; Remultiplexing of multiplex streams; Extraction or processing of SI; Disassembling of packetised elementary stream
    • H04N21/4341Demultiplexing of audio and video streams
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/434Disassembling of a multiplex stream, e.g. demultiplexing audio and video streams, extraction of additional data from a video stream; Remultiplexing of multiplex streams; Extraction or processing of SI; Disassembling of packetised elementary stream
    • H04N21/4345Extraction or processing of SI, e.g. extracting service information from an MPEG stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44004Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving video buffer management, e.g. video decoder buffer or video display buffer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/443OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB
    • H04N21/4431OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB characterized by the use of Application Program Interface [API] libraries
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/64Addressing
    • H04N21/6405Multicasting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/858Linking data to content, e.g. by linking an URL to a video object, by creating a hotspot
    • H04N21/8586Linking data to content, e.g. by linking an URL to a video object, by creating a hotspot by using a URL

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Library & Information Science (AREA)
  • Software Systems (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The application provides a method and a device for playing TS (transport stream), wherein the method comprises the following steps: receiving a TS stream to be played; analyzing URL parameters corresponding to the TS stream to obtain program information; program information and TS stream are led into DEMUX hardware through SDK [ API interface ] to carry out audio and video separation processing; importing the information subjected to audio and video separation processing into DECODE hardware for audio and video decoding processing; and playing the information subjected to the audio and video decoding processing. According to the method, complete program information is transmitted through the URL, and program information is prevented from being obtained by using TS (transport stream) so that time is saved; the SDKAPI interface is utilized to realize the injection and playing of the TS stream, and the high efficiency of the interface and the convenience characteristics of supporting more decoding types, high stability and the like are fully utilized, so that various media formats are decoded quickly, images are played successfully, and the user experience is improved.

Description

Method and device for playing TS (transport stream)
Technical Field
The present application relates to the field of video playing technologies, and in particular, to a method and an apparatus for playing a TS stream.
Background
In video playing and live broadcast apps, the video processing mode comprises hard decoding and soft decoding, wherein the soft decoding is a mode of enabling a CPU to decode videos through software, namely running video coding and decoding codes through the CPU; the hard decoding is a mode of handing part of video data which is originally totally handed to the CPU for processing by the GPU, and the parallel computing capability of the GPU is far higher than that of the CPU, so that the load on the CPU can be greatly reduced, and other programs can be simultaneously operated after the occupancy rate of the CPU is low. Therefore, compared with the soft solution, the hard solution of the video has the advantages of being smoother and more power-saving.
Native Media is a hard decoding method commonly used at present, but its stability problem is always troubling, which is mainly manifested in that during the use process, a local crash suddenly occurs, and it can only decode the audio and video type combination of the common and standard format, such as h.264+ AAC, but it is ineffective for other decoding formats, such as mpeg2 or ac3, and when the stream data is played, the stream data must be analyzed to the sps and pps data identification blocks, i.e. the often-called key I frame data, and otherwise, it takes a long time to decode the video picture. Therefore, these problems greatly affect the user experience, and a new way to solve these problems needs to be provided.
Disclosure of Invention
In view of this, the present application provides a method and an apparatus for playing a TS stream, so as to overcome the problems in the prior art that a hard video decoding is prone to a local crash, and the application range is narrow, the decoding process is complex, the speed is slow, and the user experience is affected.
In order to achieve the purpose, the application provides the following technical scheme:
a method of playing a TS stream, the method comprising:
receiving a TS stream to be played;
analyzing the URL parameter corresponding to the TS stream to obtain program information;
the program information and the TS stream are led into DEMUX hardware through an SDK API interface so as to carry out audio and video separation processing;
importing the information subjected to audio and video separation processing into DECODE hardware for audio and video decoding processing;
and playing the information subjected to the audio and video decoding processing.
Preferably, the receiving the TS stream to be played includes:
analyzing URL parameters corresponding to the TS stream to determine the multicast request type and establish a multicast receiving channel;
creating a bidirectional domain name socket, and adding a write-in end of the bidirectional domain name socket into a first IO multiplexer;
and when the TS stream arrives, caching the TS stream to a shared buffer area allocated by the bidirectional domain name socket.
Preferably, before the importing the program information and the TS stream into DEMUX hardware through an SDK API interface, the method further includes:
and adding a reading end of the bidirectional domain name socket into a second IO multiplexer to monitor the arrival of the TS stream.
Preferably, the analyzing the URL parameter corresponding to the TS stream to determine the multicast request type and create the multicast receiving channel includes:
and determining the multicast request type according to the prefix of the URL parameter, and establishing a multicast receiving channel according to the multicast address and the port of the URL parameter.
Preferably, the method further comprises the following steps: and when the fault occurs, stopping playing the decoded information and releasing the playing resources.
An apparatus for playing a TS stream, the apparatus comprising:
a receiving unit, configured to receive a TS stream to be played;
the analysis unit is used for analyzing the URL parameter corresponding to the TS stream to obtain program information;
the separation unit is used for guiding the program information and the TS stream into DEMUX hardware through an SDK API (software development kit) interface so as to carry out audio and video separation processing;
the decoding unit is used for guiding the information subjected to the audio and video separation processing into DECODE hardware for audio and video decoding processing;
and the playing unit is used for playing the information subjected to the audio and video decoding processing.
Preferably, the receiving unit includes:
the sub-analysis unit is used for analyzing the URL parameter corresponding to the TS stream so as to determine the multicast request type and establish a multicast receiving channel;
the device comprises a creating unit, a first IO multiplexer and a second IO multiplexer, wherein the creating unit is used for creating a bidirectional domain name socket and adding a writing end of the bidirectional domain name socket into the first IO multiplexer;
and the buffer unit is used for buffering the TS stream to a shared buffer area allocated by the bidirectional domain name socket when the TS stream arrives.
Preferably, the method further comprises the following steps:
and the monitoring unit is used for adding the reading end of the bidirectional domain name socket into a second IO multiplexer so as to monitor the arrival of the TS stream.
Preferably, the sub-parsing unit is specifically configured to determine a multicast request type according to the prefix of the URL parameter, and create a multicast receiving channel according to the multicast address and the port of the URL parameter.
Preferably, the method further comprises the following steps:
and the releasing unit is used for stopping playing the decoded information and releasing the playing resources when a fault occurs.
According to the technical scheme, the method for playing the TS stream analyzes the URL parameter corresponding to the TS stream to obtain the program information, and transmits the complete program information directly through the URL, so that the program information obtained by analyzing the TS stream is avoided, and the time is saved; the SDK API interface is used for directly realizing the injection and playing of the TS in the application, and the characteristics of high efficiency of the interface, capability of supporting more decoding types, high stability and the like are fully utilized, so that various media formats can be quickly decoded and images can be successfully played. The scheme provided by the application can realize rapid multicast stream data playing, rapidly play and display audio and video pictures, decode various media formats and improve user experience.
Drawings
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, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for playing a TS stream according to an embodiment of the present application;
fig. 2 is a flowchart of a method for playing a TS stream according to a second embodiment of the present application;
fig. 3 is a flowchart of a method for receiving a TS stream to be played according to a second embodiment of the present application;
fig. 4 is a schematic structural diagram of an apparatus for playing a TS stream according to a third embodiment of the present application;
fig. 5 is a schematic structural diagram of an apparatus for playing a TS stream according to a fourth embodiment of the present application;
fig. 6 is a schematic structural diagram of a receiving unit according to a fourth embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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 invention.
In order to overcome the problems that the video hard decoding in the prior art is easy to crash, the application range is narrow, the decoding process is complex and slow, and the user experience is influenced, the application provides a method and a device for rapidly playing TS (transport stream), and the specific scheme is as follows:
example one
A first embodiment of the present application provides a method for playing a TS stream, as shown in fig. 1, fig. 1 is a flowchart of the method for playing a TS stream provided in the first embodiment of the present application, where the method includes:
s101: receiving a TS stream to be played;
s102: analyzing URL parameters corresponding to the TS stream to obtain program information;
specifically, in the present application, the audio/video parameters are analyzed according to a URL (Uniform Resource Locator) parameter corresponding to the TS stream to be played, and the format is as follows: "program://19audio _ stream _ pid ═ 257& audio _ stream _ type ═ 256& video _ aac & video _ stream _ pid ═ video _ h264& pcr _ stream _ pid ═ 256", it is the audio video of the current program that is parsed from the format.
According to the method and the device, complete program information is directly transmitted through the URL, the program information obtained by analyzing the TS is avoided, and therefore time is saved.
S103: program information and TS stream are led into DEMUX hardware through an SDK API interface so as to carry out audio and video separation processing;
the SDK API interface is used for directly realizing the injection and playing of the TS in the application, and the characteristics of high efficiency of the interface, capability of supporting more decoding types, high stability and the like are fully utilized, so that various media formats can be quickly decoded and images can be successfully played.
S104: importing the information subjected to audio and video separation processing into DECODE hardware for audio and video decoding processing;
s105: and playing the information subjected to the audio and video decoding processing.
According to the technical scheme, the method for playing the TS stream, provided by the embodiment of the application, analyzes the URL parameter corresponding to the TS stream to obtain the program information, and directly transmits the complete program information through the URL, so that the program information obtained by analyzing the TS stream is avoided, and the time is saved; the SDK API interface is used for directly realizing the injection and playing of the TS in the application, and the characteristics of high efficiency of the interface, capability of supporting more decoding types, high stability and the like are fully utilized, so that various media formats can be quickly decoded and images can be successfully played. The scheme provided by the application can realize rapid multicast stream data playing, rapidly play and display audio and video pictures, decode various media formats and provide user experience.
Example two
On the basis of the first embodiment, a second embodiment of the present application provides a more specific method for playing a TS stream, as shown in fig. 2, fig. 2 is a flowchart of the method for playing a TS stream provided by the second embodiment of the present application, and the method includes:
s101: receiving a TS stream to be played;
specifically, as shown in fig. 3, fig. 3 is a flowchart of a method for receiving a TS stream to be played according to a second embodiment of the present application, where the method includes:
s1011: analyzing URL parameters corresponding to the TS stream to determine the multicast request type and establish a multicast receiving channel;
the steps may specifically include: and determining the multicast request type according to the prefix of the URL parameter, and establishing a multicast receiving channel according to the multicast address and the port of the URL parameter.
Specifically, in the present application, according to the URL parameter of the playback, e.g., udp://224.0.0.1:8000/media/play/1. ts? First, analyze its prefix "udp://" to confirm that this is a multicast request type. A multicast receive channel is then created based on the multicast address (e.g., "224.0.0.1" in the above parameters) and the port (e.g., "8000" after the multicast address in the above parameters). Question mark? The content of the number is passed to the play module.
It should be noted that, in the present application, the process of creating a multicast receiving channel according to a multicast address and a port includes: firstly, establishing a socket of SOCK _ DGRAM type, then binding the address of a local receiving network card according to a specified port, adding a multicast address into a multicast group, and circularly receiving multicast data.
S1012: creating a bidirectional domain name socket, and adding a write-in end of the bidirectional domain name socket into the first IO multiplexer;
in the present application, the bidirectional domain name socket is a channel for performing data interaction with the playing module. Specifically, a pair of interconnected sockets created by the socket pile can be used in the creation process, and any one section can be used as a sending end and a receiving end. There should be two buf in each socket descriptor. One for sending buf and one for accepting buf.
Advantages of creating the bidirectional domain name socket include: the special attribute of the socket can be utilized to be similar to a circular buffer area, and the size of the buffer area for sending and receiving can be adjusted; the socket is a file handle and can be added into an IO multiplexer, and a write-in end is added into the IO multiplexer, so that passive awakening of waiting for message preparation is realized, and the waste of CPU time due to active polling is avoided; the data receiving module obtains a file handle of the socket writing end, and the playing module obtains a socket reading end. Through the monitoring of the socket, the two modules of the data receiving module and the playing module can be completely independent, and the coupling between the modules is reduced.
S1013: and when the TS stream arrives, caching the TS stream to a shared buffer area distributed by the bidirectional domain name socket.
It should be noted that, in the present application, step S101 and its related auxiliary steps are all completed by the data receiving module, and the subsequent steps are completed by the playing module.
S102: analyzing URL parameters corresponding to the TS stream to obtain program information;
specifically, according to the URI parameter corresponding to the TS stream, the audio/video parameter is analyzed, and the format is as follows: "program:// 19? The audio _ stream _ pid is 257& audio _ stream _ type & audio _ aac & video _ stream _ pid & video _ h264& pcr _ stream _ pid & 256", and the audio/video of the current program is analyzed according to the format.
According to the method and the device, complete program information is directly transmitted through the URL, the program information obtained by analyzing the TS is avoided, and therefore time is saved.
And starting a player in the playing module according to the acquired program information, wherein the player can be a view developed in an application APP and realizing playing presentation and control by using JAVA, and can realize multicast data receiving and sending and finally realize a TS (transport stream) player, which is called TSPlayer for short.
The TSPlayer directly calls the SDK API interface of the set-top box to realize, and software on the general set-top box can be divided into three layers: the application layer refers to various installed application software, the framework layer encapsulates management and function logic of resources into an interface layer which is convenient for the application layer to call, the SDK layer refers to a layer which is realized by a hardware set top box manufacturer and is used for realizing an interface layer which is used for driving and is convenient for the framework layer to call, and the interface of the layer is generally called as an SDK API layer. The method and the device make full use of the convenience characteristics of the SDK API interface, and encapsulate a set of basic playing interfaces, such as creation, starting, data injection, volume adjustment, video size setting, stopping, destruction and the like.
In this embodiment, the method may further include, but need not include, step S103: adding a reading end of the bidirectional domain name socket into a second IO multiplexer to monitor the arrival of the TS stream;
specifically, a reading end of the socket is added into the IO multiplexing, and the read data is notified by monitoring the arrival of the waiting data, so that passive awakening of 'waiting message ready' is realized, and the waste of CPU time caused by active polling is avoided.
S104: program information and TS stream are led into DEMUX hardware through an SDK API interface so as to carry out audio and video separation processing;
and awakening the data reading processing flow when the data is detected to arrive, directly realizing the injection and playing of the TS (transport stream) in the application by utilizing the SDK API (software development kit) interface, and fully utilizing the characteristics of high efficiency of the interface, capability of supporting more decoding types, high stability and the like, thereby quickly decoding various media formats and successfully playing the image.
S105: importing the information subjected to audio and video separation processing into DECODE hardware for audio and video decoding processing;
s106: playing the information subjected to audio and video decoding processing;
s107: and when the fault occurs, stopping playing the decoded information and releasing the playing resources.
The method for playing the TS stream provided in the embodiment of the present application utilizes the rich audio/video decoding format supported by the platform SDK API, and quickly and stably implements a set of high-efficiency TS stream data playing function of the multicast source. Complete program information is directly transmitted through the URL, so that the program information obtained by analyzing the TS is avoided, and time is saved; the SDK API interface is used for directly realizing the injection and playing of the TS in the application, and the characteristics of high efficiency of the interface, capability of supporting more decoding types, high stability and the like are fully utilized, so that various media formats can be quickly decoded and images can be successfully played. The scheme provided by the application can realize rapid multicast stream data playing, rapidly play and display audio and video pictures, decode various media formats and improve user experience.
EXAMPLE III
On the basis of the first embodiment, a third embodiment of the present application provides a device for playing a TS stream, as shown in fig. 4, and fig. 4 is a schematic structural diagram of the device for playing a TS stream provided by the third embodiment of the present application. The device includes:
a receiving unit 201, configured to receive a TS stream to be played;
the parsing unit 202 is configured to parse the URL parameter corresponding to the TS stream to obtain program information;
the separation unit 203 is configured to introduce the program information and the TS stream into DEMUX hardware through an SDK API interface to perform audio and video separation processing;
the decoding unit 204 is configured to guide the information subjected to the audio/video separation processing into DECODE hardware for audio/video decoding processing;
and the playing unit 205 is configured to play the information after the audio/video decoding processing.
According to the technical scheme, the device for playing the TS stream provided by the third embodiment of the application is used for transmitting complete program information through the URL, so that the program information obtained by analyzing the TS stream is avoided, and the time is saved; the SDK API interface is used for directly realizing the injection and playing of the TS in the application, and the characteristics of high efficiency of the interface, capability of supporting more decoding types, high stability and the like are fully utilized, so that various media formats can be quickly decoded and images can be successfully played. The scheme provided by the application can realize rapid multicast stream data playing, rapidly play and display audio and video pictures, decode various media formats and improve user experience.
Example four
A fourth embodiment of the present application provides a more specific apparatus for playing a TS stream, as shown in fig. 5, fig. 5 is a schematic structural diagram of the apparatus for playing a TS stream provided in the fourth embodiment of the present application. The device includes:
a receiving unit 201, configured to receive a TS stream to be played;
as shown in fig. 6, fig. 6 is a schematic structural diagram of a receiving unit according to a fourth embodiment of the present application. The receiving unit includes:
a sub-parsing unit 2011, configured to parse the URL parameter corresponding to the TS stream to determine the multicast request type and create a multicast receiving channel;
the sub-analysis unit is specifically configured to determine a multicast request type according to the prefix of the URL parameter, and create a multicast receiving channel according to the multicast address and the port of the URL parameter.
A creating unit 2012, configured to create a bidirectional domain name socket, and add a write end of the bidirectional domain name socket to the first IO multiplexer;
the write-in end is added to IO multiplexing, so that passive awakening of waiting for message readiness is realized, and the waste of CPU time due to active polling is avoided.
The buffer unit 2013 is configured to buffer the TS stream to a shared buffer allocated to the bidirectional domain name socket when the TS stream arrives.
It should be noted that the receiving unit and several attached sub-units all belong to a data receiving module, that is, a function for completing data reception.
The parsing unit 202 is configured to parse the URL parameter corresponding to the TS stream to obtain program information;
according to the method and the device, complete program information is directly transmitted through the URL, the program information obtained by analyzing the TS is avoided, and therefore time is saved.
In this implementation, there may also, but need not necessarily, be included: and a monitoring unit 203, configured to add a read end of the bidirectional domain name socket to the second IO multiplexer to monitor arrival of the TS stream.
Specifically, a reading end of the socket is added into the IO multiplexing, and the read data is notified by monitoring the arrival of the waiting data, so that passive awakening of 'waiting message ready' is realized, and the waste of CPU time caused by active polling is avoided.
The separation unit 204 is configured to introduce the program information and the TS stream into DEMUX hardware through an SDK API interface to perform audio and video separation processing;
the decoding unit 205 is configured to import the information subjected to the audio/video separation processing into DECODE hardware for audio/video decoding processing;
and the playing unit 206 is configured to play the information after the audio/video decoding processing.
A releasing unit 207, configured to stop playing the decoded information and release the playing resource when a failure occurs.
According to the technical scheme, the device for playing the TS stream provided by the fourth embodiment of the present application utilizes the rich audio/video decoding format supported by the platform SDKAPI to quickly and stably implement a set of high-efficiency TS stream data playing function of the multicast source. Complete program information is directly transmitted through the URL, so that the program information obtained by analyzing the TS is avoided, and time is saved; the SDK API interface is used for directly realizing the injection and playing of the TS in the application, and the characteristics of high efficiency of the interface, capability of supporting more decoding types, high stability and the like are fully utilized, so that various media formats can be quickly decoded and images can be successfully played. The scheme provided by the application can realize rapid multicast stream data playing, rapidly play and display audio and video pictures, decode various media formats and improve user experience.
It should be noted that the same or similar parts in the embodiments of the present application may be mutually referred, and are not repeated in the present application.
Finally, it should also be noted that, herein, 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 phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. 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 application. Thus, the present application 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 (6)

1. A method for playing a TS stream, the method comprising:
receiving a TS stream to be played;
analyzing the URL parameter corresponding to the TS stream to obtain program information;
the program information and the TS stream are led into DEMUX hardware through an SDK API interface so as to carry out audio and video separation processing; wherein, through the interface encapsulation interface of SDK API broadcast, the interface of broadcast includes: creating, starting, data injection, volume adjustment, video size setting, stopping and destroying;
importing the information subjected to audio and video separation processing into DECODE hardware for audio and video decoding processing;
playing the information subjected to audio and video decoding processing;
wherein, the receiving the TS stream to be played comprises:
analyzing URL parameters corresponding to the TS stream to determine the multicast request type and establish a multicast receiving channel;
creating a bidirectional domain name socket, adding a writing end of the bidirectional domain name socket into an IO multiplexer, and realizing passive awakening through the IO multiplexer so as to trigger the receiving of the TS from a reading end of the bidirectional domain name socket;
when the TS stream arrives, caching the TS stream to a shared buffer area allocated by the bidirectional domain name socket;
the analyzing the URL parameter corresponding to the TS stream to determine the multicast request type and create a multicast receiving channel includes:
and determining the multicast request type according to the prefix of the URL parameter, and establishing a multicast receiving channel according to the multicast address and the port of the URL parameter.
2. The method of claim 1, prior to said importing said program information and said TS stream into DEMUX hardware via an SDK API interface, further comprising:
and adding a reading end of the bidirectional domain name socket into a second IO multiplexer to monitor the arrival of the TS stream.
3. The method of claim 1, further comprising: and when the fault occurs, stopping playing the decoded information and releasing the playing resources.
4. An apparatus for playing a TS stream, the apparatus comprising:
a receiving unit, configured to receive a TS stream to be played;
the analysis unit is used for analyzing the URL parameter corresponding to the TS stream to obtain program information;
the separation unit is used for guiding the program information and the TS stream into DEMUX hardware through an SDK API (software development kit) interface so as to carry out audio and video separation processing; wherein, through the interface encapsulation interface of SDK API broadcast, the interface of broadcast includes: creating, starting, data injection, volume adjustment, video size setting, stopping and destroying;
the decoding unit is used for guiding the information subjected to the audio and video separation processing into DECODE hardware for audio and video decoding processing;
the playing unit is used for playing the information subjected to the audio and video decoding processing;
wherein the receiving unit includes:
the sub-analysis unit is used for analyzing the URL parameter corresponding to the TS stream so as to determine the multicast request type and establish a multicast receiving channel;
the creating unit is used for creating a bidirectional domain name socket, adding a writing end of the bidirectional domain name socket into an IO multiplexer, and realizing passive awakening through the IO multiplexer so as to trigger the receiving of the TS stream from a reading end of the bidirectional domain name socket;
the buffer unit is used for buffering the TS stream to a shared buffer area allocated by the bidirectional domain name socket when the TS stream arrives;
the sub-analysis unit is specifically configured to determine a multicast request type according to the prefix of the URL parameter, and create a multicast receiving channel according to the multicast address and the port of the URL parameter.
5. The apparatus of claim 4, further comprising:
and the monitoring unit is used for adding the reading end of the bidirectional domain name socket into a second IO multiplexer so as to monitor the arrival of the TS stream.
6. The apparatus of claim 4, further comprising:
and the releasing unit is used for stopping playing the decoded information and releasing the playing resources when a fault occurs.
CN201810496351.4A 2018-05-22 2018-05-22 Method and device for playing TS (transport stream) Active CN108600826B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810496351.4A CN108600826B (en) 2018-05-22 2018-05-22 Method and device for playing TS (transport stream)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810496351.4A CN108600826B (en) 2018-05-22 2018-05-22 Method and device for playing TS (transport stream)

Publications (2)

Publication Number Publication Date
CN108600826A CN108600826A (en) 2018-09-28
CN108600826B true CN108600826B (en) 2021-04-20

Family

ID=63632583

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810496351.4A Active CN108600826B (en) 2018-05-22 2018-05-22 Method and device for playing TS (transport stream)

Country Status (1)

Country Link
CN (1) CN108600826B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113596495B (en) * 2021-07-28 2023-11-24 广州方硅信息技术有限公司 Live broadcast push stream processing method and device, equipment and medium thereof
CN114546679B (en) * 2022-02-14 2025-03-14 广东小天才科技有限公司 Direct calling method, device, equipment and medium of hidden API in Android system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101202919A (en) * 2007-11-06 2008-06-18 深圳市同洲电子股份有限公司 Digital television receiver and intermediate part
CN105744380A (en) * 2016-02-25 2016-07-06 深圳创维数字技术有限公司 Media data stream playing method and system based on Android system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040230659A1 (en) * 2003-03-12 2004-11-18 Chase Michael John Systems and methods of media messaging
US20130218663A1 (en) * 2010-06-07 2013-08-22 Affectiva, Inc. Affect based political advertisement analysis
CN103796078A (en) * 2014-01-23 2014-05-14 深圳创维-Rgb电子有限公司 Multicast video playing method and video playing terminal
US11057446B2 (en) * 2015-05-14 2021-07-06 Bright Data Ltd. System and method for streaming content from multiple servers
CN105898496A (en) * 2015-11-18 2016-08-24 乐视网信息技术(北京)股份有限公司 HLS stream hardware decoding method based on Android device and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101202919A (en) * 2007-11-06 2008-06-18 深圳市同洲电子股份有限公司 Digital television receiver and intermediate part
CN105744380A (en) * 2016-02-25 2016-07-06 深圳创维数字技术有限公司 Media data stream playing method and system based on Android system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘国梁等.Mini GUI 在数字电视机顶盒中的应用.《中国有限电视》.2005,(第14期), *

Also Published As

Publication number Publication date
CN108600826A (en) 2018-09-28

Similar Documents

Publication Publication Date Title
US8788933B2 (en) Time-shifted presentation of media streams
US11356749B2 (en) Track format for carriage of event messages
CN107666619B (en) Live data transmission method, device, electronic device, server and storage medium
CN102630059B (en) A kind of method and device realizing FLV video playback
US10177958B2 (en) Method for synchronously taking audio and video in order to proceed one-to-multi multimedia stream
CN104796796B (en) Improve the fault-tolerant method of the HLS streaming players of Android platform
WO2018054193A1 (en) Data transmission method and apparatus, and electronic device
US9369508B2 (en) Method for transmitting a scalable HTTP stream for natural reproduction upon the occurrence of expression-switching during HTTP streaming
CN103210660A (en) Receiver device, receiving method, program, and broadcasting system
US10880024B2 (en) Reception device, transmission device, and data processing method
CN103428462A (en) Method and device for processing multichannel audio and video
CN102625193B (en) A method of realizing multimedia file network playing by virtue of auxiliary files
CN101621342A (en) Method for realizing network TV program carousel based on real-time transport protocol
CN111510755A (en) Audio and video switching method and device, computer equipment and readable storage medium
US20120240180A1 (en) Set-top box, earphone, and multimedia playing method
US20200119823A1 (en) Reception device, transmission device, and data processing method
EP3741132A1 (en) Processing dynamic web content of an iso bmff web resource track
CN113938470A (en) Method and device for playing RTSP data source by browser and streaming media server
CN115623264A (en) Subtitle processing method and device for live stream, and playing method and device for live stream
CN117376593A (en) Subtitle processing method, device, storage medium and computer equipment for live streaming
CN108600826B (en) Method and device for playing TS (transport stream)
US10999646B2 (en) Information presenting method, terminal device, server and system
CN112243158B (en) Media file processing method and device, computer readable medium and electronic equipment
CN117041652A (en) Video recording method and device based on browser, electronic equipment and storage medium
CN103237215A (en) Playing method and playing device

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
GR01 Patent grant
GR01 Patent grant