Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Embodiment of the method
Camera, as a kind of video input apparatus, is widely used in Video chat, ordinary video monitoring etc.Its basic functional principle is, by the picture that collects with the frame rate of setting, such as 30 frames/second is transferred on display screen, can realize continuously dynamic transmission of video.And USB interface camera supports plug and play and hot plug, application is general.Namely the embodiment of the present invention is be USB interface camera by mobile terminal configuration, exports to computer after the pictorial data that can show on mobile terminal display screen conversion by USB interface, and by computer screen shows in real time.
As shown in Figure 1, a kind of method of mobile terminal Image texture is embodiments provided.Wherein, described mobile terminal is configured to USB interface camera in computer operating system.
Particularly, USB interface camera can be configured as by configuring the device descriptor of mobile terminal, wherein, key be in configuration device descriptor below two parameters:
bDeviceClass:0xEF DeviceClassCode
bDeviceSubClass:0x02 DeviceSubclassCode
Further, be configured to the mobile terminal of USB interface camera and computer when setting up data communication by USB interface, the USB interface webcam driver software that the operating system of computer can be utilized to be equipped with, does not need to install other drive softwares more on computers.Existing computer operating system, for windows operating system, usually the drive software of USB interface camera has all been carried in an operating system, or user has installed the drive software of USB interface camera in an operating system, the plug and play of USB interface camera therefore can be realized.Known referring to description above, mobile terminal is by configuration device descriptor, USB interface camera is configured in the operating system of computer, therefore just can utilize in computer operating system, the USB interface webcam driver software that such as windows operating system has been equipped with, realizing mobile terminal when utilizing computer display to show image in real time, no longer needing other drive softwares are installed, thus realizing plug and play.Be described below in detail computer and mobile terminal be identified as USB interface camera, process for its install driver:
First, the usb hub of computer-side monitors the voltage of the holding wire of its each port, when mobile terminal inserts the main frame of computer by USB interface, the level of holding wire can change, and now namely main frame has learnt that USB device insertion has been communicated with.
Then main frame sends first time Get Descriptor (high byte of wValue field is 0x01, indication equipment descriptor) request and obtains device descriptor; Wherein, device descriptor provides the much information of USB device, comprising: the size of the maximum bag of USB device, the config. number that USB device is supported and the out of Memory etc. about this USB device.Device descriptor due to mobile terminal has been configured to a USB interface camera, and computer can know that the USB device of this insertion is USB interface camera device.Preferably, mobile terminal can setting options or pattern, such as " Computer display pattern ", before or after mobile terminal to be communicated with computer by USB interface, if user have selected " Computer display pattern ", mean will be USB interface camera by mobile terminal configuration, so the device descriptor being configured to USB interface camera recalls by mobile terminal automatically, so that computer is identified as USB interface camera.
Then, after device descriptor after computer has read configuration, if specify the index of relevant character string descriptor (being used for describing manufacturer, product and equipment Serial Number information etc.) in the device descriptor read before, by sending several times Get Descriptor again, (high byte of wValue field is 0x03 to main frame, represent character string descriptor) order obtain these character strings describe, now main frame will pop-up window, the USB device that display finds, the i.e. information of mobile terminal, such as business men, product description, model etc.Usual USB interface camera can be shown as " USB WebCamera " on main frame, because mobile terminal in the embodiment of the present invention is just in order to show image in real time on computer display, and be configured to USB interface camera, it is not real USB interface camera, therefore other titles can be revised as, such as " Terminal Display Device ".
Finally, after main frame has known above-mentioned information from the USB device inserted, just starting the USB device for inserting, is also mobile terminal, install driver.Mobile terminal reports concrete VID (Vendor ID by device descriptor, production firm ID)/PID (Product ID, product IDs) information, user chooses the VID/PID of the USB interface webcam driver that computer operating system has been equipped with, and can realize automatically completing drive installation.Be loaded with after USB device drives, it is that this USB device selects a suitable configuration that main frame sends Set_Configuration command request.
So far, USB enumeration process terminates, USB device, and the mobile terminal being also namely configured to USB interface camera just can employ.
With reference to figure 1, the method for a kind of mobile terminal Image texture that the embodiment of the present invention provides, specifically comprises the steps:
Step 11, obtains from the video memory of described mobile terminal, gather picture resolution ratio and the time interval;
Common USB interface camera has the resolution ratio of 1,300,000 pixels, 300,000 pixels etc., and the mobile terminal being therefore configured to USB interface camera also can adopt above-mentioned resolution ratio to the resolution ratio that the picture collected is arranged.Preferably, mobile terminal is configured to the resolution ratio that can arrange described picture.Such as, user wishes, by the video stored in computer screen viewing mobile terminal, the resolution ratio of described picture to be set to 1,300,000 pixels, i.e. the resolution ratio of 1280 × 1024.Like this, when mobile terminal gathers picture collection picture from the video memory of described mobile terminal, just can go to gather picture with the resolution ratio set before.Also passable, the resolution ratio of an acquiescence is set, such as 300,000 pixels.
But, because computer confirms that resolution information is being configured to the mobile terminal of USB interface camera by USB interface insertion process, by what complete in the device descriptor of mobile terminal reporting, therefore, user first should complete described resolution ratio and arrange, then is connected with computer by mobile terminal.If after mobile terminal is connected with computer, user changes described resolution ratio again, then need to reconnect after USB disconnecting once again, to ensure that calculating function shows according to the resolution ratio after renewal.
In addition, the frame rate that usual USB interface camera Streaming Media exports is 30 frames/second or 24 frames/second, and therefore, the described time interval can be 1/30 second or 1/24 second.For 1/30 second time interval, 1 second can collect 30 pictures from the pictorial data video memory.Same, the time interval of acquiescence also can be set, such as 1/30 second.
When data communication set up by terminal and computer, can report the above-mentioned time interval and resolution ratio by device descriptor, terminal can obtain before collection picture.
Step 12, gathers picture with the resolution ratio of described acquisition and the time interval from the video memory of described mobile terminal;
The pictorial data of application program is stored in mobile terminal video memory, this pictorial data is output to the Graphics Processing chip in mobile terminal, then the pictorial data after being processed is by EBI on the display screen of mobile terminal, such as rgb interface or MDDI interface, the display screen that can be output to mobile terminal shows.
The pictorial data that first embodiment of the present invention will store in mobile terminal video memory, no longer export Graphics Processing chip to, but read out with the resolution ratio of described acquisition and the time interval, thus collect plurality of pictures, to export computer to after subsequent treatment.
Step 13, generates the described picture collected the stream medium data meeting USB interface thecamera head;
Be that USB interface camera is to carry out MPTS media data by mobile terminal configuration due to the embodiment of the present invention, so just the picture collected should be generated the stream medium data meeting USB interface camera and export, as for concrete generative process, belong to prior art, do not repeating.Such as, the described picture collected is generated the stream medium data meeting USB interface thecamera head, at least can comprise the picture format being configured to the picture collected to be suitable for the output of USB interface camera: YUV and RGB all can by the pixel format selecting to export in the embodiment of the present invention, wherein, RGB24, can as preferably as the pixel format of main flow.But it is easily understood that this does not form the restriction to it.In addition, can also comprise for the described picture collected adds frame head, postamble, etc.
Step 14, exports to computer by described stream medium data by USB interface, so that described computer shows in real time after receiving on computer display;
Owing to being the picture of the time interval collection set in step 12, so can the speed corresponding with the described time interval export when output stream media data.Such as, in step 12, gather described picture with the time interval of 1/30 second, so in this step, just can with speed 30 frames of correspondence/second output stream media data.Wherein, 30 frames/second is the frame rate of current USB interface camera video output protocol.
After computer receives described stream medium data, it can be shown on a display screen.As for, after computer receives described stream medium data, how to process described stream medium data, how to show image, this how process flow media data after being communicated with computer with existing USB interface camera, the process how showing image is similar, belong to prior art, do not repeat them here.
Preferably, the described picture collected is generated the stream medium data meeting USB interface thecamera head to comprise: the picture collected described in compression.
Can transmission bandwidth be reduced during transmission of flow media data after compression, specifically how carry out compression process and belong to the state of the art, do not repeat them here.
Like this, after mobile terminal sets up data communication by USB interface and computer, the image on mobile terminal display screen just can show in real time on computer screen.
Further, in order to reach the object of energy-conservation reduction power consumption, when mobile terminal and personal computer set up data communication, and when the image of the display screen display of mobile terminal is shown on computer screen, can the display screen of temporary close mobile terminal.Or after user's optional m igration terminal enters " Computer display pattern ", the display screen of mobile terminal can be closed.
In the embodiment of the present invention, described mobile terminal is configured to USB interface camera in the operating system of computer, from the video memory of described mobile terminal, picture is gathered with certain resolution ratio and the time interval, and the described picture collected is generated the stream medium data meeting USB interface thecamera head, finally described stream medium data is exported to computer by USB interface, so that described computer shows in real time after receiving on computer display, like this after mobile terminal and computer set up data communication by USB interface, just the display image on mobile terminal display screen can be shown in real time on the display screen of personal computer, like this can computer larger display screen display mobile terminal displaying contents, improve Consumer's Experience, secondly, by configuring the device descriptor of mobile terminal, when mobile terminal and personal computer set up data communication by USB interface, the USB interface webcam driver software that computer operating system can be utilized to be equipped with, thus do not need other drive softwares are installed again, be user-friendly to, again, can arrange the resolution ratio gathering picture, like this, the image that computer screen shows, not by the restriction of the resolution ratio of the display screen of mobile terminal, can show image more clearly.
Apparatus embodiments
As shown in Figure 2, embodiments provide a kind of mobile terminal, this terminal comprises with lower module:
Equipment configuration module 21, for being configured to USB interface camera by described mobile terminal in computer operating system;
Resolution ratio and time interval acquisition module 22, for obtaining the resolution ratio and the time interval that gather picture from the video memory of described mobile terminal;
Picture collection module 23, for gathering picture with the resolution ratio of described acquisition and the time interval from the video memory of described mobile terminal;
Modular converter 24, generates for the described picture collected the stream medium data meeting USB interface thecamera head;
Output module 25, for described stream medium data is exported to computer by USB interface, so that described computer shows in real time after receiving on computer display;
Wherein, described resolution ratio is corresponding with the resolution ratio of USB interface camera, and the described time interval is corresponding with the frame rate of the stream medium data of USB interface thecamera head.
Further, described mobile terminal also comprises:
Compression module 26, when meeting the stream medium data of USB interface thecamera head for being generated by the described picture collected, the picture collected described in compression.
Preferably, described mobile terminal is mobile phone, and described mobile phone also comprises: radio circuit, microphone, loudspeaker, power supply;
Described radio circuit, for setting up the communication of mobile phone and wireless network, realizes the digital received and sent of mobile phone and wireless network;
Described microphone, for gathering sound and the sound of collection being converted into voice data, so that described mobile phone sends described voice data by described radio circuit to wireless network;
Described loudspeaker, for the voice data received from wireless network by described radio circuit by described mobile phone, is reduced to sound and plays this sound to user;
Described power supply, for powering for each circuit of described mobile phone or device.
The course of work that mobile terminal is associated and operation principle, similar with the embodiment of the method described before, do not repeat them here.
In the embodiment of the present invention, picture collection module 23 gathers picture with the resolution ratio obtained and the time interval from the video memory of described mobile terminal, the described picture collected is generated the stream medium data meeting USB interface camera and export by modular converter 24, described stream medium data is exported to computer by USB interface by output module 25, so that described computer shows in real time after receiving on computer display, like this after data communication set up by mobile terminal and computer, just the display image on mobile terminal display screen can be shown on computer screen, like this can computer larger display screen display mobile terminal displaying contents, improve Consumer's Experience.
One of ordinary skill in the art will appreciate that all or part of flow process realized in above-described embodiment method, that the hardware that can carry out instruction relevant by computer program has come, described program can be stored in a computer read/write memory medium, this program, when performing, can comprise the flow process of the embodiment as above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-Only Memory, ROM) or random store-memory body (Random Access Memory, RAM) etc.
In a word, the foregoing is only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.