annotate libfaac.c @ 6582:7d40da88f0c7 libavcodec

Crop parameters are unsigned, having them negative could be bad and lead to crashes or maybe exploits (not checked at all if this is possible).
author michael
date Fri, 11 Apr 2008 12:57:49 +0000
parents 48759bfbd073
children 5b3acf9fd50a
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 /**
5571
134296160fc9 right filename in doxygen comment
benoit
parents: 5101
diff changeset
23 * @file 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 */
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
41 if (avctx->channels < 1 || avctx->channels > 6)
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
42 return -1;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
43
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
44 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
45 avctx->channels,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
46 &samples_input, &max_bytes_output);
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
47
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
48 /* check faac version */
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
49 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
50 if (faac_cfg->version != FAAC_CFG_VERSION) {
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
51 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
52 faacEncClose(s->faac_handle);
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
53 return -1;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
54 }
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
55
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
56 /* put the options in the configuration struct */
4891
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
57 switch(avctx->profile) {
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
58 case FF_PROFILE_AAC_MAIN:
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
59 faac_cfg->aacObjectType = MAIN;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
60 break;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
61 case FF_PROFILE_UNKNOWN:
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
62 case FF_PROFILE_AAC_LOW:
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
63 faac_cfg->aacObjectType = LOW;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
64 break;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
65 case FF_PROFILE_AAC_SSR:
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
66 faac_cfg->aacObjectType = SSR;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
67 break;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
68 case FF_PROFILE_AAC_LTP:
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
69 faac_cfg->aacObjectType = LTP;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
70 break;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
71 default:
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
72 av_log(avctx, AV_LOG_ERROR, "invalid AAC profile\n");
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
73 faacEncClose(s->faac_handle);
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
74 return -1;
8cd8fd35b6aa add the possibility to choose aac profile
benoit
parents: 4606
diff changeset
75 }
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
76 faac_cfg->mpegVersion = MPEG4;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
77 faac_cfg->useTns = 0;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
78 faac_cfg->allowMidside = 1;
2841
bceeca1bb30f vbr audio encode patch by (Justin Ruggles: jruggle, earthlink net)
michael
parents: 1826
diff changeset
79 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
80 faac_cfg->bandWidth = avctx->cutoff;
2841
bceeca1bb30f vbr audio encode patch by (Justin Ruggles: jruggle, earthlink net)
michael
parents: 1826
diff changeset
81 if(avctx->flags & CODEC_FLAG_QSCALE) {
bceeca1bb30f vbr audio encode patch by (Justin Ruggles: jruggle, earthlink net)
michael
parents: 1826
diff changeset
82 faac_cfg->bitRate = 0;
bceeca1bb30f vbr audio encode patch by (Justin Ruggles: jruggle, earthlink net)
michael
parents: 1826
diff changeset
83 faac_cfg->quantqual = avctx->global_quality / FF_QP2LAMBDA;
bceeca1bb30f vbr audio encode patch by (Justin Ruggles: jruggle, earthlink net)
michael
parents: 1826
diff changeset
84 }
3099
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
85 faac_cfg->outputFormat = 1;
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
86 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
87
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
88 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
89
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
90 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
91 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
92
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
93 /* Set decoder specific info */
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
94 avctx->extradata_size = 0;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
95 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
96
4606
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
97 unsigned char *buffer = NULL;
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
98 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
99
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
100 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
101 &decoder_specific_info_size)) {
4606
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
102 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
103 avctx->extradata_size = decoder_specific_info_size;
4606
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
104 memcpy(avctx->extradata, buffer, avctx->extradata_size);
3099
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
105 faac_cfg->outputFormat = 0;
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
106 }
4606
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
107 #undef free
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
108 free(buffer);
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
109 #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
110 }
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
111
3099
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
112 if (!faacEncSetConfiguration(s->faac_handle, faac_cfg)) {
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
113 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
114 return -1;
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
115 }
a2a116fee880 create adts stream if CODEC_FLAG_GLOBAL_HEADER not set
mru
parents: 3036
diff changeset
116
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
117 return 0;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
118 }
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
119
4170
f97a2081b5b1 make some symbols static
mru
parents: 3947
diff changeset
120 static int Faac_encode_frame(AVCodecContext *avctx,
f97a2081b5b1 make some symbols static
mru
parents: 3947
diff changeset
121 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
122 {
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
123 FaacAudioContext *s = avctx->priv_data;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
124 int bytes_written;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
125
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
126 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
127 data,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
128 avctx->frame_size * avctx->channels,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
129 frame,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
130 buf_size);
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
131
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
132 return bytes_written;
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
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 5571
diff changeset
135 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
136 {
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
137 FaacAudioContext *s = avctx->priv_data;
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 av_freep(&avctx->coded_frame);
4606
d77c5a6824e4 free faac extradata
bcoudurier
parents: 4170
diff changeset
140 av_freep(&avctx->extradata);
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
141
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
142 faacEncClose(s->faac_handle);
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
143 return 0;
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
144 }
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
145
5091
160536e80ee6 Rename faac_encoder to libfaac_encoder for consistency and to be able to
diego
parents: 4891
diff changeset
146 AVCodec libfaac_encoder = {
160536e80ee6 Rename faac_encoder to libfaac_encoder for consistency and to be able to
diego
parents: 4891
diff changeset
147 "libfaac",
1500
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
148 CODEC_TYPE_AUDIO,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
149 CODEC_ID_AAC,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
150 sizeof(FaacAudioContext),
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
151 Faac_encode_init,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
152 Faac_encode_frame,
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
153 Faac_encode_close
726a81d83ddd Patch for AAC encoding with libfaac by (Gildas Bazin <gbazin at altern dot org>)
michaelni
parents:
diff changeset
154 };