Commit fc600eff authored by Paul B Mahol's avatar Paul B Mahol

avcodec: add 64-bit signed pcm codec

parent 9876d8fc
......@@ -689,6 +689,10 @@ OBJS-$(CONFIG_PCM_S32LE_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_S32LE_ENCODER) += pcm.o
OBJS-$(CONFIG_PCM_S32LE_PLANAR_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_S32LE_PLANAR_ENCODER) += pcm.o
OBJS-$(CONFIG_PCM_S64BE_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_S64BE_ENCODER) += pcm.o
OBJS-$(CONFIG_PCM_S64LE_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_S64LE_ENCODER) += pcm.o
OBJS-$(CONFIG_PCM_U8_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_U8_ENCODER) += pcm.o
OBJS-$(CONFIG_PCM_U16BE_DECODER) += pcm.o
......
......@@ -487,6 +487,8 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (PCM_S32BE, pcm_s32be);
REGISTER_ENCDEC (PCM_S32LE, pcm_s32le);
REGISTER_ENCDEC (PCM_S32LE_PLANAR, pcm_s32le_planar);
REGISTER_ENCDEC (PCM_S64BE, pcm_s64be);
REGISTER_ENCDEC (PCM_S64LE, pcm_s64le);
REGISTER_ENCDEC (PCM_U8, pcm_u8);
REGISTER_ENCDEC (PCM_U16BE, pcm_u16be);
REGISTER_ENCDEC (PCM_U16LE, pcm_u16le);
......
......@@ -445,9 +445,9 @@ enum AVCodecID {
AV_CODEC_ID_PCM_S24LE_PLANAR,
AV_CODEC_ID_PCM_S32LE_PLANAR,
AV_CODEC_ID_PCM_S16BE_PLANAR,
/* new PCM "codecs" should be added right below this line starting with
* an explicit value of for example 0x10800
*/
AV_CODEC_ID_PCM_S64LE = 0x10800,
AV_CODEC_ID_PCM_S64BE,
/* various ADPCM codecs */
AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
......
......@@ -1636,6 +1636,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("PCM signed 32-bit big-endian"),
.props = AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_PCM_S64LE,
.type = AVMEDIA_TYPE_AUDIO,
.name = "pcm_s64le",
.long_name = NULL_IF_CONFIG_SMALL("PCM signed 64-bit little-endian"),
.props = AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_PCM_S64BE,
.type = AVMEDIA_TYPE_AUDIO,
.name = "pcm_s64be",
.long_name = NULL_IF_CONFIG_SMALL("PCM signed 64-bit big-endian"),
.props = AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_PCM_U32LE,
.type = AVMEDIA_TYPE_AUDIO,
......
......@@ -145,6 +145,7 @@ static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
ENCODE_PLANAR(uint8_t, byte, dst, n, 0, -128)
break;
#if HAVE_BIGENDIAN
case AV_CODEC_ID_PCM_S64LE:
case AV_CODEC_ID_PCM_F64LE:
ENCODE(int64_t, le64, samples, dst, n, 0, 0)
break;
......@@ -163,9 +164,11 @@ static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
break;
case AV_CODEC_ID_PCM_F64BE:
case AV_CODEC_ID_PCM_F32BE:
case AV_CODEC_ID_PCM_S64BE:
case AV_CODEC_ID_PCM_S32BE:
case AV_CODEC_ID_PCM_S16BE:
#else
case AV_CODEC_ID_PCM_S64BE:
case AV_CODEC_ID_PCM_F64BE:
ENCODE(int64_t, be64, samples, dst, n, 0, 0)
break;
......@@ -181,6 +184,7 @@ static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
break;
case AV_CODEC_ID_PCM_F64LE:
case AV_CODEC_ID_PCM_F32LE:
case AV_CODEC_ID_PCM_S64LE:
case AV_CODEC_ID_PCM_S32LE:
case AV_CODEC_ID_PCM_S16LE:
#endif /* HAVE_BIGENDIAN */
......@@ -390,6 +394,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
}
break;
#if HAVE_BIGENDIAN
case AV_CODEC_ID_PCM_S64LE:
case AV_CODEC_ID_PCM_F64LE:
DECODE(64, le64, src, samples, n, 0, 0)
break;
......@@ -408,9 +413,11 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
break;
case AV_CODEC_ID_PCM_F64BE:
case AV_CODEC_ID_PCM_F32BE:
case AV_CODEC_ID_PCM_S64BE:
case AV_CODEC_ID_PCM_S32BE:
case AV_CODEC_ID_PCM_S16BE:
#else
case AV_CODEC_ID_PCM_S64BE:
case AV_CODEC_ID_PCM_F64BE:
DECODE(64, be64, src, samples, n, 0, 0)
break;
......@@ -426,6 +433,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
break;
case AV_CODEC_ID_PCM_F64LE:
case AV_CODEC_ID_PCM_F32LE:
case AV_CODEC_ID_PCM_S64LE:
case AV_CODEC_ID_PCM_S32LE:
case AV_CODEC_ID_PCM_S16LE:
#endif /* HAVE_BIGENDIAN */
......@@ -568,4 +576,5 @@ PCM_CODEC (PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned
PCM_CODEC (PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
PCM_CODEC (PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
PCM_DECODER(PCM_ZORK, AV_SAMPLE_FMT_U8, pcm_zork, "PCM Zork");
PCM_CODEC (PCM_S64BE, AV_SAMPLE_FMT_S64, pcm_s64be, "PCM signed 64-bit big-endian");
PCM_CODEC (PCM_S64LE, AV_SAMPLE_FMT_S64, pcm_s64le, "PCM signed 64-bit little-endian");
......@@ -3419,6 +3419,8 @@ int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
return 32;
case AV_CODEC_ID_PCM_F64BE:
case AV_CODEC_ID_PCM_F64LE:
case AV_CODEC_ID_PCM_S64BE:
case AV_CODEC_ID_PCM_S64LE:
return 64;
default:
return 0;
......@@ -3436,6 +3438,7 @@ enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be)
[AV_SAMPLE_FMT_U8P ] = { AV_CODEC_ID_PCM_U8, AV_CODEC_ID_PCM_U8 },
[AV_SAMPLE_FMT_S16P] = { AV_CODEC_ID_PCM_S16LE, AV_CODEC_ID_PCM_S16BE },
[AV_SAMPLE_FMT_S32P] = { AV_CODEC_ID_PCM_S32LE, AV_CODEC_ID_PCM_S32BE },
[AV_SAMPLE_FMT_S64P] = { AV_CODEC_ID_PCM_S64LE, AV_CODEC_ID_PCM_S64BE },
[AV_SAMPLE_FMT_FLTP] = { AV_CODEC_ID_PCM_F32LE, AV_CODEC_ID_PCM_F32BE },
[AV_SAMPLE_FMT_DBLP] = { AV_CODEC_ID_PCM_F64LE, AV_CODEC_ID_PCM_F64BE },
};
......
......@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 53
#define LIBAVCODEC_VERSION_MINOR 54
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
......@@ -436,6 +436,7 @@ const AVCodecTag ff_codec_wav_tags[] = {
{ AV_CODEC_ID_PCM_U8, 0x0001 },
{ AV_CODEC_ID_PCM_S24LE, 0x0001 },
{ AV_CODEC_ID_PCM_S32LE, 0x0001 },
{ AV_CODEC_ID_PCM_S64LE, 0x0001 },
{ AV_CODEC_ID_ADPCM_MS, 0x0002 },
{ AV_CODEC_ID_PCM_F32LE, 0x0003 },
/* must come after f32le in this list */
......
......@@ -2991,6 +2991,8 @@ enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags)
return be ? AV_CODEC_ID_PCM_S24BE : AV_CODEC_ID_PCM_S24LE;
case 4:
return be ? AV_CODEC_ID_PCM_S32BE : AV_CODEC_ID_PCM_S32LE;
case 8:
return be ? AV_CODEC_ID_PCM_S64BE : AV_CODEC_ID_PCM_S64LE;
default:
return AV_CODEC_ID_NONE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment