diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-04-04 18:33:07 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-04-04 18:33:07 +0000 |
commit | b0c7f5a9d82feb7f4c4cdf77f1537193670ab58b (patch) | |
tree | 3eaf888936a068e725964631e99c3ac4719409a2 /libavformat/utils.c | |
parent | a03cbe5f7f12682d2c790e0a809dc6edf1bb6f21 (diff) | |
download | ffmpeg-b0c7f5a9d82feb7f4c4cdf77f1537193670ab58b.tar.gz |
move zero size hack from ogg.c to utils.c
Originally committed as revision 2959 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 14f965d697..6a445e2589 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1698,8 +1698,14 @@ int av_write_frame(AVFormatContext *s, int stream_index, const uint8_t *buf, 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 @@ int av_write_frame(AVFormatContext *s, int stream_index, const uint8_t *buf, 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); |