Summary of the invention
In view of the above problems, the embodiment of the present invention is proposed in order to provide overcoming the above problem or at least being partially solved
A kind of method and apparatus of video data processing of the above problem.
To solve the above-mentioned problems, the embodiment of the invention discloses a kind of methods of video data processing, are applied to view connection
Network termination, comprising:
It is described depending on networked terminals detect user for target video resource program request operation when, to Internet Server
Request the target video resource;
It is described that the target video resource that the Internet Server returns is received depending on networked terminals, and to the target video
Resource is decoded, and obtains video data and the first caption data;
It is described depending on networked terminals in detecting first caption data there are when unrecognized character code, to institute
It states unrecognized character code and carries out code conversion, obtain the second caption data;
The view networked terminals show the corresponding subtitle of second caption data when playing the video data.
It is preferably, described that depending on networked terminals, there are unrecognized character codes in detecting first caption data
When, the step of carrying out code conversion to the unrecognized character code, obtain the second caption data includes:
There are when unrecognized character code, call the first preset function raw in detecting first caption data
At the code conversion parameter for being directed to the unrecognized character code;
The code conversion parameter and the unrecognized character code are inputted into the second preset function, by described second
Preset function carries out code conversion to the unrecognized character code according to the code conversion parameter, obtains the second subtitle
Data.
Preferably, it is described in detecting first caption data there are when unrecognized character code, call the
One preset function generate be directed to the unrecognized character code code conversion parameter the step of include:
Determine the first coding mode of the unrecognized character code;
Obtain second coding mode that can be identified depending on networked terminals;
First coding mode and second coding mode are inputted into first preset function;
Obtain the code conversion parameter of the first preset function output.
Preferably, described by the code conversion parameter and the unrecognized character code inputs the second preset letter
Number carries out coding to the unrecognized character code according to the code conversion parameter by the code conversion function and turns
Before the step of changing, obtaining the second caption data, further includes:
First preset function is called to establish internal buffer;Wherein, the internal buffer be used for it is described can not
The character code of identification carries out code conversion;
Described by the code conversion parameter and the unrecognized character code inputs the second preset function, by institute
It states code conversion function and code conversion is carried out to the unrecognized character code according to the code conversion parameter, obtain the
After the step of two caption datas, further includes:
The third preset function is called to discharge the internal buffer.
Preferably, the view networked terminals show that second caption data is corresponding when playing the video data
The step of subtitle includes:
Obtain the timestamp of currently playing video data;
Search corresponding second caption data of the timestamp;
From preset local character set, matches second caption data and correspond to subtitle;
Show the subtitle.
The embodiment of the invention also discloses a kind of devices of video data processing, are applied to view networked terminals, comprising:
Target video resource request module, for detect user for target video resource program request operation when, to
Internet Server requests the target video resource;
Target video resource decoder module, the target video resource returned for receiving the Internet Server, and it is right
The target video resource is decoded, and obtains video data and the first caption data;
Second caption data obtains module, for there are unrecognized characters in detecting first caption data
When coding, code conversion is carried out to the unrecognized character code, obtains the second caption data;
Subtitle Demonstration module, for when playing the video data, showing the corresponding subtitle of second caption data.
Preferably, second caption data obtains module and includes:
First preset function calls submodule, for there are unrecognized words in detecting first caption data
When symbol coding, the first preset function is called to generate the code conversion parameter for being directed to the unrecognized character code;
Second preset function calls submodule, is used for the code conversion parameter and the unrecognized character code
The second preset function is inputted, the unrecognized character is compiled according to the code conversion parameter by second preset function
Code carries out code conversion, obtains the second caption data.
Preferably, the first preset function calling submodule includes:
First coding mode determination unit, for determining the first coding mode of the unrecognized character code;
Second coding mode acquiring unit, for obtaining second coding mode that can be identified depending on networked terminals;
Coding mode input unit, for will be described in first coding mode and second coding mode input
First preset function;
Code conversion parameter output unit, for obtaining the code conversion parameter of the first preset function output.
Preferably, further includes:
Module is established in internal buffer, for calling first preset function to establish internal buffer;Wherein, in described
Portion buffer area is used to carry out code conversion to the unrecognized character code;
Internal buffer release module, for calling the third preset function to discharge the internal buffer.
Preferably, the Subtitle Demonstration module includes:
Timestamp acquisition submodule, for obtaining the timestamp of currently playing video data;
Second caption data searches submodule, for searching corresponding second caption data of the timestamp;
Subtitle matched sub-block corresponds to subtitle for from preset local character set, matching second caption data;
Subtitle Demonstration submodule is matched, for showing the subtitle
The embodiment of the present invention includes following advantages:
In embodiments of the present invention, depending on networked terminals by detecting user for the program request operation of target video resource
When, to Internet Server request target video resource, the target video resource that the Internet Server returns then is received,
And target video resource is decoded, video data and the first caption data are obtained, is deposited in detecting the first caption data
In unrecognized character code, code conversion is carried out to unrecognized character code, obtains the second caption data, and
When playing the video data, the corresponding subtitle of the second caption data of display realizes view networked terminals to video in internet
Resource program request, and the case where can not identifying caption data in video resource depending on networked terminals is avoided, improve view networked terminals
Compatibility.
Specific embodiment
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, with reference to the accompanying drawing and specific real
Applying mode, the present invention is described in further detail.Obviously, described embodiments are some of the embodiments of the present invention, without
It is whole embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art are not before making creative work
Every other embodiment obtained is put, shall fall within the protection scope of the present invention.
It is the important milestone of network Development depending on networking, is a real-time network, can be realized HD video real-time Transmission,
Push numerous Internet applications to HD video, high definition is face-to-face.
Real-time high-definition video switching technology is used depending on networking, it can be such as high in a network platform by required service
Clear video conference, Intellectualized monitoring analysis, emergency command, digital broadcast television, delay TV, the Web-based instruction, shows video monitoring
Field live streaming, VOD program request, TV Mail, individual character records (PVR), Intranet (manages) channel by oneself, intelligent video Broadcast Control, information publication
All be incorporated into a system platform etc. services such as tens of kinds of videos, voice, picture, text, communication, data, by TV or
Computer realizes that high-definition quality video plays.
Embodiment in order to enable those skilled in the art to better understand the present invention is introduced to depending on networking below:
Depending on networking, applied portion of techniques is as described below:
Network technology (NetworkTechnology)
Traditional ethernet (Ethernet) is improved depending on the network technology innovation networked, with potential huge on network
Video flow.(Circuit is exchanged different from simple network packet packet switch (Packet Switching) or lattice network
Switching), Streaming demand is met using Packet Switching depending on networking technology.Has grouping depending on networking technology
Flexible, the simple and low price of exchange, is provided simultaneously with the quality and safety assurance of circuit switching, it is virtually electric to realize the whole network switch type
The seamless connection of road and data format.
Switching technology (Switching Technology)
Two advantages of asynchronous and packet switch that Ethernet is used depending on networking eliminate Ethernet under the premise of complete compatible and lack
It falls into, has the end-to-end seamless connection of the whole network, direct user terminal, directly carrying IP data packet.User data is in network-wide basis
It is not required to any format conversion.It is the more advanced form of Ethernet depending on networking, is a real-time exchange platform, can be realized at present mutually
The whole network large-scale high-definition realtime video transmission that networking cannot achieve pushes numerous network video applications to high Qinghua, unitizes.
Server technology (ServerTechnology)
It is different from traditional server, its Streaming Media depending on the server technology in networking and unified video platform
Transmission be built upon it is connection-oriented on the basis of, data-handling capacity is unrelated with flow, communication time, single network layer energy
Enough transmitted comprising signaling and data.For voice and video business, handled depending on networking and unified video platform Streaming Media
Complexity many simpler than data processing, efficiency substantially increase hundred times or more than traditional server.
Reservoir technology (Storage Technology)
The ultrahigh speed reservoir technology of unified video platform in order to adapt to the media content of vast capacity and super-flow and
Using state-of-the-art real time operating system, the programme information in server instruction is mapped to specific hard drive space, media
Content is no longer pass through server, and moment is directly delivered to user terminal, and user waits typical time less than 0.2 second.It optimizes
Sector distribution greatly reduces the mechanical movement of hard disc magnetic head tracking, and resource consumption only accounts for the 20% of the internet ad eundem IP, but
The concurrent flow greater than 3 times of traditional disk array is generated, overall efficiency promotes 10 times or more.
Network security technology (Network Security Technology)
Depending on the structural design networked by servicing independent licence system, equipment and the modes such as user data is completely isolated every time
The network security problem that puzzlement internet has thoroughly been eradicated from structure, does not need antivirus applet, firewall generally, has prevented black
The attack of visitor and virus, structural carefree secure network is provided for user.
It services innovative technology (Service Innovation Technology)
Business and transmission are fused together by unified video platform, whether single user, private user or a net
The sum total of network is all only primary automatic connection.User terminal, set-top box or PC are attached directly to unified video platform, obtain rich
The multimedia video service of rich colorful various forms.Unified video platform is traditional to substitute with table schema using " menu type "
Complicated applications programming, considerably less code, which can be used, can be realized complicated application, realize the new business innovation of " endless ".
Networking depending on networking is as described below:
It is a kind of central controlled network structure depending on networking, which can be Tree Network, Star network, ring network etc. class
Type, but centralized control node is needed to control whole network in network on this basis.
As shown in Figure 1, being divided into access net and Metropolitan Area Network (MAN) two parts depending on networking.
The equipment of access mesh portions can be mainly divided into 3 classes: node server, access switch, terminal (including various machines
Top box, encoding board, memory etc.).Node server is connected with access switch, and access switch can be with multiple terminal phases
Even, and it can connect Ethernet.
Wherein, node server is the node that centralized control functions are played in access net, can control access switch and terminal.
Node server can directly be connected with access switch, can also directly be connected with terminal.
Similar, the equipment of metropolitan area mesh portions can also be divided into 3 classes: metropolitan area server, node switch, node serve
Device.Metropolitan area server is connected with node switch, and node switch can be connected with multiple node servers.
Wherein, node server is the node server for accessing mesh portions, i.e. node server had both belonged to access wet end
Point, and belong to metropolitan area mesh portions.
Metropolitan area server is the node that centralized control functions are played in Metropolitan Area Network (MAN), can control node switch and node serve
Device.Metropolitan area server can be directly connected to node switch, can also be directly connected to node server.
It can be seen that be entirely a kind of central controlled network structure of layering depending on networking network, and node server and metropolitan area
The network controlled under server can be the various structures such as tree-shaped, star-like, cyclic annular.
Visually claim, access mesh portions can form unified video platform (part in virtual coil), and multiple unified videos are flat
Platform can form view networking;Each unified video platform can be interconnected by metropolitan area and wide area depending on networking.
1, view networked devices classification
1.1 embodiment of the present invention can be mainly divided into 3 classes: server depending on the equipment in networking, interchanger (including ether
Net association turns gateway), terminal (including various set-top boxes, encoding board, memory etc.).Metropolitan Area Network (MAN) can be divided on the whole depending on networking
(or national net, World Wide Web etc.) and access net.
1.2 equipment for wherein accessing mesh portions can be mainly divided into 3 classes: node server, access switch (including ether
Net association turns gateway), terminal (including various set-top boxes, encoding board, memory etc.).
The specific hardware structure of each access network equipment are as follows:
Node server:
As shown in Fig. 2, mainly including Network Interface Module 201, switching engine module 202, CPU module 203, disk array
Module 204;
Wherein, Network Interface Module 201, the Bao Jun that CPU module 203, disk array module 204 are come in enter switching engine
Module 202;Switching engine module 202 look into the operation of address table 205 to the packet come in, to obtain the navigation information of packet;
And the packet is stored according to the navigation information of packet the queue of corresponding pack buffer 206;If the queue of pack buffer 206 is close
It is full, then it abandons;All pack buffer queues of 202 poll of switching engine mould, are forwarded: 1) port if meeting the following conditions
It is less than to send caching;2) the queue package counting facility is greater than zero.Disk array module 204 mainly realizes the control to hard disk, including
The operation such as initialization, read-write to hard disk;CPU module 203 is mainly responsible between access switch, terminal (not shown)
Protocol processes, to address table 205 (including descending protocol packet address table, uplink protocol package address table, data packet addressed table)
Configuration, and, the configuration to disk array module 204.
Access switch:
As shown in figure 3, mainly including Network Interface Module (downstream network interface module 301, uplink network interface module
302), switching engine module 303 and CPU module 304;
Wherein, the packet (upstream data) that downstream network interface module 301 is come in enters packet detection module 305;Packet detection mould
Whether mesh way address (DA), source address (SA), type of data packet and the packet length of the detection packet of block 305 meet the requirements, if met,
It then distributes corresponding flow identifier (stream-id), and enters switching engine module 303, otherwise abandon;Uplink network interface mould
The packet (downlink data) that block 302 is come in enters switching engine module 303;The data packet that CPU module 204 is come in enters switching engine
Module 303;Switching engine module 303 look into the operation of address table 306 to the packet come in, to obtain the navigation information of packet;
If the packet into switching engine module 303 is that downstream network interface is gone toward uplink network interface, in conjunction with flow identifier
(stream-id) packet is stored in the queue of corresponding pack buffer 307;If the queue of the pack buffer 307 is close full,
It abandons;If the packet into switching engine module 303 is not that downstream network interface is gone toward uplink network interface, according to packet
Navigation information is stored in the data packet queue of corresponding pack buffer 307;If the queue of the pack buffer 307 is close full,
Then abandon.
All pack buffer queues of 303 poll of switching engine module, are divided to two kinds of situations in embodiments of the present invention:
If the queue is that downstream network interface is gone toward uplink network interface, meets the following conditions and be forwarded: 1)
It is less than that the port sends caching;2) the queue package counting facility is greater than zero;3) token that rate control module generates is obtained;
If the queue is not that downstream network interface is gone toward uplink network interface, meets the following conditions and is forwarded:
1) it is less than to send caching for the port;2) the queue package counting facility is greater than zero.
Rate control module 208 is configured by CPU module 204, to all downlink networks in programmable interval
Interface generates token toward the pack buffer queue that uplink network interface is gone, to control the code rate of forwarded upstream.
CPU module 304 is mainly responsible for the protocol processes between node server, the configuration to address table 306, and,
Configuration to rate control module 308.
Ethernet association turns gateway:
As shown in figure 4, mainly including Network Interface Module (downstream network interface module 401, uplink network interface module
402), switching engine module 403, CPU module 404, packet detection module 405, rate control module 408, address table 406, Bao Huan
Storage 407 and MAC adding module 409, MAC removing module 410.
Wherein, the data packet that downstream network interface module 401 is come in enters packet detection module 405;Packet detection module 405 is examined
Ethernet mac DA, ethernet mac SA, Ethernet length or frame type, the view networking mesh way address of measured data packet
DA, whether meet the requirements depending on networking source address SA, depending on networking data Packet type and packet length, corresponding stream is distributed if meeting
Identifier (stream-id);Then, MAC DA, MAC SA, length or frame type are subtracted by MAC removing module 410
(2byte), and enter corresponding receive and cache, otherwise abandon;
Downstream network interface module 401 detects the transmission caching of the port, according to the view of packet networking mesh if there is Bao Ze
Address D A knows the ethernet mac DA of corresponding terminal, adds the ethernet mac DA of terminal, Ethernet assists the MAC for turning gateway
SA, Ethernet length or frame type, and send.
The function that Ethernet association turns other modules in gateway is similar with access switch.
Terminal:
It mainly include Network Interface Module, Service Processing Module and CPU module;For example, set-top box mainly connects including network
Mouth mold block, video/audio encoding and decoding engine modules, CPU module;Encoding board mainly includes Network Interface Module, video encoding engine
Module, CPU module;Memory mainly includes Network Interface Module, CPU module and disk array module.
The equipment of 1.3 metropolitan area mesh portions can be mainly divided into 2 classes: node server, node switch, metropolitan area server.
Wherein, node switch mainly includes Network Interface Module, switching engine module and CPU module;Metropolitan area server mainly includes
Network Interface Module, switching engine module and CPU module are constituted.
2, networking data package definition is regarded
2.1 access network data package definitions
Access net data packet mainly include following sections: destination address (DA), source address (SA), reserve bytes,
payload(PDU)、CRC。
As shown in the table, the data packet for accessing net mainly includes following sections:
DA |
SA |
Reserved |
Payload |
CRC |
Wherein:
Destination address (DA) is made of 8 bytes (byte), and first character section indicates type (such as the various associations of data packet
Discuss packet, multicast packet, unicast packet etc.), be up to 256 kinds of possibility, the second byte to the 6th byte is metropolitan area net address,
Seven, the 8th bytes are access net address;
Source address (SA) is also to be made of 8 bytes (byte), is defined identical as destination address (DA);
Reserve bytes are made of 2 bytes;
The part payload has different length according to the type of different datagrams, is if it is various protocol packages
64 bytes are 32+1024=1056 bytes if it is single group unicast packets words, are not restricted to above 2 kinds certainly;
CRC is made of 4 bytes, and calculation method follows the Ethernet CRC algorithm of standard.
2.2 Metropolitan Area Network (MAN) packet definitions
The topology of Metropolitan Area Network (MAN) is pattern, may there is 2 kinds, connection even of more than two kinds, i.e. node switching between two equipment
It can all can exceed that 2 kinds between machine and node server, node switch and node switch, node switch and node server
Connection.But the metropolitan area net address of metropolitan area network equipment is uniquely, to close to accurately describe the connection between metropolitan area network equipment
System, introduces parameter in embodiments of the present invention: label, uniquely to describe a metropolitan area network equipment.
(Multi-Protocol Label Switch, multiprotocol label are handed over by the definition of label and MPLS in this specification
Change) label definition it is similar, it is assumed that between equipment A and equipment B there are two connection, then data packet from equipment A to equipment B just
There are 2 labels, data packet also there are 2 labels from equipment B to equipment A.Label is divided into label, outgoing label, it is assumed that data packet enters
The label (entering label) of equipment A is 0x0000, and the label (outgoing label) when this data packet leaves equipment A may reform into
0x0001.The networking process of Metropolitan Area Network (MAN) is to enter network process under centralized control, also means that address distribution, the label of Metropolitan Area Network (MAN)
Distribution be all to be dominated by metropolitan area server, node switch, node server be all passively execute, this point with
The label distribution of MPLS is different, and the distribution of the label of MPLS is the result that interchanger, server are negotiated mutually.
As shown in the table, the data packet of Metropolitan Area Network (MAN) mainly includes following sections:
DA |
SA |
Reserved |
Label |
Payload |
CRC |
That is destination address (DA), source address (SA), reserve bytes (Reserved), label, payload (PDU), CRC.Its
In, the format of label, which can refer to, such as gives a definition: label is 32bit, wherein high 16bit retains, only with low 16bit, its position
Set is between the reserve bytes and payload of data packet.
Based on the above-mentioned characteristic of view networking, the core idea of the embodiment of the present invention is proposed, depending on networked terminals by examining
When measuring program request operation of the user for target video resource, to Internet Server request target video resource, then receive
The target video resource that the Internet Server returns, and being decoded to target video resource obtains video data and the
One caption data compiles unrecognized character there are when unrecognized character code in detecting the first caption data
Code carries out code conversion, obtains the second caption data, and when playing the video data, and the second caption data of display is corresponding
Subtitle, realize view networked terminals to video resource program request in internet, and avoid view networked terminals can not identify video money
In source the case where caption data, the compatibility of view networked terminals is improved.
Referring to Fig. 5, a kind of step flow chart of the method for video data processing of the embodiment of the present invention, the side are shown
Method can be applied to view networked terminals.
Wherein, described depending on networked terminals may include the entities terminals such as set-top box (SetTopBox, STB), and set-top box can be with
Referred to as box on set-top box or machine is the equipment of connection a television set and outside source, it can be by the digital signal of compression
Television content is changed into, and is shown on a television set.In general, set-top box can connect camera and microphone, it is used for
The multi-medium datas such as video data and audio data are acquired, also can connect television set, are used for playing video data and audio number
According to equal multi-medium datas.
Can also include virtual view networked terminals depending on networked terminals, be depending on networked terminals virtually in order to realize particular service and
The terminal of access view networking, refers to a kind of special software, it can create a kind of environment between terminal and terminal user, and
Terminal user is then the environment that is created based on this software come operating software, it is virtual can be as real machine one depending on networked terminals
Sample runs the software realization of the terminal of program.
Specifically, the embodiment of the present invention may include steps of:
Step 501, it is described depending on networked terminals detect user for target video resource program request operation when, to interconnection
Network server requests the target video resource;
In embodiments of the present invention, server can be turned by association depending on networked terminals and obtains video money from Internet Server
Source list, and video resource list is shown to user.
It, can depending on networked terminals when detecting user in video resource list for the program request operation of target video resource
To obtain the mark of target video resource, and target video resource acquisition request is generated based on the mark, server is turned by association
It is sent to Internet Server, with to Internet Server request target video resource.
Step 502, described that the target video resource that the Internet Server returns is received depending on networked terminals, and to described
Target video resource is decoded, and obtains video data and the first caption data;
Internet Server can ask after receiving target video resource acquisition request according to target video resource acquisition
Then the target video resource is sent to association and turns server by the corresponding target video resource of identifier lookup in asking, association turns clothes
The target video resource is sent to view networked terminals by business device.
Depending on networked terminals after receiving target video resource, target video resource can be decoded, be regarded from target
Video data and the first caption data are extracted in frequency resource, the first caption data may include by the word after multiple character codes
Symbol coding.
It is step 503, described that depending on networked terminals, there are unrecognized character volumes in detecting first caption data
When code, code conversion is carried out to the unrecognized character code, obtains the second caption data;
After obtaining the first caption data, the first caption data can be matched in preset local character set depending on networked terminals
In the corresponding character of character code, when detecting in the first caption data there are unrecognized character code, eventually depending on networking
End can carry out code conversion to the unrecognized character code, obtain the second caption data.
In a kind of preferred embodiment of the present invention, step 503 may include following sub-step:
Sub-step 11 calls first there are when unrecognized character code in detecting first caption data
Preset function generates the code conversion parameter for being directed to the unrecognized character code;
As an example, the first preset function may include iconv_open function, and iconv_open function is, can be with
For initializing the internal buffer for being used for conversion, it is any to indicate that needs are transformed into from which kind of coding mode.
There are when unrecognized character code in detecting the first caption data, first can be called depending on networked terminals
The interface of preset function generates the code conversion parameter for being directed to unrecognized character code, by calling the first preset function
Carry out code conversion, avoid self-built character set mappings table and existing consumption memory, it is difficult safeguard, the problems such as application range is narrow.
Specifically, sub-step 11 may include following sub-step:
Determine the first coding mode of the unrecognized character code;Obtaining described can identify depending on networked terminals
Second coding mode;First coding mode and second coding mode are inputted into first preset function;It obtains
Take the code conversion parameter of the first preset function output.
Since there is no the characters that storage is directed to all coding modes for the local character set in view networked terminals, so when inspection
When measuring unrecognized character code, the first coding used by unrecognized character code can be determined depending on networked terminals
Then mode obtains view if GBK (Chinese Internal Code Specification, Hanzi coded character set) encodes
The second coding mode that networked terminals can identify, as UCS (Universal Character Set, universal character set) encodes.
The first coding mode and the second coding mode are being obtained, can compiled the first coding mode and second depending on networked terminals
The mark of code mode inputs the first preset function, and the first preset function can be raw according to the first coding mode and the second coding mode
At code conversion parameter.
The code conversion parameter and the unrecognized character code are inputted the second preset function by sub-step 12,
Code conversion is carried out to the unrecognized character code according to the code conversion parameter by second preset function, is obtained
To the second caption data.
As an example, the second preset function can be iconv function, and iconv function can carry out actual coding
Conversion, needs to provide two indirect buffer pointers and remainder bytes number pointer.
It, can be by code conversion parameter and unrecognized character code depending on networked terminals after obtaining code conversion parameter
The second preset function is inputted, the second preset function can be according to code conversion parameter, and the character code that will be unable to identification is converted to
The character code encoded using the second coding mode, to obtain the second caption data.
Step 504, the view networked terminals show that second caption data is corresponding when playing the video data
Subtitle.
After obtaining the second caption data, can be shown in designated position in playing video data depending on networked terminals
The corresponding subtitle of two caption datas.
In a kind of preferred embodiment of the present invention, step 504 may include following sub-step:
Sub-step 21 obtains the timestamp of currently playing video data;
In the concrete realization, video data and caption data can have timestamp, play video counts depending on networked terminals
According to when, the timestamp of available currently playing video data.
Sub-step 22 searches corresponding second caption data of the timestamp;
After acquisition time stamp, identical timestamp can be searched in the second caption data depending on networked terminals, and can be with
Obtain corresponding second caption data of the timestamp.
Sub-step 23 matches second caption data and corresponds to subtitle from preset local character set;
It, can be in local character set to the word in the second caption data depending on networked terminals after obtaining the second caption data
Symbol coding is matched, and obtains the corresponding character of character code, which is organized into subtitle.
Sub-step 24 shows the subtitle.
, can be in playing video data depending on networked terminals after obtaining subtitle, the currently playing video counts of simultaneous display
According to corresponding subtitle.
In embodiments of the present invention, depending on networked terminals by detecting user for the program request operation of target video resource
When, to Internet Server request target video resource, the target video resource that the Internet Server returns then is received,
And target video resource is decoded, video data and the first caption data are obtained, is deposited in detecting the first caption data
In unrecognized character code, code conversion is carried out to unrecognized character code, obtains the second caption data, and
When playing the video data, the corresponding subtitle of the second caption data of display realizes view networked terminals to video in internet
Resource program request, and the case where can not identifying caption data in video resource depending on networked terminals is avoided, improve view networked terminals
Compatibility.
Referring to Fig. 6, a kind of step flow chart of the method for video data processing of the embodiment of the present invention, the side are shown
Method can be applied to view networked terminals, can specifically include following steps:
Step 601, when detecting program request operation of the user for target video resource, institute is requested to Internet Server
State target video resource;
In embodiments of the present invention, server can be turned by association depending on networked terminals and obtains video money from Internet Server
Source list, and video resource list is shown to user.
It, can depending on networked terminals when detecting user in video resource list for the program request operation of target video resource
To obtain the mark of target video resource, and target video resource acquisition request is generated based on the mark, server is turned by association
It is sent to Internet Server, with to Internet Server request target video resource.
Step 602, receive the target video resource that the Internet Server returns, and to the target video resource into
Row decoding, obtains video data and the first caption data;
Internet Server can ask after receiving target video resource acquisition request according to target video resource acquisition
Then the target video resource is sent to association and turns server by the corresponding target video resource of identifier lookup in asking, association turns clothes
The target video resource is sent to view networked terminals by business device.
Depending on networked terminals after receiving target video resource, target video resource can be decoded, be regarded from target
Video data and the first caption data are extracted in frequency resource, the first caption data may include by the word after multiple character codes
Symbol coding.
Step 603, there are when unrecognized character code in detecting first caption data, calling first is pre-
It sets function and generates the code conversion parameter for being directed to the unrecognized character code;
There are when unrecognized character code in detecting the first caption data, first can be called depending on networked terminals
The interface of preset function generates the code conversion parameter for being directed to unrecognized character code.
Step 604, first preset function is called to establish internal buffer;Wherein, the internal buffer for pair
The unrecognized character code carries out code conversion;
Before carrying out code conversion, the first preset function can be called to establish internal buffer depending on networked terminals, so that
Second preset function can carry out code conversion to unrecognized character code using internal buffer.
Step 605, the code conversion parameter and the unrecognized character code are inputted into the second preset function, by
The code conversion function carries out code conversion to the unrecognized character code according to the code conversion parameter, obtains
Second caption data;
It, can be by code conversion parameter and unrecognized character code depending on networked terminals after obtaining code conversion parameter
The second preset function is inputted, the second preset function can be according to code conversion parameter, and the character code that will be unable to identification is converted to
The character code encoded using the second coding mode, to obtain the second caption data.
Step 606, the third preset function is called to discharge the internal buffer;
As an example, third preset function can be iconv_close function, and iconv_close function can be released
Put the internal buffer of iconv_open function foundation.
After code conversion, third preset function can be called to discharge the inside that the first preset function is established depending on networked terminals
Buffer area, to save the memory source of view networked terminals.
Step 607, when playing the video data, the corresponding subtitle of second caption data is shown.
After obtaining the second caption data, can be shown in designated position in playing video data depending on networked terminals
The corresponding subtitle of two caption datas.
In embodiments of the present invention, depending on networked terminals by detecting user for the program request operation of target video resource
When, to Internet Server request target video resource, the target video resource that the Internet Server returns then is received,
And target video resource is decoded, video data and the first caption data are obtained, is deposited in detecting the first caption data
In unrecognized character code, code conversion is carried out to unrecognized character code, obtains the second caption data, and
When playing the video data, the corresponding subtitle of the second caption data of display realizes view networked terminals to video in internet
Resource program request, and the case where can not identifying caption data in video resource depending on networked terminals is avoided, improve view networked terminals
Compatibility.
Moreover, by establishing internal buffer for code conversion, and internal buffer is discharged after code conversion, it saves
The memory source of view networked terminals, promotes the performance of view networked terminals.
It should be noted that for simple description, therefore, it is stated as a series of action groups for embodiment of the method
It closes, but those skilled in the art should understand that, embodiment of that present invention are not limited by the describe sequence of actions, because according to
According to the embodiment of the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art also should
Know, the embodiments described in the specification are all preferred embodiments, and the related movement not necessarily present invention is implemented
Necessary to example.
Referring to Fig. 7, a kind of structural block diagram of the device of video data processing of the embodiment of the present invention is shown, view is applied to
Networked terminals can specifically include following module:
Target video resource request module 701, for detect user for target video resource program request operation when,
The target video resource is requested to Internet Server;
Target video resource decoder module 702, the target video resource returned for receiving the Internet Server, and
The target video resource is decoded, video data and the first caption data are obtained;
Second caption data obtains module 703, for there are unrecognized in detecting first caption data
When character code, code conversion is carried out to the unrecognized character code, obtains the second caption data;
Subtitle Demonstration module 704, for when playing the video data, showing the corresponding word of second caption data
Curtain.
In a kind of preferred embodiment of the present invention, second caption data obtains module 703 and includes:
First preset function calls submodule, for there are unrecognized words in detecting first caption data
When symbol coding, the first preset function is called to generate the code conversion parameter for being directed to the unrecognized character code;
Second preset function calls submodule, is used for the code conversion parameter and the unrecognized character code
The second preset function is inputted, the unrecognized character is compiled according to the code conversion parameter by second preset function
Code carries out code conversion, obtains the second caption data.
In a kind of preferred embodiment of the present invention, the first preset function calling submodule includes:
First coding mode determination unit, for determining the first coding mode of the unrecognized character code;
Second coding mode acquiring unit, for obtaining second coding mode that can be identified depending on networked terminals;
Coding mode input unit, for will be described in first coding mode and second coding mode input
First preset function;
Code conversion parameter output unit, for obtaining the code conversion parameter of the first preset function output.
In a kind of preferred embodiment of the present invention, further includes:
Module is established in internal buffer, for calling first preset function to establish internal buffer;Wherein, in described
Portion buffer area is used to carry out code conversion to the unrecognized character code;
Internal buffer release module, for calling the third preset function to discharge the internal buffer.
In a kind of preferred embodiment of the present invention, the Subtitle Demonstration module 704 includes:
Timestamp acquisition submodule, for obtaining the timestamp of currently playing video data;
Second caption data searches submodule, for searching corresponding second caption data of the timestamp;
Subtitle matched sub-block corresponds to subtitle for from preset local character set, matching second caption data;
Subtitle Demonstration submodule is matched, for showing the subtitle
In embodiments of the present invention, depending on networked terminals by detecting user for the program request operation of target video resource
When, to Internet Server request target video resource, the target video resource that the Internet Server returns then is received,
And target video resource is decoded, video data and the first caption data are obtained, is deposited in detecting the first caption data
In unrecognized character code, code conversion is carried out to unrecognized character code, obtains the second caption data, and
When playing the video data, the corresponding subtitle of the second caption data of display realizes view networked terminals to video in internet
Resource program request, and the case where can not identifying caption data in video resource depending on networked terminals is avoided, improve view networked terminals
Compatibility.
The embodiment of the invention also discloses a kind of mobile terminal, including processor, memory and it is stored in the memory
Computer program that is upper and can running on the processor, is realized as above when the computer program is executed by the processor
A kind of the step of method of video data processing.
The embodiment of the invention also discloses a kind of computer readable storage mediums, which is characterized in that described computer-readable
Computer program is stored on storage medium, and a kind of video counts as described above are realized when the computer program is executed by processor
According to processing method the step of.
For device embodiment, since it is basically similar to the method embodiment, related so being described relatively simple
Place illustrates referring to the part of embodiment of the method.
All the embodiments in this specification are described in a progressive manner, the highlights of each of the examples are with
The difference of other embodiments, the same or similar parts between the embodiments can be referred to each other.
It should be understood by those skilled in the art that, the embodiment of the embodiment of the present invention can provide as method, apparatus or calculate
Machine program product.Therefore, the embodiment of the present invention can be used complete hardware embodiment, complete software embodiment or combine software and
The form of the embodiment of hardware aspect.Moreover, the embodiment of the present invention can be used one or more wherein include computer can
With in the computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) of program code
The form of the computer program product of implementation.
The embodiment of the present invention be referring to according to the method for the embodiment of the present invention, terminal device (system) and computer program
The flowchart and/or the block diagram of product describes.It should be understood that flowchart and/or the block diagram can be realized by computer program instructions
In each flow and/or block and flowchart and/or the block diagram in process and/or box combination.It can provide these
Computer program instructions are set to general purpose computer, special purpose computer, Embedded Processor or other programmable data processing terminals
Standby processor is to generate a machine, so that being held by the processor of computer or other programmable data processing terminal devices
Capable instruction generates for realizing in one or more flows of the flowchart and/or one or more blocks of the block diagram
The device of specified function.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing terminal devices
In computer-readable memory operate in a specific manner, so that instruction stored in the computer readable memory generates packet
The manufacture of command device is included, which realizes in one side of one or more flows of the flowchart and/or block diagram
The function of being specified in frame or multiple boxes.
These computer program instructions can also be loaded into computer or other programmable data processing terminal devices, so that
Series of operation steps are executed on computer or other programmable terminal equipments to generate computer implemented processing, thus
The instruction executed on computer or other programmable terminal equipments is provided for realizing in one or more flows of the flowchart
And/or in one or more blocks of the block diagram specify function the step of.
Although the preferred embodiment of the embodiment of the present invention has been described, once a person skilled in the art knows bases
This creative concept, then additional changes and modifications can be made to these embodiments.So the following claims are intended to be interpreted as
Including preferred embodiment and fall into all change and modification of range of embodiment of the invention.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by
One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation
Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning
Covering non-exclusive inclusion, so that process, method, article or terminal device including a series of elements not only wrap
Those elements are included, but also including other elements that are not explicitly listed, or further includes for this process, method, article
Or the element that terminal device is intrinsic.In the absence of more restrictions, being wanted by what sentence "including a ..." limited
Element, it is not excluded that there is also other identical elements in process, method, article or the terminal device for including the element.
Above to a kind of method and apparatus of video data processing provided by the present invention, it is described in detail, herein
In apply that a specific example illustrates the principle and implementation of the invention, the explanation of above example is only intended to sides
Assistant solves method and its core concept of the invention;At the same time, for those skilled in the art, think of according to the present invention
Think, there will be changes in the specific implementation manner and application range, in conclusion the content of the present specification should not be construed as pair
Limitation of the invention.