comparison ffm.c @ 743:af4e24d6310c libavformat

switch to native time bases
author michael
date Sat, 30 Apr 2005 21:43:59 +0000
parents 095009fc2f35
children da5b3b9e898e
comparison
equal deleted inserted replaced
742:21c1ae78f041 743:af4e24d6310c
161 put_be32(pb, st->quality); 161 put_be32(pb, st->quality);
162 put_be32(pb, codec->flags); 162 put_be32(pb, codec->flags);
163 /* specific info */ 163 /* specific info */
164 switch(codec->codec_type) { 164 switch(codec->codec_type) {
165 case CODEC_TYPE_VIDEO: 165 case CODEC_TYPE_VIDEO:
166 put_be32(pb, codec->frame_rate_base); 166 put_be32(pb, codec->time_base.num);
167 put_be32(pb, codec->frame_rate); 167 put_be32(pb, codec->time_base.den);
168 put_be16(pb, codec->width); 168 put_be16(pb, codec->width);
169 put_be16(pb, codec->height); 169 put_be16(pb, codec->height);
170 put_be16(pb, codec->gop_size); 170 put_be16(pb, codec->gop_size);
171 put_byte(pb, codec->qmin); 171 put_byte(pb, codec->qmin);
172 put_byte(pb, codec->qmax); 172 put_byte(pb, codec->qmax);
233 233
234 //XXX/FIXME use duration from pkt 234 //XXX/FIXME use duration from pkt
235 if (st->codec.codec_type == CODEC_TYPE_AUDIO) { 235 if (st->codec.codec_type == CODEC_TYPE_AUDIO) {
236 duration = ((float)st->codec.frame_size / st->codec.sample_rate * 1000000.0); 236 duration = ((float)st->codec.frame_size / st->codec.sample_rate * 1000000.0);
237 } else { 237 } else {
238 duration = (1000000.0 * st->codec.frame_rate_base / (float)st->codec.frame_rate); 238 duration = (1000000.0 * st->codec.time_base.num / (float)st->codec.time_base.den);
239 } 239 }
240 240
241 pts = fst->pts; 241 pts = fst->pts;
242 /* packet size & key_frame */ 242 /* packet size & key_frame */
243 header[0] = pkt->stream_index; 243 header[0] = pkt->stream_index;
478 st->quality = get_be32(pb); 478 st->quality = get_be32(pb);
479 codec->flags = get_be32(pb); 479 codec->flags = get_be32(pb);
480 /* specific info */ 480 /* specific info */
481 switch(codec->codec_type) { 481 switch(codec->codec_type) {
482 case CODEC_TYPE_VIDEO: 482 case CODEC_TYPE_VIDEO:
483 codec->frame_rate_base = get_be32(pb); 483 codec->time_base.num = get_be32(pb);
484 codec->frame_rate = get_be32(pb); 484 codec->time_base.den = get_be32(pb);
485 codec->width = get_be16(pb); 485 codec->width = get_be16(pb);
486 codec->height = get_be16(pb); 486 codec->height = get_be16(pb);
487 codec->gop_size = get_be16(pb); 487 codec->gop_size = get_be16(pb);
488 codec->qmin = get_byte(pb); 488 codec->qmin = get_byte(pb);
489 codec->qmax = get_byte(pb); 489 codec->qmax = get_byte(pb);