Revision 9f7490a0

View differences:

ffplay.c
209 209
static int audio_disable;
210 210
static int video_disable;
211 211
static int wanted_stream[CODEC_TYPE_NB]={
212
    [CODEC_TYPE_AUDIO]=0,
213
    [CODEC_TYPE_VIDEO]=0,
212
    [CODEC_TYPE_AUDIO]=-1,
213
    [CODEC_TYPE_VIDEO]=-1,
214 214
    [CODEC_TYPE_SUBTITLE]=-1,
215 215
};
216 216
static int seek_by_bytes=-1;
......
1981 1981
    int err, i, ret;
1982 1982
    int st_index[CODEC_TYPE_NB];
1983 1983
    int st_count[CODEC_TYPE_NB]={0};
1984
    int st_best_packet_count[CODEC_TYPE_NB];
1984 1985
    AVPacket pkt1, *pkt = &pkt1;
1985 1986
    AVFormatParameters params, *ap = &params;
1986 1987
    int eof=0;
......
1988 1989
    ic = avformat_alloc_context();
1989 1990

  
1990 1991
    memset(st_index, -1, sizeof(st_index));
1992
    memset(st_best_packet_count, -1, sizeof(st_best_packet_count));
1991 1993
    is->video_stream = -1;
1992 1994
    is->audio_stream = -1;
1993 1995
    is->subtitle_stream = -1;
......
2044 2046
    }
2045 2047

  
2046 2048
    for(i = 0; i < ic->nb_streams; i++) {
2047
        AVCodecContext *avctx = ic->streams[i]->codec;
2049
        AVStream *st= ic->streams[i];
2050
        AVCodecContext *avctx = st->codec;
2048 2051
        ic->streams[i]->discard = AVDISCARD_ALL;
2049 2052
        if(avctx->codec_type >= (unsigned)CODEC_TYPE_NB)
2050 2053
            exit(1);
2051 2054
        if(st_count[avctx->codec_type]++ != wanted_stream[avctx->codec_type] && wanted_stream[avctx->codec_type] >= 0)
2052 2055
            continue;
2053 2056

  
2057
        if(st_best_packet_count[avctx->codec_type] >= st->codec_info_nb_frames)
2058
            continue;
2059
        st_best_packet_count[avctx->codec_type]= st->codec_info_nb_frames;
2060

  
2054 2061
        switch(avctx->codec_type) {
2055 2062
        case CODEC_TYPE_AUDIO:
2056 2063
            if (!audio_disable)

Also available in: Unified diff