Summary of the invention
The technical problem to be solved in the present invention is to provide a kind of method and terminal of terminal processes video flowing, to realize the multi-path video stream demonstration of decoding.
In order to solve the problems of the technologies described above, the invention provides a kind of method of terminal processes video flowing, comprising:
Terminal request is also accepted video flowing;
Described in described decoding terminals, when video flowing, the state of inquiry hard decoder device, if hard decoder device is busy condition, adopts soft decoder to decode.
Further, said method also has feature below: described terminal is accepted, after video flowing, also to comprise:
Described terminal is that described video flowing creates an object video, and for this object video arranges unique mark, then described object video is put into a video flowing stored reservoir.
Further, said method also has feature below: the soft decoder of described employing also comprises after decoding:
Described terminal is combined to the decoded video requency frame data of all soft decoders on show canvas, waits for that window refreshes demonstration, by directly upper screen of decoded hard decoder device frame of video, waits for that window refreshes demonstration;
Described terminal, after refresh time arrives, is initiated screen-refresh message, and the video streaming image of all soft decoder decodings and the decoding of hard decoder device is shown on screen.
Further, said method also has feature below: described terminal also comprises after the video streaming image of all soft decoder decodings and the decoding of hard decoder device is shown on screen:
Described terminal receives displaying video stream and completes after message, deletes corresponding video flowing, as this video flowing adopts the decoding of hard decoder device, discharges hard decoder device, and the state of described hard decoder device is set to the free time simultaneously.
In order to address the above problem, the present invention also provides a kind of terminal, wherein, comprising:
The first module, for asking and accept video flowing;
The second module, when decoding described video flowing, the state of inquiry hard decoder device, if hard decoder device is busy condition, adopts soft decoder to decode.
Further, above-mentioned terminal also has feature below:
Described the first module, is also used to described video flowing to create an object video, and for this object video arranges unique mark, then described object video is put into a video flowing stored reservoir.
Further, above-mentioned terminal also has feature below: described terminal also comprises:
The 3rd module, for the decoded video requency frame data of all soft decoders is combined to show canvas, waits for that window refreshes demonstration, by directly upper screen of decoded hard decoder device frame of video, waits for that window refreshes demonstration;
Four module, after arriving at refresh time, initiates screen-refresh message, and the video streaming image of all soft decoder decodings and the decoding of hard decoder device is shown on screen.
Further, above-mentioned terminal also has feature below: described terminal also comprises:
The 5th module, completes after message for receiving displaying video stream, deletes corresponding video flowing, as this video flowing adopts the decoding of hard decoder device, discharges hard decoder device, and the state of described hard decoder device is set to the free time simultaneously.
To sum up, the invention provides a kind of method and terminal of terminal processes video flowing, can effectively utilize the high efficiency of hard decoder, use the method for soft decoding to process simultaneously and show more video flowing.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, hereinafter in connection with accompanying drawing, embodiments of the invention are elaborated.It should be noted that, in the situation that not conflicting, the combination in any mutually of the feature in embodiment and embodiment in the application.
Fig. 1 is the flow chart of the method for a kind of terminal processes video flowing of the embodiment of the present invention, and as shown in Figure 1, the method for the present embodiment comprises the following steps:
S11, terminal request are also accepted video flowing;
Described in S12, decoding terminals, when video flowing, the state of inquiry hard decoder device, if hard decoder device is busy condition, adopts soft decoder to decode.
In the present embodiment, comprise video flowing preliminary treatment, can be pre-created video flowing stored reservoir, in the time that cloud service end has a MJPEG video flowing to need terminal to show, thin terminal can arrange a unique mark (ID) for this video flowing, and this video flowing is put into video flowing stored reservoir, and video flowing stored reservoir is for managing video flowing object, so that software program can operate object video easily, raise the efficiency.
When thin terminal receives MJPEG(Motion-Join Photographic Experts Group, motion rest image (or frame by frame) compression) when video data, first according to the ID of current video data, find its corresponding video flowing object, and data are saved in corresponding video flowing object.
The process of carrying out multichannel MJPEG stream decoding processing is as follows:
In the time having a MJPEG decoding video stream request, first remove to inquire about the state of decoder, the present embodiment adopts the state of preferential inquiry hard decoder device, if the state of hard decoder device is idle, Ze Gai road video flowing uses hard decoder device to decode; Otherwise use soft decoder to decode.
Because hard decoder is an exclusive resource, if therefore hard decoder device is used, a busy indications is set need to hard decoder device, bind the ID of this road video flowing simultaneously, now hard decoder resource can not be reallocated, if the video flowing of hard decoder is released, to indications be set to the free time.
When receive MJPEG video data after, thin terminal is assigned to corresponding decoder according to the ID of current data video and decodes.
Thin terminal is carried out the demonstration of multichannel MJPEG stream and is comprised:
Create show canvas, the decoded video requency frame data of all soft decoders is combined on show canvas, wait for that window refreshes demonstration; Frame of video after hard decoder is upper screen directly, waits for that window refreshes demonstration.
When arriving after refresh time, thin terminal is initiated window refresh message, and show canvas can show video requency frame data, and the data after hard decoder also will directly refresh demonstration on screen.
In the time that cloud service end has a video flowing to discharge, can notify thin terminal, thin terminal is received after this message, video flowing object corresponding in stored reservoir can be deleted.
The embodiment of the present invention adopts the method for hard decoder and soft decoding combination, makes thin terminal possess the function that shows multichannel MJPEG video flowing.This method is used hard decoder preferential principle, can effectively utilize the high efficiency of hard solution, uses the method for soft decoding to process simultaneously and shows more video flowing.Adopt the thin terminal of the method for the embodiment of the present invention can meet the demand that current cloud computing system multiple video strems shows.
Be the video stream traffic handling process of the present invention's one application example below, as follows:
Step 101: user's (being thin terminal) initiates displaying video request to cloud service end, cloud service end is received after thin terminal request and authentication success, is responded request-reply toward thin terminal.
Step 102: thin terminal creates video flowing stored reservoir after receiving and replying, and wait for the video stream data from cloud service end.
Step 103: when thin terminal receives from cloud service Duan mono-road MJPEG video flowing, Hui Weigai road video flowing creates an object video, and for this object arrange one unique No. ID, finally this object video is put into video flowing stored reservoir.
Step 104: in the time having object video A to decode in thin terminal discovery video flowing stored reservoir, inquire about the state of thin terminal decoder.
In the present embodiment, adopt the preferential principle of hard decoder, first inquire about the state of hard decoder device, be idle condition if hard decoder device is current, object video A employing hard decoder, and hard decoder device is set to busy condition, and hard decoder is A object video by binding ID simultaneously; Otherwise adopt soft decoding.
Step 105: if thin terminal receives ID while being the MJPEG video data of A, find its corresponding object video A according to the ID of current video data, and video data is saved in object video A.Decoder corresponding in terminal is decoded to the video data in object video A.
Step 106: the data after thin terminal combinations multichannel MJPEG video decode, if object video A adopts hard decoder, directly upper screen of decoded data, waits for that window refreshes demonstration; Other adopt the object video B of soft decoding and object video C decoded data need to be combined on painting canvas, could wait for that window refreshes demonstration.
Step 107: after refresh time arrives, thin terminal can be initiated screen-refresh message, and multi-channel video stream picture is shown on screen, realizes multichannel and plays.
Step 108: Cloud Server is initiated the video A message that finishes playing, and thin terminal receives this message, and finds corresponding object video A according to video flowing No. ID.Object A is deleted from video management pond, if A adopts hard decoder, also need the resource of hard decoder to discharge, the state of hard decoder is set for idle simultaneously.
Fig. 2 is the schematic diagram of the terminal of the embodiment of the present invention, and as shown in Figure 2, the terminal of the present embodiment can comprise:
The first module, for asking and accept video flowing;
The second module, when decoding described video flowing, the state of inquiry hard decoder device, if hard decoder device is busy condition, adopts soft decoder to decode.
In a preferred embodiment, described the first module also can be used for for described video flowing creates an object video, and for this object video arranges unique mark, then described object video is put into a video flowing stored reservoir.
In a preferred embodiment, described terminal can also comprise:
The 3rd module, for the decoded video requency frame data of all soft decoders is combined to show canvas, waits for that window refreshes demonstration, by directly upper screen of decoded hard decoder device frame of video, waits for that window refreshes demonstration;
Four module, after arriving at refresh time, initiates screen-refresh message, and the video streaming image of all soft decoder decodings and the decoding of hard decoder device is shown on screen.
In a preferred embodiment, described terminal can also comprise:
The 5th module, completes after message for receiving displaying video stream, deletes corresponding video flowing, as this video flowing adopts the decoding of hard decoder device, discharges hard decoder device, and the state of described hard decoder device is set to the free time simultaneously.
One of ordinary skill in the art will appreciate that all or part of step in said method can carry out instruction related hardware by program and complete, described program can be stored in computer-readable recording medium, as read-only memory, disk or CD etc.Alternatively, all or part of step of above-described embodiment also can realize with one or more integrated circuits.Correspondingly, the each module/unit in above-described embodiment can adopt the form of hardware to realize, and also can adopt the form of software function module to realize.The present invention is not restricted to the combination of the hardware and software of any particular form.
These are only the preferred embodiments of the present invention; certainly; the present invention also can have other various embodiments; in the situation that not deviating from spirit of the present invention and essence thereof; those of ordinary skill in the art are when making according to the present invention various corresponding changes and distortion, but these corresponding changes and distortion all should belong to the protection range of the appended claim of the present invention.