Summary of the invention
In order to address the above problem, the embodiment of the present invention provides a kind of electricity saving method for video play device and system thereof and corresponding video broadcasting method and device, can save battery electric quantity, extends battery electric quantity service time.
In order to solve the problems of the technologies described above, the embodiment of the present invention provides a kind of electricity saving method for video play device, comprising:
Check the default working time of current process;
In the time of the inspection that is less than operating system default working time of described current process and update cycle, the actual run time of described current process is extended to the inspection of described operating system and the time span of update cycle.
Wherein, described method also comprises:
In the time that described process needs file reading, determine the buffer size corresponding with described process according to memory size;
The buffer size corresponding according to described process reads at least part of file in buffer zone corresponding to described process and processes.
Correspondingly, the present invention also provides a kind of video broadcasting method, comprising:
Check the default working time of the needed process of displaying video;
In the time of the inspection that is less than operating system default working time of described process and update cycle, the actual run time of described process is extended to the inspection of described operating system and the time span of update cycle;
Move described process, read video file and play.
Wherein, described in, read the step that video file plays and comprise following sub-step:
According to memory size, buffer size corresponding to described process is set;
According to described buffer size, at least part of video file is read in buffer zone corresponding to described process;
According to the video file displaying video in buffer zone corresponding to described process.
Correspondingly, the present invention also provides a kind of electricity-saving system for video play device, comprising:
Working time checking module, for checking the default working time of current process;
Module is set working time, for when the inspection that is less than operating system default working time of described current process and the update cycle, the actual run time of described current process is extended to the inspection of described operating system and the time span of update cycle.
Wherein, described system also comprises:
Buffer zone arranges module, in the time that described process needs file reading, determines according to memory size the buffer size that described process is corresponding;
File read module, processes at least part of file being read to buffer zone corresponding to described process according to described buffer size.
Correspondingly, the present invention also provides a kind of video play device, comprising:
Working time checking module, for checking the default working time of the needed process of displaying video;
Module is set working time, for when the inspection that is less than operating system default working time of described process and the update cycle, the actual run time of described process is extended to the inspection of described operating system and the time span of update cycle;
Processing module, for moving described process, reads video file and plays.
Wherein, described processing module comprises:
Buffer zone arranges module, for buffer size corresponding to described process is set according to memory size;
File read module, for reading to buffer zone corresponding to described process according to buffer size corresponding to described process by least part of video file;
Playing module, for according to the video file displaying video of buffer zone corresponding to described process.
Implement the embodiment of the present invention, there is following beneficial effect: by the default actual run time that is less than the process of operating system inspection and update cycle working time being extended to the time span of this inspection and update cycle, can make CPU keep running status always, avoid frequently switching and wasting battery electric quantity in working order and between idle state because of CPU.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
Referring to Fig. 1, is the process flow diagram of the electricity saving method for video play device that provides of first embodiment of the invention, and the method comprises:
The default working time of step S100, inspection current process.
Step S101, in the time of the inspection that is less than operating system default working time of described current process and update cycle, the actual run time of described current process is extended to the inspection of described operating system and the time span of update cycle.In general, the inspection of window operating system and the time span of update cycle are 15.6ms.For DWORD timeGetTime (VOID) function, this function obtains the currency of timer, the unit of timeGetTime rreturn value is 1ms, in the time using this function, can improve by timeBeginPeriod and timeEndPeriod function are set the precision of timeGetTime function, while guaranteeing to use, do not affect cpu cycle switching.Again for example, sleep function is carried out and is hung up a period of time, and the parameter that sleep can be set is 15.6ms.Again for example, some thread waits or synchronous function, be less than 15.6ms if wait for or hang up function, is made as 15.6, such as: DWORD WaitForSingleObject (HANDLE hHandle, DWORD dwMilliseconds); When dwMilliseconds is less than 15.6ms, be made as 15.6ms.Also have some other function that affects cpu cycle switching, as SetCoalescableTimer and KeSetCoalescableTimer/WaitForMultipleObject etc., if be less than 15.6ms default working time, be made as 15.6ms.
The electricity saving method that the embodiment of the present invention provides, by the default actual run time that is less than the process of operating system inspection and update cycle working time being extended to the time span of this inspection and update cycle, can make CPU keep running status always, avoid frequently switching and wasting battery electric quantity in working order and between idle state because of CPU.
Referring to Fig. 2, is the process flow diagram of the electricity saving method for video play device that provides of second embodiment of the invention, and the method comprises:
The default working time of step S200, inspection current process.
Step S201, in the time of the inspection that is less than operating system default working time of described current process and update cycle, the actual run time of described current process is extended to the inspection of described operating system and the time span of update cycle.
Step S202, in the time that process needs file reading, according to memory size determine the buffer size corresponding with described process.Particularly, the buffer size corresponding with described process can arrange according to total memory size in advance, also can in the time of file reading, arrange according to real-time capacity and file size, and still, generally speaking, buffer size is set to as far as possible large.For example, if there is abundant idle internal memory, can disposable whole file be read into buffer zone.Total memory size of distinct electronic apparatuses is substantially different, the memory size of desktop computer or notebook computer can be slightly larger, the memory size of mobile phone or panel computer can be smaller, according to the difference of electronic equipment, choose suitable buffer size, can reduce the number of operations to hard disk, thereby reduce the consumption to battery electric quantity.This electricity saving method be not only applicable to windows, ios device also can, be not limited to application platform.The for example file of a 200M, PC can the disposable 20M of reading data (being set to 20M by buffer size), and ios device can the disposable 5M-10M of reading data (being set to 5M-10M by buffer size).
Step S203, according to buffer size corresponding to described process, at least part of file is read in buffer zone corresponding to described process and processed.
Referring to Fig. 3, is the process flow diagram of the video broadcasting method that provides of preferred embodiment of the present invention, and the method comprises:
The default working time of step S300, the needed process of inspection displaying video.
Step S301, in the time of the inspection that is less than operating system default working time of described process and update cycle, the actual run time of described process is extended to the inspection of described operating system and the time span of update cycle.Conventionally, the inspection of window operating system and the time span of update cycle are 15.6ms.For DWORD timeGetTime (VOID) function, this function obtains the currency of timer, the unit of timeGetTime rreturn value is 1ms, in the time using this function, can improve by timeBeginPeriod and timeEndPeriod function are set the precision of timeGetTime function, while guaranteeing to use, do not affect cpu cycle switching.Again for example, sleep function is carried out and is hung up a period of time, and the parameter that sleep can be set is 15.6ms.Again for example, some thread waits or synchronous function, be less than 15.6ms if wait for or hang up function, is made as 15.6, such as: DWORD WaitForSingleObject (HANDLE hHandle, DWORD dwMilliseconds); When dwMilliseconds is less than 15.6ms, be made as 15.6ms.Also have some other function that affects cpu cycle switching, as SetCoalescableTimer and KeSetCoalescableTimer/WaitForMultipleObject etc., if be less than 15.6ms default working time, be made as 15.6ms.
Step S302, move described process, read video file and play.
The video broadcasting method that the embodiment of the present invention provides, by the default actual run time that is less than the process of operating system inspection and update cycle working time being extended to the time span of this inspection and update cycle, can make CPU keep running status always, avoid frequently switching and wasting battery electric quantity in working order and between idle state because of CPU.
Referring to Fig. 4, is in embodiment, in step S302, to read the flowchart that video file is play described in Fig. 3, comprising:
Step S400, according to memory size, buffer size corresponding to described process is set.
Step S401, according to described buffer size, at least part of video file is read in buffer zone corresponding to described process.
Step S402, according to the video file displaying video in buffer zone corresponding to described process.
In said method, need to buffer size be set to as far as possible large.For example, if there is abundant idle internal memory, can disposable whole file be read into buffer zone.Total memory size of distinct electronic apparatuses is substantially different, the memory size of desktop computer or notebook computer can be slightly larger, the memory size of mobile phone or panel computer can be smaller, according to the difference of electronic equipment, choose suitable buffer size, can reduce the number of operations to hard disk, thereby reduce the consumption to battery electric quantity.This electricity saving method be not only applicable to windows, ios device also can, be not limited to application platform.The for example file of a 200M, PC can the disposable 20M of reading data (being set to 20M by buffer size), and ios device can the disposable 5M-10M of reading data (being set to 5M-10M by buffer size).
Referring to Fig. 5, is the structural representation of the electricity-saving system 500 for video play device that provides of preferred embodiment of the present invention, and electricity-saving system 500 comprises:
Working time checking module 510, for checking the default working time of current process;
Module 520 is set working time, for when the inspection that is less than operating system default working time of described current process and the update cycle, the actual run time of described current process is extended to the inspection of described operating system and the time span of update cycle.Conventionally, the inspection of window operating system and the time span of update cycle are 15.6ms.For DWORD timeGetTime (VOID) function, this function obtains the currency of timer, the unit of timeGetTime rreturn value is 1ms, in the time using this function, can improve by timeBeginPeriod and timeEndPeriod function are set the precision of timeGetTime function, while guaranteeing to use, do not affect cpu cycle switching.Again for example, sleep function is carried out and is hung up a period of time, and the parameter that sleep can be set is 15.6ms.Again for example, some thread waits or synchronous function, be less than 15.6ms if wait for or hang up function, is made as 15.6, such as: DWORD WaitForSingleObject (HANDLE hHandle, DWORD dwMilliseconds); When dwMilliseconds is less than 15.6ms, be made as 15.6ms.Also have some other function that affects cpu cycle switching, as SetCoalescableTimer and KeSetCoalescableTimer/WaitForMultipleObject etc., if be less than 15.6ms default working time, be made as 15.6ms.
The electricity-saving system that the embodiment of the present invention provides, by the default actual run time that is less than the process of operating system inspection and update cycle working time being extended to the time span of this inspection and update cycle, can make CPU keep running status always, avoid frequently switching and wasting battery electric quantity in working order and between idle state because of CPU.
Preferably, electricity-saving system 500 can also comprise:
Buffer zone arranges module, in the time that process needs file reading, determines the buffer size corresponding with described process according to memory size.Particularly, buffer size can arrange according to total memory size in advance, also can in the time of file reading, arrange according to real-time capacity and file size, and still, generally speaking, buffer size is set to as far as possible large.For example, if there is abundant idle internal memory, can disposable whole file be read into buffer zone.Total memory size of distinct electronic apparatuses is substantially different, the memory size of desktop computer or notebook computer can be slightly larger, the memory size of mobile phone or panel computer can be smaller, according to the difference of electronic equipment, choose suitable buffer size, can reduce the number of operations to hard disk, thereby reduce the consumption to battery electric quantity.This electricity saving method be not only applicable to windows, ios device also can, be not limited to application platform.The for example file of a 200M, PC can the disposable 20M of reading data (being set to 20M by buffer size), and ios device can the disposable 5M-10M of reading data (being set to 5M-10M by buffer size).
File read module, processes at least part of file being read to buffer zone corresponding to described process according to buffer size corresponding to described process.
Referring to Fig. 6, is the structural representation of the video play device 600 that provides of preferred embodiment of the present invention, and this device 600 comprises:
Working time checking module 610, for checking the default working time of the needed process of displaying video;
Module 620 is set working time, for when the inspection that is less than operating system default working time of described process and the update cycle, the actual run time of described process is extended to the inspection of described operating system and the time span of update cycle.Conventionally, the inspection of window operating system and the time span of update cycle are 15.6ms.For DWORD timeGetTime (VOID) function, this function obtains the currency of timer, the unit of timeGetTime rreturn value is 1ms, in the time using this function, can improve by timeBeginPeriod and timeEndPeriod function are set the precision of timeGetTime function, while guaranteeing to use, do not affect cpu cycle switching.Again for example, sleep function is carried out and is hung up a period of time, and the parameter that sleep can be set is 15.6ms.Again for example, some thread waits or synchronous function, be less than 15.6ms if wait for or hang up function, is made as 15.6, such as: DWORD WaitForSingleObject (HANDLE hHandle, DWORD dwMilliseconds); When dwMilliseconds is less than 15.6ms, be made as 15.6ms.Also have some other function that affects cpu cycle switching, as SetCoalescableTimer and KeSetCoalescableTimer/WaitForMultipleObject etc., if be less than 15.6ms default working time, be made as 15.6ms.
Processing module 630, for moving described process, reads video file and plays.
The video play device that the embodiment of the present invention provides, by the default actual run time that is less than the process of operating system inspection and update cycle working time being extended to the time span of this inspection and update cycle, can make CPU keep running status always, avoid frequently switching and wasting battery electric quantity in working order and between idle state because of CPU.
In a preferred embodiment, processing module 630 comprises: buffer zone arranges module, for buffer size corresponding to described process is set according to memory size; File read module, for reading to buffer zone corresponding to described process according to described buffer size by least part of video file; Playing module, for according to the video file displaying video of buffer zone corresponding to described process.
In an embodiment of the present invention, need to buffer size be set to as far as possible large.For example, if there is abundant idle internal memory, can disposable whole file be read into buffer zone.Total memory size of distinct electronic apparatuses is substantially different, the memory size of desktop computer or notebook computer can be slightly larger, the memory size of mobile phone or panel computer can be smaller, according to the difference of electronic equipment, choose suitable buffer size, can reduce the number of operations to hard disk, thereby reduce the consumption to battery electric quantity.This electricity saving method be not only applicable to windows, ios device also can, be not limited to application platform.The for example file of a 200M, PC can the disposable 20M of reading data (being set to 20M by buffer size), and ios device can the disposable 5M-10M of reading data (being set to 5M-10M by buffer size).
One of ordinary skill in the art will appreciate that all or part of flow process realizing in above-described embodiment method, can carry out the hardware that instruction is relevant by computer program to complete, described program can be stored in a computer read/write memory medium, this program, in the time carrying out, can comprise as the flow process of the embodiment of 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.
Above disclosed is only preferred embodiment of the present invention, certainly can not limit with this interest field of the present invention, one of ordinary skill in the art will appreciate that all or part of flow process that realizes above-described embodiment, and the equivalent variations of doing according to the claims in the present invention, still belong to the scope that invention is contained.