comparison avidec.c @ 982:c21f07d85158 libavformat

10l forgot to set packet_size
author michael
date Wed, 01 Mar 2006 15:21:53 +0000
parents 55519fa957c3
children 558381bf97d2
comparison
equal deleted inserted replaced
981:55519fa957c3 982:c21f07d85158
32 int remaining; 32 int remaining;
33 int packet_size; 33 int packet_size;
34 34
35 int scale; 35 int scale;
36 int rate; 36 int rate;
37 int sample_size; /* audio only data */ 37 int sample_size; /* size of one sample (or packet) (in the rate/scale sense) in bytes */
38 int start; 38 int start;
39 39
40 int64_t cum_len; /* temporary storage (used during seek) */ 40 int64_t cum_len; /* temporary storage (used during seek) */
41 41
42 int prefix; ///< normally 'd'<<8 + 'c' or 'w'<<8 + 'b' 42 int prefix; ///< normally 'd'<<8 + 'c' or 'w'<<8 + 'b'
472 int64_t pos= best_st->index_entries[i].pos; 472 int64_t pos= best_st->index_entries[i].pos;
473 pos += best_ast->packet_size - best_ast->remaining; 473 pos += best_ast->packet_size - best_ast->remaining;
474 url_fseek(&s->pb, pos + 8, SEEK_SET); 474 url_fseek(&s->pb, pos + 8, SEEK_SET);
475 // av_log(NULL, AV_LOG_DEBUG, "pos=%Ld\n", pos); 475 // av_log(NULL, AV_LOG_DEBUG, "pos=%Ld\n", pos);
476 476
477 assert(best_ast->remaining <= best_ast->packet_size);
478
477 avi->stream_index= best_stream_index; 479 avi->stream_index= best_stream_index;
478 if(!best_ast->remaining) 480 if(!best_ast->remaining)
481 best_ast->packet_size=
479 best_ast->remaining= best_st->index_entries[i].size; 482 best_ast->remaining= best_st->index_entries[i].size;
480 } 483 }
481 } 484 }
482 485
483 resync: 486 resync:
507 /* XXX: how to handle B frames in avi ? */ 510 /* XXX: how to handle B frames in avi ? */
508 pkt->dts = ast->frame_offset; 511 pkt->dts = ast->frame_offset;
509 // pkt->dts += ast->start; 512 // pkt->dts += ast->start;
510 if(ast->sample_size) 513 if(ast->sample_size)
511 pkt->dts /= ast->sample_size; 514 pkt->dts /= ast->sample_size;
512 //av_log(NULL, AV_LOG_DEBUG, "dts:%Ld offset:%d %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, n, size); 515 //av_log(NULL, AV_LOG_DEBUG, "dts:%Ld offset:%Ld %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, avi->stream_index, size);
513 pkt->stream_index = avi->stream_index; 516 pkt->stream_index = avi->stream_index;
514 517
515 if (st->codec->codec_type == CODEC_TYPE_VIDEO) { 518 if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
516 if(st->index_entries){ 519 if(st->index_entries){
517 AVIndexEntry *e; 520 AVIndexEntry *e;