annotate libfaac.c @ 9884:c2da2b1e1a12 libavcodec

LSF (Line Spectral Frequencies) decoding routine.
author voroshil
date Wed, 24 Jun 2009 04:38:48 +0000
parents e9d9d946f213
children 7955db355703
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
1 /*
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
2 * Interface to libfaac for aac encoding
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
3 * Copyright (c) 2002 Gildas Bazin <gbazin@netcourrier.com>
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
4 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3099
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3099
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3099
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3099
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3099
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
15 * Lesser General Public License for more details.
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
16 *
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3099
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 3031
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
20 */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2841
diff changeset
21
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
22 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 7895
diff changeset
23 * @file libavcodec/libfaac.c
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
24 * Interface to libfaac for aac encoding.
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
25 */
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
26
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
27 #include "avcodec.h"
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
28 #include <faac.h>
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
29
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
30 typedef struct FaacAudioContext {
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
31 faacEncHandle faac_handle;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
32 } FaacAudioContext;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
33
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 5571
diff changeset
34 static av_cold int Faac_encode_init(AVCodecContext *avctx)
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
35 {
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
36 FaacAudioContext *s = avctx->priv_data;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
37 faacEncConfigurationPtr faac_cfg;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
38 unsigned long samples_input, max_bytes_output;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
39
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
40 /* number of channels */
7895
726e49d4d0ee Log an error message in case of invalid number of channels.
stefano
parents: 7451
diff changeset
41 if (avctx->channels < 1 || avctx->channels > 6) {
726e49d4d0ee Log an error message in case of invalid number of channels.
stefano
parents: 7451
diff changeset
42 av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed\n", avctx->channels);
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
43 return -1;
7895
726e49d4d0ee Log an error message in case of invalid number of channels.
stefano
parents: 7451
diff changeset
44 }
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
45
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
46 s->faac_handle = faacEncOpen(avctx->sample_rate,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
47 avctx->channels,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
48 &samples_input, &max_bytes_output);
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
49
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
50 /* check faac version */
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
51 faac_cfg = faacEncGetCurrentConfiguration(s->faac_handle);
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
52 if (faac_cfg->version != FAAC_CFG_VERSION) {
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
53 av_log(avctx, AV_LOG_ERROR, "wrong libfaac version (compiled for: %d, using %d)\n", FAAC_CFG_VERSION, faac_cfg->version);
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
54 faacEncClose(s->faac_handle);
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
55 return -1;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
56 }
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
57
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
58 /* put the options in the configuration struct */
4891
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
59 switch(avctx->profile) {
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
60 case FF_PROFILE_AAC_MAIN:
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
61 faac_cfg->aacObjectType = MAIN;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
62 break;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
63 case FF_PROFILE_UNKNOWN:
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
64 case FF_PROFILE_AAC_LOW:
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
65 faac_cfg->aacObjectType = LOW;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
66 break;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
67 case FF_PROFILE_AAC_SSR:
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
68 faac_cfg->aacObjectType = SSR;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
69 break;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
70 case FF_PROFILE_AAC_LTP:
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
71 faac_cfg->aacObjectType = LTP;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
72 break;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
73 default:
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
74 av_log(avctx, AV_LOG_ERROR, "invalid AAC profile\n");
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
75 faacEncClose(s->faac_handle);
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
76 return -1;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
77 }
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
78 faac_cfg->mpegVersion = MPEG4;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
79 faac_cfg->useTns = 0;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
80 faac_cfg->allowMidside = 1;
2841
bceeca1bb30f vbr audio encode patch by (Justin Ruggles: jruggle, earthlink net)
michael
parents: 1826
diff changeset
81 faac_cfg->bitRate = avctx->bit_rate / avctx->channels;
3031
0f5f311f2f94 Parameter added for user to set the cutoff frequency when encoding with faac.
banan
parents: 2979
diff changeset
82 faac_cfg->bandWidth = avctx->cutoff;
2841
bceeca1bb30f vbr audio encode patch by (Justin Ruggles: jruggle, earthlink net)
michael
parents: 1826
diff changeset
83 if(avctx->flags & CODEC_FLAG_QSCALE) {
bceeca1bb30f vbr audio encode patch by (Justin Ruggles: jruggle, earthlink net)
michael
parents: 1826
diff changeset
84 faac_cfg->bitRate = 0;
bceeca1bb30f vbr audio encode patch by (Justin Ruggles: jruggle, earthlink net)
michael
parents: 1826
diff changeset
85 faac_cfg->quantqual = avctx->global_quality / FF_QP2LAMBDA;
bceeca1bb30f vbr audio encode patch by (Justin Ruggles: jruggle, earthlink net)
michael
parents: 1826
diff changeset
86 }
3099
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
87 faac_cfg->outputFormat = 1;
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
88 faac_cfg->inputFormat = FAAC_INPUT_16BIT;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
89
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
90 avctx->frame_size = samples_input / avctx->channels;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
91
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
92 avctx->coded_frame= avcodec_alloc_frame();
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
93 avctx->coded_frame->key_frame= 1;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
94
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
95 /* Set decoder specific info */
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
96 avctx->extradata_size = 0;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
97 if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
98
4606
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
99 unsigned char *buffer = NULL;
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
100 unsigned long decoder_specific_info_size;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
101
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
102 if (!faacEncGetDecoderSpecificInfo(s->faac_handle, &buffer,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
103 &decoder_specific_info_size)) {
4606
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
104 avctx->extradata = av_malloc(decoder_specific_info_size + FF_INPUT_BUFFER_PADDING_SIZE);
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
105 avctx->extradata_size = decoder_specific_info_size;
4606
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
106 memcpy(avctx->extradata, buffer, avctx->extradata_size);
3099
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
107 faac_cfg->outputFormat = 0;
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
108 }
4606
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
109 #undef free
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
110 free(buffer);
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
111 #define free please_use_av_free
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
112 }
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
113
3099
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
114 if (!faacEncSetConfiguration(s->faac_handle, faac_cfg)) {
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
115 av_log(avctx, AV_LOG_ERROR, "libfaac doesn't support this output format!\n");
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
116 return -1;
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
117 }
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
118
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
119 return 0;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
120 }
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
121
4170
f97a2081b5b1 make some symbols static
mru
parents: 3947
diff changeset
122 static int Faac_encode_frame(AVCodecContext *avctx,
f97a2081b5b1 make some symbols static
mru
parents: 3947
diff changeset
123 unsigned char *frame, int buf_size, void *data)
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
124 {
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
125 FaacAudioContext *s = avctx->priv_data;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
126 int bytes_written;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
127
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
128 bytes_written = faacEncEncode(s->faac_handle,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
129 data,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
130 avctx->frame_size * avctx->channels,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
131 frame,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
132 buf_size);
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
133
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
134 return bytes_written;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
135 }
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
136
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 5571
diff changeset
137 static av_cold int Faac_encode_close(AVCodecContext *avctx)
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
138 {
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
139 FaacAudioContext *s = avctx->priv_data;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
140
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
141 av_freep(&avctx->coded_frame);
4606
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
142 av_freep(&avctx->extradata);
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
143
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
144 faacEncClose(s->faac_handle);
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
145 return 0;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
146 }
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
147
5091
160536e80ee6 Rename faac_encoder to libfaac_encoder for consistency and to be able to
diego
parents: 4891
diff changeset
148 AVCodec libfaac_encoder = {
160536e80ee6 Rename faac_encoder to libfaac_encoder for consistency and to be able to
diego
parents: 4891
diff changeset
149 "libfaac",
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
150 CODEC_TYPE_AUDIO,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
151 CODEC_ID_AAC,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
152 sizeof(FaacAudioContext),
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
153 Faac_encode_init,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
154 Faac_encode_frame,
6712
5b3acf9fd50a Add long names to AVCodec declarations.
diego
parents: 6517
diff changeset
155 Faac_encode_close,
7451
85ab7655ad4d Modify all codecs to report their supported input and output sample format(s).
pross
parents: 7040
diff changeset
156 .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6712
diff changeset
157 .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"),
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
158 };