Commit 82e415b1 authored by Michael Niedermayer's avatar Michael Niedermayer

avoid using non constant fields of AVCodecContext in avi muxer

Originally committed as revision 4897 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 378251ad
...@@ -613,8 +613,8 @@ static int avi_write_idx1(AVFormatContext *s) ...@@ -613,8 +613,8 @@ static int avi_write_idx1(AVFormatContext *s)
url_fseek(pb, avi->frames_hdr_strm[n], SEEK_SET); url_fseek(pb, avi->frames_hdr_strm[n], SEEK_SET);
ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale); ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
if (au_ssize == 0) { if (au_ssize == 0) {
put_le32(pb, stream->frame_number); put_le32(pb, avi->packet_count[n]);
nb_frames += stream->frame_number; nb_frames += avi->packet_count[n];
} else { } else {
put_le32(pb, avi->audio_strm_length[n] / au_ssize); put_le32(pb, avi->audio_strm_length[n] / au_ssize);
} }
...@@ -730,11 +730,11 @@ static int avi_write_trailer(AVFormatContext *s) ...@@ -730,11 +730,11 @@ static int avi_write_trailer(AVFormatContext *s)
for (n=nb_frames=0;n<s->nb_streams;n++) { for (n=nb_frames=0;n<s->nb_streams;n++) {
AVCodecContext *stream = s->streams[n]->codec; AVCodecContext *stream = s->streams[n]->codec;
if (stream->codec_type == CODEC_TYPE_VIDEO) { if (stream->codec_type == CODEC_TYPE_VIDEO) {
if (nb_frames < stream->frame_number) if (nb_frames < avi->packet_count[n])
nb_frames = stream->frame_number; nb_frames = avi->packet_count[n];
} else { } else {
if (stream->codec_id == CODEC_ID_MP2 || stream->codec_id == CODEC_ID_MP3) { if (stream->codec_id == CODEC_ID_MP2 || stream->codec_id == CODEC_ID_MP3) {
nb_frames += stream->frame_number; nb_frames += avi->packet_count[n];
} }
} }
} }
......
...@@ -59,29 +59,29 @@ stddev: 7.99 PSNR:30.06 bytes:7602176 ...@@ -59,29 +59,29 @@ stddev: 7.99 PSNR:30.06 bytes:7602176
7932708 ./data/a-huffyuv.avi 7932708 ./data/a-huffyuv.avi
799d3db687f6cdd7a837ec156efc171f *./data/out.yuv 799d3db687f6cdd7a837ec156efc171f *./data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176 stddev: 0.00 PSNR:99.99 bytes:7602176
d37d4d4b5acfffe3a01a72f51c162a82 *./data/a-mpeg4-rc.avi acf1fb041e2208742df6a083ee24f6bb *./data/a-mpeg4-rc.avi
822270 ./data/a-mpeg4-rc.avi 822270 ./data/a-mpeg4-rc.avi
3ecd1afdaf2d691d01628737326dda35 *./data/out.yuv 3ecd1afdaf2d691d01628737326dda35 *./data/out.yuv
stddev: 10.41 PSNR:27.76 bytes:7602176 stddev: 10.41 PSNR:27.76 bytes:7602176
81078d7852dfd6041ff17b5dc8ed0ffc *./data/a-mpeg4-adv.avi b3060dfd7638093b92de96ccc4568409 *./data/a-mpeg4-adv.avi
600240 ./data/a-mpeg4-adv.avi 600240 ./data/a-mpeg4-adv.avi
0b7935cee2070f3b838478cea6dc4b3c *./data/out.yuv 0b7935cee2070f3b838478cea6dc4b3c *./data/out.yuv
stddev: 10.25 PSNR:27.90 bytes:7602176 stddev: 10.25 PSNR:27.90 bytes:7602176
052f9e98112011ddc302b521e34d6385 *./data/a-mpeg4-thread.avi 0ba8ddfbdf68c7b53b24da5915b6bbf1 *./data/a-mpeg4-thread.avi
764686 ./data/a-mpeg4-thread.avi 764686 ./data/a-mpeg4-thread.avi
252d1e8cc1ee88eea693cebd6b4e7e53 *./data/out.yuv 252d1e8cc1ee88eea693cebd6b4e7e53 *./data/out.yuv
stddev: 12.32 PSNR:26.31 bytes:7602176 stddev: 12.32 PSNR:26.31 bytes:7602176
88cfdda74f0488cf4a8324667a1ec9e8 *./data/a-mpeg4-Q.avi a316960921c77d88817d857bbe19dccd *./data/a-mpeg4-Q.avi
899452 ./data/a-mpeg4-Q.avi 899452 ./data/a-mpeg4-Q.avi
af59c063ed644c7dc4151a0a2debbddd *./data/out.yuv af59c063ed644c7dc4151a0a2debbddd *./data/out.yuv
stddev: 5.69 PSNR:33.00 bytes:7602176 stddev: 5.69 PSNR:33.00 bytes:7602176
28446a8cc5f1cfc337415f408ab67f0e *./data/a-mpeg4-PSP.mp4 28446a8cc5f1cfc337415f408ab67f0e *./data/a-mpeg4-PSP.mp4
407349 ./data/a-mpeg4-PSP.mp4 407349 ./data/a-mpeg4-PSP.mp4
dd193b592a02864d612c64cbbf5e1258 *./data/a-error-mpeg4-adv.avi 40f1b11c7c5c114af109ef4ea6a7097d *./data/a-error-mpeg4-adv.avi
766682 ./data/a-error-mpeg4-adv.avi 766682 ./data/a-error-mpeg4-adv.avi
e90b201e20563ec7817f5dc4276902ed *./data/out.yuv e90b201e20563ec7817f5dc4276902ed *./data/out.yuv
stddev: 15.90 PSNR:24.09 bytes:7602176 stddev: 15.90 PSNR:24.09 bytes:7602176
adf36cbca712f8202d474cf1f99bdcd0 *./data/a-mpeg4-nr.avi 994c604f7fafc77f50acc61df7c20cd2 *./data/a-mpeg4-nr.avi
689772 ./data/a-mpeg4-nr.avi 689772 ./data/a-mpeg4-nr.avi
79f4e8263e40822c0cbf35725f375b24 *./data/out.yuv 79f4e8263e40822c0cbf35725f375b24 *./data/out.yuv
stddev: 7.03 PSNR:31.18 bytes:7602176 stddev: 7.03 PSNR:31.18 bytes:7602176
......
ffmpeg regression test ffmpeg regression test
9f2252939564a3b735605be5e6575f04 *./data/b-libav.avi ffe84c1d286255bb6856f864b8122b6a *./data/b-libav.avi
342282 ./data/b-libav.avi 342282 ./data/b-libav.avi
./data/b-libav.avi CRC=0xccab3a27 ./data/b-libav.avi CRC=0xccab3a27
6f4dca897d9a009009798e434fe5f651 *./data/b-libav.asf 6f4dca897d9a009009798e434fe5f651 *./data/b-libav.asf
......
...@@ -59,29 +59,29 @@ stddev: 5.34 PSNR:33.56 bytes:7602176 ...@@ -59,29 +59,29 @@ stddev: 5.34 PSNR:33.56 bytes:7602176
6454196 ./data/a-huffyuv.avi 6454196 ./data/a-huffyuv.avi
dde5895817ad9d219f79a52d0bdfb001 *./data/out.yuv dde5895817ad9d219f79a52d0bdfb001 *./data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176 stddev: 0.00 PSNR:99.99 bytes:7602176
8375752d50a0a11c85370eebfb601d5d *./data/a-mpeg4-rc.avi b25c4fd396faddd829d8ef5a31a1cce3 *./data/a-mpeg4-rc.avi
227618 ./data/a-mpeg4-rc.avi 227618 ./data/a-mpeg4-rc.avi
addcb0b8e42d71c25a0590d10e8e41c6 *./data/out.yuv addcb0b8e42d71c25a0590d10e8e41c6 *./data/out.yuv
stddev: 4.27 PSNR:35.51 bytes:7602176 stddev: 4.27 PSNR:35.51 bytes:7602176
49bb293a098ebf88870f663d590a02d9 *./data/a-mpeg4-adv.avi 390b43f0156d05f11489fe6cec2d7593 *./data/a-mpeg4-adv.avi
172526 ./data/a-mpeg4-adv.avi 172526 ./data/a-mpeg4-adv.avi
e3445dab9a3fa83a0f86457e24cb0cea *./data/out.yuv e3445dab9a3fa83a0f86457e24cb0cea *./data/out.yuv
stddev: 4.84 PSNR:34.42 bytes:7602176 stddev: 4.84 PSNR:34.42 bytes:7602176
4b88839dd9696ff5500bea89b9ca66be *./data/a-mpeg4-thread.avi c6c0c6884f4388bcb6eeba8046dd1e18 *./data/a-mpeg4-thread.avi
253268 ./data/a-mpeg4-thread.avi 253268 ./data/a-mpeg4-thread.avi
d6f1714d6fe1f969fc4ca416c6f8ba6c *./data/out.yuv d6f1714d6fe1f969fc4ca416c6f8ba6c *./data/out.yuv
stddev: 4.04 PSNR:35.98 bytes:7602176 stddev: 4.04 PSNR:35.98 bytes:7602176
bb7f7889f0694a1c499041f3ee5e234d *./data/a-mpeg4-Q.avi e3297036902923727157b8d1b52cbc7e *./data/a-mpeg4-Q.avi
164998 ./data/a-mpeg4-Q.avi 164998 ./data/a-mpeg4-Q.avi
b078f22c66083f0537bd3581509684d8 *./data/out.yuv b078f22c66083f0537bd3581509684d8 *./data/out.yuv
stddev: 4.01 PSNR:36.05 bytes:7602176 stddev: 4.01 PSNR:36.05 bytes:7602176
1a3e5c4b097c7609415248e235f39967 *./data/a-mpeg4-PSP.mp4 1a3e5c4b097c7609415248e235f39967 *./data/a-mpeg4-PSP.mp4
321922 ./data/a-mpeg4-PSP.mp4 321922 ./data/a-mpeg4-PSP.mp4
74b9ddde044f90c8ee25042e9faaef68 *./data/a-error-mpeg4-adv.avi a2adfb70459e8b2218756bac5e67c4c7 *./data/a-error-mpeg4-adv.avi
177212 ./data/a-error-mpeg4-adv.avi 177212 ./data/a-error-mpeg4-adv.avi
9fa0943825f364d6fb700dc75cf5d8bb *./data/out.yuv 9fa0943825f364d6fb700dc75cf5d8bb *./data/out.yuv
stddev: 9.71 PSNR:28.37 bytes:7602176 stddev: 9.71 PSNR:28.37 bytes:7602176
edf6bf425e6e5f78bdd1b992003aee9a *./data/a-mpeg4-nr.avi b2722a6e5e7cce05665f221e15fd5202 *./data/a-mpeg4-nr.avi
154302 ./data/a-mpeg4-nr.avi 154302 ./data/a-mpeg4-nr.avi
b69fc415185075bdb21bedeae03d20b8 *./data/out.yuv b69fc415185075bdb21bedeae03d20b8 *./data/out.yuv
stddev: 4.73 PSNR:34.62 bytes:7602176 stddev: 4.73 PSNR:34.62 bytes:7602176
......
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