Summary of the invention
The present invention seeks to provides a kind of high in the clouds Control Network video image to handle stream media service system and method to the defective that prior art exists.
The present invention adopts following technical scheme for realizing above-mentioned purpose:
High in the clouds of the present invention Control Network video image is handled stream media service system, it is characterized in that comprising by user's cluster, server cluster and cloud control desk and cloud database three parts constituting; It is user's cluster that a plurality of users are seen as, and system provides client for each user, through client realize with the video image processing platform between alternately; Server cluster is to have to provide video image to handle the set of some station servers of service function, and wherein, the video image processing capacity that each server provides all is separate, mutually noninterfere each other; The cloud control desk is used for scheduling and distribution server resource; Realize communicating by letter between client cluster and the server cluster; Make each client all can enjoy the image processing service that server independently provides, include the information of each server in the server cluster in the cloud database.
The method that high in the clouds Control Network video image is handled stream media service system is following:
Employing cloud control desk is dispatched the server cluster resource that service is provided and is distributed; For providing parallel video image, user's cluster handles service; Service content mainly is that the algorithm that the user provides is loaded in the test video, and test result and data record are got off; The video image result feeds back to the user through client with the mode of VLC Streaming Media and online download.
The key step of setting up intercommunication mutually between said client, cloud control desk and the server is following:
(1) client is sent the instruction of Connection Service device request to the cloud control desk;
(2) to receive and parse after the instruction of connection request from the cloud database information of obtaining idle server according to the distributed hash algorithm be address and port to the cloud control desk;
(3) the cloud control desk sends to client with the information of idle server;
(4) the cloud control desk is opened this idle server, after preparation establishes a communications link with client, is its service that provides video image to handle;
(5) client with will establish a communications link for it provides the server of service.
The step of said cloud control desk scheduling and distribution server is following:
(a) after the cloud control desk receives and parse the connection request of client, call the scheduling allocation algorithm;
(b) obtain key assignments Value according to accidental distributed hash algorithm;
(c) in the cloud database, search the information that ID is the server of Value; Judge that ID is that the state of server of Value is whether idle: if idle; Be that the information of the server of Value is that address and port are submitted to the cloud control desk directly, and server state is changed to " busy " ID; If busy, regenerate an Integer n again, repeated execution of steps (2) obtains a new key assignments Value, till getting access to idle server;
(d) information with the server that is dispatched to is that address and port send to client;
(e) the cloud control desk is opened server and is prepared as the service that client provides video image to handle;
(f) information interaction of wait client and server is sent the instruction that connects the request of disconnection up to client;
(g) after request instruction is broken off in the connection that receives and parse the user, upgrade the high in the clouds database, discharge server resource.
Said client and server info comprise user data upload, control and treatment instruction, three parts of result feedback alternately, and concrete steps are following:
1) client and server establish a communications link;
2) data that will handle of user send to server;
3) feedback information of waiting for server end instruction;
4) according to feedback information, client is sent next step operational processes instruction: if feedack is the Data Receiving success, then send processing instruction; If feedack is the Data Receiving failure, then the client repeating step 2), till the Data Receiving success that needs are handled;
5) after server receives the processing instruction of client transmission, carry out corresponding video image and handle, the information command that processing is finished sends to client, and client can select different modes to obtain result according to demand;
6) client is sent the instruction that connects the request of disconnection to the cloud control desk after receiving the result of server process;
7) withdraw from client.
Said client is following from the method for server data download:
A) server sends to client with the information command that processing finishes, and client sends to server according to the downloading mode of demand selection needs with the downloading mode instruction;
B) server receives and parses the download instruction that client is sent;
C) if instruction resolves to online downloading mode; Server adopts socket document flow packet fragmentation mode; Directly the data after the server process are sent to the user, after the user receives the instruction that server send to finish, result that just can be after client is checked processing; If instruction resolves to VLC Streaming Media transmission means, server is when client is sent result, and client can show in real time, need not to show after download is accomplished again;
D) after client is received the result of server process, send the instruction of breaking off connection request to the cloud control desk.
The method of said establishment VLC Streaming Media transmission is following:
A) creating the libvlc dynamic assembly is structural anomaly class MediaException, MediaHandle, Media, MediaPlayerHandle and MediaPlayer;
B) play parameter setting;
C) create also libvlc instance of initialization, and create an empty medium player object;
D) the win32/win64 window handle that gives the output of media player medium is set;
E) reclaim associative operation such as rubbish.
At present, the system for cloud computing technology has become the important technology that solves mass data calculating, uses " cloud control " service, can thousands of server cluster be put together, and realizes management, task scheduling etc. automatically.Based on its technological thought, the present invention has designed and developed a kind of networked video image based on " cloud control " and has handled service system, and the service of the operation test result of various video image Processing Algorithm can be provided for the multi-user.System has batch process, parallel processing, interaction, disposes, dwindles the main frame scale fast, improves characteristics such as resource utilization.
Embodiment
The present invention has developed a kind of networked video image and has handled service system, is a multi-user access formula system.Summary of the invention comprises: (1) development and Design a kind of system pattern that can provide networked video image to handle service.Promptly; The data that the user will handle through the Internet based on client (comprising video image Processing Algorithm and video image) are submitted to the video image processing platform; The video image processing platform can be handled according to user request accordingly, and result is fed back to the user through client with the mode of VLC Streaming Media or online download.(2) employing cloud control technology is dispatched and is distributed a plurality of server resources, and being embodied as the multi-user provides parallel video image to handle service.Promptly; Supply client to use through accidental distributed hash algorithm idle server of search from cloud database (information that includes server cluster the database as: the ID of each server, address, port and state (idle or busy)); Thereby computational resource is optimized, improves computational efficiency.(3) designed interactive client, uploaded and be principal character with the VLC Streaming Media transmission of video image result or the mode of online download with user data online.VLC Streaming Media mode need not to download the just real-time display video process result of ability.Can satisfy different user and check the demand of video, processing result image.
The networking video image is handled service system and mainly is made up of user's cluster, server cluster and cloud control desk and cloud database three parts.It is user's cluster that a plurality of users are seen as, and system provides client for each user, through client realize with the video image processing platform between alternately; Server cluster is to have to provide video image to handle the set of some station servers of service function, and wherein, the video image processing capacity that each server provides all is separate, mutually noninterfere each other; The cloud control desk is used for scheduling and distribution server resource; Realize communicating by letter between client cluster and the server cluster; Make each client all can enjoy the image processing service that server independently provides; The information that includes each server in the server cluster in the cloud database, as: the ID of server (numbering), address, port and state (idle or busy).This system is in providing the process of service, and the user need not the execution mode of being concerned about that server end is concrete, the result that only need wait for downloads and handle.General frame is seen Fig. 1.
The present invention has designed a cloud control desk and cloud database between client and server, accomplish the scheduling and the distribution of server cluster resource, realizes communicating by letter between client and the server.The cloud control desk finds the server of a free time according to the distributed hash algorithm in the cloud database, the information (address and port) of the idle server that is dispatched to is issued client, and opening server is that client is set up communication port between the server.The scheduling graph of cloud control desk is seen Fig. 2, and for example, user A is assigned to server D according to the scheduling of cloud control desk, and user B is assigned to server C.
Development and Design of the present invention interactive client.The user has realized the online user's of uploading functions such as video, image and algorithm in client; The service of VLC Streaming Media or online download is provided when feedback result.The user can not only handle video and the image of oneself through networked video image processing platform, can also on this platform, verify the algorithm of oneself; After server-side processes finished, the user can select the VLC media stream in real time to obtain the result according to different demands or the result is obtained in online download simultaneously.Wherein, VLC (VideoLan Client) is a cross-platform media player and streaming media server, can be used for playing network streaming media and this machine multimedia file.The VLC stream media technology supports that multimedia data stream transmits to client from server through network, and the client edge joint is received the technology that play on the limit.Because it is an open source code, therefore, we have designed streaming media service based on the interface of VLC source code encapsulation at networked video image processing platform, are used in the real-time display video image result of client.
Mutual communication between client, cloud control desk and the server connects
The networking video image is handled service system and is comprised that mainly three part communications connect: between client and the cloud control desk, between cloud control desk and the server and between client and the server.Communication between this three part connects and is based on all that socket communication accomplishes, and client is connected scheduling and the distribution that needs the cloud control desk with communication between the server.
The key step of setting up intercommunication mutually between client, cloud control desk and the server is following:
(1) client is sent the instruction of Connection Service device request to the cloud control desk;
(2) the cloud control desk receives and parses after the instruction of connection request from the cloud database information (address and port) of obtaining idle server according to the distributed hash algorithm;
(3) the cloud control desk sends to client with the information of idle server;
(4) the cloud control desk is opened this idle server, after preparation establishes a communications link with client, is its service that provides video image to handle;
(5) client with will establish a communications link for it provides the server of service.
The process of setting up intercommunication mutually between client, cloud control desk and the server is seen Fig. 3.
The cloud control desk
The main scheduling and the distribution of accomplishing server of cloud control desk technology of the present invention's design distributes the server of a separate free for it service to be provided for each user.Its scheduling and distribution idle server are mainly accomplished according to accidental distributed hash algorithm search cloud database.
The step of scheduling of cloud control desk and distribution server is following:
(1) after the cloud control desk receives and parse the connection request of client, calls the scheduling allocation algorithm;
(2) obtain key assignments Value according to accidental distributed hash algorithm.The process that the distributed hash algorithm obtains key assignments Value is following: (ID of server is 0,1...m-1), generates an Integer n at random, and the value of Value is that n gets surplus (being Value=n%m) divided by m to suppose that the m station server is arranged;
(3) in the cloud database, search the information that ID is the server of Value, judge that ID is that the state of server of Value is whether idle.If idle, be that the information (address and port) of the server of Value is submitted to the cloud control desk directly, and server state is changed to " busy " ID; If busy, regenerate an Integer n again, repeated execution of steps (2) obtains a new key assignments Value, till getting access to idle server;
(4) information (address and port) with the server that is dispatched to sends to client;
(5) the cloud control desk is opened server and is prepared as the service that client provides video image to handle;
(6) information interaction of wait client and server is sent the instruction that connects the request of disconnection up to client;
(7) after request instruction is broken off in the connection that receives and parse the user, upgrade the high in the clouds database, discharge server resource.
The block diagram of cloud control desk internal schedule and distribution server is seen Fig. 4.
Interactive client
The present invention has designed interactively client, its function comprises that the user is online when uploading data (image, video, algorithm) technology and feedback result online download technology and VLC streaming media transmission technique.The data that the user will handle through client send to server through the Internet, and server end is handled according to user's demand, and the back user that finishes dealing with can select the result after online download or VLC Streaming Media transmission means are checked processing according to demand.
The mutual main process of client and server info is seen Fig. 5.Its reciprocal process mainly comprises user data upload, control and treatment instruction, three parts of result feedback.Concrete steps are following:
(1) client and server establish a communications link;
(2) data (image, video, algorithm etc.) that will handle of user send to server;
(3) feedback information of waiting for server end instruction (data uploaded of reception whether success);
(4) according to feedback information, client is sent next step operational processes instruction.If feedack is the Data Receiving success, then send processing instruction (Video processing or image processing); If feedack is Data Receiving failure, client repeating step (2) then is till the Data Receiving success that needs are handled;
(5) after server receives the processing instruction of client transmission; Carrying out corresponding video image handles; The information command that processing is finished sends to client, and client can select different modes to obtain result (as: the online download of Streaming Media shows perhaps online download etc. simultaneously in real time) according to demand;
(6) client is sent the instruction that connects the request of disconnection to the cloud control desk after receiving the result of server process;
(7) withdraw from client.
(1) (3) (4) (6) (7) in the above-mentioned steps are the control and treatment instruction.
The present invention has designed dual mode when client downloads: VLC Streaming Media transmission downloading mode and online downloading mode.Online downloading mode is based on document flow transmission and the transmission packets Mechanism Design of socket, and the result of feedback could show after must downloading completion; VLC Streaming Media transmission means realizes through embedding the libvlc storehouse, and it can not downloaded under the situation of completion in the real-time demonstration process result of client in result.
Client is following from the main process of server data download:
(1) server sends to client with the information command that processing finishes, and client sends to server according to the downloading mode of demand selection needs with the downloading mode instruction;
(2) server receives and parses the download instruction that client is sent;
(3) if instruction resolves to online downloading mode; Server adopts socket document flow packet fragmentation mode; Directly the data after the server process are sent to the user, after the user receives the instruction that server send to finish, result's (video, image) that just can be after client is checked processing; If instruction resolves to VLC Streaming Media transmission means, server is when client is sent result, and client can show in real time, need not to show after download is accomplished again;
(4) after client is received the result of server process, send the instruction of breaking off connection request to the cloud control desk;
Create the transmission of VLC Streaming Media
Mainly be to realize through embedded libvlc in networked video image processing platform.Based on libvlc structural anomaly structure class, create and libvlc instance of initialization, create the DST PLAYER object of a sky then, realize the output of video flowing.The concrete realization as follows:
A) create the libvlc dynamic assembly.Be structural anomaly class MediaException, MediaHandle, Media, MediaPlayerHandle and MediaPlayer;
B) play parameter setting;
C) create also libvlc instance of initialization, and create an empty medium player object;
D) the win32/win64 window handle that gives the output of media player medium is set;
E) reclaim associative operation such as rubbish.