[FFmpeg-cvslog] libvo-aacenc: Sync up with 0.7.2

Reinhard Tartler git at videolan.org
Sun Nov 6 02:00:01 CET 2011


ffmpeg | branch: release/0.6 | Reinhard Tartler <siretart at tauware.de> | Sat Nov  5 12:19:43 2011 +0100| [9f95d7aab3ced729f3e931ef11006881e0735738] | committer: Reinhard Tartler

libvo-aacenc: Sync up with 0.7.2

This version was checked out from the 0.7.2 release and has some bits
reverted to compile in the release/0.6 branch

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f95d7aab3ced729f3e931ef11006881e0735738
---

 libavcodec/libvo-aacenc.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c
index 65c2745..da4a7bf 100644
--- a/libavcodec/libvo-aacenc.c
+++ b/libavcodec/libvo-aacenc.c
@@ -59,25 +59,27 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
     if (s->codec_api.SetParam(s->handle, VO_PID_AAC_ENCPARAM, &params)
         != VO_ERR_NONE) {
         av_log(avctx, AV_LOG_ERROR, "Unable to set encoding parameters\n");
-        return AVERROR_UNKNOWN;
+        return AVERROR(EINVAL);
     }
 
-    avctx->extradata_size = 2;
-    avctx->extradata      = av_mallocz(avctx->extradata_size +
-                                       FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!avctx->extradata)
-        return AVERROR(ENOMEM);
-
     for (index = 0; index < 16; index++)
         if (avctx->sample_rate == ff_mpeg4audio_sample_rates[index])
             break;
     if (index == 16) {
         av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n",
                                     avctx->sample_rate);
-        return AVERROR_NOTSUPP;
+        return AVERROR(ENOSYS);
+    }
+    if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
+        avctx->extradata_size = 2;
+        avctx->extradata      = av_mallocz(avctx->extradata_size +
+                                           FF_INPUT_BUFFER_PADDING_SIZE);
+        if (!avctx->extradata)
+            return AVERROR(ENOMEM);
+
+        avctx->extradata[0] = 0x02 << 3 | index >> 1;
+        avctx->extradata[1] = (index & 0x01) << 7 | avctx->channels << 3;
     }
-    avctx->extradata[0] = 0x02 << 3 | index >> 1;
-    avctx->extradata[1] = (index & 0x01) << 7 | avctx->channels << 3;
     return 0;
 }
 
@@ -108,12 +110,12 @@ static int aac_encode_frame(AVCodecContext *avctx,
     if (s->codec_api.GetOutputData(s->handle, &output, &output_info)
         != VO_ERR_NONE) {
         av_log(avctx, AV_LOG_ERROR, "Unable to encode frame\n");
-        return AVERROR_UNKNOWN;
+        return AVERROR(EINVAL);
     }
     return output.Length;
 }
 
-AVCodec ff_libvo_aacenc_encoder = {
+AVCodec libvo_aacenc_encoder = {
     "libvo_aacenc",
     CODEC_TYPE_AUDIO,
     CODEC_ID_AAC,
@@ -122,7 +124,7 @@ AVCodec ff_libvo_aacenc_encoder = {
     aac_encode_frame,
     aac_encode_close,
     NULL,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("libvo-aacenc AAC"),
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn AAC"),
 };
 



More information about the ffmpeg-cvslog mailing list