comparison asf-enc.c @ 1762:cb8b538021cd libavformat

muxing packets with unknown timestamps is not allowed
author michael
date Wed, 07 Feb 2007 22:26:48 +0000
parents 39cafa2f6060
children 913e0d9b82d3
comparison
equal deleted inserted replaced
1761:e9bff647e326 1762:cb8b538021cd
723 codec = s->streams[pkt->stream_index]->codec; 723 codec = s->streams[pkt->stream_index]->codec;
724 stream = &asf->streams[pkt->stream_index]; 724 stream = &asf->streams[pkt->stream_index];
725 725
726 //XXX /FIXME use duration from AVPacket (quick hack by) 726 //XXX /FIXME use duration from AVPacket (quick hack by)
727 pts = (pkt->pts != AV_NOPTS_VALUE) ? pkt->pts : pkt->dts; 727 pts = (pkt->pts != AV_NOPTS_VALUE) ? pkt->pts : pkt->dts;
728 if (pts == AV_NOPTS_VALUE) { 728 assert(pts != AV_NOPTS_VALUE);
729 if (codec->codec_type == CODEC_TYPE_AUDIO) { 729 duration = pts * 10000;
730 duration = (codec->frame_number * (int64_t)codec->frame_size * INT64_C(10000000)) /
731 codec->sample_rate;
732 } else {
733 duration = av_rescale(codec->frame_number * (int64_t)codec->time_base.num, 10000000, codec->time_base.den);
734 }
735 } else {
736 duration = pts * 10000;
737 }
738 asf->duration= FFMAX(asf->duration, duration); 730 asf->duration= FFMAX(asf->duration, duration);
739 731
740 packet_st = asf->nb_packets; 732 packet_st = asf->nb_packets;
741 put_frame(s, stream, pkt->pts, pkt->data, pkt->size, pkt->flags); 733 put_frame(s, stream, pkt->pts, pkt->data, pkt->size, pkt->flags);
742 734