ref: acc732ac0da6a971337d857b2789f05eb1a4aab4
parent: c6f38fccec03ed1c226e423bdbe2efd6fa02d224
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Nov 14 18:27:19 EST 2021
add stupid pause that does not sync audio and video (yet)
--- a/main.c
+++ b/main.c
@@ -25,6 +25,7 @@
static Channel *audiofinished;
static char info[256];
static int showinfo;
+static int paused;
static uvlong dispdelay;
static int framedrop;
static uvlong late;
@@ -43,7 +44,7 @@
fprint(2, "runaudio: %r\n");
}else{
for(s = x; Sread(s, &f) == 0 && f.sz > 0;){
- if(!synced){
+ if(!synced || paused){
recvp(audiosync);
chanclose(audiosync);
synced = 1;
@@ -381,7 +382,16 @@
case Ckeyboard:
end = key == 'q' || key == Kdel;
done = key == '\n';
- showinfo = key == 'i' ? !showinfo : showinfo;
+ showinfo ^= key == 'i';
+ if(key == 'p'){
+ if(!paused){
+ audiosync = chancreate(sizeof(void*), 1);
+ a[Cframe].op = CHANNOP;
+ }else{
+ a[Cframe].op = CHANRCV;
+ }
+ paused ^= 1;
+ }
forced = 1;
break;