Revision 14d194d5

View differences:

libavformat/utils.c
1006 1006
    return index;
1007 1007
}
1008 1008

  
1009
/**
1010
 * build an index for raw streams using a parser.
1011
 */
1012
static void av_build_index_raw(AVFormatContext *s)
1013
{
1014
    AVPacket pkt1, *pkt = &pkt1;
1015
    int ret;
1016
    AVStream *st;
1017

  
1018
    st = s->streams[0];
1019
    av_read_frame_flush(s);
1020
    url_fseek(&s->pb, s->data_offset, SEEK_SET);
1021

  
1022
    for(;;) {
1023
        ret = av_read_frame(s, pkt);
1024
        if (ret < 0)
1025
            break;
1026
        if (pkt->stream_index == 0 && st->parser &&
1027
            (pkt->flags & PKT_FLAG_KEY)) {
1028
            av_add_index_entry(st, st->parser->frame_offset, pkt->dts,
1029
                            0, 0, AVINDEX_KEYFRAME);
1030
        }
1031
        av_free_packet(pkt);
1032
    }
1033
}
1034

  
1035
/**
1036
 * Returns TRUE if we deal with a raw stream.
1037
 *
1038
 * Raw codec data and parsing needed.
1039
 */
1040
static int is_raw_stream(AVFormatContext *s)
1041
{
1042
    AVStream *st;
1043

  
1044
    if (s->nb_streams != 1)
1045
        return 0;
1046
    st = s->streams[0];
1047
    if (!st->need_parsing)
1048
        return 0;
1049
    return 1;
1050
}
1051

  
1052 1009
int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp,
1053 1010
                              int flags)
1054 1011
{

Also available in: Unified diff