[embodiment]
See also Fig. 1, be depicted as set-top box 100 and video server 300 connection diagrams in an embodiment of the present invention.
Set-top box 100 in an embodiment of the present invention is connected with video server 300 by broadband network 200.Broadband network 200 comprises the broadband network that uses the digital user loop technology, and the broadband network of use hybred fiber-coax cable technology etc.Store the required film resource of set-top box 100 in the video server 300.
Set-top box 100 in an embodiment of the present invention includes a man-machine interface unit 111, a line request (Setup request) unit 113, a playing request (Play request) unit 115, a normal play time calculating unit 119, an overload detecting unit 117, a broadcast unit 121 and disconnection line request (Teardown request) unit 123.
In the present embodiment, the user can and disconnect line request unit 123 by man-machine interface unit 111 control line request units 113, playing request unit 115.The user desires to carry out can pass through directly control man-machine interface unit 111 realizations when line, disconnection line, F.F., playback and time-out etc. are operated.
Man-machine interface unit 111 is the window of user's controller top box 100, and the user need realize by the man-machine interface unit to all operations that set-top box 100 is sent.Line request unit 113 is used to set up communicating to connect between set-top box 100 and the video server 300.Promptly, line request unit 113 is responsible for receiving the order from man-machine interface unit 111, send a line request to video server 300, require video server 300 to distribute an interconnection resources for set-top box 100, and handle the line request response that video server 300 transmissions are returned.Playing request unit 115 is used for sending a playing request to video server 300, requires video server 300 to distribute a movie resource to it, and handles video server 300 and send the playing request or the control response of returning.When the user desires with normal mode broadcast film, can send the normal mode playing request to video server 300 by man-machine interface unit 111 controls playing request units 115.When the user desires with special patterns such as F.F., playback and time-out broadcast film, also can send corresponding special pattern playing request to video server 300 by man-machine interface unit 111 controls playing request units 115.Whether overload detecting unit 117 is used to detect video server 300 and overloads.Normal play time calculating unit 119 is used to calculate the normal play time of film when overload takes place video server 300.Broadcast unit 121 is used to play film, and it can enter normal mode under user's control or special pattern is play.Disconnect the line that line request unit 123 is used to disconnect between set-top box 100 and the video server 300.
See also Fig. 2, be depicted as set-top box 100 in an embodiment of the present invention from sending the flow chart that the line request is play to normal mode.
Enter step S211, line request unit 113 sends a line request and flows (Real-Time Stream) to video server 300 in real time to start one, and video server 300 promptly is to give set-top box 100 Resources allocation by real-time stream.The line request that line request unit 113 sends to video server 300 comprises following information at least:
The version of the Internet Protocol address of set-top box 100 and the real time streaming transport protocol of use;
Set-top box 100 is sent the sequence number (Sequence code) of this line request, and this line request is line request for the first time, so its sequence number is 1;
The film format that set-top box 100 is supported, for example MPEG-2 (Moving Picture ExpertGroup) form or WMV (Windows Media Video) form;
Set-top box 100 employed host-host protocols, for example User Datagram Protoco (UDP) (User DatagramProtocol, UDP) or transmission control protocol (Transmisson Control Protocol, TCP);
Set-top box 100 is used to receive the port of data and the Internet Protocol address of video server 300 etc.
Line request unit 113 enters step S213 and waits for that video server 300 sends line request response (Setup Response) after video server 300 sends the line request.Video server 300 sends the line request response of returning and comprises following information at least:
The version of the real time streaming transport protocol that set-top box 100 is used;
The conditional code (Status Code) of described line request response, described conditional code is used to represent video server 300 whether to agree this line request, if allow in the present embodiment then send " 200 ", this moment show set-top box 100 successful with video server 300 lines, if do not allow then send " 403 ", this line failure is described;
The sequence number that described line is responded is identical with the sequence number of above-mentioned line request;
The session number (Session ID) that set-top box 100 and video server 300 are set up;
The title of video server 300 and the version information of operating system;
Film format and employed host-host protocol that set-top box 100 desires receive;
Video server 300 is described the agreement of film, as utility cession describe agreement (SessionDescription Protocol, SDP) or other agreement is described;
Information such as the bandwidth of the Internet Protocol address of video server 300 and communication port thereof, transmission film and packet size are used to describe the size of the field of film relevant information.
Wherein, the description of aforesaid film relevant information comprises the broadcast scope (Range) of film.Video server 300 can be represented the broadcast scope in two ways, first kind for show time mark (Presentation Time Stamp, PTS), for example " Range:pts=71287-560857513 ", unit be (Bit); Second kind be the normal play time (Normal Play Time, NPT), for example " Range:npt=1200.00-end ", unit is second (Second).Wherein the normal play time is meant film from position that initial position to film has been play during this period of time, and it can calculate by showing time mark.In follow-up communication process, communicating by letter between set-top box 100 and the video server 300 all transmitted film with the normal play time.In the present embodiment, show that time mark also is used for basis of calculation reproduction time simultaneously when overload takes place video server 300.
In step S213, when set-top box 100 successes set up line with video server 300 after, enter step S215, playing request unit 115 sends a playing request (Play Request) that comprises logical character to video server 300.The described playing request that comprises the logical sub symbol comprises following information at least:
The Internet Protocol address of video server 300;
The sequence number of this playing request is for the sequence number of aforesaid line request adds an integer; For example, send then should on the basis of aforementioned line request, add 3 if this playing request is the 4th;
The broadcasting speed of film represents that with " Scale:1.00 " film is with normal speed forward;
The session number that set-top box 100 and video server 300 are set up, session number equates with the session number of aforesaid line request response.
Because this playing request is first playing request, film does not begin to play as yet, even video server 300 overloads, the broadcast scope of its set-top box that sends to 100 is the same for the movie scope that " 0.00-end " and set-top box 100 have just begun to play film also.So the broadcast scope of this playing request informs that with logical character " beginning-end " the film scope that video server 300 desires are play is broadcast from the beginning to the end, i.e. " Range:npt=beginning-end ".
In step S215, playing request unit 115 needs to wait for that video server 300 sends the playing request response (Play Response) of returning after video server 300 sends playing request, and described playing request response comprises following information at least:
The version of the employed real time streaming transport protocol of both sides;
Be used to represent whether video server 300 agrees the state code of this playing request;
The sequence number and the session number of described playing request response, described sequence number and session number are consistent with the sequence number and the session number of aforementioned playout request;
The broadcast scope of film, broadcasting speed (Scale) and line speed.
In step S217, set-top box 100 judges according to above-mentioned playing request response whether video server 300 allows to play film.If then set-top box 100 enters step S219 and plays film by broadcast unit 121.If not, then playing request unit 115 returns step S215 comprises logical character again to video server 300 transmissions one normal mode playing request once more.
See also Fig. 3, the set-top box 100 that is depicted as in an embodiment of the present invention enters the flow chart of speical play pattern from normal play mode.
Enter step S311, after set-top box 100 enters the normal mode broadcast.In this process, if detecting the user, man-machine interface unit 111 sends special pattern play instructions such as F.F., playback and time-out, then man-machine interface unit 111 promptly is responsible for relevant command information is sent to playing request unit 115.
Enter step S313, playing request unit 115 comprises the special pattern playing request of logical character to video server 300 transmissions one.Playing request unit 115 comprises following information at least in the special pattern playing request that this step sent:
The sequence number of described special pattern playing request, described sequence number are that the sequence number of the normal mode playing request among the step S211 adds an integer;
Movie speed, described broadcasting speed is the integral multiple of movie speed among the step S215, for example, if the user desires to play with the speed that is twice in normal playback speed, the value of the broadcasting speed field of then described special pattern playing request is 2, i.e. " Scale:2.00 ";
The broadcast scope of film represents that with logical character " current-end " film is played to end from present reproduction time, i.e. " Range:npt=current-end " always in the broadcast scope of film described in this step.
Enter step S315, the response of video server 300 is waited in playing request unit 115.Do not take place at video server 300 under the situation of overload, the broadcast scope during its playing request that sends to set-top box 100 responds is promptly with normal play time representation.For example, if playing request unit 115 begins to send the fast-forward play request of 2 times of speed when movie to 1200 second, then the broadcast scope in the playing request response is " Range:npt=1200.00-end ", and broadcasting speed is " Scale:2.00 ".Take place under the situation of overload at video server 300, corresponding playing request response message promptly becomes " Range:npt=0.00-end " and " Scale:2.00 ".
Enter step S317, whether the broadcast scope in the 117 detecting playing request responses of overload detecting unit is correct, to determine whether video server 300 overloads.Because film has been play a period of time in said process, not should be " 0.00-end " so video server 300 is passed to the broadcast scope of broadcast unit 121.In the present embodiment, whether overload detecting unit 117 can be that " 0.00-end " is to judge whether video server 300 overloads by the broadcast scope in the response of detecting playing request.If overload detecting unit 117 detects the broadcast scope for " 0.00-end ", show that video server 300 overloads, next enter step S319.If it is not " 0.00-end " that overload detecting unit 117 detects the broadcast scope, show that video server 300 does not overload, can directly enter step S323 with speical play mode playback film.
Enter step S319, normal play time calculating unit 119 calculates the normal play time that film has been play.In the present embodiment, normal play time calculating unit 119 inquires film from line request response broadcast scope is " Range:pts=71287-560857513 ".Then, the demonstration time stamp value in the normal play time calculating unit 119 inquiry MPEG-2 news frames, the value that for example inquires is 67535839.And the normal play speed of film is 90000 bps (the normal play speed of MPEG), so the normal play time of film is: (67535839-71287)/(90000 bps) ≈ 750 seconds.
Enter step S321, playing request unit 115 sends a special pattern playing request that comprises the normal play time that is calculated among the step S319 to video server 300.Then return step S315, playing request unit 115 waits for that video server 300 sends the playing request response of returning.If video server 300 does not allow broadcast unit 121 to play then returns the film that step S311 continues to play remainder.If video server 300 allows broadcast unit 121 to play then repeating step S317, then enter step S323 and play with special pattern.
See also Fig. 4, the set-top box 100 that is depicted as in an embodiment of the present invention enters the flow chart of normal play mode from the speical play pattern.
Enter step S411, set-top box 100 enters normal mode play after, if man-machine interface unit 111 detects the user and sends the normal mode play operation in this process, then man-machine interface unit 111 instruction promptly being responsible for being correlated with sends to playing request unit 115.
Enter step S413, playing request unit 115 comprises the normal mode playing request of logical character to video server 300 transmissions one.Playing request unit 115 comprises following information at least in the normal mode playing request that this step sent:
The sequence number of described normal mode playing request, described sequence number are that the sequence number of the normal mode playing request among the step S211 adds an integer;
Movie speed, described broadcasting speed are normal playback speed, i.e. " Scale:1.00 ";
The broadcast scope of film is to be played to end from present reproduction time with logical character " current-end " expression film in broadcast scope described in this step equally always, i.e. " Range:npt=current-end ".
Enter step S415, the response of video server 300 is waited in playing request unit 115.Do not take place at video server 300 under the situation of overload, the broadcast scope during its playing request that sends to set-top box 100 responds is with normal play time representation.For example, if the playing request unit begins to send the normal mode playing request when movie to 2200 second, then the broadcast scope in the playing request response is " Range:npt=2200.00-end ", and broadcasting speed is " Scale:1.00 ".If video server 300 overloads, then corresponding playing request response message is " Range:npt=0.00-end " and " Scale:1.00 ".
Enter step S417, whether the broadcast scope in the 117 detecting playing request responses of overload detecting unit is correct.Because film has been play a period of time in said process, not should be " 0.00-end " so video server 300 is passed to the broadcast scope of broadcast unit 121.In the present embodiment, whether overload detecting unit 117 can be that " 0.00-end " is to judge whether video server 300 overloads by the broadcast scope in the response of detecting playing request.If overload detecting unit 117 detects the broadcast scope for " 0.00-end ", show that video server 300 overloads, next need enter step S419.If it is not " 0.00-end " that overload detecting unit 117 detects the broadcast scope, show that video server 300 does not overload, can directly enter step S423 and play film with normal mode.
Enter step S419, normal play time calculating unit 119 calculates the normal play time that film has been play.In the present embodiment, the normal play time calculating unit 119 broadcast scope that inquires film from line request response is " Range:pts=71287-560857513 ".Then, the demonstration time stamp value in the normal play time calculating unit 119 inquiry MPEG-2 news frames, the value that for example inquires is 77535839.And the normal play speed of film is 90000 bps (the normal play speed of MPEG), so the normal play time of film is: (77535839-71287)/(90000 bps) ≈ 861 seconds.
Enter step S421, playing request unit 115 sends a normal mode playing request that comprises the normal play time that is calculated among the step S419 to video server 300.Then return step S415, playing request unit 115 waits for that video server 300 sends the playing request response of returning.If video server 300 does not allow broadcast unit 121 to play then returns step S411.If video server 300 allows broadcast units 121 to play then whether repeating step S417 detecting video server 300 overloads, can not enter step S423 and play with normal mode if overload does not take place.
See also Fig. 5, be depicted as the flow chart that set-top box 100 and video server 300 in an embodiment of the present invention disconnects lines.
Enter step S511, broadcast unit 121 with normally/special pattern plays.If man-machine interface unit 111 detects the user and sends the operation of disconnection line in this process, then the promptly responsible instruction that will be correlated with in man-machine interface unit 111 sends to playing request unit 115.
Enter step S513, disconnect line request unit 123 and send a disconnection line request to video server 300.Disconnect the disconnection line request that line request unit 123 sends and inform that with logical character " Teardown " video server 300 discharges stream resource in real time, disconnect information such as the sequence number that also comprises this request in the line request simultaneously and session number.
Enter step S515, disconnect line request unit 123 and wait for that video server 300 sends the disconnection line request response of returning.If video server 300 is agreed to disconnect lines then is entered step S517, if video server 300 disagree with disconnect line return step S511 continue with normally/special pattern plays.
Whether set-top box 100 in an embodiment of the present invention and video server overload processing method thereof can be detected video server 300 timely and overload, and the time that film has been play when calculating video server 300 voluntarily overload taking place, with the burden that alleviates video server 300 and avoid film to play again.