changeset 607:fce9fc3a0f17 libavformat

timestamp fix
author michael
date Mon, 06 Dec 2004 16:40:10 +0000
parents ef6d04c1dd9a
children fcf079a47658
files rm.c
diffstat 1 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rm.c	Mon Dec 06 00:15:52 2004 +0000
+++ b/rm.c	Mon Dec 06 16:40:10 2004 +0000
@@ -628,6 +628,7 @@
             codec_data_size = get_be32(pb);
             codec_pos = url_ftell(pb);
             st->codec.codec_type = CODEC_TYPE_DATA;
+            av_set_pts_info(st, 64, 1, 1000);
 
             v = get_be32(pb);
             if (v == MKTAG(0xfd, 'a', 'r', '.')) {
@@ -724,7 +725,7 @@
     AVStream *st;
     int len, num, timestamp, i, tmp, j;
     uint8_t *ptr;
-    int flags;
+    int flags, res;
 
     if (rm->old_format) {
         /* just read raw bytes */
@@ -748,8 +749,11 @@
             return AVERROR_IO;
         num = get_be16(pb);
         timestamp = get_be32(pb);
-        get_byte(pb); /* reserved */
+        res= get_byte(pb); /* reserved */
         flags = get_byte(pb); /* flags */
+        
+//        av_log(s, AV_LOG_DEBUG, "%d %d %X %d\n", num, timestamp, flags, res);
+        
         rm->nb_packets--;
         len -= 12;
         
@@ -798,6 +802,22 @@
         av_new_packet(pkt, len);
         pkt->stream_index = i;
         get_buffer(pb, pkt->data, len);
+
+#if 0
+        if (st->codec.codec_type == CODEC_TYPE_VIDEO) {
+            if(st->codec.codec_id == CODEC_ID_RV20){
+                int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1);
+                av_log(NULL, AV_LOG_DEBUG, "%d %Ld %d\n", timestamp, timestamp*512LL/25, seq);
+
+                seq |= (timestamp&~0x3FFF);
+                if(seq - timestamp >  0x2000) seq -= 0x4000;
+                if(seq - timestamp < -0x2000) seq += 0x4000;
+            }
+        }
+#endif
+        pkt->pts= timestamp;
+        if(flags&2) 
+            pkt->flags |= PKT_FLAG_KEY;
     }
 
     /* for AC3, needs to swap bytes */