shithub: zuke

Download patch

ref: f38b08c9148d85c6ea1800dacc3cc87cf6aa7ed5
parent: 7b5192c88829c6f111ee1032c6e5e1f99917f4da
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Jan 29 06:07:29 EST 2021

do not preload live streams

--- a/zuke.c
+++ b/zuke.c
@@ -472,6 +472,8 @@
 
 	if(player == playernext)
 		playernext = nil;
+	if(!getmeta(player->pcur)->filefmt[0])
+		playerret(player);
 	sendul(player->ctl, Cstop);
 }
 
@@ -478,8 +480,11 @@
 static void
 start(Player *player)
 {
-	if(player != nil)
-		sendul(player->ctl, Cstart);
+	if(player == nil)
+		return;
+	if(!getmeta(player->pcur)->filefmt[0])
+		playerret(player);
+	sendul(player->ctl, Cstart);
 }
 
 static void playerthread(void *player_);
@@ -505,7 +510,7 @@
 	player->pcur = pcur;
 
 	threadcreate(playerthread, player, 4096);
-	if(playerret(player) < 0)
+	if(getmeta(pcur)->filefmt[0] && playerret(player) < 0)
 		return nil;
 
 done:
@@ -541,10 +546,16 @@
 	cur = getmeta(player->pcur);
 	fmt = cur->filefmt;
 	fd = -1;
-	if(*fmt && (fd = open(cur->path, OREAD)) < 0){
-		fprint(2, "%r\n");
-		sendul(player->ev, Everror);
-		goto freeplayer;
+	if(*fmt){
+		if((fd = open(cur->path, OREAD)) < 0){
+			fprint(2, "%r\n");
+			sendul(player->ev, Everror);
+			chanclose(player->ev);
+			goto freeplayer;
+		}
+	}else{
+		sendul(player->ev, Evready);
+		chanclose(player->ev);
 	}
 
 	pipe(p);
@@ -575,7 +586,10 @@
 
 	c = 0;
 	if(!noinit){
-		sendul(player->ev, Evready);
+		if(*fmt){
+			sendul(player->ev, Evready);
+			chanclose(player->ev);
+		}
 		buf = malloc(Relbufsz);
 		if((io = ioproc()) == nil)
 			sysfatal("player: %r");