Abstract:
Disclosed are a subtitle switching method and device, the method comprising the following steps: receiving a subtitle switching instruction input by a user; acquiring to-be-switched subtitle data corresponding to the subtitle switching instruction and stored in a corresponding preset buffer area and a present time stamp of video and audio data currently being played; and outputting and displaying subtitle data of the to-be-switched subtitle data having a time stamp matching the present time stamp. When playing a video and audio file, the present invention caches subtitles in all languages, removes stored data of language subtitle data not currently being played and having a time stamp earlier than that of the video and audio data currently being played in a buffer area, and outputs and displays data of the to-be-switched subtitle data having a time stamp matching that of the video and audio data.

Description:
FIELD OF THE INVENTION 
       [0001]    The present invention relates to a field of Internet TV, especially to a subtitle switching method and device. 
       BACKGROUND OF THE INVENTION 
       [0002]    In many countries and areas, especially for some European video content providers, in order to provide video-on-demand programme services to people in variety of languages, the subtitles in variety of languages are embedded in the video files of the video programmes. When people are watching these programmes, using a remote controller may realize to switch the subtitles in variety of languages, for example, when watching Chinese blockbusters, many programmes may simultaneously provide Chinese and English subtitles. As shown in  FIG. 1 , in general, the procedure of switching subtitles as follows: 
         [0003]    Currently playing the subtitle  1  in language A, when the users switches the subtitle  2  in language B: 
         [0004]    Firstly, stop sending data of subtitle  1  into a cache A 1 , removing the cache A 1 , and flushing the subtitle decode module to remove data cached in the subtitle decode module; 
         [0005]    Then, sending data of subtitle  2  into a cache A 1 , the data cache module sends the data in the cache A 1  into the data cache module; 
         [0006]    Later, after the data cache module receives the data of subtitle  2 , decoding the data of subtitle  2 , synchronizing the decoded data of subtitle and audio or video data at time which then are outputted to the output module. 
         [0007]    Finally, after receiving the decoded subtitle data, the output module outputs the decoded subtitle data, then switching subtitles is closed. 
         [0008]    According to the abovementioned procedure, when switching subtitles, after clearing up the data of subtitle  1  in the cache A 1  and the data cache module, inserting the data of subtitle  2  at time TS 1 . Therefore, compared with audio or video files, the abovementioned procedure lacks the data in time length of TS 1  subducting TS 3 , where TS 3  represents the time of the present time stamp. Therefore, during the process of switching subtitles, people need to wait for the time length of TS 1  subducting TS 3  to see switched subtitles, meanwhile, since the time length of the subtitles does not match that of the audio and video files, sometimes it will appear lag phenomenon when outputting the subtitles, audio and video synchronously. 
       SUMMARY OF THE INVENTION 
       [0009]    The present invention discloses a subtitle switching method and device, to solve a technology problem that the conventional subtitle switching method needs to wait for a period of time causing the display screen in lag phenomenon. 
         [0010]    In order to realize the abovementioned aim, the present invention provides a subtitle switching method which includes: 
         [0011]    receiving an instruction for switching subtitles inputted by users; 
         [0012]    obtaining subtitle data corresponding to the instruction and stored in a preset buffer area, and a present time stamp of audio and video data currently played; 
         [0013]    outputting and displaying the subtitle data of to-be-switched subtitle data when a time stamp matching the present time stamp currently played. 
         [0014]    Preferably, before receiving the instruction for switching subtitles inputted by users, the subtitle switching method further includes: 
         [0015]    demultiplexing audio and video files to obtain the audio and video data, and arrays of subtitle data corresponding to the audio and video data; 
         [0016]    storing the audio and video data, and the arrays of subtitle data into a corresponding preset buffer area; 
         [0017]    decoding the audio and video data, and subtitle data in present language of the arrays of subtitle data; 
         [0018]    outputting and displaying the decoded audio and video data, and the decoded present language data synchronously. 
         [0019]    Preferably, after receiving the instruction for switching subtitles inputted by users, the subtitle switching method further includes: determining whether to-be-switched subtitle data is the subtitle data in present language; 
         [0020]    if yes, continue outputting the present language subtitle data; 
         [0021]    if no, obtain the to-be-switched subtitle data and stored in the preset buffer area, and obtain a present time stamp of the audio and video data currently played. 
         [0022]    Preferably, after obtaining the to-be-switched subtitle data, stored in the preset buffer area and obtaining the present time stamp of the audio and video data currently played includes: removing subtitle data of the to-be-switched subtitle data having the time stamp earlier than the present time stamp currently played. 
         [0023]    Preferably, before outputting and displaying the subtitle data of the to-be-switched subtitle data having the time stamp matching the present time stamp currently played, the method further includes: decoding the subtitle data of the to-be-switched subtitle data having the time stamp matching the present time stamp currently played. 
         [0024]    Furthermore, in order to realize the above aims, the present invention further discloses a subtitle switching device including: 
         [0025]    a receiving module, configured for receiving an instruction inputted by users; 
         [0026]    an obtaining module, configured for obtaining the to-be-switched subtitle data, corresponding to the instruction, stored in the corresponding preset buffer area and the present time stamp of the audio and video data currently played; 
         [0027]    an output module, for outputting and displaying subtitle data of the to-be-switched subtitle data having a time stamp matching the present time stamp currently played. 
         [0028]    In addition, in order to realize the above aims, the present invention discloses a subtitle switching device including: 
         [0029]    a receiving module, for receiving an instruction for switch inputted by users; 
         [0030]    an obtaining module, for receiving to-be-switched subtitle data and stored in a preset buffer area, and a present time stamp of the audio and video data currently played; 
         [0031]    an output module, for outputting and displaying subtitle data when a time stamp matching the present time stamp currently played. 
         [0032]    Preferably, the subtitle switching device further includes: 
         [0033]    a demux module, for demultiplexing the audio and video file to obtain the audio and video data and arrays of subtitle data corresponding the audio and video data; 
         [0034]    a data cache module, for caching the audio and video data and arrays of subtitle data into a corresponding buffer area; 
         [0035]    a decode module, for decoding the audio and video data and present language data in the arrays of subtitle data; and 
         [0036]    the output module is configured for outputting and displaying the decoded audio and video data and the decoded present language data synchronously. 
         [0037]    Preferably, the subtitle switching device further includes: a determination module, for determining whether the to-be-switched subtitle data is the present language subtitle currently played; and the output module is configured for outputting the present subtitle data currently played. 
         [0038]    Preferably, the subtitle switching device further includes: a remove module, for removing the subtitle data of to-be-switched subtitle data having the time stamp earlier than the present time stamp. 
         [0039]    Preferably, according to the subtitle switching device, the decode module is configured for decoding the subtitle data of to-be-switched subtitle data having the time stamp matching the present time stamp currently played. 
         [0040]    The method and subtitle switching device of the present invention, when the audio and video files are currently played, caching the subtitles in a variety of languages, by removing the subtitle data in the buffer area having the time stamp of language subtitle data non-currently played earlier than the time stamp of the audio and video data currently played, and outputting the subtitle data having the time stamp of the subtitle data matching the present time stamp currently played, contents of data frame of the subtitle data after switched and contents of data frame in current display can be well-matched, switching subtitles will be comparative smooth without lag phenomenon. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0041]      FIG. 1  is a schematic diagram of principle of a conventional subtitle switching method; 
           [0042]      FIG. 2  is a schematic diagram of principle of a subtitle switching method according to the present invention; 
           [0043]      FIG. 3  is a flowchart of the subtitle switching method according the first embodiment of the present invention; 
           [0044]      FIG. 4  is a flowchart of the subtitle switching method according to the second embodiment of the present invention; 
           [0045]      FIG. 5  is a flowchart of the subtitle switching method according to the third embodiment of the present invention; 
           [0046]      FIG. 6  is a flowchart of the subtitle switching method according to the fourth embodiment of the present invention; 
           [0047]      FIG. 7  is a flowchart of the subtitle switching method according to fifth embodiment of the present invention; 
           [0048]      FIG. 8  is a structural diagram of a subtitle switching device according to the first embodiment of the present invention; 
           [0049]      FIG. 9  is a structural diagram of the subtitle switching device according to the second embodiment of the present invention; 
           [0050]      FIG. 10  is a structural diagram of the subtitle switching device according to the third embodiment of the present invention; 
           [0051]      FIG. 11  is a structural diagram of the subtitle switching device according to the fourth embodiment of the present invention; 
       
    
    
       [0052]    Objective achieving, function features, and advantages of the present invention are further described with reference to the embodiments and the accompany drawings. 
       DETAILED DESCRIPTION OF THE EMBODIMENTS 
       [0053]    It should be understood that the specific embodiments described herein are merely used for describing the present invention, but are not intended to limit the present invention. 
         [0054]    In order to solve the problem that switching multiple subtitles needs to wait for a period of time to cause the display screen in lag phenomenon, as shown in  FIG. 2 , demultiplexing the audio and video file, and then caching the subtitles in variety of languages. In order to realize switching subtitles relatively smoothly and quickly, and the switched subtitles and the presently displayed video are well-matched. 
         [0055]    Based on above principle, the present invention discloses a subtitle switching method, with reference to  FIG. 3 , in an embodiment, the subtitle switching method includes the following steps: 
         [0056]    Step S 11 : receiving an instruction inputted by users. 
         [0057]    When a user is watching audio and video files, the subtitles displayed by default are not wanted, the user can switch the subtitles by a remote controller. Specifically, choosing a function of switching subtitles, and choosing a demanding subtitle type in the optional list to generate an instruction of switching subtitles. Once detecting the instruction of switching subtitles, receiving it. 
         [0058]    Step S 12 , obtaining the to-be-switched subtitle data, corresponding to the instruction, stored in the corresponding preset buffer area and the present time stamp of the audio and video data currently played; 
         [0059]    According to the instruction for switching subtitles, obtaining to-be-switched subtitle data corresponding to the instruction, then the to-be-switched subtitle data are stored in the corresponding buffer, and each subtitle data has a corresponding preset buffer area, that means, different subtitle data may be stored in different preset buffer areas. Meanwhile, obtaining the preset time stamp of the audio and video data currently played, that means, obtaining the present time stamp of the data frame in the obtained audio and video data currently played. 
         [0060]    Step S 13 : outputting and displaying subtitle data of the to-be-switched subtitle data having the time stamp matching the present time stamp. 
         [0061]    Outputting and displaying subtitle data of the to-be-switched subtitle data having the time stamp matching the present time stamp can allow the to-be-switched subtitle data and the video data in present display to be well-matched. 
         [0062]    The subtitle switching method according to the embodiments of the present invention, when the audio and video files are currently played, caching the subtitles in a variety of languages, by removing the subtitle data in the buffer area having the time stamp of language subtitle data non-currently played earlier than that of the audio and video data currently played, outputting and displaying the subtitle data having the time stamp of the subtitle data matching the present time stamp currently played, so as to allow contents of data frame of the subtitle data after switched and contents of data frame currently played to be well-matched, switching subtitles will be comparative smooth without lag phenomenon. 
         [0063]    Furthermore, with reference to  FIG. 4 ,  FIG. 4  is a flowchart of the subtitle switching method according to the second embodiment of the present invention. 
         [0064]    According to the above embodiments, before receiving the instruction inputted by users further includes: 
         [0065]    step S 21 : demultiplexing the audio and video file to obtain audio and video data, and arrays of subtitle data corresponding the audio and video data; 
         [0066]    step S 22 : storing the audio and video data and the arrays of subtitle data into a corresponding preset buffer area; 
         [0067]    step S 23 : decoding the audio and video data and subtitle data in present language; 
         [0068]    step S 24 : outputting and displaying the decoded audio and video data and the decoded present language data synchronously. 
         [0069]    More specifically, when receiving the instruction of displaying the audio and video file, firstly demultiplexing the audio and video file to separate the arrays of subtitle data, video data out from the audio and video file; then storing the audio and video data into the corresponding preset buffer area, as well as storing arrays of subtitle data into the corresponding buffer area; later, decoding the audio and video files, at the same time decoding the subtitle data in present language, of arrays of subtitle data; at last, outputting and displaying audio and video data synchronously outputting and displaying the subtitle data in present language. 
         [0070]    Furthermore, with reference to  FIG. 5 ,  FIG. 5  is a flowchart of the subtitle switching method according to the third embodiment of the present invention. 
         [0071]    According to the above embodiments, after receiving the instruction inputted by users, the present invention further includes: 
         [0072]    step S 31 : determine whether the to-be-switched subtitle data is the present language data currently played; 
         [0073]    if yes, step into the step S 32 ; if no, step into the step S 12 ; 
         [0074]    step S 32 : continue outputting and displaying the present language data currently played; 
         [0075]    step S 12 : obtaining the to-be-switched subtitle data and stored in the preset buffer area, and obtain a present time stamp of the audio and video data currently played. 
         [0076]    More specifically, when receiving the instruction for switching subtitles, firstly determine whether the subtitle data is the preset language data currently played, if yes, continue outputting and displaying the present language data currently played, if no, performing step S 12  to obtain the to-be-switched subtitle data and stored in the preset buffer area, meanwhile to obtain a present time stamp of the audio and video data currently played. 
         [0077]    Furthermore, with reference to  FIG. 6 ,  FIG. 6  is a flowchart of the subtitle switching method according to the fourth embodiment of the present invention; 
         [0078]    According to the above embodiments, after obtaining the to-be-switched subtitle data, corresponding to the instruction, stored in the corresponding preset buffer area and the present time stamps of the audio and video data currently played, the present invention further includes: 
         [0079]    step S 41 , removing the subtitle data of to-be-switched subtitle data having the time stamp earlier than the present time stamp of the audio and video data currently played. 
         [0080]    Comparing the time stamps of data frames in other non-currently played language data of the to-be-switched subtitle data and stored in the preset buffer area with the present time stamps of the data frames currently played, the data frames will be released having the time stamps of to-be-switched subtitle data earlier than the present time stamps of the data frames currently played. 
         [0081]    According to another embodiment of the present invention, the subtitle switching method further includes the following steps: 
         [0082]    Furthermore, with reference to  FIG. 7 ,  FIG. 7  is a flowchart of the subtitle switching method according to fifth embodiment of the present invention. 
         [0083]    According to above embodiments, before outputting and displaying the subtitle data of to-be-switched subtitle data having the time stamp matching the present time stamp of the audio and video data currently played, the subtitle switching method further includes: 
         [0084]    step S 51 , decoding the subtitle data of to-be-switched subtitle data having the time stamp later than or matching the present time stamp currently played. 
         [0085]    More specifically, before outputting and displaying the subtitle data of to-be-switched subtitle data having the time stamp matching the present time stamp of the audio and video data currently played, decoding the subtitle data of to-be-switched subtitle data having the time stamp matching the present time stamp currently played, to allow the subtitle data being displayed. 
         [0086]    The present invention discloses a subtitle switching device, with reference to  FIG. 8 , in an embodiment, the device includes: 
         [0087]    A receiving module  101  is configured for receiving an instruction for switching subtitles inputted by users; 
         [0088]    When users are watching audio and video files, and find the subtitle displayed by default is not wanted, switching subtitles may be realized by a remoter. More specifically, by choosing a function of switching subtitles, and selecting a demanding subtitle type from the popping-up optional list to generate the instruction for switching subtitles, once detecting the instruction for switching subtitles, receiving it; 
         [0089]    An obtaining module  102  is configured for receiving the to-be-switched subtitle data and stored in a preset buffer area, and a present time stamp of the audio and video data currently played; 
         [0090]    According to the instructions for switching subtitles, obtaining the to-be-switched subtitle data, corresponding to the subtitle type chosen by users, where the to-be-switched subtitle data is stored in a corresponding preset buffer area, and each subtitle data has a corresponding preset buffer area, i.e. different subtitle data is stored in different preset buffer area; meanwhile, obtaining a present time stamp of the audio and video data currently played. 
         [0091]    An output module  103  is configured for outputting and displaying subtitle data of the to-be-switched subtitle data having a time stamp matching the present time stamp currently played; 
         [0092]    Then subtitle data of the to-be-switched subtitle data having a time stamp matching the present time stamp currently played are outputted and displayed. 
         [0093]    The subtitle switching device according to the embodiment of the present invention, when the audio and video files are currently played, caching the subtitles in a variety of languages, by removing the subtitle data in the buffer area having the time stamp of language subtitle data non-currently played earlier than the present time stamp of the audio and video data currently played, and outputting the subtitle data having the time stamp of the subtitle data matching the present time stamp currently played, contents of data frames of the subtitle data after switched and contents of data frames in current display can be well-matched, switching subtitles will be comparative smooth without lag phenomenon. 
         [0094]    Furthermore, with reference to  FIG. 9 ,  FIG. 9  is a structural diagram of the subtitle switching device according to the second embodiment of the present invention; 
         [0095]    According to the above embodiments of the present invention, the device further includes: 
         [0096]    A demux module  201  is configured for demultiplexing the audio and video file to obtain the audio and video data and arrays of subtitle data corresponding the audio and video data; 
         [0097]    A data cache module  202  is configured for caching the audio and video data and arrays of subtitle data into a corresponding buffer; preferably, the data cache module  202  includes several subtitle cache units  222  is configured for storing the arrays of the subtitle data into the corresponding preset buffer area, and an audio and video cache unit  224  is configured for storing the audio and video data into the corresponding preset buffer area. 
         [0098]    A decode module  203  is configured for decoding the audio and video data and present language data in the arrays of subtitle data; preferably, the decode module  203  includes a subtitle decode module  232  is configured for decoding the present language data, and an audio and video decode module  234  is configured for decoding the audio and video data; 
         [0099]    The output module  103  is configured for outputting and displaying the decoded audio and video data and the decoded present language data synchronously. 
         [0100]    More specifically, when receiving the instruction of displaying the audio and video file, firstly demultiplexing the audio and video file to separate the arrays of subtitle data, separating the audio and video data out from the audio and video file; then storing the audio and video data into the corresponding preset buffer area, as well as storing arrays of subtitle data into the corresponding buffer area; later, decoding the audio and video files, at the same time decoding the subtitle data in present language, of arrays of subtitle data; at last, outputting and displaying audio and video data synchronously outputting and displaying the subtitle data in present language. 
         [0101]    Furthermore, with reference to  FIG. 10 ,  FIG. 10  is a structural diagram of the subtitle switching device according to the third embodiment of the present invention; 
         [0102]    According to above embodiments of the present invention, the subtitle switching device further includes: 
         [0103]    A determination module  301 , for determining whether the to-be-switched subtitle data is the present language subtitle currently played; and 
         [0104]    The output module  104  is configured for outputting the present subtitle data currently played. 
         [0105]    More specifically, when receiving the instruction for switching subtitles, firstly determine whether the subtitle data is the preset language data currently played, if yes, continue outputting and displaying the present language data currently played, if no, obtain the to-be-switched subtitle data and stored in the preset buffer area, meanwhile obtain a present time stamp of the audio and video data currently played. 
         [0106]    Furthermore, with reference to  FIG. 11 ,  FIG. 11  is a structural diagram of the subtitle switching device according to the fourth embodiment of the present invention. 
         [0107]    According to above embodiment of the present invention, the subtitle switching device further includes a removing module  404  is configured for removing the subtitle data of the to-be-switched subtitle data having the time stamp earlier than the present time stamp of the audio and video data currently played. 
         [0108]    Comparing the time stamps of data frames of the to-be-switched subtitle data, with the present time stamps of the data frames currently played, the data frames will be released having the time stamps of to-be-switched subtitle data earlier than the present time stamps of the data frames currently played. 
         [0109]    Furthermore, according to the above embodiments of the present invention, the decode module  203  is also configured for decoding the subtitle data of to-be-switched subtitle data having the time stamp later than or matching the present time stamp currently played. 
         [0110]    More specifically, before outputting and displaying the subtitle data of to-be-switched subtitle data having the time stamp matching the present time stamp of the audio and video data currently played, decoding the subtitle data of to-be-switched subtitle data having the time stamp matching the present time stamp currently played, to allow the subtitle data being displayed. 
         [0111]    Overall, the subtitle switching method and device according to the embodiments of the present invention, when the audio and video files are currently played, caching the subtitles in a variety of languages, by removing the subtitle data in the buffer area having the time stamp of language subtitle data in non-current display earlier than the present time stamp of the audio and video data currently played, and outputting the subtitle data having the time stamp of the subtitle data matching the present time stamp currently played, contents of data frames of the subtitle data after switched and contents of data frames in current display can be well-matched, switching subtitles will be comparative smooth without lag phenomenon. 
         [0112]    The foregoing descriptions are merely embodiments of the present invention, and are not intended to limit the scope of the present invention. An equivalent structural or equivalent process alternation made by using the content of the specification and drawings of the present invention, or an application of the content of the specification and drawings directly or indirectly to another related technical field, shall fall within the protection scope of the present invention.