~ft/aacdec

0e1b2b1c2c5854d690112f4f3de3d92d8bfb9d1f — Sigrid Haflínudóttir 10 months ago d265917
audio/aacdec: remove unused stuff
1 files changed, 0 insertions(+), 56 deletions(-)

M frontend/main.c
M frontend/main.c => frontend/main.c +0 -56
@@ 46,24 46,6 @@ typedef struct {
	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,35 93,12 @@ advance_buffer(aac_buffer *b, int bytes)
	}
}

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)
{
	NeAACDecHandle hDecoder;
	NeAACDecFrameInfo frameInfo;
	NeAACDecConfigurationPtr config;
	int tagsize;
	unsigned long samplerate;
	unsigned char channels;
	void *sample_buffer;


@@ 159,14 118,6 @@ decode(void)
	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);


@@ 177,13 128,6 @@ decode(void)
	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){
		sysfatal("NeAACDecInit failed: %d", bread);