Revision b7effd4e libavformat/bink.c

View differences:

libavformat/bink.c
82 82
    if (!vst)
83 83
        return AVERROR(ENOMEM);
84 84

  
85
    vst->codec->codec_tag = get_le32(pb);
85
    vst->codec->codec_tag = avio_rl32(pb);
86 86

  
87
    bink->file_size = get_le32(pb) + 8;
88
    vst->duration   = get_le32(pb);
87
    bink->file_size = avio_rl32(pb) + 8;
88
    vst->duration   = avio_rl32(pb);
89 89

  
90 90
    if (vst->duration > 1000000) {
91 91
        av_log(s, AV_LOG_ERROR, "invalid header: more than 1000000 frames\n");
92 92
        return AVERROR(EIO);
93 93
    }
94 94

  
95
    if (get_le32(pb) > bink->file_size) {
95
    if (avio_rl32(pb) > bink->file_size) {
96 96
        av_log(s, AV_LOG_ERROR,
97 97
               "invalid header: largest frame size greater than file size\n");
98 98
        return AVERROR(EIO);
......
100 100

  
101 101
    url_fskip(pb, 4);
102 102

  
103
    vst->codec->width  = get_le32(pb);
104
    vst->codec->height = get_le32(pb);
103
    vst->codec->width  = avio_rl32(pb);
104
    vst->codec->height = avio_rl32(pb);
105 105

  
106
    fps_num = get_le32(pb);
107
    fps_den = get_le32(pb);
106
    fps_num = avio_rl32(pb);
107
    fps_den = avio_rl32(pb);
108 108
    if (fps_num == 0 || fps_den == 0) {
109 109
        av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den);
110 110
        return AVERROR(EIO);
......
115 115
    vst->codec->codec_id   = CODEC_ID_BINKVIDEO;
116 116
    vst->codec->extradata  = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);
117 117
    vst->codec->extradata_size = 4;
118
    get_buffer(pb, vst->codec->extradata, 4);
118
    avio_read(pb, vst->codec->extradata, 4);
119 119

  
120
    bink->num_audio_tracks = get_le32(pb);
120
    bink->num_audio_tracks = avio_rl32(pb);
121 121

  
122 122
    if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) {
123 123
        av_log(s, AV_LOG_ERROR,
......
135 135
                return AVERROR(ENOMEM);
136 136
            ast->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
137 137
            ast->codec->codec_tag   = 0;
138
            ast->codec->sample_rate = get_le16(pb);
138
            ast->codec->sample_rate = avio_rl16(pb);
139 139
            av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
140
            flags = get_le16(pb);
140
            flags = avio_rl16(pb);
141 141
            ast->codec->codec_id = flags & BINK_AUD_USEDCT ?
142 142
                                   CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT;
143 143
            ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1;
......
147 147
    }
148 148

  
149 149
    /* frame index table */
150
    next_pos = get_le32(pb);
150
    next_pos = avio_rl32(pb);
151 151
    for (i = 0; i < vst->duration; i++) {
152 152
        pos = next_pos;
153 153
        if (i == vst->duration - 1) {
154 154
            next_pos = bink->file_size;
155 155
            keyframe = 0;
156 156
        } else {
157
            next_pos = get_le32(pb);
157
            next_pos = avio_rl32(pb);
158 158
            keyframe = pos & 1;
159 159
        }
160 160
        pos &= ~1;
......
201 201
    }
202 202

  
203 203
    while (bink->current_track < bink->num_audio_tracks) {
204
        uint32_t audio_size = get_le32(pb);
204
        uint32_t audio_size = avio_rl32(pb);
205 205
        if (audio_size > bink->remain_packet_size - 4) {
206 206
            av_log(s, AV_LOG_ERROR,
207 207
                   "frame %"PRId64": audio size in header (%u) > size of packet left (%u)\n",

Also available in: Unified diff