Commit df651cf4 authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos

Add an annotation field as required by the specification when muxing Sun AU.

Reviewed-by: Paul B Mahol
parent f1470ca6
......@@ -35,6 +35,8 @@
/* if we don't know the size in advance */
#define AU_UNKNOWN_SIZE ((uint32_t)(~0))
/* the specification requires an annotation field of at least eight bytes */
#define AU_HEADER_SIZE (24+8)
/* The libavcodec codecs we support, and the IDs they have in the file */
static const AVCodecTag codec_au_tags[] = {
......@@ -56,11 +58,12 @@ static int put_au_header(AVIOContext *pb, AVCodecContext *enc)
if(!enc->codec_tag)
return -1;
ffio_wfourcc(pb, ".snd"); /* magic number */
avio_wb32(pb, 24); /* header size */
avio_wb32(pb, AU_HEADER_SIZE); /* header size */
avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */
avio_wb32(pb, (uint32_t)enc->codec_tag); /* codec ID */
avio_wb32(pb, enc->sample_rate);
avio_wb32(pb, (uint32_t)enc->channels);
avio_wb64(pb, 0); /* annotation field */
return 0;
}
......@@ -97,7 +100,7 @@ static int au_write_trailer(AVFormatContext *s)
/* update file size */
file_size = avio_tell(pb);
avio_seek(pb, 8, SEEK_SET);
avio_wb32(pb, (uint32_t)(file_size - 24));
avio_wb32(pb, (uint32_t)(file_size - AU_HEADER_SIZE));
avio_seek(pb, file_size, SEEK_SET);
avio_flush(pb);
......
118ff3dc83c62ce9ce669eef57e55bb2 *tests/data/fate/acodec-pcm-f32be.au
2116824 tests/data/fate/acodec-pcm-f32be.au
e74eb6b65cb397ce541bac120b00680a *tests/data/fate/acodec-pcm-f32be.au
2116832 tests/data/fate/acodec-pcm-f32be.au
64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-f32be.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
8112296b1ed94f72f20d04b1a54850a7 *tests/data/fate/acodec-pcm-f64be.au
4233624 tests/data/fate/acodec-pcm-f64be.au
8c8ba9d2c68384c5f077306e220f1188 *tests/data/fate/acodec-pcm-f64be.au
4233632 tests/data/fate/acodec-pcm-f64be.au
64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-f64be.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
dbd11f783219485cae32024e47c19dfb *./tests/data/lavf/lavf.au
90136 ./tests/data/lavf/lavf.au
dc54f834a23ddc0c086a86f0cef898d7 *./tests/data/lavf/lavf.au
90144 ./tests/data/lavf/lavf.au
./tests/data/lavf/lavf.au CRC=0xf1ae5536
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 2048
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 2048
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 2048
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 2048
ret: 0 st:-1 flags:1 ts: 1.894167
ret:-EOF
ret: 0 st: 0 flags:0 ts: 0.788345
ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 69556 size: 2048
ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 69564 size: 2048
ret: 0 st: 0 flags:1 ts:-0.317506
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 2048
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 2048
ret: 0 st:-1 flags:0 ts: 2.576668
ret:-EOF
ret: 0 st:-1 flags:1 ts: 1.470835
ret:-EOF
ret: 0 st: 0 flags:0 ts: 0.365011
ret: 0 st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 32218 size: 2048
ret: 0 st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 32226 size: 2048
ret: 0 st: 0 flags:1 ts:-0.740839
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 2048
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 2048
ret: 0 st:-1 flags:0 ts: 2.153336
ret:-EOF
ret: 0 st:-1 flags:1 ts: 1.047503
ret:-EOF
ret: 0 st: 0 flags:0 ts:-0.058322
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 2048
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 2048
ret: 0 st: 0 flags:1 ts: 2.835828
ret:-EOF
ret: 0 st:-1 flags:0 ts: 1.730004
ret:-EOF
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 55076 size: 2048
ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 55084 size: 2048
ret: 0 st: 0 flags:0 ts:-0.481655
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 2048
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 2048
ret: 0 st: 0 flags:1 ts: 2.412494
ret:-EOF
ret: 0 st:-1 flags:0 ts: 1.306672
ret:-EOF
ret: 0 st:-1 flags:1 ts: 0.200839
ret: 0 st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos: 17738 size: 2048
ret: 0 st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos: 17746 size: 2048
ret: 0 st: 0 flags:0 ts:-0.904989
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 2048
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 2048
ret: 0 st: 0 flags:1 ts: 1.989184
ret:-EOF
ret: 0 st:-1 flags:0 ts: 0.883340
ret: 0 st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 77934 size: 2048
ret: 0 st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 77942 size: 2048
ret: 0 st:-1 flags:1 ts:-0.222493
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 2048
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 2048
ret: 0 st: 0 flags:0 ts: 2.671678
ret:-EOF
ret: 0 st: 0 flags:1 ts: 1.565850
ret:-EOF
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 40596 size: 2048
ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 40604 size: 2048
ret: 0 st:-1 flags:1 ts:-0.645825
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 2048
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 2048
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 8192
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 8192
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 8192
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 8192
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos: 668288 size: 8192
ret: 0 st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos: 668296 size: 8192
ret: 0 st: 0 flags:0 ts: 0.788345
ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 278152 size: 8192
ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 278160 size: 8192
ret: 0 st: 0 flags:1 ts:-0.317506
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 8192
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 8192
ret: 0 st:-1 flags:0 ts: 2.576668
ret: 0 st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos: 909072 size: 8192
ret: 0 st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos: 909080 size: 8192
ret: 0 st:-1 flags:1 ts: 1.470835
ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 518936 size: 8192
ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 518944 size: 8192
ret: 0 st: 0 flags:0 ts: 0.365011
ret: 0 st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 128800 size: 8192
ret: 0 st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 128808 size: 8192
ret: 0 st: 0 flags:1 ts:-0.740839
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 8192
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 8192
ret: 0 st:-1 flags:0 ts: 2.153336
ret: 0 st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos: 759720 size: 8192
ret: 0 st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos: 759728 size: 8192
ret: 0 st:-1 flags:1 ts: 1.047503
ret: 0 st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 369584 size: 8192
ret: 0 st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 369592 size: 8192
ret: 0 st: 0 flags:0 ts:-0.058322
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 8192
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 8192
ret: 0 st: 0 flags:1 ts: 2.835828
ret: 0 st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos:1000504 size: 8192
ret: 0 st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos:1000512 size: 8192
ret: 0 st:-1 flags:0 ts: 1.730004
ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 610368 size: 8192
ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 610376 size: 8192
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 220232 size: 8192
ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 220240 size: 8192
ret: 0 st: 0 flags:0 ts:-0.481655
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 8192
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 8192
ret: 0 st: 0 flags:1 ts: 2.412494
ret: 0 st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos: 851152 size: 8192
ret: 0 st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos: 851160 size: 8192
ret: 0 st:-1 flags:0 ts: 1.306672
ret: 0 st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 461016 size: 8192
ret: 0 st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 461024 size: 8192
ret: 0 st:-1 flags:1 ts: 0.200839
ret: 0 st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos: 70880 size: 8192
ret: 0 st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos: 70888 size: 8192
ret: 0 st: 0 flags:0 ts:-0.904989
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 8192
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 8192
ret: 0 st: 0 flags:1 ts: 1.989184
ret: 0 st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos: 701808 size: 8192
ret: 0 st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos: 701816 size: 8192
ret: 0 st:-1 flags:0 ts: 0.883340
ret: 0 st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 311664 size: 8192
ret: 0 st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 311672 size: 8192
ret: 0 st:-1 flags:1 ts:-0.222493
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 8192
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 8192
ret: 0 st: 0 flags:0 ts: 2.671678
ret: 0 st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos: 942592 size: 8192
ret: 0 st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos: 942600 size: 8192
ret: 0 st: 0 flags:1 ts: 1.565850
ret: 0 st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 552456 size: 8192
ret: 0 st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 552464 size: 8192
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 162312 size: 8192
ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 162320 size: 8192
ret: 0 st:-1 flags:1 ts:-0.645825
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 8192
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 8192
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 16384
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 16384
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 16384
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 16384
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos:1336552 size: 16384
ret: 0 st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos:1336560 size: 16384
ret: 0 st: 0 flags:0 ts: 0.788345
ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 556280 size: 16384
ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 556288 size: 16384
ret: 0 st: 0 flags:1 ts:-0.317506
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 16384
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 16384
ret: 0 st:-1 flags:0 ts: 2.576668
ret: 0 st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos:1818120 size: 16384
ret: 0 st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos:1818128 size: 16384
ret: 0 st:-1 flags:1 ts: 1.470835
ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos:1037848 size: 16384
ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos:1037856 size: 16384
ret: 0 st: 0 flags:0 ts: 0.365011
ret: 0 st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 257576 size: 16384
ret: 0 st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 257584 size: 16384
ret: 0 st: 0 flags:1 ts:-0.740839
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 16384
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 16384
ret: 0 st:-1 flags:0 ts: 2.153336
ret: 0 st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos:1519416 size: 16384
ret: 0 st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos:1519424 size: 16384
ret: 0 st:-1 flags:1 ts: 1.047503
ret: 0 st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 739144 size: 16384
ret: 0 st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 739152 size: 16384
ret: 0 st: 0 flags:0 ts:-0.058322
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 16384
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 16384
ret: 0 st: 0 flags:1 ts: 2.835828
ret: 0 st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos:2000984 size: 16384
ret: 0 st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos:2000992 size: 16384
ret: 0 st:-1 flags:0 ts: 1.730004
ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos:1220712 size: 16384
ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos:1220720 size: 16384
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 440440 size: 16384
ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 440448 size: 16384
ret: 0 st: 0 flags:0 ts:-0.481655
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 16384
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 16384
ret: 0 st: 0 flags:1 ts: 2.412494
ret: 0 st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos:1702280 size: 16384
ret: 0 st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos:1702288 size: 16384
ret: 0 st:-1 flags:0 ts: 1.306672
ret: 0 st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 922008 size: 16384
ret: 0 st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 922016 size: 16384
ret: 0 st:-1 flags:1 ts: 0.200839
ret: 0 st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos: 141736 size: 16384
ret: 0 st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos: 141744 size: 16384
ret: 0 st: 0 flags:0 ts:-0.904989
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 16384
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 16384
ret: 0 st: 0 flags:1 ts: 1.989184
ret: 0 st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos:1403592 size: 16384
ret: 0 st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos:1403600 size: 16384
ret: 0 st:-1 flags:0 ts: 0.883340
ret: 0 st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 623304 size: 16384
ret: 0 st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 623312 size: 16384
ret: 0 st:-1 flags:1 ts:-0.222493
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 16384
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 16384
ret: 0 st: 0 flags:0 ts: 2.671678
ret: 0 st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos:1885160 size: 16384
ret: 0 st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos:1885168 size: 16384
ret: 0 st: 0 flags:1 ts: 1.565850
ret: 0 st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos:1104888 size: 16384
ret: 0 st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos:1104896 size: 16384
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 324600 size: 16384
ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 324608 size: 16384
ret: 0 st:-1 flags:1 ts:-0.645825
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 24 size: 16384
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 16384
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