ref: 281db6ceec174d040229ca88d20499d006541c78
parent: 263ee2a907db25fb6624cc36c09b80adf1372b6c
author: menno <menno>
date: Mon Sep 22 14:22:19 EDT 2003
Added extra output info from the decoder library
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**
+**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
-**
+**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: main.c,v 1.45 2003/09/03 20:19:29 menno Exp $
+** $Id: main.c,v 1.46 2003/09/22 18:22:19 menno Exp $
**/
#ifdef _WIN32
@@ -284,8 +284,8 @@
fprintf(stdout, " 9: 16 bit PCM data (dithered with HEAVY noise shaping).\n");
fprintf(stdout, " -s X Force the samplerate to X (for RAW files).\n");
fprintf(stdout, " -l X Set object type. Supported object types:\n");
- fprintf(stdout, " 0: Main object type.\n");
- fprintf(stdout, " 1: LC (Low Complexity) object type.\n");
+ fprintf(stdout, " 1: Main object type.\n");
+ fprintf(stdout, " 2: LC (Low Complexity) object type.\n");
fprintf(stdout, " 3: LTP (Long Term Prediction) object type.\n");
fprintf(stdout, " 23: LD (Low Delay) object type.\n");
fprintf(stdout, " -d Down matrix 5.1 to 2 channels\n");
--- a/include/faad.h
+++ b/include/faad.h
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: faad.h,v 1.29 2003/09/18 13:38:38 menno Exp $
+** $Id: faad.h,v 1.30 2003/09/22 18:22:19 menno Exp $
**/
#ifndef __AACDEC_H__
@@ -46,10 +46,10 @@
#define FAAD2_VERSION "2.0 RC1 "
/* object types for AAC */
-#define MAIN 0
-#define LC 1
-#define SSR 2
-#define LTP 3
+#define MAIN 1
+#define LC 2
+#define SSR 3
+#define LTP 4
#define ER_LC 17
#define ER_LTP 19
#define LD 23
@@ -60,6 +60,12 @@
#define ADIF 1
#define ADTS 2
+/* SBR signalling */
+#define NO_SBR 0
+#define SBR_UPSAMPLED 1
+#define SBR_DOWNSAMPLED 2
+#define NO_SBR_UPSAMPLED 3
+
/* library output formats */
#define FAAD_FMT_16BIT 1
#define FAAD_FMT_24BIT 2
@@ -143,6 +149,12 @@
unsigned char channels;
unsigned char error;
unsigned long samplerate;
+
+ /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
+ unsigned char sbr;
+
+ /* MPEG-4 ObjectType */
+ unsigned char object_type;
/* multichannel configuration */
unsigned char num_front_channels;
--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: decoder.c,v 1.67 2003/09/18 13:42:04 menno Exp $
+** $Id: decoder.c,v 1.68 2003/09/22 18:22:19 menno Exp $
**/
#include "common.h"
@@ -231,7 +231,7 @@
faad_byte_align(&ld);
hDecoder->sf_index = adif.pce[0].sf_index;
- hDecoder->object_type = adif.pce[0].object_type;
+ hDecoder->object_type = adif.pce[0].object_type + 1;
*samplerate = get_sample_rate(hDecoder->sf_index);
*channels = adif.pce[0].channels;
@@ -248,7 +248,7 @@
adts_frame(&adts, &ld);
hDecoder->sf_index = adts.sf_index;
- hDecoder->object_type = adts.profile;
+ hDecoder->object_type = adts.profile + 1;
*samplerate = get_sample_rate(hDecoder->sf_index);
*channels = (adts.channel_configuration > 6) ?
@@ -348,8 +348,6 @@
}
#endif
- if (hDecoder->object_type < 5)
- hDecoder->object_type--; /* For AAC differs from MPEG-4 */
if (rc != 0)
{
return rc;
@@ -912,6 +910,10 @@
hInfo->channels = output_channels;
/* samplerate */
hInfo->samplerate = get_sample_rate(hDecoder->sf_index);
+ /* object type */
+ hInfo->object_type = hDecoder->object_type;
+ /* sbr */
+ hInfo->sbr = NO_SBR;
/* check if frame has channel elements */
if (channels == 0)
@@ -1177,6 +1179,11 @@
frame_len *= 2;
hInfo->samples *= 2;
hInfo->samplerate *= 2;
+ /* sbr */
+ if (hDecoder->sbr_present_flag == 1)
+ hInfo->sbr = SBR_UPSAMPLED;
+ else
+ hInfo->sbr = NO_SBR_UPSAMPLED;
sample_buffer = output_to_PCM(hDecoder, time_out2, sample_buffer,
output_channels, frame_len, outputFormat);
--- a/libfaad/structs.h
+++ b/libfaad/structs.h
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: structs.h,v 1.13 2003/09/18 13:38:38 menno Exp $
+** $Id: structs.h,v 1.14 2003/09/22 18:22:19 menno Exp $
**/
#ifndef __STRUCTS_H__
@@ -336,6 +336,12 @@
uint8_t channels;
uint8_t error;
uint32_t samplerate;
+
+ /* SBR: 0: off, 1: on; normal, 2: on; downsampled */
+ uint8_t sbr;
+
+ /* MPEG-4 ObjectType */
+ uint8_t object_type;
/* multichannel configuration */
uint8_t num_front_channels;
--- a/libfaad/syntax.h
+++ b/libfaad/syntax.h
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: syntax.h,v 1.33 2003/09/09 18:09:52 menno Exp $
+** $Id: syntax.h,v 1.34 2003/09/22 18:22:19 menno Exp $
**/
#ifndef __SYNTAX_H__
@@ -36,14 +36,20 @@
#include "drc.h"
#include "bits.h"
-#define MAIN 0
-#define LC 1
-#define SSR 2
-#define LTP 3
+#define MAIN 1
+#define LC 2
+#define SSR 3
+#define LTP 4
#define LD 23
#define ER_LC 17
#define ER_LTP 19
#define DRM_ER_LC 27 /* special object type for DRM */
+
+/* SBR signalling */
+#define NO_SBR 0
+#define SBR_UPSAMPLED 1
+#define SBR_DOWNSAMPLED 2
+#define NO_SBR_UPSAMPLED 3
/* DRM channel definitions */
#define DRMCH_MONO 1