# HG changeset patch # User michael # Date 1081103587 0 # Node ID b6949d80b7a9bf09b44b98f3c908ea623491787c # Parent 237eeeb50fb86d04df24829c71432af1f5fdcbde move zero size hack from ogg.c to utils.c diff -r 237eeeb50fb8 -r b6949d80b7a9 ogg.c --- a/ogg.c Sun Apr 04 17:55:59 2004 +0000 +++ b/ogg.c Sun Apr 04 18:33:07 2004 +0000 @@ -73,10 +73,6 @@ pts= av_rescale(pts, avctx->sample_rate, AV_TIME_BASE); - if(!size){ -// av_log(avfcontext, AV_LOG_DEBUG, "zero packet\n"); - return 0; - } // av_log(avfcontext, AV_LOG_DEBUG, "M%d\n", size); /* flush header packets so audio starts on a new page */ diff -r 237eeeb50fb8 -r b6949d80b7a9 utils.c --- a/utils.c Sun Apr 04 17:55:59 2004 +0000 +++ b/utils.c Sun Apr 04 18:33:07 2004 +0000 @@ -1698,8 +1698,14 @@ st = s->streams[stream_index]; pts_mask = (1LL << s->pts_wrap_bits) - 1; - ret = s->oformat->write_packet(s, stream_index, buf, size, - st->pts.val & pts_mask); + + /* HACK/FIXME we skip all zero size audio packets so a encoder can pass pts by outputing zero size packets */ + if(st->codec.codec_type==CODEC_TYPE_AUDIO && size==0) + ret = 0; + else + ret = s->oformat->write_packet(s, stream_index, buf, size, + st->pts.val & pts_mask); + if (ret < 0) return ret; @@ -1708,9 +1714,8 @@ case CODEC_TYPE_AUDIO: frame_size = get_audio_frame_size(&st->codec, size); - /* note, we skip the initial 0-size packets as they are most likely equal to the encoder delay, + /* HACK/FIXME, we skip the initial 0-size packets as they are most likely equal to the encoder delay, but it would be better if we had the real timestamps from the encoder */ -// av_log(s, AV_LOG_DEBUG, "%d %lld %lld\n", size, st->pts.num, st->pts.val); if (frame_size >= 0 && (size || st->pts.num!=st->pts.den>>1 || st->pts.val)) { av_frac_add(&st->pts, (int64_t)s->pts_den * frame_size);