[go: up one dir, main page]

CN105744380B - A kind of media data flow playback method and system based on android system - Google Patents

A kind of media data flow playback method and system based on android system Download PDF

Info

Publication number
CN105744380B
CN105744380B CN201610103442.8A CN201610103442A CN105744380B CN 105744380 B CN105744380 B CN 105744380B CN 201610103442 A CN201610103442 A CN 201610103442A CN 105744380 B CN105744380 B CN 105744380B
Authority
CN
China
Prior art keywords
multicast
stream
android system
data
multicast channel
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.)
Expired - Fee Related
Application number
CN201610103442.8A
Other languages
Chinese (zh)
Other versions
CN105744380A (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 Skyworth Digital Technology Co Ltd
Shenzhen Skyworth Software Co Ltd
Original Assignee
Shenzhen Skyworth Digital Technology Co Ltd
Shenzhen Skyworth Software 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 Skyworth Digital Technology Co Ltd, Shenzhen Skyworth Software Co Ltd filed Critical Shenzhen Skyworth Digital Technology Co Ltd
Priority to CN201610103442.8A priority Critical patent/CN105744380B/en
Publication of CN105744380A publication Critical patent/CN105744380A/en
Priority to PCT/CN2017/074669 priority patent/WO2017144001A1/en
Application granted granted Critical
Publication of CN105744380B publication Critical patent/CN105744380B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/443OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

本发明公开一种基于Android系统的媒体数据流播放方法及系统。其中,方法包括步骤:A、应用APP建立组播地址,并打开组播端口,生成组播通道;B、应用APP获取数据源的传输流包,并利用所述组播通道发送所述传输流包,在Android系统内形成组播流;C、应用APP利用所述组播地址打开应用层的播放器,并开始播放所述组播流。本发明不需要修改Android系统层,容易实施,应用简单;本发明充分利用Android系统中TCP/IP协议栈的数据组播功能,通过标准的组播通道形成了数据流代理,达到非标准数据流通过标准的Android应用层播放器播放的目的;本发明可在已经发布的Android系统或产品中应用,可以解决特定的媒体流播放问题,具有良好的兼容性、通用性。

The invention discloses a method and system for playing media data streams based on an Android system. Wherein, the method includes the steps: A. Applying the APP to establish a multicast address, and opening the multicast port to generate a multicast channel; B. Using the APP to obtain the transmission stream packet of the data source, and using the multicast channel to send the transmission stream package, forming a multicast stream in the Android system; C, the application APP uses the multicast address to open the player of the application layer, and starts to play the multicast stream. The present invention does not need to modify the Android system layer, is easy to implement, and is simple to apply; the present invention makes full use of the data multicast function of the TCP/IP protocol stack in the Android system, forms a data stream proxy through a standard multicast channel, and achieves non-standard data streams The purpose of playing through a standard Android application layer player; the present invention can be applied in released Android systems or products, can solve specific media stream playback problems, and has good compatibility and versatility.

Description

一种基于Android系统的媒体数据流播放方法及系统A method and system for playing media data stream based on Android system

技术领域technical field

本发明涉及多媒体数据播放领域,尤其涉及一种基于Android系统的媒体数据流播放方法及系统。The invention relates to the field of multimedia data playback, in particular to a method and system for playing media data streams based on an Android system.

背景技术Background technique

目前,搭载Android系统的产品如手机、机顶盒、智能电视等,其实现播放都是在应用APP中指定具体的播放数据资源定位符URL,然后传递给系统底层的播放服务层,通过播放服务层实现具体数据请求、处理、播放显示等,从而形成Android系统内完整的多媒体子系统。但是这样的多媒体子系统也存在弊端:非通用或非标准的播放资源数据应对能力差。At present, for products equipped with the Android system, such as mobile phones, set-top boxes, and smart TVs, etc., the playback is achieved by specifying a specific playback data resource locator URL in the application APP, and then passing it to the playback service layer at the bottom of the system, through the playback service layer. Specific data request, processing, playback and display, etc., thus forming a complete multimedia subsystem in the Android system. However, such a multimedia subsystem also has disadvantages: the ability to deal with non-universal or non-standard playback resource data is poor.

现有技术中,改进的方法一般有两种:第一种是修改系统底层的播放服务层,从而达到对特定播放资源的支持以实现播放;第二种是在应用层获取特定数据后逐层穿透送到底层的播放服务层,然后通过特定解码通道实现解码播放。In the prior art, there are generally two ways to improve: the first is to modify the playback service layer at the bottom of the system, so as to achieve support for specific playback resources to achieve playback; the second is to obtain specific data layer by layer after the application layer Penetrate to the underlying playback service layer, and then realize decoding and playback through a specific decoding channel.

但是上述两种方法均需要产品软件系统开发的介入,其软件开发工作量大并且效率低,同时还有可能导致音视频延迟;另外,对于已经发布的系统或产品,由于其系统底层已经相对稳定和固化,所以无法实现对非通用或非标准的资源进行播放。However, both of the above two methods require the intervention of product software system development. The software development workload is large and inefficient, and it may also cause audio and video delays; and solidification, so it is impossible to play non-universal or non-standard resources.

因此,现有技术还有待于改进和发展。Therefore, the prior art still needs to be improved and developed.

发明内容Contents of the invention

鉴于上述现有技术的不足,本发明的目的在于提供一种基于Android系统的媒体数据流播放方法及系统,旨在解决现有的播放方法无法支持特定媒体资源、开发难度大、效率低且可能影响播放效果的问题。In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide a media data stream playback method and system based on the Android system, aiming at solving the problem that the existing playback method cannot support specific media resources, development is difficult, low efficiency and possible Problems that affect the playback effect.

本发明的技术方案如下:Technical scheme of the present invention is as follows:

一种基于Android系统的媒体数据流播放方法,其中,包括步骤:A kind of media data streaming playing method based on Android system, wherein, comprises steps:

A、应用APP建立组播地址,并打开组播端口,生成组播通道;A. Apply the APP to establish a multicast address, and open the multicast port to generate a multicast channel;

B、应用APP获取数据源的传输流包,并利用所述组播通道发送所述传输流包,在Android系统内形成组播流;B. Apply the APP to obtain the transport stream packet of the data source, and utilize the multicast channel to send the transport stream packet to form a multicast stream in the Android system;

C、应用APP利用所述组播地址打开应用层的播放器,并开始播放所述组播流。C. The application APP uses the multicast address to open the player of the application layer, and starts to play the multicast stream.

优选的,所述步骤C之后还包括:Preferably, after the step C, it also includes:

D、当通过所述应用APP操控所述播放器时,匹配控制所述组播通道的数据注入速率和流量。D. When controlling the player through the application APP, matching and controlling the data injection rate and flow of the multicast channel.

优选的,所述步骤D之后还包括:Preferably, after the step D, it also includes:

E、当所述数据源播放结束时,关闭所述组播通道以及关闭所述播放器。E. When the data source finishes playing, close the multicast channel and close the player.

优选的,所述步骤A具体包括:Preferably, said step A specifically includes:

A1、应用APP查询Android系统内的网络以及网络端口的使用状态,并将处于空闲状态的网络端口作为组播端口;A1. Use the APP to query the network and network port usage status in the Android system, and use the idle network port as a multicast port;

A2、应用APP利用所述组播端口建立组播地址,并打开组播端口,生成组播通道。A2. The APP uses the multicast port to establish a multicast address, and opens the multicast port to generate a multicast channel.

优选的,所述操控包括暂停、恢复和倍速播放。Preferably, the manipulation includes pausing, resuming and playing at double speed.

一种基于Android系统的媒体数据流播放系统,其中,包括:A kind of media data streaming playing system based on Android system, wherein, comprises:

组播通道生成模块,用于建立组播地址,并打开组播端口,生成组播通道;The multicast channel generation module is used to establish a multicast address, and open a multicast port to generate a multicast channel;

组播流形成模块,用于获取数据源的传输流包,并利用所述组播通道发送所述传输流包,在Android系统内形成组播流;The multicast flow forming module is used to obtain the transport stream packet of the data source, and utilizes the multicast channel to send the transport stream packet to form a multicast stream in the Android system;

播放模块,用于利用所述组播地址打开应用层的播放器,并开始播放所述组播流。The playing module is used to use the multicast address to open the player of the application layer, and start playing the multicast stream.

优选的,所述媒体数据流播放系统还包括:Preferably, the media data stream playing system also includes:

控制模块,用于当通过所述应用APP操控所述播放器时,匹配控制所述组播通道的数据注入速率和流量。A control module, configured to match and control the data injection rate and flow of the multicast channel when the player is controlled by the application APP.

优选的,所述媒体数据流播放系统还包括:Preferably, the media data stream playing system also includes:

关闭模块,用于当所述数据源播放结束时,关闭所述组播通道以及关闭所述播放器。The closing module is used to close the multicast channel and the player when the data source finishes playing.

优选的,所述组播通道生成模块具体包括:Preferably, the multicast channel generation module specifically includes:

查询单元,用于查询Android系统内的网络以及网络端口的使用状态,并将处于空闲状态的网络端口作为组播端口;The query unit is used to query the network in the Android system and the usage status of the network port, and use the network port in idle state as the multicast port;

组播通道生成单元,用于利用所述组播端口建立组播地址,并打开组播端口,生成组播通道。The multicast channel generation unit is configured to use the multicast port to establish a multicast address, open the multicast port, and generate a multicast channel.

优选的,所述操控包括暂停、恢复和倍速播放。Preferably, the manipulation includes pausing, resuming and playing at double speed.

有益效果:本发明可完全在应用APP内部实现,实际播放是通过Android应用层标准的播放器组件进行,整个过程不需要修改Android系统层,所以容易实施,应用简单;本发明充分利用Android系统中TCP/IP协议栈的数据组播功能,通过标准的组播通道形成了数据流代理,达到非标准数据流通过标准的Android应用层播放器播放的目的;本发明可以在已经发布的Android系统或产品中应用,可以解决特定的媒体流播放问题,具有良好的兼容性、通用性。Beneficial effects: the present invention can be completely implemented inside the application APP, and the actual playback is performed through the standard player component of the Android application layer. The whole process does not need to modify the Android system layer, so it is easy to implement and simple to apply; the present invention fully utilizes the The data multicast function of the TCP/IP protocol stack forms a data stream agent by a standard multicast channel, and reaches the purpose of playing non-standard data streams through a standard Android application layer player; the present invention can be used in released Android systems or The application in the product can solve specific media streaming problems, and has good compatibility and versatility.

附图说明Description of drawings

图1为本发明一种基于Android系统的媒体数据流播放方法第一实施例的流程图;Fig. 1 is a kind of flow chart of the first embodiment of the media data stream playing method based on the Android system of the present invention;

图2为图1中步骤S1的具体流程图;Fig. 2 is the specific flowchart of step S1 in Fig. 1;

图3为本发明一种基于Android系统的媒体数据流播放方法第二实施例的流程图;Fig. 3 is a kind of flow chart of the second embodiment of the method for playing media data stream based on the Android system of the present invention;

图4为本发明一种基于Android系统的媒体数据流播放方法第三实施例的流程图;Fig. 4 is a flow chart of the third embodiment of a media data stream playing method based on the Android system of the present invention;

图5为本发明一种基于Android系统的媒体数据流播放系统第一实施例的结构框图;Fig. 5 is a structural block diagram of the first embodiment of a media data stream playing system based on the Android system of the present invention;

图6为图5中组播通道生成模块的具体流程图;Fig. 6 is the specific flowchart of multicast channel generation module in Fig. 5;

图7为本发明一种基于Android系统的媒体数据流播放系统第二实施例的结构框图;Fig. 7 is a structural block diagram of the second embodiment of a media data stream playing system based on the Android system of the present invention;

图8为本发明一种基于Android系统的媒体数据流播放系统第三实施例的结构框图。FIG. 8 is a structural block diagram of a third embodiment of a media data stream playing system based on an Android system according to the present invention.

具体实施方式Detailed ways

本发明提供一种基于Android系统的媒体数据流播放方法及系统,为使本发明的目的、技术方案及效果更加清楚、明确,以下对本发明进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。The present invention provides a method and system for playing media data streams based on the Android system. In order to make the purpose, technical solution and effect of the present invention clearer and clearer, the present invention will be further described in detail below. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

请参阅图1,图1为本发明一种基于Android系统的媒体数据流播放方法第一实施例的流程图,其包括步骤:Please refer to Fig. 1, Fig. 1 is a kind of flow chart of the first embodiment of the media data streaming playing method based on Android system of the present invention, and it comprises steps:

S1、应用APP建立组播地址,并打开组播端口,生成组播通道;S1. Apply the APP to establish a multicast address, and open a multicast port to generate a multicast channel;

S2、应用APP获取数据源的传输流包,并利用所述组播通道发送所述传输流包,在Android系统内形成组播流;S2. Applying the APP to obtain the transport stream packet of the data source, and sending the transport stream packet through the multicast channel to form a multicast stream in the Android system;

S3、应用APP利用所述组播地址打开应用层的播放器,并开始播放所述组播流。S3. The application APP uses the multicast address to open the player of the application layer, and starts to play the multicast stream.

本发明在不修改产品系统的前提下,通过应用APP中技术实现即可解决特定媒体数据流的播放,增强了产品的适用性、通用性。本发明的方法非常适合应用APP能获取稳定、平滑的媒体流的场景下应用。On the premise of not modifying the product system, the present invention can solve the playback of specific media data streams by applying the technology in the APP, thereby enhancing the applicability and versatility of the product. The method of the present invention is very suitable for application in scenarios where the APP can obtain stable and smooth media streams.

本发明的实现原理主要是:利用Android系统中TCP/IP协议栈提供的局域网内的组播功能,在应用APP中建立Android系统内的组播通道,向此组播通道中发送(注入)传输流包,同时利用Android系统媒体播放子系统对标准组播资源的播放支持以达到实现播放的要求。The realization principle of the present invention is mainly: use the multicast function in the local area network provided by the TCP/IP protocol stack in the Android system, establish a multicast channel in the Android system in the application APP, and send (inject) the transmission to this multicast channel Streaming packets, while using the media playback subsystem of the Android system to support the playback of standard multicast resources to achieve the playback requirements.

如图2所示,所述步骤S1具体包括:As shown in Figure 2, the step S1 specifically includes:

S11、应用APP查询Android系统内的网络以及网络端口的使用状态,并将处于空闲状态的网络端口作为组播端口;S11, using the APP to query the network in the Android system and the usage status of the network port, and use the network port in the idle state as the multicast port;

S12、应用APP利用所述组播端口建立组播地址,并打开组播端口,生成组播通道。S12. The APP uses the multicast port to establish a multicast address, and opens the multicast port to generate a multicast channel.

本步骤是充分利用Android系统中TCP/IP协议栈的数据组播功能,将应用APP内部的私有数据流(或称私有媒体流)在系统形成组播流,即形成公开、标准的播放流。本步骤巧妙地利用了Android系统中全局的TCP/IP协议栈的功能,使其完成私有媒体流的中转站或代理服务器功能,从而将私有媒体流转化为公开、标准的播放流。This step is to make full use of the data multicast function of the TCP/IP protocol stack in the Android system, and use the private data stream (or private media stream) inside the app to form a multicast stream in the system, that is, to form an open and standard playback stream. This step cleverly utilizes the function of the global TCP/IP protocol stack in the Android system to make it complete the transfer station or proxy server function of the private media stream, thereby converting the private media stream into an open and standard playback stream.

具体来说,此步骤中关键是确定应用APP所需要的组播地址及组播端口。由于在IP网络中,组播地址有其特殊规定:多播地址(multicast address)即组播地址,是一组主机的标示符,其已经加入到一个多播组中。在以太网中,多播地址是一个48位的标示符,命名了一组应该在这个网络中应用接收到一个分组的站点。在IPv4中,组播地址也被叫做D类地址,是一种类型的IP地址,它的范围从224.0.0.0到239.255.255.255(即确立的组播地址应该在TCP/IP网络标准规定的组播地址范围内,即224.0.0.0-239.255.255.255这段组播保留地址内),或,等同的,在224.0.0.0/4。但224.0.0.0被保留,不能赋给任何多播组。Specifically, the key in this step is to determine the multicast address and multicast port required by the application APP. Because in the IP network, the multicast address has its special regulations: the multicast address (multicast address) is the multicast address, which is an identifier of a group of hosts, which have been added to a multicast group. In Ethernet, a multicast address is a 48-bit identifier that names a group of stations on the network that should receive a packet. In IPv4, a multicast address is also called a class D address, which is a type of IP address ranging from 224.0. 224.0.0.0-239.255.255.255 multicast reserved addresses), or, equivalently, within 224.0.0.0/4. But 224.0.0.0 is reserved and cannot be assigned to any multicast group.

例如,选取的组播地址从239.1.2.1开始,发送端口从1234开始检查,如果发现目标端口被占用逐次加1,直到找到满足要求的空闲端口作为组播端口,即确立的组播端口应是当前系统中处于空闲的动态或私有端口。通过检查,发现目标端口1234空闲,那确定的组播地址URL即为udp://239.1.2.1:1234,即以UDP开头的URL,如"udp://组播地址:端口号"。打开组播通道即为建立组播SOCKET、绑定组播端口,加入组播群组。For example, the selected multicast address starts from 239.1.2.1, and the sending port starts to check from 1234. If the target port is found to be occupied, add 1 successively until a free port that meets the requirements is found as the multicast port, that is, the established multicast port should be A dynamic or private port that is free in the current system. Through inspection, it is found that the target port 1234 is free, and the determined multicast address URL is udp://239.1.2.1:1234, that is, the URL starting with UDP, such as "udp://multicast address:port number". Opening a multicast channel means establishing a multicast SOCKET, binding a multicast port, and joining a multicast group.

在步骤S2中,应用APP连续获取需播放的数据流形成连续的传输流包(TS包),通过前述的组播通道连续发送(即注入)传输流包,形成系统内的组播流。此步骤中关键过程为获取正确的传输流包及将传输流包发向组播通道。In step S2, the application APP continuously acquires the data stream to be played to form continuous transport stream packets (TS packets), and continuously sends (that is, injects) transport stream packets through the aforementioned multicast channel to form a multicast stream in the system. The key process in this step is to obtain the correct transport stream packet and send the transport stream packet to the multicast channel.

由于本发明是面向解决特定数据流播放问题而设计,特定的数据流的解析不是本发明所关注的(不同的数据源应该有自己的数据解析说明或接口),本发明所关注的是这些数据流解析得到后的过程,特别说明的是在发送给组播通道之前需要确定数据包是传输流包,基于Android系统的播放一般都是支持TS流直接解码播放显示的。如果解析得到的数据包不是TS包例如是程序流包,则需要在发送前将其转化成TS包。至于将TS包发送到组播通道,就是向步骤S1中所开的组播SOCKET发送TS包。Since the present invention is designed to solve the problem of playing specific data streams, the analysis of specific data streams is not the focus of the present invention (different data sources should have their own data analysis instructions or interfaces), and the focus of the present invention is these data The process after stream parsing is obtained. In particular, it is necessary to confirm that the data packet is a transport stream packet before sending it to the multicast channel. Playback based on the Android system generally supports direct decoding and playback of TS streams. If the analyzed data packet is not a TS packet such as a program stream packet, it needs to be converted into a TS packet before sending. As for sending the TS packet to the multicast channel, it is to send the TS packet to the multicast SOCKET opened in step S1.

另外,获取数据包(即传输流包)以及将数据包向组播通道发送过程应该在播放器打开之前开始,播放器打开时需要组播通道内已经有一定量的媒体数据。In addition, the process of obtaining data packets (that is, transport stream packets) and sending data packets to the multicast channel should start before the player is opened. When the player is opened, there must be a certain amount of media data in the multicast channel.

在所述步骤S3中,由于组播地址URL具有相对的标准和普适性,以此标准的组播地址去打开Android应用层的播放器(标准播放器MediaPlayer)实现对组播流的播放。本发明中,播放的本质还是利用Android应用层的MediaPlayer实现播放,只是在MediaPlayer接触到数据前将数据流进行转化。In the step S3, since the multicast address URL is relatively standard and universal, use the standard multicast address to open the Android application layer player (standard player MediaPlayer) to play the multicast stream. In the present invention, the essence of playing still utilizes the MediaPlayer of the Android application layer to realize playing, and only converts the data stream before the MediaPlayer touches the data.

具体来说,本步骤的关键过程是用前述的组播地址URL去打开一个Android应用层中标准播放器MediaPlayer。例如组播地址URL:" udp://239.1.2.1:1234",即通过此URL去调用MediaPlayer的setDataSource接口,成功后依次调用prepare接口(准备接口)及start接口(开始接口),如果这些过程均成功,表示此步骤完成。此步骤在步骤S2后开始,并且两者是互为依赖的,可能需要多次的数据注入才能打开MediaPlayer(MediaPlayer在打开时需要探测到一定量的媒体数据才能确定解码类型及其它播放的关键参数);而如果只是注入数据没有播放器去消耗组播通道的数据,那么注入数据也是无用的。Specifically, the key process of this step is to use the aforementioned multicast address URL to open a standard player MediaPlayer in the Android application layer. For example, the multicast address URL: "udp://239.1.2.1:1234", that is, call the setDataSource interface of MediaPlayer through this URL, and call the prepare interface (preparation interface) and start interface (start interface) in turn after success. If these processes All successful, indicating that this step is complete. This step starts after step S2, and the two are interdependent, and may require multiple data injections to open MediaPlayer (MediaPlayer needs to detect a certain amount of media data when it is opened to determine the decoding type and other key parameters for playback ); and if there is no player to consume the data of the multicast channel just by injecting data, then injecting data is also useless.

所以为了顺利完成如此的数据关系,可专门设置一个任务去完成MediaPlayer的打开过程,即数据注入与MediaPlayer打开分别在不同的任务中完成,MediaPlayer只需要成功打开一次即可。打开Android应用层的播放器是指在应用APP自身的进程中打开的播放器对象,具体包括利用MediaPlayer的标准接口进行创建、设置播放源、播放准备等过程;在打开播放器后开始播放,其是指利用播放器提供的标准接口方法开始数据流(TS包)的播放。Therefore, in order to successfully complete such a data relationship, a task can be specially set to complete the opening process of MediaPlayer, that is, data injection and MediaPlayer opening are completed in different tasks, and MediaPlayer only needs to be successfully opened once. The player that opens the Android application layer refers to the player object that is opened in the process of the application APP itself, specifically including the process of creating, setting the playback source, and preparing for playback using the standard interface of MediaPlayer; after opening the player, start playing, and other It means to use the standard interface method provided by the player to start playing the data stream (TS packet).

请参阅图3,图3为本发明一种基于Android系统的媒体数据流播放方法第二实施例的流程图,其包括步骤:Please refer to Fig. 3, Fig. 3 is a kind of flow chart of the second embodiment of the media data stream playing method based on the Android system of the present invention, and it comprises steps:

S1、应用APP建立组播地址,并打开组播端口,生成组播通道;S1. Apply the APP to establish a multicast address, and open a multicast port to generate a multicast channel;

S2、应用APP获取数据源的传输流包,并利用所述组播通道发送所述传输流包,在Android系统内形成组播流;S2. Applying the APP to obtain the transport stream packet of the data source, and sending the transport stream packet through the multicast channel to form a multicast stream in the Android system;

S3、应用APP利用所述组播地址打开应用层的播放器,并开始播放所述组播流;S3. The application APP uses the multicast address to open the player of the application layer, and starts to play the multicast stream;

S4、当通过所述应用APP操控所述播放器时,匹配控制所述组播通道的数据注入速率和流量。S4. When the player is controlled by the application APP, match and control the data injection rate and flow of the multicast channel.

其与上述方法第一实施例不同的是,在所述步骤S3之后增加一步骤S4,其是为了完善整个播放流程而添加。数据的注入要考虑到播放的场景,播放的场景也需要考虑数据注入情况,只有这样播放过程才是完美的。例如,当APP应用需要进行暂停播放操作时,通过MediaPlayer的pause(暂停)接口进行播放器的暂停,同时也需要数据注入过程及数据解析和获取过程也要暂停,否则注入到组播通道中的数据会被浪费,并且恢复播放时播放的结果也是错误的;同理,当应用需要恢复播放显示时,通过MediaPlayer的start接口进行播放器的恢复播放显示的同时也需要数据注入过程及数据解析、获取过程要同步恢复处理,否则整个过程就会发生错位。即当通过所述应用APP操控播放器时,匹配控制组播通道的数据注入速率和流量。It is different from the first embodiment of the method above in that a step S4 is added after the step S3, which is added to improve the entire playback process. The data injection should take into account the playback scene, and the playback scene also needs to consider the data injection situation. Only in this way is the playback process perfect. For example, when the APP application needs to pause the playback operation, the pause (pause) interface of the MediaPlayer is used to pause the player, and the data injection process, data parsing and acquisition process must also be paused, otherwise the data injected into the multicast channel The data will be wasted, and the playback result will be wrong when the playback is resumed; similarly, when the application needs to resume the playback display, the playback display of the player through the start interface of the MediaPlayer also requires the data injection process and data analysis. The acquisition process must resume processing synchronously, otherwise the whole process will be misplaced. That is, when the player is controlled through the application APP, the data injection rate and traffic of the multicast channel are matched and controlled.

APP应用持续重复获取传输流包并持续向组播通道发送所述传输流包;在播放过程中,需要根据播放媒体的类型及播放的环节调整发送速度及数据量大小,避免超过或不满足播放要求的数据流量;另外还可根据应用的要求对播放器对象进行操作,比如暂停、恢复、倍速播放等(但显然还可以是其他的常用或不常用操作),同时也需要数据流注入进行相应的匹配。The APP application continuously and repeatedly obtains the transport stream packet and continuously sends the transport stream packet to the multicast channel; during the playback process, it is necessary to adjust the sending speed and data volume according to the type of media to be played and the playback link, so as to avoid exceeding or not satisfying the playback requirements. The required data flow; in addition, the player object can also be operated according to the requirements of the application, such as pause, resume, double-speed playback, etc. (but obviously other common or infrequent operations can also be used), and data flow injection is also required for corresponding match.

请参阅图4,图4为本发明一种基于Android系统的媒体数据流播放方法第三实施例的流程图,其包括步骤:Please refer to Fig. 4, Fig. 4 is a kind of flow chart of the third embodiment of the media data stream playing method based on Android system of the present invention, and it comprises steps:

S1、应用APP建立组播地址,并打开组播端口,生成组播通道;S1. Apply the APP to establish a multicast address, and open a multicast port to generate a multicast channel;

S2、应用APP获取数据源的传输流包,并利用所述组播通道发送所述传输流包,在Android系统内形成组播流;S2. Applying the APP to obtain the transport stream packet of the data source, and sending the transport stream packet through the multicast channel to form a multicast stream in the Android system;

S3、应用APP利用所述组播地址打开应用层的播放器,并开始播放所述组播流;S3. The application APP uses the multicast address to open the player of the application layer, and starts to play the multicast stream;

S4、当通过所述应用APP操控所述播放器时,匹配控制所述组播通道的数据注入速率和流量;S4. When controlling the player through the application APP, matching and controlling the data injection rate and flow of the multicast channel;

S5、当所述数据源播放结束时,关闭所述组播通道以及关闭所述播放器。S5. When the playing of the data source ends, close the multicast channel and close the player.

其与方法第二实施例不同的是,在所述步骤S4之后,增加了步骤S5。在所述步骤S5中,应用可以根据数据流状态或用户要求进行播放器的控制,选择退出播放,退出数据注入一同结束。It is different from the second embodiment of the method in that after the step S4, a step S5 is added. In the step S5, the application can control the player according to the data stream status or the user's request, and choose to exit the playback, and the exit data injection ends together.

具体来说,播放结束的过程:一种是应用中需要播放的数据流已经完成时;另外一种是在播放过程中遇到无法解决的问题时,或者用户需要结束播放。此两种情况都需要退出播放过程。在退出时,需要关闭所打开的资源:组播通道、播放器等,这些都是系统内重要的资源地,不需要时将其关闭。Specifically, the process of ending playback: one is when the data stream that needs to be played in the application has been completed; the other is when an unsolvable problem is encountered during playback, or the user needs to end the playback. In both cases, the playback process needs to be exited. When exiting, you need to close the opened resources: multicast channel, player, etc. These are important resources in the system, and they should be closed when not needed.

在本发明中数据获取、建立组播通道、向组播通道发送数据、打开及操控播放器MediaPlayer等技术过程均在同一个应用进程中实施。In the present invention, technical processes such as data acquisition, establishment of the multicast channel, sending data to the multicast channel, opening and manipulating the player MediaPlayer are all implemented in the same application process.

基于上述方法,本发明还提供一种基于Android系统的媒体数据流播放系统第一实施例,如图5所示,其包括:Based on the above method, the present invention also provides a first embodiment of a media data stream playback system based on the Android system, as shown in Figure 5, which includes:

组播通道生成模块100,用于建立组播地址,并打开组播端口,生成组播通道;The multicast channel generating module 100 is used to set up a multicast address, and open a multicast port to generate a multicast channel;

组播流形成模块200,用于获取数据源的传输流包,并利用所述组播通道发送所述传输流包,在Android系统内形成组播流;The multicast flow forming module 200 is used to obtain the transport stream packet of the data source, and utilizes the multicast channel to send the transport stream packet to form a multicast stream in the Android system;

播放模块300,用于利用所述组播地址打开应用层的播放器,并开始播放所述组播流。The playing module 300 is configured to use the multicast address to open the player of the application layer, and start playing the multicast stream.

本发明的系统第一实施例,其通过应用APP中技术实现来解决特定媒体数据流的播放,增强了产品的适用性、通用性。本发明的系统非常适合应用APP能获取稳定、平滑的媒体流的场景下应用。其实现原理主要是:利用Android系统中TCP/IP协议栈提供的局域网内的组播功能,在应用APP中建立Android系统内的组播通道,向此组播通道中发送(注入)传输流包,同时利用Android系统媒体播放子系统对标准组播资源的播放支持以达到实现播放的要求。The first embodiment of the system of the present invention solves the playback of specific media data streams by applying the technology in the APP, which enhances the applicability and versatility of the product. The system of the present invention is very suitable for application in the scenario where the APP can obtain stable and smooth media streams. Its realization principle is mainly: use the multicast function in the local area network provided by the TCP/IP protocol stack in the Android system, establish a multicast channel in the Android system in the application APP, and send (inject) the transport stream packet into the multicast channel At the same time, the Android system media playback subsystem supports the playback of standard multicast resources to meet the playback requirements.

如图6所示,所述组播通道生成模块100具体包括:As shown in Figure 6, the multicast channel generation module 100 specifically includes:

查询单元110,用于查询Android系统内的网络以及网络端口的使用状态,并将处于空闲状态的网络端口作为组播端口;Inquiry unit 110 is used to inquire about the network in the Android system and the usage state of the network port, and use the idle network port as the multicast port;

组播通道生成单元120,用于利用所述组播端口建立组播地址,并打开组播端口,生成组播通道。The multicast channel generating unit 120 is configured to use the multicast port to establish a multicast address, open the multicast port, and generate a multicast channel.

在所述组播通道生成模块100中,关键是确定应用APP所需要的组播地址及组播端口。由于在IP 网络中,组播地址有其特殊规定:多播地址(multicast address)即组播地址,是一组主机的标示符,其已经加入到一个多播组中。在以太网中,多播地址是一个48位的标示符,命名了一组应该在这个网络中应用接收到一个分组的站点。在IPv4中,组播地址也被叫做D类地址,是一种类型的IP地址,它的范围从224.0.0.0到239.255.255.255(即确立的组播地址应该在TCP/IP网络标准规定的组播地址范围内,即224.0.0.0-239.255.255.255这段组播保留地址内),或,等同的,在224.0.0.0/4。但224.0.0.0被保留,不能赋给任何多播组。In the multicast channel generation module 100, the key is to determine the multicast address and multicast port required by the application APP. Because in the IP network, the multicast address has its special regulations: the multicast address (multicast address) is the multicast address, which is the identifier of a group of hosts, which have been added to a multicast group. In Ethernet, a multicast address is a 48-bit identifier that names a group of stations on the network that should receive a packet. In IPv4, a multicast address is also called a class D address, which is a type of IP address ranging from 224.0. 224.0.0.0-239.255.255.255 multicast reserved addresses), or, equivalently, within 224.0.0.0/4. But 224.0.0.0 is reserved and cannot be assigned to any multicast group.

例如,选取的组播地址从239.1.2.1开始,发送端口从1234开始检查,如果发现目标端口被占用逐次加1,直到找到满足要求的空闲端口作为组播端口,即确立的组播端口应是当前系统中处于空闲的动态或私有端口。通过检查,发现目标端口1234空闲,那确定的组播地址URL即为udp://239.1.2.1:1234,即以UDP开头的URL,如"udp://组播地址:端口号"。打开组播通道即为建立组播SOCKET、绑定组播端口,加入组播群组。For example, the selected multicast address starts from 239.1.2.1, and the sending port starts to check from 1234. If the target port is found to be occupied, add 1 successively until a free port that meets the requirements is found as the multicast port, that is, the established multicast port should be A dynamic or private port that is free in the current system. Through inspection, it is found that the target port 1234 is free, and the determined multicast address URL is udp://239.1.2.1:1234, that is, the URL starting with UDP, such as "udp://multicast address:port number". Opening a multicast channel means establishing a multicast SOCKET, binding a multicast port, and joining a multicast group.

在所述组播流形成模块200中,应用APP连续获取需播放的数据流形成连续的传输流包(TS包),通过前述的组播通道连续发送(即注入)传输流包,形成系统内的组播流。此模块中的关键为获取正确的传输流包及将传输流包发向组播通道。In the multicast stream forming module 200, the application APP continuously acquires the data stream to be played to form continuous transport stream packets (TS packets), and continuously sends (that is, injects) transport stream packets through the aforementioned multicast channel to form a system internal TS packet. of multicast streams. The key in this module is to obtain the correct transport stream packet and send the transport stream packet to the multicast channel.

由于本发明是面向解决特定数据流播放问题而设计,特定的数据流的解析不是本发明所关注的(不同的数据源应该有自己的数据解析说明或接口),本发明所关注的是这些数据流解析得到后的过程,特别说明的是在发送给组播通道之前需要确定数据包是传输流包,基于Android系统的播放一般都是支持TS流直接解码播放显示的。如果解析得到的数据包不是TS包例如是程序流包,则需要在发送前将其转化成TS包。至于将TS包发送到组播通道,就是向组播通道生成模块100中所开的组播SOCKET发送TS包。Since the present invention is designed to solve the problem of playing specific data streams, the analysis of specific data streams is not the focus of the present invention (different data sources should have their own data analysis instructions or interfaces), and the focus of the present invention is these data The process after stream parsing is obtained. In particular, it is necessary to confirm that the data packet is a transport stream packet before sending it to the multicast channel. Playback based on the Android system generally supports direct decoding and playback of TS streams. If the analyzed data packet is not a TS packet such as a program stream packet, it needs to be converted into a TS packet before sending. As for sending the TS packet to the multicast channel, it is to send the TS packet to the multicast SOCKET opened in the multicast channel generating module 100 .

在所述播放模块300中,由于组播地址URL具有相对的标准和普适性,以此标准的组播地址去打开Android应用层的播放器(标准播放器MediaPlayer)实现对组播流的播放。本发明中,播放的本质还是利用Android应用层的MediaPlayer实现播放,只是在MediaPlayer接触到数据前将数据流进行转化。In the playing module 300, since the multicast address URL is relatively standard and universal, use this standard multicast address to open the player (standard player MediaPlayer) of the Android application layer to realize the playback of the multicast stream . In the present invention, the essence of playing still utilizes the MediaPlayer of the Android application layer to realize playing, and only converts the data stream before the MediaPlayer touches the data.

具体来说,本模块的关键是用前述的组播地址URL去打开一个Android应用层中标准播放器MediaPlayer。例如组播地址URL:" udp://239.1.2.1:1234",即通过此URL去调用MediaPlayer的setDataSource接口,成功后依次调用prepare接口(准备接口)及start接口(开始接口),如果这些过程均成功,表示此步骤完成。所述播放模块300与所述组播流形成模块200两者是互为依赖的,可能需要多次的数据注入才能打开MediaPlayer(MediaPlayer在打开时需要探测到一定量的媒体数据才能确定解码类型及其它播放的关键参数);而如果只是注入数据没有播放器去消耗组播通道的数据,那么注入数据也是无用的。Specifically, the key of this module is to use the aforementioned multicast address URL to open a standard player MediaPlayer in the Android application layer. For example, the multicast address URL: "udp://239.1.2.1:1234", that is, call the setDataSource interface of MediaPlayer through this URL, and call the prepare interface (preparation interface) and start interface (start interface) in turn after success. If these processes All successful, indicating that this step is complete. The playback module 300 and the multicast stream forming module 200 are interdependent, and may require multiple data injections to open the MediaPlayer (MediaPlayer needs to detect a certain amount of media data when it is opened to determine the decoding type and Other key parameters for playback); and if only the data is injected and there is no player to consume the data of the multicast channel, then the injected data is useless.

所以为了顺利完成如此的数据关系,可专门设置一个任务去完成MediaPlayer的打开过程,即数据注入与MediaPlayer打开分别在不同的任务中完成,MediaPlayer只需要成功打开一次即可。打开Android应用层的播放器是指在应用APP自身的进程中打开的播放器对象,具体包括利用MediaPlayer的标准接口进行创建、设置播放源、播放准备等过程;在打开播放器后开始播放,其是指利用播放器提供的标准接口方法开始数据流(TS包)的播放。Therefore, in order to successfully complete such a data relationship, a task can be specially set to complete the opening process of MediaPlayer, that is, data injection and MediaPlayer opening are completed in different tasks, and MediaPlayer only needs to be successfully opened once. The player that opens the Android application layer refers to the player object that is opened in the process of the application APP itself, specifically including the process of using the standard interface of MediaPlayer to create, set the playback source, and prepare for playback; after opening the player, start playing, other It means to use the standard interface method provided by the player to start playing the data stream (TS package).

本发明还提供一种基于Android系统的媒体数据流播放系统第二实施例,如图7所示,其包括:The present invention also provides a second embodiment of a media data stream playing system based on an Android system, as shown in FIG. 7 , which includes:

组播通道生成模块100,用于建立组播地址,并打开组播端口,生成组播通道;The multicast channel generating module 100 is used to set up a multicast address, and open a multicast port to generate a multicast channel;

组播流形成模块200,用于获取数据源的传输流包,并利用所述组播通道发送所述传输流包,在Android系统内形成组播流;The multicast flow forming module 200 is used to obtain the transport stream packet of the data source, and utilizes the multicast channel to send the transport stream packet to form a multicast stream in the Android system;

播放模块300,用于利用所述组播地址打开应用层的播放器,并开始播放所述组播流;The playing module 300 is used to open the player of the application layer by using the multicast address, and start playing the multicast stream;

控制模块400,用于当通过所述应用APP操控所述播放器时,匹配控制所述组播通道的数据注入速率和流量。The control module 400 is configured to match and control the data injection rate and flow of the multicast channel when the player is controlled by the application APP.

其与系统第一实施例不同的是,增加了控制模块400,其是为了完善整个播放流程而添加。数据的注入要考虑到播放的场景,播放的场景也需要考虑数据注入情况,只有这样播放过程才是完美的。例如,当APP应用需要进行暂停播放操作时,通过MediaPlayer的pause(暂停)接口进行播放器的暂停,同时也需要数据注入过程及数据解析和获取过程也要暂停,否则注入到组播通道中的数据会被浪费,并且恢复播放时播放的结果也是错误的;同理,当应用需要恢复播放显示时,通过MediaPlayer的start接口进行播放器的恢复播放显示的同时也需要数据注入过程及数据解析、获取过程要同步恢复处理,否则整个过程就会发生错位。即当通过所述应用APP操控播放器时,匹配控制组播通道的数据注入速率和流量。It is different from the first embodiment of the system in that a control module 400 is added to improve the entire playback process. The data injection should take into account the playback scene, and the playback scene also needs to consider the data injection situation. Only in this way is the playback process perfect. For example, when the APP application needs to pause the playback operation, the pause (pause) interface of the MediaPlayer is used to pause the player, and the data injection process, data parsing and acquisition process must also be paused, otherwise the data injected into the multicast channel The data will be wasted, and the playback result will be wrong when the playback is resumed; similarly, when the application needs to resume the playback display, the playback display of the player through the start interface of the MediaPlayer also requires the data injection process and data analysis. The acquisition process must resume processing synchronously, otherwise the whole process will be misplaced. That is, when the player is controlled through the application APP, the data injection rate and traffic of the multicast channel are matched and controlled.

APP应用持续重复获取传输流包并持续向组播通道发送所述传输流包;在播放过程中,需要根据播放媒体的类型及播放的环节调整发送速度及数据量大小,避免超过或不满足播放要求的数据流量;另外还可根据应用的要求对播放器对象进行操作,比如暂停、恢复、倍速播放等(但显然还可以是其他的常用或不常用操作),同时也需要数据流注入进行相应的匹配。The APP application continuously and repeatedly obtains the transport stream packet and continuously sends the transport stream packet to the multicast channel; during the playback process, it is necessary to adjust the sending speed and data volume according to the type of media to be played and the playback link, so as to avoid exceeding or not satisfying the playback requirements. The required data flow; in addition, the player object can also be operated according to the requirements of the application, such as pause, resume, double-speed playback, etc. (but obviously other common or infrequent operations can also be used), and data flow injection is also required for corresponding match.

本发明还提供一种基于Android系统的媒体数据流播放系统第三实施例,如图8所示,其包括:The present invention also provides a third embodiment of a media data stream playing system based on an Android system, as shown in FIG. 8 , which includes:

组播通道生成模块100,用于建立组播地址,并打开组播端口,生成组播通道;The multicast channel generating module 100 is used to set up a multicast address, and open a multicast port to generate a multicast channel;

组播流形成模块200,用于获取数据源的传输流包,并利用所述组播通道发送所述传输流包,在Android系统内形成组播流;The multicast flow forming module 200 is used to obtain the transport stream packet of the data source, and utilizes the multicast channel to send the transport stream packet to form a multicast stream in the Android system;

播放模块300,用于利用所述组播地址打开应用层的播放器,并开始播放所述组播流;The playing module 300 is used to open the player of the application layer by using the multicast address, and start playing the multicast stream;

控制模块400,用于当通过所述应用APP操控所述播放器时,匹配控制所述组播通道的数据注入速率和流量;A control module 400, configured to match and control the data injection rate and flow of the multicast channel when the player is controlled by the application APP;

关闭模块500,用于当所述数据源播放结束时,关闭所述组播通道以及关闭所述播放器。The closing module 500 is configured to close the multicast channel and the player when the data source finishes playing.

其与系统第二实施例不同的是,增加了关闭模块500,在此模块中,应用可以根据数据流状态或用户要求进行播放器的控制,选择退出播放,退出数据注入一同结束。It differs from the second embodiment of the system in that a shutdown module 500 is added. In this module, the application can control the player according to the data stream status or user requirements, choose to quit playing, and exit data injection together.

具体来说,播放结束的过程:一种是应用中需要播放的数据流已经完成时;另外一种是在播放过程中遇到无法解决的问题时,或者用户需要结束播放。此两种情况都需要退出播放过程。在退出时,需要关闭所打开的资源:组播通道、播放器等,这些都是系统内重要的资源地,不需要时将其关闭。Specifically, the process of ending playback: one is when the data stream that needs to be played in the application has been completed; the other is when an unsolvable problem is encountered during playback, or the user needs to end the playback. In both cases, the playback process needs to be exited. When exiting, you need to close the opened resources: multicast channel, player, etc. These are important resources in the system, and they should be closed when not needed.

在本发明中数据获取、建立组播通道、向组播通道发送数据、打开及操控播放器MediaPlayer等技术过程均在同一个应用进程中实施。In the present invention, technical processes such as data acquisition, establishment of the multicast channel, sending data to the multicast channel, opening and manipulating the player MediaPlayer are all implemented in the same application process.

应当理解的是,本发明的应用不限于上述的举例,对本领域普通技术人员来说,可以根据上述说明加以改进或变换,所有这些改进和变换都应属于本发明所附权利要求的保护范围。It should be understood that the application of the present invention is not limited to the above examples, and those skilled in the art can make improvements or transformations according to the above descriptions, and all these improvements and transformations should belong to the protection scope of the appended claims of the present invention.

Claims (4)

1.一种基于Android系统的媒体数据流播放方法,其特征在于,包括步骤:1. a media data stream playing method based on Android system, is characterized in that, comprises steps: A、应用APP建立组播地址,并打开组播端口,生成组播通道;A. Apply the APP to establish a multicast address, and open the multicast port to generate a multicast channel; B、应用APP获取数据源的传输流包,并利用所述组播通道发送所述传输流包,在Android系统内形成组播流;B. Apply the APP to obtain the transport stream packet of the data source, and utilize the multicast channel to send the transport stream packet to form a multicast stream in the Android system; C、应用APP利用所述组播地址打开应用层的播放器,并开始播放所述组播流;C. The application APP uses the multicast address to open the player of the application layer, and starts to play the multicast stream; 所述步骤A具体包括:Described step A specifically comprises: A1、应用APP查询Android系统内的网络以及网络端口的使用状态,并将处于空闲状态的网络端口作为组播端口;A1. Use the APP to query the network and network port usage status in the Android system, and use the idle network port as a multicast port; A2、应用APP利用所述组播端口建立组播地址,并打开组播端口,生成组播通道;A2, the application APP uses the multicast port to establish a multicast address, and opens the multicast port to generate a multicast channel; 利用Android系统中TCP/IP协议栈提供的局域网内的组播功能,在应用APP中建立Android系统内的组播通道,向所述组播通道中发送或注入传输流包,同时利用Android系统媒体播放子系统对标准组播资源的播放进行支持以达到播放要求;Utilize the multicast function in the local area network provided by the TCP/IP protocol stack in the Android system, establish a multicast channel in the Android system in the application APP, send or inject transport stream packets into the multicast channel, and use the Android system media at the same time The playback subsystem supports the playback of standard multicast resources to meet playback requirements; 所述步骤C之后还包括:After the step C, also include: D、当通过所述应用APP操控所述播放器时,匹配控制所述组播通道的数据注入速率和流量;所述操控包括暂停、恢复和倍速播放;D. When the player is manipulated through the application APP, the data injection rate and flow of the multicast channel are matched and controlled; the manipulation includes pausing, resuming, and double-speed playback; 所述步骤B中,应用APP连续获取需播放的数据流形成连续的传输流包,通过所述组播通道连续发送传输流包,形成系统内的组播流;若获取到的数据流不是传输流包,则需在发送前将数据流转化成传输流包。In the step B, the application APP continuously obtains the data stream to be played to form a continuous transport stream packet, and continuously sends the transport stream packet through the multicast channel to form a multicast stream in the system; if the obtained data stream is not a transmission stream Stream packets, the data stream needs to be converted into transport stream packets before sending. 2.根据权利要求1所述的基于Android系统的媒体数据流播放方法,其特征在于,所述步骤D之后还包括:2. the media data stream playing method based on Android system according to claim 1, is characterized in that, also comprises after described step D: E、当所述数据源播放结束时,关闭所述组播通道以及关闭所述播放器。E. When the data source finishes playing, close the multicast channel and close the player. 3.一种基于Android系统的媒体数据流播放系统,其特征在于,包括:3. A media data stream playing system based on Android system, characterized in that, comprising: 组播通道生成模块,用于建立组播地址,并打开组播端口,生成组播通道;The multicast channel generation module is used to establish a multicast address, and open a multicast port to generate a multicast channel; 组播流形成模块,用于获取数据源的传输流包,并利用所述组播通道发送所述传输流包,在Android系统内形成组播流;应用APP连续获取需播放的数据流形成连续的传输流包,通过所述组播通道连续发送传输流包,形成系统内的组播流;若获取到的数据流不是传输流包,则需在发送前将数据流转化成传输流包;The multicast flow forming module is used to obtain the transport stream packet of the data source, and utilize the multicast channel to send the transport stream packet to form a multicast stream in the Android system; the application APP continuously acquires the data stream to be played to form a continuous The transport stream packets are sent continuously through the multicast channel to form a multicast stream in the system; if the obtained data stream is not a transport stream packet, the data stream needs to be converted into a transport stream packet before sending; 播放模块,用于利用所述组播地址打开应用层的播放器,并开始播放所述组播流;A playback module, configured to use the multicast address to open the player of the application layer, and start playing the multicast stream; 所述组播通道生成模块具体包括:The multicast channel generation module specifically includes: 查询单元,用于查询Android系统内的网络以及网络端口的使用状态,并将处于空闲状态的网络端口作为组播端口;The query unit is used to query the network in the Android system and the usage state of the network port, and use the network port in idle state as the multicast port; 组播通道生成单元,用于利用所述组播端口建立组播地址,并打开组播端口,生成组播通道;A multicast channel generating unit, configured to use the multicast port to establish a multicast address, and open the multicast port to generate a multicast channel; 利用Android系统中TCP/IP协议栈提供的局域网内的组播功能,在应用APP中建立Android系统内的组播通道,向所述组播通道中发送或注入传输流包,同时利用Android系统媒体播放子系统对标准组播资源的播放进行支持以达到播放要求;Using the multicast function in the local area network provided by the TCP/IP protocol stack in the Android system, establish a multicast channel in the Android system in the application APP, send or inject transport stream packets into the multicast channel, and use the Android system media at the same time The playback subsystem supports the playback of standard multicast resources to meet playback requirements; 还包括:Also includes: 控制模块,用于当通过所述应用APP操控所述播放器时,匹配控制所述组播通道的数据注入速率和流量;所述操控包括暂停、恢复和倍速播放。The control module is used to match and control the data injection rate and flow of the multicast channel when the player is controlled by the application APP; the control includes pausing, resuming and playing at double speed. 4.根据权利要求3所述的基于Android系统的媒体数据流播放系统,其特征在于,还包括:4. the media data stream playing system based on Android system according to claim 3, is characterized in that, also comprises: 关闭模块,用于当所述数据源播放结束时,关闭所述组播通道以及关闭所述播放器。The closing module is used to close the multicast channel and the player when the data source finishes playing.
CN201610103442.8A 2016-02-25 2016-02-25 A kind of media data flow playback method and system based on android system Expired - Fee Related CN105744380B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610103442.8A CN105744380B (en) 2016-02-25 2016-02-25 A kind of media data flow playback method and system based on android system
PCT/CN2017/074669 WO2017144001A1 (en) 2016-02-25 2017-02-24 Method and system for media data stream playback based on android system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610103442.8A CN105744380B (en) 2016-02-25 2016-02-25 A kind of media data flow playback method and system based on android system

Publications (2)

Publication Number Publication Date
CN105744380A CN105744380A (en) 2016-07-06
CN105744380B true CN105744380B (en) 2018-11-30

Family

ID=56248497

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610103442.8A Expired - Fee Related CN105744380B (en) 2016-02-25 2016-02-25 A kind of media data flow playback method and system based on android system

Country Status (2)

Country Link
CN (1) CN105744380B (en)
WO (1) WO2017144001A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105744380B (en) * 2016-02-25 2018-11-30 深圳创维数字技术有限公司 A kind of media data flow playback method and system based on android system
CN108600826B (en) * 2018-05-22 2021-04-20 深圳市茁壮网络股份有限公司 Method and device for playing TS (transport stream)
CN110149559A (en) * 2019-05-27 2019-08-20 湖南快乐阳光互动娱乐传媒有限公司 Method and system for playing video in global variable speed manner

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103796078A (en) * 2014-01-23 2014-05-14 深圳创维-Rgb电子有限公司 Multicast video playing method and video playing terminal
CN104796796A (en) * 2015-04-21 2015-07-22 范文鲜 Method for improving fault tolerance of HLS (hyper text transport protocol live streaming) player of Android platform

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8000395B2 (en) * 2006-05-24 2011-08-16 Newport Media, Inc. System and method for statistical multiplexing of video channels for DVB-H mobile TV applications
CN101867803B (en) * 2010-05-21 2012-11-28 杭州华三通信技术有限公司 Data transmission method, equipment and system
CN103313111A (en) * 2012-10-29 2013-09-18 中兴通讯股份有限公司 Media playing method and device
CN103945284B (en) * 2013-01-18 2018-10-12 联想(北京)有限公司 Information processing method and information processing unit
US20150046568A1 (en) * 2013-08-11 2015-02-12 Imvision Software Technologies Ltd. Method and system for playing multicast over-the-top (ott) content streams
CN106464932A (en) * 2014-03-31 2017-02-22 英国电讯有限公司 Multicast streaming
CN104618802A (en) * 2015-02-03 2015-05-13 深圳市米家互动网络有限公司 Mobile terminal, network set-top box based on Android and system recovery method thereof
CN105744380B (en) * 2016-02-25 2018-11-30 深圳创维数字技术有限公司 A kind of media data flow playback method and system based on android system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103796078A (en) * 2014-01-23 2014-05-14 深圳创维-Rgb电子有限公司 Multicast video playing method and video playing terminal
CN104796796A (en) * 2015-04-21 2015-07-22 范文鲜 Method for improving fault tolerance of HLS (hyper text transport protocol live streaming) player of Android platform

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
组播测试工具VLC使用说明;https://wenku.baidu.com/view/3e77a982bceb19e8b8f6baa3.html?from=;《百度文库》;20111213;前言、第1-2节 *

Also Published As

Publication number Publication date
WO2017144001A1 (en) 2017-08-31
CN105744380A (en) 2016-07-06

Similar Documents

Publication Publication Date Title
CN106464965B (en) Method and apparatus for displaying application data in wireless communication system
CN103581699B (en) Video playing method, streaming media server and streaming media playing system
CN102547239B (en) Video surveillance system based on Android mobile terminal
KR100848128B1 (en) Progressive streaming method using real time streaming protocol
CN103391277B (en) media playing method, device and system
CN101998174B (en) Quick access method, server, client and system of multicast RTP (real time protocol) session
CN105610824B (en) A kind of screen sharing method based on screen mirror image and RTSP Streaming Media frame
CN104394127B (en) A kind of multimedia sharing method, equipment and system
WO2012109821A1 (en) Method, system for sharing steaming media resources, and device with digital living network alliance (dlna) function
CN104202675A (en) Intelligent terminal and quick channel switching method and device thereof
CN102195955B (en) Method and corresponding equipment for switching between live broadcast service and time shifting service
CN105744380B (en) A kind of media data flow playback method and system based on android system
WO2010017656A1 (en) Fast content switching in a communication system
CN105142008B (en) A method of playing second terminal data using first terminal
WO2009015611A1 (en) Method, system and apparatus for quick switching media source
CN107006054B (en) Wireless docking method and system for audio-video relay
WO2018018965A1 (en) Screen sharing method, device, and system
CN106612445A (en) Wireless one-screen audio channel control method, transmitting device and receiving device
WO2015117355A1 (en) Method and device for realizing multimedia broadcasting of terminal
CN111614927B (en) Video session establishment method, device, electronic device and storage medium
WO2015131454A1 (en) Projection method, terminal and system
CN101453474B (en) Terminal, information inserting system and method
CN106790030B (en) Multi-screen cooperative audio transmission server, client, system and processing method thereof
CN109361671A (en) A streaming media transmission architecture method based on SIP protocol
WO2015109842A1 (en) Method for processing segmented programs, server and client device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20181130

CF01 Termination of patent right due to non-payment of annual fee