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

ramiro subversion at mplayerhq.hu
Sun Aug 24 17:24:28 CEST 2008


Author: ramiro
Date: Sun Aug 24 17:24:28 2008
New Revision: 3583

Log:
Reorganize mlp_encode_frame().

Modified:
   mlp/mlpenc.c

Modified: mlp/mlpenc.c
==============================================================================
--- mlp/mlpenc.c	(original)
+++ mlp/mlpenc.c	Sun Aug 24 17:24:28 2008
@@ -1678,18 +1678,24 @@ static int mlp_encode_frame(AVCodecConte
 
     ctx->frame_index = avctx->frame_number % ctx->major_header_interval;
 
-    ctx->sample_buffer = ctx->major_frame_buffer
-                       + ctx->frame_index * ctx->one_sample_buffer_size;
-
     ctx->input_buffer = ctx->major_input_buffer
                       + ctx->frame_index * ctx->input_buffer_frame_size;
 
-    ctx->write_buffer = ctx->sample_buffer;
-
     if (ctx->last_frame == ctx->input_buffer) {
         return 0;
     }
 
+    if (ctx->frame_size[ctx->frame_index] > MAX_BLOCKSIZE) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid frame size (%d > %d)\n",
+               ctx->frame_size[ctx->frame_index], MAX_BLOCKSIZE);
+        return -1;
+    }
+
+    ctx->sample_buffer = ctx->major_frame_buffer
+                       + ctx->frame_index * ctx->one_sample_buffer_size;
+
+    ctx->write_buffer = ctx->sample_buffer;
+
     if (avctx->frame_number < ctx->major_header_interval) {
         if (data) {
             goto input_and_return;
@@ -1705,12 +1711,6 @@ static int mlp_encode_frame(AVCodecConte
         }
     }
 
-    if (ctx->frame_size[ctx->frame_index] > MAX_BLOCKSIZE) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid frame size (%d > %d)\n",
-               ctx->frame_size[ctx->frame_index], MAX_BLOCKSIZE);
-        return -1;
-    }
-
     restart_frame = !ctx->frame_index;
 
     avctx->coded_frame->key_frame = restart_frame;



More information about the FFmpeg-soc mailing list