[FFmpeg-soc] [soc]: r3469 - mlp/mlpenc.c

ramiro subversion at mplayerhq.hu
Tue Aug 19 19:45:59 CEST 2008


Author: ramiro
Date: Tue Aug 19 19:45:59 2008
New Revision: 3469

Log:
Dynamically allocate frame_size.

Modified:
   mlp/mlpenc.c

Modified: mlp/mlpenc.c
==============================================================================
--- mlp/mlpenc.c	(original)
+++ mlp/mlpenc.c	Tue Aug 19 19:45:59 2008
@@ -102,7 +102,7 @@ typedef struct {
 
     int32_t        *lossless_check_data;
 
-    unsigned int    frame_size[MAJOR_HEADER_INTERVAL];
+    unsigned int   *frame_size;
     unsigned int    frame_index;
 
     unsigned int    one_sample_buffer_size;
@@ -309,6 +309,7 @@ static av_cold int mlp_encode_init(AVCod
     MLPEncodeContext *ctx = avctx->priv_data;
     unsigned int major_frame_buffer_size;
     unsigned int lossless_check_data_size;
+    unsigned int frame_size_size;
     unsigned int substr;
 
     ctx->avctx = avctx;
@@ -367,6 +368,13 @@ static av_cold int mlp_encode_init(AVCod
     ctx->mlp_channels3  = code_channels3(avctx->channels);
     ctx->num_substreams = 1;
 
+    frame_size_size = sizeof(unsigned int)
+                    * ctx->major_header_interval;
+
+    ctx->frame_size = av_malloc(frame_size_size);
+    if (!ctx->frame_size)
+        return -1;
+
     lossless_check_data_size = sizeof(int32_t) * ctx->num_substreams
                              * ctx->major_header_interval;
 
@@ -1428,6 +1436,7 @@ static av_cold int mlp_encode_close(AVCo
     av_freep(&ctx->lossless_check_data);
     av_freep(&ctx->major_frame_buffer);
     av_freep(&avctx->coded_frame);
+    av_freep(&ctx->frame_size);
 
     return 0;
 }



More information about the FFmpeg-soc mailing list