1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

wmaenc: alloc/free coded_frame instead of keeping it in the WMACodecContext

This commit is contained in:
Justin Ruggles 2012-12-23 20:26:15 -05:00
parent c815ca3641
commit 205a95f7b5
3 changed files with 10 additions and 6 deletions

View File

@ -386,6 +386,11 @@ int ff_wma_end(AVCodecContext *avctx)
av_free(s->int_table[i]); av_free(s->int_table[i]);
} }
#if FF_API_OLD_ENCODE_AUDIO
if (av_codec_is_encoder(avctx->codec))
av_freep(&avctx->coded_frame);
#endif
return 0; return 0;
} }

View File

@ -66,7 +66,6 @@ typedef struct CoefVLCTable {
typedef struct WMACodecContext { typedef struct WMACodecContext {
AVCodecContext* avctx; AVCodecContext* avctx;
AVFrame frame;
GetBitContext gb; GetBitContext gb;
PutBitContext pb; PutBitContext pb;
int version; ///< 1 = 0x160 (WMAV1), 2 = 0x161 (WMAV2) int version; ///< 1 = 0x160 (WMAV1), 2 = 0x161 (WMAV2)

View File

@ -52,6 +52,11 @@ static int encode_init(AVCodecContext * avctx){
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
#if FF_API_OLD_ENCODE_AUDIO
if (!(avctx->coded_frame = avcodec_alloc_frame()))
return AVERROR(ENOMEM);
#endif
/* extract flag infos */ /* extract flag infos */
flags1 = 0; flags1 = 0;
flags2 = 1; flags2 = 1;
@ -88,11 +93,6 @@ static int encode_init(AVCodecContext * avctx){
s->frame_len; s->frame_len;
avctx->frame_size = avctx->delay = s->frame_len; avctx->frame_size = avctx->delay = s->frame_len;
#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame = &s->frame;
avcodec_get_frame_defaults(avctx->coded_frame);
#endif
return 0; return 0;
} }