Revision b7effd4e libavformat/anm.c

View differences:

libavformat/anm.c
84 84
    int i, ret;
85 85

  
86 86
    url_fskip(pb, 4); /* magic number */
87
    if (get_le16(pb) != MAX_PAGES) {
87
    if (avio_rl16(pb) != MAX_PAGES) {
88 88
        av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
89 89
        return AVERROR_INVALIDDATA;
90 90
    }
91 91

  
92
    anm->nb_pages   = get_le16(pb);
93
    anm->nb_records = get_le32(pb);
92
    anm->nb_pages   = avio_rl16(pb);
93
    anm->nb_records = avio_rl32(pb);
94 94
    url_fskip(pb, 2); /* max records per page */
95
    anm->page_table_offset = get_le16(pb);
96
    if (get_le32(pb) != ANIM_TAG)
95
    anm->page_table_offset = avio_rl16(pb);
96
    if (avio_rl32(pb) != ANIM_TAG)
97 97
        return AVERROR_INVALIDDATA;
98 98

  
99 99
    /* video stream */
......
103 103
    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
104 104
    st->codec->codec_id   = CODEC_ID_ANM;
105 105
    st->codec->codec_tag  = 0; /* no fourcc */
106
    st->codec->width      = get_le16(pb);
107
    st->codec->height     = get_le16(pb);
108
    if (get_byte(pb) != 0)
106
    st->codec->width      = avio_rl16(pb);
107
    st->codec->height     = avio_rl16(pb);
108
    if (avio_r8(pb) != 0)
109 109
        goto invalid;
110 110
    url_fskip(pb, 1); /* frame rate multiplier info */
111 111

  
112 112
    /* ignore last delta record (used for looping) */
113
    if (get_byte(pb))  /* has_last_delta */
113
    if (avio_r8(pb))  /* has_last_delta */
114 114
        anm->nb_records = FFMAX(anm->nb_records - 1, 0);
115 115

  
116 116
    url_fskip(pb, 1); /* last_delta_valid */
117 117

  
118
    if (get_byte(pb) != 0)
118
    if (avio_r8(pb) != 0)
119 119
        goto invalid;
120 120

  
121
    if (get_byte(pb) != 1)
121
    if (avio_r8(pb) != 1)
122 122
        goto invalid;
123 123

  
124 124
    url_fskip(pb, 1); /* other recs per frame */
125 125

  
126
    if (get_byte(pb) != 1)
126
    if (avio_r8(pb) != 1)
127 127
        goto invalid;
128 128

  
129 129
    url_fskip(pb, 32); /* record_types */
130
    st->nb_frames = get_le32(pb);
131
    av_set_pts_info(st, 64, 1, get_le16(pb));
130
    st->nb_frames = avio_rl32(pb);
131
    av_set_pts_info(st, 64, 1, avio_rl16(pb));
132 132
    url_fskip(pb, 58);
133 133

  
134 134
    /* color cycling and palette data */
......
138 138
        ret = AVERROR(ENOMEM);
139 139
        goto close_and_return;
140 140
    }
141
    ret = get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
141
    ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size);
142 142
    if (ret < 0)
143 143
        goto close_and_return;
144 144

  
......
149 149

  
150 150
    for (i = 0; i < MAX_PAGES; i++) {
151 151
        Page *p = &anm->pt[i];
152
        p->base_record = get_le16(pb);
153
        p->nb_records  = get_le16(pb);
154
        p->size        = get_le16(pb);
152
        p->base_record = avio_rl16(pb);
153
        p->nb_records  = avio_rl16(pb);
154
        p->size        = avio_rl16(pb);
155 155
    }
156 156

  
157 157
    /* find page of first frame */
......
211 211
    tmp = url_ftell(pb);
212 212
    url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
213 213
              8 + anm->record * 2, SEEK_SET);
214
    record_size = get_le16(pb);
214
    record_size = avio_rl16(pb);
215 215
    url_fseek(pb, tmp, SEEK_SET);
216 216

  
217 217
    /* fetch record */

Also available in: Unified diff