]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/pcm.c
ac3enc: Add codec-specific options for writing AC-3 metadata.
[ffmpeg] / libavcodec / pcm.c
index b6b49dc049c548d67e79d1b1b6b72adeb6c80f3a..e2a733495e448c746b53d74fea794a8bf6989149 100644 (file)
@@ -2,20 +2,20 @@
  * PCM codecs
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -292,6 +292,11 @@ static int pcm_decode_frame(AVCodecContext *avctx,
         /* we process 40-bit blocks per channel for LXF */
         sample_size = 5;
 
+    if (sample_size == 0) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid sample_size\n");
+        return AVERROR(EINVAL);
+    }
+
     n = avctx->channels * sample_size;
 
     if(n && buf_size % n){
@@ -468,7 +473,7 @@ static int pcm_decode_frame(AVCodecContext *avctx,
 
 #if CONFIG_ENCODERS
 #define PCM_ENCODER(id_,sample_fmt_,name_,long_name_) \
-AVCodec name_ ## _encoder = {                   \
+AVCodec ff_ ## name_ ## _encoder = {            \
     .name        = #name_,                      \
     .type        = AVMEDIA_TYPE_AUDIO,          \
     .id          = id_,                         \
@@ -477,14 +482,14 @@ AVCodec name_ ## _encoder = {                   \
     .close       = pcm_encode_close,            \
     .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
     .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
+}
 #else
 #define PCM_ENCODER(id,sample_fmt_,name,long_name_)
 #endif
 
 #if CONFIG_DECODERS
 #define PCM_DECODER(id_,sample_fmt_,name_,long_name_)         \
-AVCodec name_ ## _decoder = {                   \
+AVCodec ff_ ## name_ ## _decoder = {            \
     .name           = #name_,                   \
     .type           = AVMEDIA_TYPE_AUDIO,       \
     .id             = id_,                      \
@@ -493,17 +498,17 @@ AVCodec name_ ## _decoder = {                   \
     .decode         = pcm_decode_frame,         \
     .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
     .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
+}
 #else
 #define PCM_DECODER(id,sample_fmt_,name,long_name_)
 #endif
 
 #define PCM_CODEC(id, sample_fmt_, name, long_name_)         \
-    PCM_ENCODER(id,sample_fmt_,name,long_name_) PCM_DECODER(id,sample_fmt_,name,long_name_)
+    PCM_ENCODER(id,sample_fmt_,name,long_name_); PCM_DECODER(id,sample_fmt_,name,long_name_)
 
 /* Note: Do not forget to add new entries to the Makefile as well. */
 PCM_CODEC  (CODEC_ID_PCM_ALAW,  AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law");
-PCM_CODEC  (CODEC_ID_PCM_DVD,   AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
+PCM_DECODER(CODEC_ID_PCM_DVD,   AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
 PCM_CODEC  (CODEC_ID_PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
 PCM_CODEC  (CODEC_ID_PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
 PCM_CODEC  (CODEC_ID_PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");