summaryrefslogtreecommitdiff
path: root/libavformat/ogg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-04-27 03:35:14 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-04-27 03:35:14 +0000
commitc0c37848d8c571b13c5fe443f6d0811ac2d3cc36 (patch)
tree66a1fe568cc6e7c094dc171a26be17779bbe8d84 /libavformat/ogg.c
parent293ed23f1201d33a9510cf062213faa51ef620d4 (diff)
export pts if available
Originally committed as revision 3081 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/ogg.c')
-rw-r--r--libavformat/ogg.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/ogg.c b/libavformat/ogg.c
index 65c507c240..61a9212663 100644
--- a/libavformat/ogg.c
+++ b/libavformat/ogg.c
@@ -172,6 +172,7 @@ static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap)
int i;
avfcontext->ctx_flags |= AVFMTCTX_NOHEADER;
+ av_set_pts_info(avfcontext, 60, 1, AV_TIME_BASE);
ogg_sync_init(&context->oy) ;
buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ;
@@ -218,6 +219,9 @@ static int ogg_read_packet(AVFormatContext *avfcontext, AVPacket *pkt) {
return -EIO ;
pkt->stream_index = 0 ;
memcpy(pkt->data, op.packet, op.bytes);
+ if(avfcontext->streams[0]->codec.sample_rate && op.granulepos!=-1)
+ pkt->pts= av_rescale(op.granulepos, AV_TIME_BASE, avfcontext->streams[0]->codec.sample_rate);
+// printf("%lld %d %d\n", pkt->pts, (int)op.granulepos, avfcontext->streams[0]->codec.sample_rate);
return op.bytes;
}