PCM signed 16-bit big-endian planar decoder
[ffmpeg.git] / libavcodec / pcm.c
index 26801fd..a87aafc 100644 (file)
@@ -48,7 +48,7 @@ static av_cold int pcm_encode_init(AVCodecContext *avctx)
     avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
     avctx->block_align           = avctx->channels * avctx->bits_per_coded_sample / 8;
     avctx->bit_rate              = avctx->block_align * avctx->sample_rate * 8;
-    avctx->coded_frame           = avcodec_alloc_frame();
+    avctx->coded_frame           = av_frame_alloc();
     if (!avctx->coded_frame)
         return AVERROR(ENOMEM);
 
@@ -253,7 +253,7 @@ static av_cold int pcm_decode_init(AVCodecContext *avctx)
 #if HAVE_BIGENDIAN
 #define DECODE_PLANAR(size, endian, src, dst, n, shift, offset)         \
     {                                                                   \
-        int av_unused n2;                                               \
+        int n2;                                                         \
         n /= avctx->channels;                                           \
         for (c = 0; c < avctx->channels; c++) {                         \
             samples = frame->extended_data[c];                          \
@@ -264,7 +264,6 @@ static av_cold int pcm_decode_init(AVCodecContext *avctx)
 #else
 #define DECODE_PLANAR(size, endian, src, dst, n, shift, offset)         \
     {                                                                   \
-        int av_unused n2;                                               \
         n /= avctx->channels;                                           \
         for (c = 0; c < avctx->channels; c++) {                         \
             samples = frame->extended_data[c];                          \
@@ -348,6 +347,9 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
             samples += 2;
         }
         break;
+    case AV_CODEC_ID_PCM_S16BE_PLANAR:
+        DECODE_PLANAR(16, be16, src, samples, n, 0, 0);
+        break;
     case AV_CODEC_ID_PCM_S16LE_PLANAR:
         DECODE_PLANAR(16, le16, src, samples, n, 0, 0);
         break;
@@ -453,6 +455,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
 #define PCM_ENCODER_1(id_, sample_fmt_, name_, long_name_)                  \
 AVCodec ff_ ## name_ ## _encoder = {                                        \
     .name         = #name_,                                                 \
+    .long_name    = NULL_IF_CONFIG_SMALL(long_name_),                       \
     .type         = AVMEDIA_TYPE_AUDIO,                                     \
     .id           = AV_CODEC_ID_ ## id_,                                    \
     .init         = pcm_encode_init,                                        \
@@ -461,7 +464,6 @@ AVCodec ff_ ## name_ ## _encoder = {                                        \
     .capabilities = CODEC_CAP_VARIABLE_FRAME_SIZE,                          \
     .sample_fmts  = (const enum AVSampleFormat[]){ sample_fmt_,             \
                                                    AV_SAMPLE_FMT_NONE },    \
-    .long_name    = NULL_IF_CONFIG_SMALL(long_name_),                       \
 }
 
 #define PCM_ENCODER_2(cf, id, sample_fmt, name, long_name)                  \
@@ -475,6 +477,7 @@ AVCodec ff_ ## name_ ## _encoder = {                                        \
 #define PCM_DECODER_1(id_, sample_fmt_, name_, long_name_)                  \
 AVCodec ff_ ## name_ ## _decoder = {                                        \
     .name           = #name_,                                               \
+    .long_name      = NULL_IF_CONFIG_SMALL(long_name_),                     \
     .type           = AVMEDIA_TYPE_AUDIO,                                   \
     .id             = AV_CODEC_ID_ ## id_,                                  \
     .priv_data_size = sizeof(PCMDecode),                                    \
@@ -483,7 +486,6 @@ AVCodec ff_ ## name_ ## _decoder = {                                        \
     .capabilities   = CODEC_CAP_DR1,                                        \
     .sample_fmts    = (const enum AVSampleFormat[]){ sample_fmt_,           \
                                                      AV_SAMPLE_FMT_NONE },  \
-    .long_name      = NULL_IF_CONFIG_SMALL(long_name_),                     \
 }
 
 #define PCM_DECODER_2(cf, id, sample_fmt, name, long_name)                  \
@@ -507,6 +509,7 @@ PCM_DECODER(PCM_LXF,          AV_SAMPLE_FMT_S32P, pcm_lxf,          "PCM signed
 PCM_CODEC  (PCM_MULAW,        AV_SAMPLE_FMT_S16, pcm_mulaw,        "PCM mu-law");
 PCM_CODEC  (PCM_S8,           AV_SAMPLE_FMT_U8,  pcm_s8,           "PCM signed 8-bit");
 PCM_CODEC  (PCM_S16BE,        AV_SAMPLE_FMT_S16, pcm_s16be,        "PCM signed 16-bit big-endian");
+PCM_DECODER(PCM_S16BE_PLANAR, AV_SAMPLE_FMT_S16P,pcm_s16be_planar, "PCM signed 16-bit big-endian planar");
 PCM_CODEC  (PCM_S16LE,        AV_SAMPLE_FMT_S16, pcm_s16le,        "PCM signed 16-bit little-endian");
 PCM_DECODER(PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16P, pcm_s16le_planar, "PCM 16-bit little-endian planar");
 PCM_CODEC  (PCM_S24BE,        AV_SAMPLE_FMT_S32, pcm_s24be,        "PCM signed 24-bit big-endian");