comparison asf.c @ 828:a5af9ba25343 libavformat

round pointer up to next packet_size multiple
author michael
date Wed, 27 Jul 2005 07:31:40 +0000
parents feca73904e67
children 8e1b338096a0
comparison
equal deleted inserted replaced
827:d064b7d0899d 828:a5af9ba25343
420 ByteIOContext *pb = &s->pb; 420 ByteIOContext *pb = &s->pb;
421 uint32_t packet_length, padsize; 421 uint32_t packet_length, padsize;
422 int rsize = 9; 422 int rsize = 9;
423 int c; 423 int c;
424 424
425 if((url_ftell(&s->pb) - s->data_offset) % asf->packet_size)
426 return -1;
427 assert((url_ftell(&s->pb) - s->data_offset) % asf->packet_size == 0); 425 assert((url_ftell(&s->pb) - s->data_offset) % asf->packet_size == 0);
428 426
429 c = get_byte(pb); 427 c = get_byte(pb);
430 if (c != 0x82) { 428 if (c != 0x82) {
431 if (!url_feof(pb)) 429 if (!url_feof(pb))
483 if (asf->packet_size_left < FRAME_HEADER_SIZE 481 if (asf->packet_size_left < FRAME_HEADER_SIZE
484 || asf->packet_segments < 1) { 482 || asf->packet_segments < 1) {
485 //asf->packet_size_left <= asf->packet_padsize) { 483 //asf->packet_size_left <= asf->packet_padsize) {
486 int ret = asf->packet_size_left + asf->packet_padsize; 484 int ret = asf->packet_size_left + asf->packet_padsize;
487 //printf("PacketLeftSize:%d Pad:%d Pos:%Ld\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb)); 485 //printf("PacketLeftSize:%d Pad:%d Pos:%Ld\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb));
486 if((url_ftell(&s->pb) + ret - s->data_offset) % asf->packet_size)
487 ret += asf->packet_size - ((url_ftell(&s->pb) + ret - s->data_offset) % asf->packet_size);
488 /* fail safe */ 488 /* fail safe */
489 url_fskip(pb, ret); 489 url_fskip(pb, ret);
490 asf->packet_pos= url_ftell(&s->pb); 490 asf->packet_pos= url_ftell(&s->pb);
491 ret = asf_get_packet(s); 491 ret = asf_get_packet(s);
492 //printf("READ ASF PACKET %d r:%d c:%d\n", ret, asf->packet_size_left, pc++); 492 //printf("READ ASF PACKET %d r:%d c:%d\n", ret, asf->packet_size_left, pc++);