changeset 344:a573dca492a3 libavformat

audio pts fix
author michael
date Sat, 10 Jan 2004 23:55:57 +0000
parents 538e6791f4c7
children d94c6fd7b95e
files avidec.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/avidec.c	Sat Jan 10 22:36:35 2004 +0000
+++ b/avidec.c	Sat Jan 10 23:55:57 2004 +0000
@@ -419,7 +419,11 @@
                 ast = st->priv_data;
 
                 /* XXX: how to handle B frames in avi ? */
-                pkt->pts = ((int64_t)ast->frame_offset * ast->scale* AV_TIME_BASE) / ast->rate;
+                if(st->codec.codec_type == CODEC_TYPE_VIDEO)
+                    pkt->pts = ((int64_t)ast->frame_offset * ast->scale* AV_TIME_BASE) / ast->rate;
+                else //FIXME this is proably not correct for all weird avis
+                    pkt->pts = ((int64_t)ast->frame_offset * ast->scale* AV_TIME_BASE) / (ast->rate * st->codec.block_align);
+//printf("%Ld %d %d %d %d\n", pkt->pts, ast->frame_offset, ast->scale,  AV_TIME_BASE,  ast->rate);
                 pkt->stream_index = n;
                 /* FIXME: We really should read index for that */
                 if (st->codec.codec_type == CODEC_TYPE_VIDEO) {