Skip to content

Commit 723ce7d

Browse files
committed
First stab at "play" support
1 parent 6628ba3 commit 723ce7d

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

decoder.cpp

+12-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Decoder::Decoder( ES *s_stream,
2525
state.fullscreen = false;
2626
state.live = true;
2727
state.oglq = s_oglq;
28+
state.playing = false;
2829

2930
pthread_create( &thread_handle, NULL, thread_helper, this );
3031
}
@@ -60,9 +61,17 @@ void Decoder::loop( void )
6061

6162
picture_displayed = state.current_picture;
6263

63-
DecoderOperation *op = opq.dequeue( true );
64-
op->execute( state );
65-
delete op;
64+
DecoderOperation *op = opq.dequeue( !state.playing );
65+
if ( op ) {
66+
op->execute( state );
67+
delete op;
68+
} else if ( state.playing ) {
69+
state.current_picture++;
70+
/*
71+
state.outputq.flush();
72+
state.outputq.enqueue( new MoveSlider( state.current_picture ) );
73+
*/
74+
}
6675
}
6776
}
6877

decoder.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class DecoderState {
2121
OpenGLDisplay *display;
2222
Queue<DisplayOperation> *oglq;
2323
Queue<ControllerOperation> outputq;
24+
25+
bool playing;
2426
};
2527

2628
class Decoder {

decoderop.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
void XKey::execute( DecoderState &state )
77
{
88
switch ( key ) {
9+
case ' ':
10+
state.playing = !state.playing;
11+
break;
912
case 'f':
1013
state.fullscreen = !state.fullscreen;
1114
{

0 commit comments

Comments
 (0)