The content of the invention
In order to solve the above problems, the embodiment of the present invention provides a kind of electricity saving method for video play device and its is
System and corresponding video broadcasting method and device, can save battery electric quantity, extend battery electric quantity use time.
In order to solve the above-mentioned technical problem, the embodiments of the invention provide a kind of power saving side for video play device
Method, including:
Check the default run time of current process;
, will be described current when the default run time of the current process is less than inspection and the update cycle of operating system
The actual run time of process extends to inspection and the time span of update cycle of the operating system.
Wherein, methods described also includes:
When the process needs to read file, buffer size corresponding with the process is determined according to memory size;
At least part file is read by the corresponding buffering area of the process according to the corresponding buffer size of the process
It is middle to be handled.
Correspondingly, present invention also offers a kind of video broadcasting method, including:
The default run time of process required for inspection broadcasting video;
When the default run time of the process is less than inspection and the update cycle of operating system, by the reality of the process
Border run time extends to inspection and the time span of update cycle of the operating system;
The process is run, video file is read and plays out.
Wherein, the step of reading video file is played out includes following sub-step:
The corresponding buffer size of the process is set according to memory size;
At least part video file is read into the corresponding buffering area of the process according to the buffer size;
Video file in the corresponding buffering area of the process plays video.
Correspondingly, present invention also offers a kind of electricity-saving system for video play device, including:
Run time checks module, the default run time for checking current process;
Run time setup module, for when the current process default run time be less than operating system inspection and
During the update cycle, by the actual run time of the current process extend to the operating system inspection and the update cycle when
Between length.
Wherein, the system also includes:
Setting buffers module, for when the process needs to read file, the process to be determined according to memory size
Corresponding buffer size;
File read module, it is corresponding at least part file to be read into the process according to the buffer size
Handled in buffering area.
Correspondingly, present invention also offers a kind of video play device, including:
Run time checks module, the default run time for the process required for inspection broadcasting video;
Run time setup module, inspection and renewal for being less than operating system when the default run time of the process
During the cycle, the actual run time of the process is extended to inspection and the time span of update cycle of the operating system;
Processing module, for running the process, reads video file and plays out.
Wherein, the processing module includes:
Setting buffers module, for setting the corresponding buffer size of the process according to memory size;
File read module, for according to the corresponding buffer size of the process by least part video file read to
In the corresponding buffering area of the process;
Playing module, video is played for the video file in the corresponding buffering area of the process.
Implement the embodiment of the present invention, have the advantages that:By the way that default run time is less than into operating system inspection
The time span of the inspection and update cycle are extended to the actual run time of the process of update cycle, CPU can be made always
Remain on state, it is to avoid because CPU wastes battery electric quantity between working condition and idle state frequent switching.
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 carried out clear, complete
Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.It is based on
Embodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under the premise of creative work is not made
Embodiment, belongs to the scope of protection of the invention.
Fig. 1 is referred to, is the flow chart for the electricity saving method for video play device that first embodiment of the invention is provided,
This method includes:
Step S100, the default run time for checking current process.
Step S101, it is less than the inspection of operating system and during the update cycle when the default run time of the current process,
The actual run time of the current process is extended to inspection and the time span of update cycle of the operating system.Typically
For, the inspection of window operating systems and the time span of update cycle are 15.6ms.For DWORD timeGetTime
(VOID) function, the function obtains the currency of timer, and the unit of timeGetTime return values is 1ms, is using the function
When, the precision of timeGetTime functions can be improved by setting timeBeginPeriod and timeEndPeriod functions,
Ensure in use, not influenceing cpu cycle to switch.In another example, sleep functions, which are performed, hangs up a period of time, can set sleep's
Parameter is 15.6ms.In another example, some threads are waited or synchronous function, if waiting or hang up function is less than 15.6ms, are set
For 15.6, such as:DWORD WaitForSingleObject(HANDLE hHandle,DWORD dwMilliseconds);
When dwMilliseconds is less than 15.6ms, 15.6ms is set to.The function that also some other influence cpu cycle switches, such as
SetCoalescableTimer and KeSetCoalescableTimer/WaitForMultipleObject etc., if default operation
Time is less than 15.6ms, then is set to 15.6ms.
Electricity saving method provided in an embodiment of the present invention, by the way that default run time is less than into operating system inspection and week is updated
The actual run time of the process of phase extends to the time span of the inspection and update cycle, and CPU can be made to be always maintained at operation
State, it is to avoid because CPU wastes battery electric quantity between working condition and idle state frequent switching.
Fig. 2 is referred to, is the flow chart for the electricity saving method for video play device that second embodiment of the invention is provided,
This method includes:
Step S200, the default run time for checking current process.
Step S201, it is less than the inspection of operating system and during the update cycle when the default run time of the current process,
The actual run time of the current process is extended to inspection and the time span of update cycle of the operating system.
Step S202, when process needs to read file, corresponding with process buffering area is determined according to memory size
Size.Specifically, buffer size corresponding with the process can be configured previously according to total memory size, can also be
It is configured, still, generally speaking, buffer size is set to according to real-time capacity and file size when reading file
It is as far as possible big.If for example, there is enough idle internal memories, disposably whole file can be read into buffering area.Different electronics are set
Standby total memory size is substantially different, and the memory size of desktop computer or notebook computer can be somewhat larger, mobile phone or flat board electricity
The memory size of brain can be smaller, according to the difference of electronic equipment, chooses suitable buffer size, it is possible to reduce to hard disk
Number of operations, so as to reduce the consumption to battery electric quantity.This electricity saving method is not only suitable for windows, ios device can also,
It is not limited to application platform.Such as one 200M file, PC can disposably read 20M data(Buffer size is set
It is set to 20M), ios device can disposably read 5M-10M data(Buffer size is set to 5M-10M).
Step S203, at least part file read by process correspondence according to the corresponding buffer size of the process
Buffering area in handled.
Fig. 3 is referred to, is the flow chart for the video broadcasting method that present pre-ferred embodiments are provided, this method includes:
The default run time of process required for step S300, inspection broadcasting video.
Step S301, it is less than the inspection of operating system and during the update cycle when the default run time of the process, by institute
The actual run time for stating process extends to inspection and the time span of update cycle of the operating system.Generally, window
The inspection of operating system and the time span of update cycle are 15.6ms., should for DWORD timeGetTime (VOID) function
Function obtains the currency of timer, and the unit of timeGetTime return values is 1ms, can be by setting when using the function
Put timeBeginPeriod and timeEndPeriod functions to improve the precision of timeGetTime functions, it is ensured that in use, not
Influence cpu cycle switching.In another example, sleep functions, which are performed, hangs up a period of time, and the parameter that can set sleep is 15.6ms.
In another example, some threads are waited or synchronous function, if waiting or hang up function is less than 15.6ms, are set to 15.6, such as:
DWORD WaitForSingleObject(HANDLE hHandle,DWORD dwMilliseconds);dwMilliseconds
During less than 15.6ms, 15.6ms is set to.The function that also some other influence cpu cycle switches, such as
SetCoalescableTimer and KeSetCoalescableTimer/WaitForMultipleObject etc., if default operation
Time is less than 15.6ms, then is set to 15.6ms.
Step S302, the operation process, read video file and play out.
Video broadcasting method provided in an embodiment of the present invention, by the way that default run time is less than into operating system inspection and more
The actual run time of the process in new cycle extends to the time span of the inspection and update cycle, can be always maintained at CPU
Running status, it is to avoid because CPU wastes battery electric quantity between working condition and idle state frequent switching.
Fig. 4 is referred to, is to read the execution flow that video file is played out in embodiment described in Fig. 3 in step S302
Figure, including:
Step S400, the corresponding buffer size of the process is set according to memory size.
Step S401, at least part video file read by buffering corresponding to the process according to the buffer size
Qu Zhong.
Step S402, the video file in the corresponding buffering area of the process play video.
, it is necessary to buffer size is set to as far as possible big in the above method.If for example, there is enough idle internal memories,
Disposably whole file can be read into buffering area.Total memory size of distinct electronic apparatuses is substantially different, desktop computer or pen
Remember that the memory size of this computer can be somewhat larger, the memory size of mobile phone or tablet personal computer can be smaller, according to electronic equipment
Difference, chooses suitable buffer size, it is possible to reduce to the number of operations of hard disk, so as to reduce the consumption to battery electric quantity.
This electricity saving method is not only suitable for windows, and ios device can also, it is not limited to application platform.Such as one 200M text
Part, PC can disposably read 20M data(Buffer size is set to 20M), ios device can disposably read 5M-10M numbers
According to(Buffer size is set to 5M-10M).
Fig. 5 is referred to, is the structure for the electricity-saving system 500 for video play device that present pre-ferred embodiments are provided
Schematic diagram, electricity-saving system 500 includes:
Run time checks module 510, the default run time for checking current process;
Run time setup module 520, the inspection for being less than operating system when the default run time of the current process
When looking into the update cycle, the actual run time of the current process is extended to inspection and the update cycle of the operating system
Time span.Generally, the inspection of window operating systems and the time span of update cycle are 15.6ms.For DWORD
TimeGetTime (VOID) function, the function obtains the currency of timer, and the unit of timeGetTime return values is 1ms,
, can be by setting timeBeginPeriod and timeEndPeriod functions to improve when using the function
The precision of timeGetTime functions, it is ensured that in use, not influenceing cpu cycle to switch.In another example, sleep functions, which are performed, hangs up one
Section time, the parameter that can set sleep is 15.6ms.In another example, some threads are waited or synchronous function, if waiting or hanging
Play function and be less than 15.6ms, be then set to 15.6, such as:DWORD WaitForSingleObject(HANDLE hHandle,
DWORD dwMilliseconds);When dwMilliseconds is less than 15.6ms, 15.6ms is set to.Also some other influences
The function of cpu cycle switching, such as SetCoalescableTimer and KeSetCoalescableTimer/
WaitForMultipleObject etc., if default run time is less than 15.6ms, is set to 15.6ms.
Electricity-saving system provided in an embodiment of the present invention, by the way that default run time is less than into operating system inspection and week is updated
The actual run time of the process of phase extends to the time span of the inspection and update cycle, and CPU can be made to be always maintained at operation
State, it is to avoid because CPU wastes battery electric quantity between working condition and idle state frequent switching.
Preferably, electricity-saving system 500 can also include:
Setting buffers module, for when process needs to read file, being determined and the process pair according to memory size
The buffer size answered.Specifically, buffer size can be configured previously according to total memory size, can also read text
It is configured during part according to real-time capacity and file size, still, generally speaking, buffer size is set to try one's best
Greatly.If for example, there is enough idle internal memories, disposably whole file can be read into buffering area.Distinct electronic apparatuses
Total memory size is substantially different, and the memory size of desktop computer or notebook computer can be somewhat larger, mobile phone or tablet personal computer
Memory size can be smaller, according to the difference of electronic equipment, chooses suitable buffer size, it is possible to reduce the operation to hard disk
Number of times, so as to reduce the consumption to battery electric quantity.This electricity saving method is not only suitable for windows, ios device can also, not
It is confined to application platform.Such as one 200M file, PC can disposably read 20M data(Buffer size is set to
20M), ios device can disposably read 5M-10M data(Buffer size is set to 5M-10M).
File read module, described at least part file is read according to the process corresponding buffer size
Handled in the corresponding buffering area of process.
Fig. 6 is referred to, is the structural representation for the video play device 600 that present pre-ferred embodiments are provided, the device
600 include:
Run time checks module 610, the default run time for the process required for inspection broadcasting video;
Run time setup module 620, for when the process default run time be less than operating system inspection and
During the update cycle, by the actual run time of the process extend to the operating system inspection and the update cycle time it is long
Degree.Generally, the inspection of window operating systems and the time span of update cycle are 15.6ms.For DWORD
TimeGetTime (VOID) function, the function obtains the currency of timer, and the unit of timeGetTime return values is 1ms,
, can be by setting timeBeginPeriod and timeEndPeriod functions to improve when using the function
The precision of timeGetTime functions, it is ensured that in use, not influenceing cpu cycle to switch.In another example, sleep functions, which are performed, hangs up one
Section time, the parameter that can set sleep is 15.6ms.In another example, some threads are waited or synchronous function, if waiting or hanging
Play function and be less than 15.6ms, be then set to 15.6, such as:DWORD WaitForSingleObject(HANDLE hHandle,
DWORD dwMilliseconds);When dwMilliseconds is less than 15.6ms, 15.6ms is set to.Also some other influences
The function of cpu cycle switching, such as SetCoalescableTimer and KeSetCoalescableTimer/
WaitForMultipleObject etc., if default run time is less than 15.6ms, is set to 15.6ms.
Processing module 630, for running the process, reads video file and plays out.
Video play device provided in an embodiment of the present invention, by the way that default run time is less than into operating system inspection and more
The actual run time of the process in new cycle extends to the time span of the inspection and update cycle, can be always maintained at CPU
Running status, it is to avoid because CPU wastes battery electric quantity between working condition and idle state frequent switching.
In a preferred embodiment, processing module 630 includes:Setting buffers module, for being set according to memory size
Put the corresponding buffer size of the process;File read module, for according to the buffer size by least part video
File is read into the corresponding buffering area of the process;Playing module, for regarding in the corresponding buffering area of the process
Frequency file plays video.
In an embodiment of the present invention, it is necessary to buffer size is set to as far as possible big.If for example, having enough free time
Internal memory, disposably whole file can be read into buffering area.Total memory size of distinct electronic apparatuses is substantially different, desktop
The memory size of brain or notebook computer can be somewhat larger, and the memory size of mobile phone or tablet personal computer can be smaller, according to electronics
The difference of equipment, chooses suitable buffer size, it is possible to reduce to the number of operations of hard disk, so as to reduce to battery electric quantity
Consumption.This electricity saving method is not only suitable for windows, and ios device can also, it is not limited to application platform.Such as one
200M file, PC can disposably read 20M data(Buffer size is set to 20M), ios device can disposably read
5M-10M data(Buffer size is set to 5M-10M).
One of ordinary skill in the art will appreciate that realize all or part of flow in above-described embodiment method, being can be with
The hardware of correlation is instructed to complete by computer program, described program can be stored in a computer read/write memory medium
In, the program is upon execution, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, described storage medium can be magnetic
Dish, CD, read-only memory(Read-Only Memory, ROM)Or random access memory(Random Access
Memory, RAM)Deng.
Above disclosure is only preferred embodiment of present invention, can not limit the right model of the present invention with this certainly
Enclose, one of ordinary skill in the art will appreciate that all or part of flow of above-described embodiment is realized, and will according to right of the present invention
Made equivalent variations are sought, still falls within and invents covered scope.