Commit 469c174f authored by michael's avatar michael

move zero size hack from ogg.c to utils.c


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@2959 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 6ccd41be
...@@ -73,10 +73,6 @@ static int ogg_write_packet(AVFormatContext *avfcontext, ...@@ -73,10 +73,6 @@ static int ogg_write_packet(AVFormatContext *avfcontext,
pts= av_rescale(pts, avctx->sample_rate, AV_TIME_BASE); 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); // av_log(avfcontext, AV_LOG_DEBUG, "M%d\n", size);
/* flush header packets so audio starts on a new page */ /* flush header packets so audio starts on a new page */
......
...@@ -1698,8 +1698,14 @@ int av_write_frame(AVFormatContext *s, int stream_index, const uint8_t *buf, ...@@ -1698,8 +1698,14 @@ int av_write_frame(AVFormatContext *s, int stream_index, const uint8_t *buf,
st = s->streams[stream_index]; st = s->streams[stream_index];
pts_mask = (1LL << s->pts_wrap_bits) - 1; 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) if (ret < 0)
return ret; return ret;
...@@ -1708,9 +1714,8 @@ int av_write_frame(AVFormatContext *s, int stream_index, const uint8_t *buf, ...@@ -1708,9 +1714,8 @@ int av_write_frame(AVFormatContext *s, int stream_index, const uint8_t *buf,
case CODEC_TYPE_AUDIO: case CODEC_TYPE_AUDIO:
frame_size = get_audio_frame_size(&st->codec, size); 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 */ 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)) { if (frame_size >= 0 && (size || st->pts.num!=st->pts.den>>1 || st->pts.val)) {
av_frac_add(&st->pts, av_frac_add(&st->pts,
(int64_t)s->pts_den * frame_size); (int64_t)s->pts_den * frame_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment