changeset 828:a5af9ba25343 libavformat

round pointer up to next packet_size multiple
author michael
date Wed, 27 Jul 2005 07:31:40 +0000
parents d064b7d0899d
children e3a3fe90b62f
files asf.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/asf.c	Sat Jul 23 21:52:41 2005 +0000
+++ b/asf.c	Wed Jul 27 07:31:40 2005 +0000
@@ -422,8 +422,6 @@
     int rsize = 9;
     int c;
     
-    if((url_ftell(&s->pb) - s->data_offset) % asf->packet_size)
-        return -1;
     assert((url_ftell(&s->pb) - s->data_offset) % asf->packet_size == 0);
     
     c = get_byte(pb);
@@ -485,6 +483,8 @@
 	    //asf->packet_size_left <= asf->packet_padsize) {
 	    int ret = asf->packet_size_left + asf->packet_padsize;
 	    //printf("PacketLeftSize:%d  Pad:%d Pos:%Ld\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb));
+            if((url_ftell(&s->pb) + ret - s->data_offset) % asf->packet_size)
+                ret += asf->packet_size - ((url_ftell(&s->pb) + ret - s->data_offset) % asf->packet_size);
 	    /* fail safe */
 	    url_fskip(pb, ret);
             asf->packet_pos= url_ftell(&s->pb);