movenc.c: Add support for >16bit BE flavours

Currently only LE handled correctly
Updated fate checksums to reflect new headers

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Tim Nicholson 2012-10-02 11:18:04 +01:00 committed by Michael Niedermayer
parent 2e8dcde1fe
commit 60b433d905
3 changed files with 27 additions and 7 deletions

View File

@ -288,6 +288,14 @@ static int mov_write_enda_tag(AVIOContext *pb)
return 10; return 10;
} }
static int mov_write_enda_tag_be(AVIOContext *pb)
{
avio_wb32(pb, 10);
ffio_wfourcc(pb, "enda");
avio_wb16(pb, 0); /* big endian */
return 10;
}
static void put_descr(AVIOContext *pb, int tag, unsigned int size) static void put_descr(AVIOContext *pb, int tag, unsigned int size)
{ {
int i = 3; int i = 3;
@ -369,6 +377,14 @@ static int mov_pcm_le_gt16(enum AVCodecID codec_id)
codec_id == AV_CODEC_ID_PCM_F64LE; codec_id == AV_CODEC_ID_PCM_F64LE;
} }
static int mov_pcm_be_gt16(enum AVCodecID codec_id)
{
return codec_id == AV_CODEC_ID_PCM_S24BE ||
codec_id == AV_CODEC_ID_PCM_S32BE ||
codec_id == AV_CODEC_ID_PCM_F32BE ||
codec_id == AV_CODEC_ID_PCM_F64BE;
}
static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track)
{ {
int64_t pos = avio_tell(pb); int64_t pos = avio_tell(pb);
@ -432,8 +448,10 @@ static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track)
ffio_wfourcc(pb, "mp4a"); ffio_wfourcc(pb, "mp4a");
avio_wb32(pb, 0); avio_wb32(pb, 0);
mov_write_esds_tag(pb, track); mov_write_esds_tag(pb, track);
} else if (mov_pcm_le_gt16(track->enc->codec_id)) { } else if (mov_pcm_le_gt16(track->enc->codec_id)) {
mov_write_enda_tag(pb); mov_write_enda_tag(pb);
} else if (mov_pcm_be_gt16(track->enc->codec_id)) {
mov_write_enda_tag_be(pb);
} else if (track->enc->codec_id == AV_CODEC_ID_AMR_NB) { } else if (track->enc->codec_id == AV_CODEC_ID_AMR_NB) {
mov_write_amr_tag(pb, track); mov_write_amr_tag(pb, track);
} else if (track->enc->codec_id == AV_CODEC_ID_AC3) { } else if (track->enc->codec_id == AV_CODEC_ID_AC3) {
@ -629,6 +647,7 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
tag = AV_RL32("lpcm"); tag = AV_RL32("lpcm");
version = 2; version = 2;
} else if (track->audio_vbr || mov_pcm_le_gt16(track->enc->codec_id) || } else if (track->audio_vbr || mov_pcm_le_gt16(track->enc->codec_id) ||
mov_pcm_be_gt16(track->enc->codec_id) ||
track->enc->codec_id == AV_CODEC_ID_ADPCM_MS || track->enc->codec_id == AV_CODEC_ID_ADPCM_MS ||
track->enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV || track->enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV ||
track->enc->codec_id == AV_CODEC_ID_QDM2) { track->enc->codec_id == AV_CODEC_ID_QDM2) {
@ -697,7 +716,8 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
track->enc->codec_id == AV_CODEC_ID_ADPCM_MS || track->enc->codec_id == AV_CODEC_ID_ADPCM_MS ||
track->enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV || track->enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV ||
track->enc->codec_id == AV_CODEC_ID_QDM2 || track->enc->codec_id == AV_CODEC_ID_QDM2 ||
(mov_pcm_le_gt16(track->enc->codec_id) && version==1))) (mov_pcm_le_gt16(track->enc->codec_id) && version==1) ||
(mov_pcm_be_gt16(track->enc->codec_id) && version==1)))
mov_write_wave_tag(pb, track); mov_write_wave_tag(pb, track);
else if(track->tag == MKTAG('m','p','4','a')) else if(track->tag == MKTAG('m','p','4','a'))
mov_write_esds_tag(pb, track); mov_write_esds_tag(pb, track);

View File

@ -1,4 +1,4 @@
5d843e1f56796aae3185016f164b16b7 *tests/data/fate/acodec-pcm-s24be.mov cbf0bd68d21099335e197ae812834110 *tests/data/fate/acodec-pcm-s24be.mov
1588269 tests/data/fate/acodec-pcm-s24be.mov 1588323 tests/data/fate/acodec-pcm-s24be.mov
64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s24be.out.wav 64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s24be.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400 stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400

View File

@ -1,4 +1,4 @@
b34c66c56df1b1e75688929cf20670b9 *tests/data/fate/acodec-pcm-s32be.mov 856b157d3ab505f0859b0de692e6a8bc *tests/data/fate/acodec-pcm-s32be.mov
2117473 tests/data/fate/acodec-pcm-s32be.mov 2117527 tests/data/fate/acodec-pcm-s32be.mov
64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s32be.out.wav 64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s32be.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400 stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400