Revision ded3c7da

View differences:

libavformat/avidec.c
626 626
            pkt->stream_index = avi->stream_index;
627 627

  
628 628
            if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
629
                if(st->index_entries){
630 629
                    AVIndexEntry *e;
631 630
                    int index;
631
                assert(st->index_entries);
632 632

  
633 633
                    index= av_index_search_timestamp(st, pkt->dts, 0);
634 634
                    e= &st->index_entries[index];
......
637 637
                        if (e->flags & AVINDEX_KEYFRAME)
638 638
                            pkt->flags |= PKT_FLAG_KEY;
639 639
                    }
640
                } else {
641
                    /* if no index, better to say that all frames
642
                        are key frames */
643
                    pkt->flags |= PKT_FLAG_KEY;
644
                }
645 640
            } else {
646 641
                pkt->flags |= PKT_FLAG_KEY;
647 642
            }
......
735 730
            avi->stream_index= n;
736 731
            ast->packet_size= size + 8;
737 732
            ast->remaining= size;
733

  
734
            {
735
                uint64_t pos= url_ftell(pb) - 8;
736
                if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){
737
                    av_add_index_entry(st, pos, ast->frame_offset / FFMAX(1, ast->sample_size), size, 0, AVINDEX_KEYFRAME);
738
                }
739
            }
738 740
            goto resync;
739 741
          }
740 742
        }

Also available in: Unified diff