Revision b7effd4e libavformat/swfdec.c

View differences:

libavformat/swfdec.c
30 30
    if (url_feof(pb))
31 31
        return -1;
32 32

  
33
    tag = get_le16(pb);
33
    tag = avio_rl16(pb);
34 34
    len = tag & 0x3f;
35 35
    tag = tag >> 6;
36 36
    if (len == 0x3f) {
37
        len = get_le32(pb);
37
        len = avio_rl32(pb);
38 38
    }
39 39
//    av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len);
40 40
    *len_ptr = len;
......
58 58
    AVIOContext *pb = s->pb;
59 59
    int nbits, len, tag;
60 60

  
61
    tag = get_be32(pb) & 0xffffff00;
61
    tag = avio_rb32(pb) & 0xffffff00;
62 62

  
63 63
    if (tag == MKBETAG('C', 'W', 'S', 0)) {
64 64
        av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n");
......
66 66
    }
67 67
    if (tag != MKBETAG('F', 'W', 'S', 0))
68 68
        return AVERROR(EIO);
69
    get_le32(pb);
69
    avio_rl32(pb);
70 70
    /* skip rectangle size */
71
    nbits = get_byte(pb) >> 3;
71
    nbits = avio_r8(pb) >> 3;
72 72
    len = (4 * nbits - 3 + 7) / 8;
73 73
    url_fskip(pb, len);
74
    swf->frame_rate = get_le16(pb); /* 8.8 fixed */
75
    get_le16(pb); /* frame count */
74
    swf->frame_rate = avio_rl16(pb); /* 8.8 fixed */
75
    avio_rl16(pb); /* frame count */
76 76

  
77 77
    swf->samples_per_frame = 0;
78 78
    s->ctx_flags |= AVFMTCTX_NOHEADER;
......
92 92
        if (tag < 0)
93 93
            return AVERROR(EIO);
94 94
        if (tag == TAG_VIDEOSTREAM) {
95
            int ch_id = get_le16(pb);
95
            int ch_id = avio_rl16(pb);
96 96
            len -= 2;
97 97

  
98 98
            for (i=0; i<s->nb_streams; i++) {
......
101 101
                    goto skip;
102 102
            }
103 103

  
104
            get_le16(pb);
105
            get_le16(pb);
106
            get_le16(pb);
107
            get_byte(pb);
104
            avio_rl16(pb);
105
            avio_rl16(pb);
106
            avio_rl16(pb);
107
            avio_r8(pb);
108 108
            /* Check for FLV1 */
109 109
            vst = av_new_stream(s, ch_id);
110 110
            if (!vst)
111 111
                return -1;
112 112
            vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
113
            vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, get_byte(pb));
113
            vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb));
114 114
            av_set_pts_info(vst, 16, 256, swf->frame_rate);
115 115
            vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
116 116
            len -= 8;
......
124 124
                    goto skip;
125 125
            }
126 126

  
127
            get_byte(pb);
128
            v = get_byte(pb);
129
            swf->samples_per_frame = get_le16(pb);
127
            avio_r8(pb);
128
            v = avio_r8(pb);
129
            swf->samples_per_frame = avio_rl16(pb);
130 130
            ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */
131 131
            if (!ast)
132 132
                return -1;
......
141 141
            av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
142 142
            len -= 4;
143 143
        } else if (tag == TAG_VIDEOFRAME) {
144
            int ch_id = get_le16(pb);
144
            int ch_id = avio_rl16(pb);
145 145
            len -= 2;
146 146
            for(i=0; i<s->nb_streams; i++) {
147 147
                st = s->streams[i];
148 148
                if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) {
149
                    frame = get_le16(pb);
149
                    frame = avio_rl16(pb);
150 150
                    av_get_packet(pb, pkt, len-2);
151 151
                    pkt->pos = pos;
152 152
                    pkt->pts = frame;
......
185 185
                vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
186 186
                st = vst;
187 187
            }
188
            get_le16(pb); /* BITMAP_ID */
188
            avio_rl16(pb); /* BITMAP_ID */
189 189
            av_new_packet(pkt, len-2);
190
            get_buffer(pb, pkt->data, 4);
190
            avio_read(pb, pkt->data, 4);
191 191
            if (AV_RB32(pkt->data) == 0xffd8ffd9 ||
192 192
                AV_RB32(pkt->data) == 0xffd9ffd8) {
193 193
                /* old SWF files containing SOI/EOI as data start */
194 194
                /* files created by swink have reversed tag */
195 195
                pkt->size -= 4;
196
                get_buffer(pb, pkt->data, pkt->size);
196
                avio_read(pb, pkt->data, pkt->size);
197 197
            } else {
198
                get_buffer(pb, pkt->data + 4, pkt->size - 4);
198
                avio_read(pb, pkt->data + 4, pkt->size - 4);
199 199
            }
200 200
            pkt->pos = pos;
201 201
            pkt->stream_index = st->index;

Also available in: Unified diff