mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-17 06:34:08 +00:00
working mpegplayer example
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@506 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -412,7 +412,12 @@ void MwLLNextEvent(MwLL handle) {
|
||||
}
|
||||
|
||||
void MwLLSleep(int ms) {
|
||||
usleep(ms * 1000);
|
||||
struct timespec ts;
|
||||
|
||||
ts.tv_sec = ms / 1000;
|
||||
ts.tv_nsec = (ms % 1000) * 1000 * 1000;
|
||||
|
||||
nanosleep(&ts, NULL);
|
||||
}
|
||||
|
||||
void MwLLSetTitle(MwLL handle, const char* title) {
|
||||
|
||||
13
src/core.c
13
src/core.c
@@ -289,8 +289,11 @@ int MwPending(MwWidget handle) {
|
||||
void MwLoop(MwWidget handle) {
|
||||
long tick = MwLLGetTick();
|
||||
int i;
|
||||
long wait = MwGetInteger(handle, MwNwaitMS);
|
||||
if(wait == MwDEFAULT) wait = MwWaitMS;
|
||||
while(!handle->close) {
|
||||
int v = 0;
|
||||
long t, t2;
|
||||
while(MwPending(handle)) {
|
||||
if((v = MwStep(handle)) != 0) break;
|
||||
}
|
||||
@@ -300,9 +303,13 @@ void MwLoop(MwWidget handle) {
|
||||
MwDispatchUserHandler(handle->tick_list[i], MwNtickHandler, NULL);
|
||||
}
|
||||
|
||||
tick = MwWaitMS - (MwLLGetTick() - tick);
|
||||
if(tick > 0) MwLLSleep(tick);
|
||||
tick = MwLLGetTick();
|
||||
t = (tick + wait) - (t2 = MwLLGetTick());
|
||||
if(t > 0){
|
||||
MwLLSleep(t);
|
||||
tick += wait;
|
||||
}else{
|
||||
tick = t2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user