diff options
author | Paul B Mahol <onemda@gmail.com> | 2016-08-17 19:46:21 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2016-08-18 15:30:05 +0200 |
commit | fc600eff630faebda980b7d6fcf02569ebd3bb11 (patch) | |
tree | b063be79da4efc0e58272b550cc41b9655ebaa23 | |
parent | 9876d8fc6d2b77d5aa31a4b748241b9ebb797167 (diff) | |
download | ffmpeg-fc600eff630faebda980b7d6fcf02569ebd3bb11.tar.gz |
avcodec: add 64-bit signed pcm codec
-rw-r--r-- | libavcodec/Makefile | 4 | ||||
-rw-r--r-- | libavcodec/allcodecs.c | 2 | ||||
-rw-r--r-- | libavcodec/avcodec.h | 6 | ||||
-rw-r--r-- | libavcodec/codec_desc.c | 14 | ||||
-rw-r--r-- | libavcodec/pcm.c | 11 | ||||
-rw-r--r-- | libavcodec/utils.c | 3 | ||||
-rw-r--r-- | libavcodec/version.h | 2 | ||||
-rw-r--r-- | libavformat/riff.c | 1 | ||||
-rw-r--r-- | libavformat/utils.c | 2 |
9 files changed, 40 insertions, 5 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile index b375720b1e..16c9fcfd15 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -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 diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index a1ae61fece..4c6b94ecad 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -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); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index b43ee5a00d..6ac66461ac 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -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, diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index dea17c93bb..24948caffe 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1637,6 +1637,20 @@ static const AVCodecDescriptor codec_descriptors[] = { .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, .name = "pcm_u32le", diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 9a13602543..2e8e8e73a6 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -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"); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 6f4d553324..138125a2d9 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -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 }, }; diff --git a/libavcodec/version.h b/libavcodec/version.h index cdfc4f9365..7ee5b5aa13 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -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, \ diff --git a/libavformat/riff.c b/libavformat/riff.c index 2d54922503..5cef7a9799 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -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 */ diff --git a/libavformat/utils.c b/libavformat/utils.c index 47cb7dd733..dd9df9294a 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -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; } |