---
 libavcodec/wma.c    |    5 +++++
 libavcodec/wma.h    |    1 -
 libavcodec/wmaenc.c |   10 +++++-----
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/libavcodec/wma.c b/libavcodec/wma.c
index 9808a16..6d651d8 100644
--- a/libavcodec/wma.c
+++ b/libavcodec/wma.c
@@ -387,6 +387,11 @@ int ff_wma_end(AVCodecContext *avctx)
         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;
 }
 
diff --git a/libavcodec/wma.h b/libavcodec/wma.h
index fb2aa8b..9804847 100644
--- a/libavcodec/wma.h
+++ b/libavcodec/wma.h
@@ -66,7 +66,6 @@ typedef struct CoefVLCTable {
 
 typedef struct WMACodecContext {
     AVCodecContext* avctx;
-    AVFrame frame;
     GetBitContext gb;
     PutBitContext pb;
     int version;                            ///< 1 = 0x160 (WMAV1), 2 = 0x161 
(WMAV2)
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index 044114b..1462f5e 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -52,6 +52,11 @@ static int encode_init(AVCodecContext * avctx){
         return AVERROR(EINVAL);
     }
 
+#if FF_API_OLD_ENCODE_AUDIO
+    if (!(avctx->coded_frame = avcodec_alloc_frame()))
+        return AVERROR(ENOMEM);
+#endif
+
     /* extract flag infos */
     flags1 = 0;
     flags2 = 1;
@@ -88,11 +93,6 @@ static int encode_init(AVCodecContext * avctx){
                          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;
 }
 
-- 
1.7.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to