Revision b7effd4e libavformat/ffmdec.c

View differences:

libavformat/ffmdec.c
95 95
            av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n");
96 96
            return -1;
97 97
        }
98
        state = (state << 8) | get_byte(s->pb);
98
        state = (state << 8) | avio_r8(s->pb);
99 99
    }
100 100
    return 0;
101 101
}
......
120 120
            if (url_ftell(pb) == ffm->file_size)
121 121
                url_fseek(pb, ffm->packet_size, SEEK_SET);
122 122
    retry_read:
123
            id = get_be16(pb); /* PACKET_ID */
123
            id = avio_rb16(pb); /* PACKET_ID */
124 124
            if (id != PACKET_ID)
125 125
                if (ffm_resync(s, id) < 0)
126 126
                    return -1;
127
            fill_size = get_be16(pb);
128
            ffm->dts = get_be64(pb);
129
            frame_offset = get_be16(pb);
130
            get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
127
            fill_size = avio_rb16(pb);
128
            ffm->dts = avio_rb64(pb);
129
            frame_offset = avio_rb16(pb);
130
            avio_read(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
131 131
            ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
132 132
            if (ffm->packet_end < ffm->packet || frame_offset < 0)
133 133
                return -1;
......
188 188

  
189 189
    ffm_seek1(s, pos);
190 190
    url_fskip(pb, 4);
191
    dts = get_be64(pb);
191
    dts = avio_rb64(pb);
192 192
#ifdef DEBUG_SEEK
193 193
    av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0);
194 194
#endif
......
273 273
    uint32_t tag;
274 274

  
275 275
    /* header */
276
    tag = get_le32(pb);
276
    tag = avio_rl32(pb);
277 277
    if (tag != MKTAG('F', 'F', 'M', '1'))
278 278
        goto fail;
279
    ffm->packet_size = get_be32(pb);
279
    ffm->packet_size = avio_rb32(pb);
280 280
    if (ffm->packet_size != FFM_PACKET_SIZE)
281 281
        goto fail;
282
    ffm->write_index = get_be64(pb);
282
    ffm->write_index = avio_rb64(pb);
283 283
    /* get also filesize */
284 284
    if (!url_is_streamed(pb)) {
285 285
        ffm->file_size = url_fsize(pb);
......
289 289
        ffm->file_size = (UINT64_C(1) << 63) - 1;
290 290
    }
291 291

  
292
    nb_streams = get_be32(pb);
293
    get_be32(pb); /* total bitrate */
292
    nb_streams = avio_rb32(pb);
293
    avio_rb32(pb); /* total bitrate */
294 294
    /* read each stream */
295 295
    for(i=0;i<nb_streams;i++) {
296 296
        char rc_eq_buf[128];
......
303 303

  
304 304
        codec = st->codec;
305 305
        /* generic info */
306
        codec->codec_id = get_be32(pb);
307
        codec->codec_type = get_byte(pb); /* codec_type */
308
        codec->bit_rate = get_be32(pb);
309
        st->quality = get_be32(pb);
310
        codec->flags = get_be32(pb);
311
        codec->flags2 = get_be32(pb);
312
        codec->debug = get_be32(pb);
306
        codec->codec_id = avio_rb32(pb);
307
        codec->codec_type = avio_r8(pb); /* codec_type */
308
        codec->bit_rate = avio_rb32(pb);
309
        st->quality = avio_rb32(pb);
310
        codec->flags = avio_rb32(pb);
311
        codec->flags2 = avio_rb32(pb);
312
        codec->debug = avio_rb32(pb);
313 313
        /* specific info */
314 314
        switch(codec->codec_type) {
315 315
        case AVMEDIA_TYPE_VIDEO:
316
            codec->time_base.num = get_be32(pb);
317
            codec->time_base.den = get_be32(pb);
318
            codec->width = get_be16(pb);
319
            codec->height = get_be16(pb);
320
            codec->gop_size = get_be16(pb);
321
            codec->pix_fmt = get_be32(pb);
322
            codec->qmin = get_byte(pb);
323
            codec->qmax = get_byte(pb);
324
            codec->max_qdiff = get_byte(pb);
325
            codec->qcompress = get_be16(pb) / 10000.0;
326
            codec->qblur = get_be16(pb) / 10000.0;
327
            codec->bit_rate_tolerance = get_be32(pb);
316
            codec->time_base.num = avio_rb32(pb);
317
            codec->time_base.den = avio_rb32(pb);
318
            codec->width = avio_rb16(pb);
319
            codec->height = avio_rb16(pb);
320
            codec->gop_size = avio_rb16(pb);
321
            codec->pix_fmt = avio_rb32(pb);
322
            codec->qmin = avio_r8(pb);
323
            codec->qmax = avio_r8(pb);
324
            codec->max_qdiff = avio_r8(pb);
325
            codec->qcompress = avio_rb16(pb) / 10000.0;
326
            codec->qblur = avio_rb16(pb) / 10000.0;
327
            codec->bit_rate_tolerance = avio_rb32(pb);
328 328
            codec->rc_eq = av_strdup(get_strz(pb, rc_eq_buf, sizeof(rc_eq_buf)));
329
            codec->rc_max_rate = get_be32(pb);
330
            codec->rc_min_rate = get_be32(pb);
331
            codec->rc_buffer_size = get_be32(pb);
332
            codec->i_quant_factor = av_int2dbl(get_be64(pb));
333
            codec->b_quant_factor = av_int2dbl(get_be64(pb));
334
            codec->i_quant_offset = av_int2dbl(get_be64(pb));
335
            codec->b_quant_offset = av_int2dbl(get_be64(pb));
336
            codec->dct_algo = get_be32(pb);
337
            codec->strict_std_compliance = get_be32(pb);
338
            codec->max_b_frames = get_be32(pb);
339
            codec->luma_elim_threshold = get_be32(pb);
340
            codec->chroma_elim_threshold = get_be32(pb);
341
            codec->mpeg_quant = get_be32(pb);
342
            codec->intra_dc_precision = get_be32(pb);
343
            codec->me_method = get_be32(pb);
344
            codec->mb_decision = get_be32(pb);
345
            codec->nsse_weight = get_be32(pb);
346
            codec->frame_skip_cmp = get_be32(pb);
347
            codec->rc_buffer_aggressivity = av_int2dbl(get_be64(pb));
348
            codec->codec_tag = get_be32(pb);
349
            codec->thread_count = get_byte(pb);
350
            codec->coder_type = get_be32(pb);
351
            codec->me_cmp = get_be32(pb);
352
            codec->partitions = get_be32(pb);
353
            codec->me_subpel_quality = get_be32(pb);
354
            codec->me_range = get_be32(pb);
355
            codec->keyint_min = get_be32(pb);
356
            codec->scenechange_threshold = get_be32(pb);
357
            codec->b_frame_strategy = get_be32(pb);
358
            codec->qcompress = av_int2dbl(get_be64(pb));
359
            codec->qblur = av_int2dbl(get_be64(pb));
360
            codec->max_qdiff = get_be32(pb);
361
            codec->refs = get_be32(pb);
362
            codec->directpred = get_be32(pb);
329
            codec->rc_max_rate = avio_rb32(pb);
330
            codec->rc_min_rate = avio_rb32(pb);
331
            codec->rc_buffer_size = avio_rb32(pb);
332
            codec->i_quant_factor = av_int2dbl(avio_rb64(pb));
333
            codec->b_quant_factor = av_int2dbl(avio_rb64(pb));
334
            codec->i_quant_offset = av_int2dbl(avio_rb64(pb));
335
            codec->b_quant_offset = av_int2dbl(avio_rb64(pb));
336
            codec->dct_algo = avio_rb32(pb);
337
            codec->strict_std_compliance = avio_rb32(pb);
338
            codec->max_b_frames = avio_rb32(pb);
339
            codec->luma_elim_threshold = avio_rb32(pb);
340
            codec->chroma_elim_threshold = avio_rb32(pb);
341
            codec->mpeg_quant = avio_rb32(pb);
342
            codec->intra_dc_precision = avio_rb32(pb);
343
            codec->me_method = avio_rb32(pb);
344
            codec->mb_decision = avio_rb32(pb);
345
            codec->nsse_weight = avio_rb32(pb);
346
            codec->frame_skip_cmp = avio_rb32(pb);
347
            codec->rc_buffer_aggressivity = av_int2dbl(avio_rb64(pb));
348
            codec->codec_tag = avio_rb32(pb);
349
            codec->thread_count = avio_r8(pb);
350
            codec->coder_type = avio_rb32(pb);
351
            codec->me_cmp = avio_rb32(pb);
352
            codec->partitions = avio_rb32(pb);
353
            codec->me_subpel_quality = avio_rb32(pb);
354
            codec->me_range = avio_rb32(pb);
355
            codec->keyint_min = avio_rb32(pb);
356
            codec->scenechange_threshold = avio_rb32(pb);
357
            codec->b_frame_strategy = avio_rb32(pb);
358
            codec->qcompress = av_int2dbl(avio_rb64(pb));
359
            codec->qblur = av_int2dbl(avio_rb64(pb));
360
            codec->max_qdiff = avio_rb32(pb);
361
            codec->refs = avio_rb32(pb);
362
            codec->directpred = avio_rb32(pb);
363 363
            break;
364 364
        case AVMEDIA_TYPE_AUDIO:
365
            codec->sample_rate = get_be32(pb);
366
            codec->channels = get_le16(pb);
367
            codec->frame_size = get_le16(pb);
368
            codec->sample_fmt = (int16_t) get_le16(pb);
365
            codec->sample_rate = avio_rb32(pb);
366
            codec->channels = avio_rl16(pb);
367
            codec->frame_size = avio_rl16(pb);
368
            codec->sample_fmt = (int16_t) avio_rl16(pb);
369 369
            break;
370 370
        default:
371 371
            goto fail;
372 372
        }
373 373
        if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) {
374
            codec->extradata_size = get_be32(pb);
374
            codec->extradata_size = avio_rb32(pb);
375 375
            codec->extradata = av_malloc(codec->extradata_size);
376 376
            if (!codec->extradata)
377 377
                return AVERROR(ENOMEM);
378
            get_buffer(pb, codec->extradata, codec->extradata_size);
378
            avio_read(pb, codec->extradata, codec->extradata_size);
379 379
        }
380 380
    }
381 381

  
382 382
    /* get until end of block reached */
383 383
    while ((url_ftell(pb) % ffm->packet_size) != 0)
384
        get_byte(pb);
384
        avio_r8(pb);
385 385

  
386 386
    /* init packet demux */
387 387
    ffm->packet_ptr = ffm->packet;

Also available in: Unified diff