Mercurial > libavcodec.hg
comparison faac.c @ 4606:d77c5a6824e4 libavcodec
free faac extradata
author | bcoudurier |
---|---|
date | Wed, 28 Feb 2007 09:56:15 +0000 |
parents | f97a2081b5b1 |
children | 8cd8fd35b6aa |
comparison
equal
deleted
inserted
replaced
4605:d4feec96fd64 | 4606:d77c5a6824e4 |
---|---|
74 | 74 |
75 /* Set decoder specific info */ | 75 /* Set decoder specific info */ |
76 avctx->extradata_size = 0; | 76 avctx->extradata_size = 0; |
77 if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) { | 77 if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) { |
78 | 78 |
79 unsigned char *buffer; | 79 unsigned char *buffer = NULL; |
80 unsigned long decoder_specific_info_size; | 80 unsigned long decoder_specific_info_size; |
81 | 81 |
82 if (!faacEncGetDecoderSpecificInfo(s->faac_handle, &buffer, | 82 if (!faacEncGetDecoderSpecificInfo(s->faac_handle, &buffer, |
83 &decoder_specific_info_size)) { | 83 &decoder_specific_info_size)) { |
84 avctx->extradata = buffer; | 84 avctx->extradata = av_malloc(decoder_specific_info_size + FF_INPUT_BUFFER_PADDING_SIZE); |
85 avctx->extradata_size = decoder_specific_info_size; | 85 avctx->extradata_size = decoder_specific_info_size; |
86 memcpy(avctx->extradata, buffer, avctx->extradata_size); | |
86 faac_cfg->outputFormat = 0; | 87 faac_cfg->outputFormat = 0; |
87 } | 88 } |
89 #undef free | |
90 free(buffer); | |
91 #define free please_use_av_free | |
88 } | 92 } |
89 | 93 |
90 if (!faacEncSetConfiguration(s->faac_handle, faac_cfg)) { | 94 if (!faacEncSetConfiguration(s->faac_handle, faac_cfg)) { |
91 av_log(avctx, AV_LOG_ERROR, "libfaac doesn't support this output format!\n"); | 95 av_log(avctx, AV_LOG_ERROR, "libfaac doesn't support this output format!\n"); |
92 return -1; | 96 return -1; |
113 static int Faac_encode_close(AVCodecContext *avctx) | 117 static int Faac_encode_close(AVCodecContext *avctx) |
114 { | 118 { |
115 FaacAudioContext *s = avctx->priv_data; | 119 FaacAudioContext *s = avctx->priv_data; |
116 | 120 |
117 av_freep(&avctx->coded_frame); | 121 av_freep(&avctx->coded_frame); |
118 | 122 av_freep(&avctx->extradata); |
119 //if (avctx->extradata_size) free(avctx->extradata); | |
120 | 123 |
121 faacEncClose(s->faac_handle); | 124 faacEncClose(s->faac_handle); |
122 return 0; | 125 return 0; |
123 } | 126 } |
124 | 127 |