Commit Diff


commit - 71749f40a357d69c986047ded9fd44b270538c50
commit + efe0c8838579123aa8b598d840f59148175b94e1
blob - 6bfe0240fd4e2187fe1c4b2a42918345e37e0f6a
blob + 1a021a064be20ce190396b037ba388863c132af9
--- player_oggvorbis.c
+++ player_oggvorbis.c
@@ -46,6 +46,7 @@ play_oggvorbis(int fd)
 	static uint8_t pcmout[4096];
 	FILE *f;
 	OggVorbis_File vf;
+	vorbis_info *vi;
 	int current_section, eof = 0;
 
 	if ((f = fdopen(fd, "r")) == NULL)
@@ -56,20 +57,15 @@ play_oggvorbis(int fd)
 		goto end;
 	}
 
-	{
-		char **ptr;
-		vorbis_info *vi;
+	/*
+	 * we could extract some tags by looping over the NULL
+	 * terminated array returned by ov_comment(&vf, -1), see
+	 * previous revision of this file.
+	 */
+	vi = ov_info(&vf, -1);
+	if (player_setup(vi->rate, vi->channels) == -1)
+		err(1, "player_setrate");
 
-		vi = ov_info(&vf, -1);
-		for (ptr = ov_comment(&vf, -1)->user_comments; *ptr; ++ptr)
-			printf("%s\n", *ptr);
-
-		printf("bitstream is %d channel, %ldHz\n", vi->channels, vi->rate);
-
-		if (player_setup(vi->rate, vi->channels) == -1)
-			err(1, "player_setrate");
-	}
-
 	while (!eof) {
 		long ret;
 
blob - d4455d96a79e101fa447c5f02ec3ce652245c27a
blob + fc7f4ae38538cbc1b2da97e34fd23e949db9155b
--- player_opus.c
+++ player_opus.c
@@ -76,11 +76,9 @@ play_opus(int fd)
 			prev_li = li;
 
 			head = op_head(of, li);
-			if (head->input_sample_rate) {
-				if (player_setup(head->input_sample_rate, 2)
-				    == -1)
-					err(1, "player_setrate");
-			}
+			if (head->input_sample_rate &&
+			    player_setup(head->input_sample_rate, 2) == -1)
+				err(1, "player_setrate");
 		}
 
 		for (i = 0; i < 2*ret; ++i) {