shithub: aacenc

Download patch

ref: f90c83531213d267c8c46f014b0c9dccd455d1b6
parent: 75d777f59b9db1c638a710a840e035b92f7b0b3b
author: lenox <lenox>
date: Fri Mar 17 03:19:08 EST 2000

removed function faac_EncodeFinish()

--- a/aacenc.h
+++ b/aacenc.h
@@ -94,7 +94,6 @@
 int faac_EncodeFrame(faacAACStream *as);
 int faac_BlockEncodeFrame(faacAACStream *as, short *input_samples, int Samples);
 void faac_EncodeFree(faacAACStream *as);
-void faac_EncodeFinish(faacAACStream *as);
 faacVersion *faac_Version(void);
 void faac_InitParams(faacAACStream *as);
 void faac_SetParam(faacAACStream *as, int param, int value);
@@ -105,7 +104,6 @@
 __declspec(dllexport) int faac_EncodeFrame(faacAACStream *as);
 __declspec(dllexport) int faac_BlockEncodeFrame(faacAACStream *as, short *input_samples, int Samples);
 __declspec(dllexport) void faac_EncodeFree(faacAACStream *as);
-__declspec(dllexport) void faac_EncodeFinish(faacAACStream *as);
 __declspec(dllexport) faacVersion *faac_Version(void);
 __declspec(dllexport) void faac_InitParams(faacAACStream *as);
 __declspec(dllexport) void faac_SetParam(faacAACStream *as, int param, int value);
--- a/encoder.c
+++ b/encoder.c
@@ -307,8 +307,15 @@
   if ( Samples > 0 )
     if ( faac_EncodeFrameCore(as, Samples) == FERROR)
       return FERROR;
-  if (Samples < as->samplesToRead)
+  if (Samples < as->samplesToRead) {
+    if(as->sampleBuffer){
+      free(as->sampleBuffer);
+      as->sampleBuffer = NULL;
+    }
+    faac_EncodeFrameCore(as,0);
+    faac_EncodeFrameCore(as,0);
     return F_FINISH;
+    }
   return FNO_ERROR;
 }
 ////////////////////////////////////////////////////////////////////////////////
@@ -315,17 +322,18 @@
 int faac_BlockEncodeFrame(faacAACStream *as, short *input_samples, int Samples)
 {
   memcpy(as->sampleBuffer,input_samples,sizeof(short)*Samples);
-  return faac_EncodeFrameCore(as, Samples);
-}
-////////////////////////////////////////////////////////////////////////////////
-void faac_EncodeFinish(faacAACStream *as)
-{
-  if(as->sampleBuffer){
-    free(as->sampleBuffer);
-    as->sampleBuffer = NULL;
-  }
-  faac_EncodeFrameCore(as,0);
-  faac_EncodeFrameCore(as,0);
+  if (Samples < as->samplesToRead) {
+    faac_EncodeFrameCore(as,Samples);
+    if(as->sampleBuffer){
+      free(as->sampleBuffer);
+      as->sampleBuffer = NULL;
+    }
+    faac_EncodeFrameCore(as,0);
+    faac_EncodeFrameCore(as,0);
+    return F_FINISH;
+    }
+  else
+    return faac_EncodeFrameCore(as,Samples);
 }
 ////////////////////////////////////////////////////////////////////////////////
 void faac_EncodeFree(faacAACStream *as)
--- a/faac.c
+++ b/faac.c
@@ -310,7 +310,7 @@
     } while (result != F_FINISH);
 
     /* finishing last frames and destroying internal data */
-    faac_EncodeFinish(as);
+//    faac_EncodeFinish(as);
     faac_EncodeFree(as);
 #ifdef _WIN32
     end = GetTickCount();