Mercurial > libavformat.hg
comparison ffm.c @ 2222:3427d0c63a32 libavformat
Use AV_RB* macros where appropriate.
patch by Ronald S. Bultje, rsbultje gmail com
thread: Re: [FFmpeg-devel] remove int readers
date: Sat, 23 Jun 2007 09:32:12 -0400
author | diego |
---|---|
date | Fri, 06 Jul 2007 09:32:34 +0000 |
parents | 1a3c9056982a |
children | d52c718e83f9 |
comparison
equal
deleted
inserted
replaced
2221:efb7b615d57c | 2222:3427d0c63a32 |
---|---|
599 } | 599 } |
600 #endif | 600 #endif |
601 ffm->read_state = READ_DATA; | 601 ffm->read_state = READ_DATA; |
602 /* fall thru */ | 602 /* fall thru */ |
603 case READ_DATA: | 603 case READ_DATA: |
604 size = (ffm->header[2] << 16) | (ffm->header[3] << 8) | ffm->header[4]; | 604 size = AV_RB24(ffm->header + 2); |
605 if (!ffm_is_avail_data(s, size)) { | 605 if (!ffm_is_avail_data(s, size)) { |
606 return AVERROR(EAGAIN); | 606 return AVERROR(EAGAIN); |
607 } | 607 } |
608 | 608 |
609 duration = (ffm->header[5] << 16) | (ffm->header[6] << 8) | ffm->header[7]; | 609 duration = AV_RB24(ffm->header + 5); |
610 | 610 |
611 av_new_packet(pkt, size); | 611 av_new_packet(pkt, size); |
612 pkt->stream_index = ffm->header[0]; | 612 pkt->stream_index = ffm->header[0]; |
613 pkt->pos = url_ftell(&s->pb); | 613 pkt->pos = url_ftell(&s->pb); |
614 if (ffm->header[1] & FLAG_KEY_FRAME) | 614 if (ffm->header[1] & FLAG_KEY_FRAME) |
712 | 712 |
713 #ifdef CONFIG_FFSERVER | 713 #ifdef CONFIG_FFSERVER |
714 offset_t ffm_read_write_index(int fd) | 714 offset_t ffm_read_write_index(int fd) |
715 { | 715 { |
716 uint8_t buf[8]; | 716 uint8_t buf[8]; |
717 offset_t pos; | |
718 int i; | |
719 | 717 |
720 lseek(fd, 8, SEEK_SET); | 718 lseek(fd, 8, SEEK_SET); |
721 read(fd, buf, 8); | 719 read(fd, buf, 8); |
722 pos = 0; | 720 return AV_RB64(buf); |
723 for(i=0;i<8;i++) | |
724 pos |= (int64_t)buf[i] << (56 - i * 8); | |
725 return pos; | |
726 } | 721 } |
727 | 722 |
728 void ffm_write_write_index(int fd, offset_t pos) | 723 void ffm_write_write_index(int fd, offset_t pos) |
729 { | 724 { |
730 uint8_t buf[8]; | 725 uint8_t buf[8]; |