Revision e63a3628 libavformat/cafdec.c

View differences:

libavformat/cafdec.c
65 65

  
66 66
    /* parse format description */
67 67
    st->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
68
    st->codec->sample_rate = av_int2dbl(get_be64(pb));
69
    st->codec->codec_tag   = get_be32(pb);
70
    flags = get_be32(pb);
71
    caf->bytes_per_packet  = get_be32(pb);
68
    st->codec->sample_rate = av_int2dbl(avio_rb64(pb));
69
    st->codec->codec_tag   = avio_rb32(pb);
70
    flags = avio_rb32(pb);
71
    caf->bytes_per_packet  = avio_rb32(pb);
72 72
    st->codec->block_align = caf->bytes_per_packet;
73
    caf->frames_per_packet = get_be32(pb);
74
    st->codec->channels    = get_be32(pb);
75
    st->codec->bits_per_coded_sample = get_be32(pb);
73
    caf->frames_per_packet = avio_rb32(pb);
74
    st->codec->channels    = avio_rb32(pb);
75
    st->codec->bits_per_coded_sample = avio_rb32(pb);
76 76

  
77 77
    /* calculate bit rate for constant size packets */
78 78
    if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) {
......
127 127
        st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE);
128 128
        if (!st->codec->extradata)
129 129
            return AVERROR(ENOMEM);
130
        get_buffer(pb, st->codec->extradata, ALAC_HEADER);
130
        avio_read(pb, st->codec->extradata, ALAC_HEADER);
131 131
        st->codec->extradata_size = ALAC_HEADER;
132 132
        url_fskip(pb, size - ALAC_PREAMBLE - ALAC_HEADER);
133 133
    } else {
134 134
        st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
135 135
        if (!st->codec->extradata)
136 136
            return AVERROR(ENOMEM);
137
        get_buffer(pb, st->codec->extradata, size);
137
        avio_read(pb, st->codec->extradata, size);
138 138
        st->codec->extradata_size = size;
139 139
    }
140 140

  
......
152 152

  
153 153
    ccount = url_ftell(pb);
154 154

  
155
    num_packets = get_be64(pb);
155
    num_packets = avio_rb64(pb);
156 156
    if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets)
157 157
        return AVERROR_INVALIDDATA;
158 158

  
159
    st->nb_frames  = get_be64(pb); /* valid frames */
160
    st->nb_frames += get_be32(pb); /* priming frames */
161
    st->nb_frames += get_be32(pb); /* remainder frames */
159
    st->nb_frames  = avio_rb64(pb); /* valid frames */
160
    st->nb_frames += avio_rb32(pb); /* priming frames */
161
    st->nb_frames += avio_rb32(pb); /* remainder frames */
162 162

  
163 163
    st->duration = 0;
164 164
    for (i = 0; i < num_packets; i++) {
......
181 181
{
182 182
    AVIOContext *pb = s->pb;
183 183
    unsigned int i;
184
    unsigned int nb_entries = get_be32(pb);
184
    unsigned int nb_entries = avio_rb32(pb);
185 185
    for (i = 0; i < nb_entries; i++) {
186 186
        char key[32];
187 187
        char value[1024];
......
204 204
    url_fskip(pb, 8); /* magic, version, file flags */
205 205

  
206 206
    /* audio description chunk */
207
    if (get_be32(pb) != MKBETAG('d','e','s','c')) {
207
    if (avio_rb32(pb) != MKBETAG('d','e','s','c')) {
208 208
        av_log(s, AV_LOG_ERROR, "desc chunk not present\n");
209 209
        return AVERROR_INVALIDDATA;
210 210
    }
211
    size = get_be64(pb);
211
    size = avio_rb64(pb);
212 212
    if (size != 32)
213 213
        return AVERROR_INVALIDDATA;
214 214

  
......
226 226
        if (found_data && (caf->data_size < 0 || url_is_streamed(pb)))
227 227
            break;
228 228

  
229
        tag  = get_be32(pb);
230
        size = get_be64(pb);
229
        tag  = avio_rb32(pb);
230
        size = avio_rb64(pb);
231 231
        if (url_feof(pb))
232 232
            break;
233 233

  

Also available in: Unified diff