mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
EA IMA SEAD decoder
original patch by Peter Ross Originally committed as revision 10879 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
29c3d42b42
commit
7bb65d8964
@ -276,6 +276,7 @@ OBJS-$(CONFIG_ADPCM_IMA_DK3_DECODER) += adpcm.o
|
|||||||
OBJS-$(CONFIG_ADPCM_IMA_DK3_ENCODER) += adpcm.o
|
OBJS-$(CONFIG_ADPCM_IMA_DK3_ENCODER) += adpcm.o
|
||||||
OBJS-$(CONFIG_ADPCM_IMA_DK4_DECODER) += adpcm.o
|
OBJS-$(CONFIG_ADPCM_IMA_DK4_DECODER) += adpcm.o
|
||||||
OBJS-$(CONFIG_ADPCM_IMA_DK4_ENCODER) += adpcm.o
|
OBJS-$(CONFIG_ADPCM_IMA_DK4_ENCODER) += adpcm.o
|
||||||
|
OBJS-$(CONFIG_ADPCM_IMA_EA_SEAD_DECODER) += adpcm.o
|
||||||
OBJS-$(CONFIG_ADPCM_IMA_QT_DECODER) += adpcm.o
|
OBJS-$(CONFIG_ADPCM_IMA_QT_DECODER) += adpcm.o
|
||||||
OBJS-$(CONFIG_ADPCM_IMA_QT_ENCODER) += adpcm.o
|
OBJS-$(CONFIG_ADPCM_IMA_QT_ENCODER) += adpcm.o
|
||||||
OBJS-$(CONFIG_ADPCM_IMA_SMJPEG_DECODER) += adpcm.o
|
OBJS-$(CONFIG_ADPCM_IMA_SMJPEG_DECODER) += adpcm.o
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
* CD-ROM XA ADPCM codec by BERO
|
* CD-ROM XA ADPCM codec by BERO
|
||||||
* EA ADPCM decoder by Robin Kay (komadori@myrealbox.com)
|
* EA ADPCM decoder by Robin Kay (komadori@myrealbox.com)
|
||||||
* EA ADPCM R1/R2/R3 decoder by Peter Ross (pross@xvid.org)
|
* EA ADPCM R1/R2/R3 decoder by Peter Ross (pross@xvid.org)
|
||||||
|
* EA IMA SEAD decoder by Peter Ross (pross@xvid.org)
|
||||||
* THP ADPCM decoder by Marco Gerards (mgerards@xs4all.nl)
|
* THP ADPCM decoder by Marco Gerards (mgerards@xs4all.nl)
|
||||||
*
|
*
|
||||||
* Features and limitations:
|
* Features and limitations:
|
||||||
@ -1137,6 +1138,12 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
|
|||||||
buf_size -= 128;
|
buf_size -= 128;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CODEC_ID_ADPCM_IMA_EA_SEAD:
|
||||||
|
for (; src < buf+buf_size; src++) {
|
||||||
|
*samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] >> 4, 6);
|
||||||
|
*samples++ = adpcm_ima_expand_nibble(&c->status[st],src[0]&0x0F, 6);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case CODEC_ID_ADPCM_EA:
|
case CODEC_ID_ADPCM_EA:
|
||||||
samples_in_chunk = AV_RL32(src);
|
samples_in_chunk = AV_RL32(src);
|
||||||
if (samples_in_chunk >= ((buf_size - 12) * 2)) {
|
if (samples_in_chunk >= ((buf_size - 12) * 2)) {
|
||||||
@ -1535,6 +1542,7 @@ ADPCM_CODEC(CODEC_ID_ADPCM_EA, adpcm_ea);
|
|||||||
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_AMV, adpcm_ima_amv);
|
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_AMV, adpcm_ima_amv);
|
||||||
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3);
|
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3);
|
||||||
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
|
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
|
||||||
|
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
|
||||||
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
|
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
|
||||||
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
|
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
|
||||||
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
|
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
|
||||||
|
@ -254,6 +254,7 @@ void avcodec_register_all(void)
|
|||||||
REGISTER_DECODER (ADPCM_IMA_AMV, adpcm_ima_amv);
|
REGISTER_DECODER (ADPCM_IMA_AMV, adpcm_ima_amv);
|
||||||
REGISTER_ENCDEC (ADPCM_IMA_DK3, adpcm_ima_dk3);
|
REGISTER_ENCDEC (ADPCM_IMA_DK3, adpcm_ima_dk3);
|
||||||
REGISTER_ENCDEC (ADPCM_IMA_DK4, adpcm_ima_dk4);
|
REGISTER_ENCDEC (ADPCM_IMA_DK4, adpcm_ima_dk4);
|
||||||
|
REGISTER_DECODER (ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
|
||||||
REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt);
|
REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt);
|
||||||
REGISTER_ENCDEC (ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
|
REGISTER_ENCDEC (ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
|
||||||
REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav);
|
REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav);
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
#define AV_STRINGIFY(s) AV_TOSTRING(s)
|
#define AV_STRINGIFY(s) AV_TOSTRING(s)
|
||||||
#define AV_TOSTRING(s) #s
|
#define AV_TOSTRING(s) #s
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT ((51<<16)+(47<<8)+1)
|
#define LIBAVCODEC_VERSION_INT ((51<<16)+(47<<8)+2)
|
||||||
#define LIBAVCODEC_VERSION 51.47.1
|
#define LIBAVCODEC_VERSION 51.47.2
|
||||||
#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
|
#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
|
||||||
|
|
||||||
#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
|
#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
|
||||||
@ -214,6 +214,7 @@ enum CodecID {
|
|||||||
CODEC_ID_ADPCM_EA_R1,
|
CODEC_ID_ADPCM_EA_R1,
|
||||||
CODEC_ID_ADPCM_EA_R3,
|
CODEC_ID_ADPCM_EA_R3,
|
||||||
CODEC_ID_ADPCM_EA_R2,
|
CODEC_ID_ADPCM_EA_R2,
|
||||||
|
CODEC_ID_ADPCM_IMA_EA_SEAD,
|
||||||
|
|
||||||
/* AMR */
|
/* AMR */
|
||||||
CODEC_ID_AMR_NB= 0x12000,
|
CODEC_ID_AMR_NB= 0x12000,
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
|
|
||||||
#define SCHl_TAG MKTAG('S', 'C', 'H', 'l')
|
#define SCHl_TAG MKTAG('S', 'C', 'H', 'l')
|
||||||
|
#define SEAD_TAG MKTAG('S', 'E', 'A', 'D') /* Sxxx header */
|
||||||
|
#define SNDC_TAG MKTAG('S', 'N', 'D', 'C') /* Sxxx data */
|
||||||
|
#define SEND_TAG MKTAG('S', 'E', 'N', 'D') /* Sxxx end */
|
||||||
#define ISNh_TAG MKTAG('1', 'S', 'N', 'h') /* 1SNx header */
|
#define ISNh_TAG MKTAG('1', 'S', 'N', 'h') /* 1SNx header */
|
||||||
#define EACS_TAG MKTAG('E', 'A', 'C', 'S')
|
#define EACS_TAG MKTAG('E', 'A', 'C', 'S')
|
||||||
#define ISNd_TAG MKTAG('1', 'S', 'N', 'd') /* 1SNx data */
|
#define ISNd_TAG MKTAG('1', 'S', 'N', 'd') /* 1SNx data */
|
||||||
@ -205,6 +208,23 @@ static int process_audio_header_eacs(AVFormatContext *s)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Process SEAD sound header
|
||||||
|
* return 1 if success, 0 if invalid format, otherwise AVERROR_xxx
|
||||||
|
*/
|
||||||
|
static int process_audio_header_sead(AVFormatContext *s)
|
||||||
|
{
|
||||||
|
EaDemuxContext *ea = s->priv_data;
|
||||||
|
ByteIOContext *pb = &s->pb;
|
||||||
|
|
||||||
|
ea->sample_rate = get_le32(pb);
|
||||||
|
ea->bytes = get_le32(pb); /* 1=8-bit, 2=16-bit */
|
||||||
|
ea->num_channels = get_le32(pb);
|
||||||
|
ea->audio_codec = CODEC_ID_ADPCM_IMA_EA_SEAD;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int process_video_header_vp6(AVFormatContext *s)
|
static int process_video_header_vp6(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
EaDemuxContext *ea = s->priv_data;
|
EaDemuxContext *ea = s->priv_data;
|
||||||
@ -259,6 +279,10 @@ static int process_ea_header(AVFormatContext *s) {
|
|||||||
err = process_audio_header_elements(s);
|
err = process_audio_header_elements(s);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SEAD_TAG:
|
||||||
|
err = process_audio_header_sead(s);
|
||||||
|
break;
|
||||||
|
|
||||||
case MVhd_TAG :
|
case MVhd_TAG :
|
||||||
err = process_video_header_vp6(s);
|
err = process_video_header_vp6(s);
|
||||||
break;
|
break;
|
||||||
@ -283,6 +307,7 @@ static int ea_probe(AVProbeData *p)
|
|||||||
switch (AV_RL32(&p->buf[0])) {
|
switch (AV_RL32(&p->buf[0])) {
|
||||||
case ISNh_TAG:
|
case ISNh_TAG:
|
||||||
case SCHl_TAG:
|
case SCHl_TAG:
|
||||||
|
case SEAD_TAG:
|
||||||
case MVhd_TAG:
|
case MVhd_TAG:
|
||||||
return AVPROBE_SCORE_MAX;
|
return AVPROBE_SCORE_MAX;
|
||||||
}
|
}
|
||||||
@ -354,6 +379,7 @@ static int ea_read_packet(AVFormatContext *s,
|
|||||||
chunk_size -= 32;
|
chunk_size -= 32;
|
||||||
case ISNd_TAG:
|
case ISNd_TAG:
|
||||||
case SCDl_TAG:
|
case SCDl_TAG:
|
||||||
|
case SNDC_TAG:
|
||||||
if (!ea->audio_codec) {
|
if (!ea->audio_codec) {
|
||||||
url_fskip(pb, chunk_size);
|
url_fskip(pb, chunk_size);
|
||||||
break;
|
break;
|
||||||
@ -387,6 +413,7 @@ static int ea_read_packet(AVFormatContext *s,
|
|||||||
case 0:
|
case 0:
|
||||||
case ISNe_TAG:
|
case ISNe_TAG:
|
||||||
case SCEl_TAG:
|
case SCEl_TAG:
|
||||||
|
case SEND_TAG:
|
||||||
ret = AVERROR(EIO);
|
ret = AVERROR(EIO);
|
||||||
packet_read = 1;
|
packet_read = 1;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user