shithub: hj264

Download patch

ref: d0d9578b83591f9cd1c3d88b8c950e367f40a955
parent: 98a5c516f0d3c3a604958f27b9808ce63fd8df0a
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Aug 6 04:30:20 EDT 2021

change -O to -o: disable optimization by default (twitch stream craps out)

--- a/hj264.c
+++ b/hj264.c
@@ -63,7 +63,7 @@
 	u8int bgrx[];
 };
 
-static int nopt;
+static int opt;
 
 #pragma varargck type "ℏ" int
 static int
@@ -243,7 +243,7 @@
 	for(;;){
 		if((img = recvp(h->frame)) == nil)
 			break;
-		if(!nopt && prev != nil && memcmp(img->bgrx, prev->bgrx, img->w*img->h*4) == 0){
+		if(opt && prev != nil && memcmp(img->bgrx, prev->bgrx, img->w*img->h*4) == 0){
 			free(img);
 			continue;
 		}
@@ -250,7 +250,7 @@
 
 		xrgb2yuv420(img->bgrx, img->w, img->h, &h->yuv);
 		ts = img->ns / Nmsec;
-		if(!nopt){
+		if(opt){
 			free(prev);
 			prev = img;
 		}else{
@@ -314,7 +314,7 @@
 static void
 usage(void)
 {
-	fprint(2, "usage: %s [-D] [-f FPS] [-F FORMAT] [-g GOP] [-n THREADS] [-O] [-k KBPS] [-q 0…10] [-Q QP] FILE\n", argv0);
+	fprint(2, "usage: %s [-D] [-f FPS] [-F FORMAT] [-g GOP] [-n THREADS] [-o] [-k KBPS] [-q 0…10] [-Q QP] FILE\n", argv0);
 	threadexitsall("usage");
 }
 
@@ -392,8 +392,8 @@
 	case 'n':
 		nthreads = atoi(EARGF(usage()));
 		break;
-	case 'O':
-		nopt = 1;
+	case 'o':
+		opt = 1;
 		break;
 	case 'q':
 		quality = atoi(EARGF(usage()));