shithub: aacdec

Download patch

ref: 0e1b2b1c2c5854d690112f4f3de3d92d8bfb9d1f
parent: d26591730d2b04b21ca6533c2635225dd67a043f
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Sep 13 12:53:46 EDT 2020

audio/aacdec: remove unused stuff

--- a/frontend/main.c
+++ b/frontend/main.c
@@ -46,24 +46,6 @@
 	int at_eof;
 }aac_buffer;
 
-static int adts_sample_rates[] = {
-	96000,
-	88200,
-	64000,
-	48000,
-	44100,
-	32000,
-	24000,
-	22050,
-	16000,
-	12000,
-	11025,
-	8000,
-	7350,
-	0,
-	0,
-	0,
-};
 static Biobuf stdin, stdout;
 
 static int
@@ -111,28 +93,6 @@
 	}
 }
 
-static void
-lookforheader(aac_buffer *b)
-{
-	int i = 0;
-
-	while(!b->at_eof ){
-		if(b->bytes_into_buffer > 4){
-			if((b->buffer[0+i] == 0xff && (b->buffer[1+i] & 0xf6) == 0xf0) ||
-			   (b->buffer[0+i] == 'A' && b->buffer[1+i] == 'D' && b->buffer[2+i] == 'I' && b->buffer[3+i] == 'F')){
-				fill_buffer(b);
-				break;
-			}else{
-				b->file_offset++;
-				b->bytes_consumed++;
-				b->bytes_into_buffer--;
-			}
-		}else{
-			fill_buffer(b);
-		}
-	}
-}
-
 static int
 decode(void)
 {
@@ -139,7 +99,6 @@
 	NeAACDecHandle hDecoder;
 	NeAACDecFrameInfo frameInfo;
 	NeAACDecConfigurationPtr config;
-	int tagsize;
 	unsigned long samplerate;
 	unsigned char channels;
 	void *sample_buffer;
@@ -159,14 +118,6 @@
 	if(bread != FAAD_MIN_STREAMSIZE*MAX_CHANNELS)
 		b.at_eof = 1;
 
-	if(!memcmp(b.buffer, "ID3", 3)){
-		/* high bit is not used */
-		tagsize = b.buffer[6]<<21 | b.buffer[7]<<14 | b.buffer[8]<<7 | b.buffer[9];
-		tagsize += 10;
-		advance_buffer(&b, tagsize);
-		fill_buffer(&b);
-	}
-
 	hDecoder = NeAACDecOpen();
 
 	config = NeAACDecGetCurrentConfiguration(hDecoder);
@@ -176,13 +127,6 @@
 	config->downMatrix = 0;
 	config->useOldADTSFormat = 0;
 	NeAACDecSetConfiguration(hDecoder, config);
-
-	lookforheader(&b);
-
-	channels = 2;
-	samplerate = 44100;
-	if(b.buffer[0] == 0xff && (b.buffer[1]&0xf6) == 0xf0)
-		samplerate = adts_sample_rates[(b.buffer[2] & 0x3c) >> 2];
 
 	fill_buffer(&b);
 	if((bread = NeAACDecInit(hDecoder, b.buffer, b.bytes_into_buffer, &samplerate, &channels)) < 0){