comparison libmpdemux/muxer_avi.c @ 13249:a6642a4330fa

ensure that avi files have a valid header as soon as possible. without this, the header says 0x0 video size, which works with mplayer when the video size is stored in the codec data, but it does NOT work with other players or with codecs that don't store size (e.g. snow). actually i don't like having seeks in the muxer module, but i don't know any other way to implement this fix without major changes to mencoder. if you have a better fix, please reverse this and commit yours.
author rfelker
date Sun, 05 Sep 2004 16:51:15 +0000
parents da17b2c262de
children b8b626781ab0
comparison
equal deleted inserted replaced
13248:80d80d449057 13249:a6642a4330fa
192 off_t rifflen; 192 off_t rifflen;
193 muxer_t *muxer=s->muxer; 193 muxer_t *muxer=s->muxer;
194 struct avi_stream_info *si = s->priv; 194 struct avi_stream_info *si = s->priv;
195 struct avi_stream_info *vsi = muxer->def_v->priv; 195 struct avi_stream_info *vsi = muxer->def_v->priv;
196 int paddedlen = len + (len&1); 196 int paddedlen = len + (len&1);
197
198 if (s->type == MUXER_TYPE_VIDEO && !s->h.dwSuggestedBufferSize) {
199 off_t pos=ftell(muxer->file);
200 fseek(muxer->file, 0, SEEK_SET);
201 avifile_write_header(muxer);
202 fseek(muxer->file, pos, SEEK_SET);
203 }
197 204
198 rifflen = muxer->file_end - vsi->riffofs[vsi->riffofspos] - 8; 205 rifflen = muxer->file_end - vsi->riffofs[vsi->riffofspos] - 8;
199 if (vsi->riffofspos == 0) { 206 if (vsi->riffofspos == 0) {
200 rifflen += 8+muxer->idx_pos*sizeof(AVIINDEXENTRY); 207 rifflen += 8+muxer->idx_pos*sizeof(AVIINDEXENTRY);
201 } 208 }