Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
As mentioned above, enumerate the link that medium type is set up owing to adopting, often existing can't normal play, such as without problems such as image, voiceless sound or video/audio are asynchronous.The reason that these problems produce is that efficient is also different because the realization mechanism of filter is different.And, adopt when enumerating medium type and connecting, need between two filters mutually inquiry whether to support the other side, namely to inquire about the other side and whether support certain type, such inquiry itself is more consuming time.Based on this, the embodiment of the invention provides a kind of method for building up, device and player of playing link, is intended to simplify the process of setting up link, realizes simultaneously the Auto-matching of medium type, realizes the optimization of playing.The present invention is described in detail below in conjunction with accompanying drawing.
The embodiment of the invention provides a kind of method for building up of playing link, and as shown in Figure 1, the method comprises:
Step 101 is obtained audio-video document according to the file path that receives;
Step 102 is obtained Format Type, the type of coding of audio-video document according to audio-video document;
Step 103 is selected resolver, decoder and renderer according to Format Type, the type of coding of audio-video document;
Step 104 is set up the broadcast link according to the resolver of selecting, decoder and renderer, with playing audio-video document.
As seen from the above description, by selecting resolver, decoder and renderer according to the Format Type of file, type of coding, and setting up thus and play link, overcome employing of the prior art and enumerated the lower problem of efficient that the link of medium type foundation occurs, thereby can realize setting up the optimization of link and result of broadcast.
Particularly, above-mentioned Format Type according to audio-video document, type of coding select resolver, decoder and renderer to comprise: if set in advance optimal solution parser, decoder and renderer, then select optimal solution parser, decoder and renderer; If do not set in advance optimal solution parser, decoder and renderer, then select high resolver, decoder and the renderer of priority according to Format Type, the type of coding of audio-video document.Wherein, the Format Type of audio-video document is used for selecting the high resolver of priority; The type of coding of audio-video document is used for selecting the high decoder of priority; The playing platform of audio-video document is used for selecting the high renderer of priority.
That is to say, system can pre-configured optimum link to (resolver+decoder+renderer), to set up optimum link.If the optimum link pair of design in advance then can also not select high resolver, decoder and the renderer of priority set up optimum link according to Format Type, the type of coding of audio-video document.This has just been avoided handshake procedure of the prior art, does not need to inquire about the medium type that input and output PIN (pin) supports, but directly specifies connection type to connect.Like this, just can simplify the process of setting up link, and, because the connection priority of setting up is higher, also can realize the optimization of playing efficiency.
Fig. 2 is the flow chart of selecting pre-configured optimum link, and as shown in Figure 2, this flow process comprises:
Step 201 is inquired about pre-configured optimum link table;
Step 202 if find optimum link, then carry out step 203, otherwise returns error message;
Step 203 judges whether to carry out this locality and plays, and if so, carry out step 204, otherwise carry out step 205;
Does step 204 read filter with FileReader (Asyn)? if so, carry out step 206, otherwise carry out step 207;
Step 205 loads QvodSource, and carry out step 208;
Step 206 loads FileReader (Asyn), and carry out step 208;
Step 207 loads and specifies Source, and carry out step 209;
Step 208 loads the Splitter in the optimum link, and carry out step 209;
Step 209 loads Decoder;
Step 210 loads Render, and returns correct information.
Fig. 3 is the flow chart of not setting up in advance optimum link during the devise optimum link, and as shown in Figure 3, this flow process comprises:
Step 301 is according to Format Type inquiry optimal solution parser, if a plurality of resolver then sorts by priority;
Step 302 loads the optimal solution parser, if unsuccessful, then attempts next resolver, and returns step 301;
Step 303 is inquired about optimum decoder according to video, audio coding type, if a plurality of decoders are arranged, then sorts by priority;
Step 304 loads optimum decoder, if unsuccessful, then attempts next decoder, and returns step 303;
Step 305 loads optimum renderer.
The embodiment of the invention also provides a kind of apparatus for establishing of playing link, is preferably used for realizing the method in above-described embodiment.As shown in Figure 4, this device comprises:
Audio-video document acquiring unit 401 is used for obtaining audio-video document according to the file path that receives;
Audio-video document type acquiring unit 402 is for the Format Type, the type of coding that obtain audio-video document according to audio-video document;
Filter selected cell 403, the Format Type, the type of coding that are used for according to audio-video document are selected resolver, decoder and renderer;
Link establishment unit 404 is used for setting up the broadcast link according to the resolver of selecting, decoder and renderer, with playing audio-video document.
Can be found out by above description, link establishment unit 404 is selected resolver, decoder and renderer, and is set up thus and play link according to Format Type, the type of coding of file by filter selected cell 403, overcome employing of the prior art and enumerated the lower problem of efficient that the link of medium type foundation occurs, thereby can realize setting up the optimization of link and result of broadcast.
Particularly, as shown in Figure 5, above-mentioned filter selected cell 403 comprises:
Predetermined filter is selected module 4031, is used for selecting optimal solution parser, decoder and renderer when having set in advance optimal solution parser, decoder and renderer;
The priority filter is selected module 4032, and being used for not setting in advance optimal solution parser, decoder and renderer is to select high resolver, decoder and the renderer of priority according to Format Type, the type of coding of audio-video document.
Wherein, as shown in Figure 6, the priority filter selects module 4032 to comprise:
Resolver chooser module 40321 is used for selecting the high resolver of priority according to the Format Type of audio-video document;
Decoder chooser module 40322 is used for selecting the high decoder of priority according to the type of coding of audio-video document;
Renderer chooser module 40323 is used for selecting the high renderer of priority according to the playing platform of audio-video document.
The concrete implementation of above-mentioned each unit, each module can with reference to the description in above-described embodiment one, repeat no more herein.
The embodiment of the invention also provides a kind of player, comprises the broadcast link establishment device in above-described embodiment.Particularly, the structural representation of this player as shown in Figure 7, this player comprises: data communication interface 1, file read module 2, separation module 3, audio decoder module 4, video decode module 5, audio frequency rendering module 6, Video Rendering module 7, post-processing module 8, playing controller 9, player link Optimum Matching module 10 (namely playing the link establishment device), playback interface 11 and User Interface (not shown).Wherein, data communication interface is used for receiving audio-video document; The file read module is by data communication interface Gains resources data; Separation module is categorized into voice data and video data for generation of request of data and with resource data, afterwards voice data is sent to the audio decoder module, gives the video decode module with video data transmitting; The audio decoder module exports audio playing apparatus to after the voice data of decoding is processed via the audio frequency rendering module; The video requency frame data of video decode module decoding is delivered to the transmit control module of User Interface via the Video Rendering module, and presents to the user by the broadcast window of User Interface.Post-processing module is mainly used in the processing such as color correction, 2 dimension videos.During playing audio-video document, a disk position or core position are preserved or be kept at temporarily to resource data, and separation module constantly reads resource data in the mode of asking/replying from preserving the position by file read module and data communication module.
In specific implementation process, as shown in Figure 8, player link Optimum Matching module 10 comprises: Filter management module 101 and link establishment module 102.Wherein:
Filter management module is managed all available filters, comprises resolver, decoder, color conversion filter, Video Rendering device, audio frequency renderer.Filter management module is read in outside XML file when initialization, as shown in Figure 9, the XML file comprises filters.xml, best.xml, filter_map.xml, and wherein, filters.xml is used for the attribute (GUID, DLL path, priority etc.) of each filter of record; Best.xml is used for some optimum link combinations that the record great many of experiments finds; Filter_map.xml is used for the corresponding relation of log file form (document container), type of coding and resolver.In addition, this XML file including the title of all filters of using of player, the combination of GUID unique identifier, the used resolver of the different compress modes of different-format, decoder, renderer.Outside by revising XML, just can realize the Optimum Matching of link.
The file path that the link establishment module is imported into according to playing controller, analyze Format Type, Video coding type, the audio coding type of file, match pre-designed optimum link to (resolver+decoder+renderer) from Filter management module, set up optimum link.If the optimum link pair of design in advance then according to Format Type, the type of coding of file, is not chosen the high resolver of priority, decoder, set up link.
That is to say, the process of setting up link can be divided into for two steps: the first step is the coupling optimum link, if success, then link establishment is finished, otherwise, carry out the second step Auto-matching and set up link.According to Format Type, determine document parser, according to the Video coding type, determine Video Decoder again, the audio coding type is determined audio decoder, determines Video Rendering device, audio frequency renderer according to the platform (WIN7, XP) of operation at last.In the connection procedure of the filter of second step, for fear of adopting handshake procedure of the prior art, do not inquire about the medium type that input and output PIN (pin) supports, but directly specify connection type (comprising main medium type and time medium type) to connect.The input medium type of each filter is recorded in advance Filters.xml and has suffered, and need to not enumerate inquiry in program operation process, does like this efficient that can improve connection.
Above-mentioned main medium type refers to the preliminary classification of audio frequency, video and captions, and inferior medium type refers to the segmentation under the main medium type, such as video: H.264, MPEG-1, MPEG-4, ffshow; Audio frequency: AAV, AMR-NB, PCM-LE.
Below be the optimum link example:
1, document container (file type): MP4
Video Decoder: AVC
Audio decoder: AAC
2, document container (file type): 3GP
Video Decoder: H263
Audio decoder: AMR-NB
3, document container (file type): MKV
Video Decoder: AVC
Audio decoder: AAC
4, document container (file type): MP4
Video Decoder: AVC
Audio decoder: PCM-LE
5, document container (file type): MKV
Video Decoder: VC-1
Audio decoder: AC-3
6, document container (file type): MKV
Video Decoder: RV40
Audio decoder: COOKER
7, document container (file type): FLV
Video Decoder: AVC
Audio decoder: AAC
The selection of renderer: windows XP:vmr7 video render
Just use EVR Video Render under WIN7, the VISTA
In practical operation should, VMR 9 VIDEO RENDER also are a kind of selections, but because its more problems, are called link and do not include optimum link.
Can be found out by above description,, can avoid adopting handshake procedure of the prior art automatically according to file format, type of coding coupling best link by player link Optimum Matching module 10, overcome the problem of setting up the link complexity of the prior art.
In sum, the embodiment of the invention is mated optimized filter for different file types, media coding type (Audio and Video), realize playing the optimization of link, overcome employing of the prior art and enumerated the lower problem of efficient that the link of medium type foundation occurs, thereby can realize setting up the optimization of link and result of broadcast.
One of ordinary skill in the art will appreciate that all or part of step that realizes in above-described embodiment method can come the relevant hardware of instruction finish by program, this program can be stored in the computer read/write memory medium, such as ROM/RAM, magnetic disc, CD etc.
Above-described specific embodiment; purpose of the present invention, technical scheme and beneficial effect are further described; institute is understood that; the above only is specific embodiments of the invention; the protection range that is not intended to limit the present invention; within the spirit and principles in the present invention all, any modification of making, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.