Mercurial > libavformat.hg
comparison ffm.c @ 3310:66d5e19f7b77 libavformat
use duration from pkt
author | bcoudurier |
---|---|
date | Wed, 21 May 2008 22:52:21 +0000 |
parents | a1cfa9c6e399 |
children | c603ff471631 |
comparison
equal
deleted
inserted
replaced
3309:a1cfa9c6e399 | 3310:66d5e19f7b77 |
---|---|
245 { | 245 { |
246 AVStream *st = s->streams[pkt->stream_index]; | 246 AVStream *st = s->streams[pkt->stream_index]; |
247 FFMStream *fst = st->priv_data; | 247 FFMStream *fst = st->priv_data; |
248 int64_t pts; | 248 int64_t pts; |
249 uint8_t header[FRAME_HEADER_SIZE]; | 249 uint8_t header[FRAME_HEADER_SIZE]; |
250 int duration; | |
251 int size= pkt->size; | 250 int size= pkt->size; |
252 | |
253 //XXX/FIXME use duration from pkt | |
254 if (st->codec->codec_type == CODEC_TYPE_AUDIO) { | |
255 duration = ((float)st->codec->frame_size / st->codec->sample_rate * 1000000.0); | |
256 } else { | |
257 duration = (1000000.0 * st->codec->time_base.num / (float)st->codec->time_base.den); | |
258 } | |
259 | 251 |
260 pts = fst->pts; | 252 pts = fst->pts; |
261 /* packet size & key_frame */ | 253 /* packet size & key_frame */ |
262 header[0] = pkt->stream_index; | 254 header[0] = pkt->stream_index; |
263 header[1] = 0; | 255 header[1] = 0; |
264 if (pkt->flags & PKT_FLAG_KEY) | 256 if (pkt->flags & PKT_FLAG_KEY) |
265 header[1] |= FLAG_KEY_FRAME; | 257 header[1] |= FLAG_KEY_FRAME; |
266 AV_WB24(header+2, size); | 258 AV_WB24(header+2, size); |
267 AV_WB24(header+5, duration); | 259 AV_WB24(header+5, pkt->duration); |
268 ffm_write_data(s, header, FRAME_HEADER_SIZE, pts, 1); | 260 ffm_write_data(s, header, FRAME_HEADER_SIZE, pts, 1); |
269 ffm_write_data(s, pkt->data, size, pts, 0); | 261 ffm_write_data(s, pkt->data, size, pts, 0); |
270 | 262 |
271 fst->pts += duration; | 263 fst->pts += duration; |
272 return 0; | 264 return 0; |