forked from tmarrinan/node-demux
-
Notifications
You must be signed in to change notification settings - Fork 2
/
seekworker.cc
46 lines (43 loc) · 914 Bytes
/
seekworker.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "seekworker.h"
void SeekWorker::Execute() {
baton->state = DS_SEEK;
baton->Seek();
}
void SeekWorker::HandleOKCallback() {
Nan::HandleScope();
if(baton->error != "") {
baton->m_Error(baton->error);
}
else {
baton->m_Seek();
if(baton->decode_first_frame) {
baton->m_Frame(baton->frame_buffer);
}
baton->state = DS_IDLE;
switch (baton->action) {
case DA_NONE:
break;
case DA_LOAD:
break;
case DA_PLAY:
baton->demux_start = uv_now(uv_default_loop());
baton->video_start = baton->current_frame * baton->frame_time * 1000.0;
baton->m_Start();
Nan::AsyncQueueWorker(new DemuxWorker(baton, true));
break;
case DA_PAUSE:
baton->action = DA_NONE;
baton->m_Pause();
break;
case DA_SEEK:
baton->action = DA_NONE;
break;
case DA_END:
baton->action = DA_NONE;
baton->m_End();
break;
default:
break;
}
}
}