Commit baf402d9 authored by michael's avatar michael

Also favor streams with more packets in ffplay.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22008 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 1615b8de
......@@ -209,8 +209,8 @@ static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
static int audio_disable;
static int video_disable;
static int wanted_stream[CODEC_TYPE_NB]={
[CODEC_TYPE_AUDIO]=0,
[CODEC_TYPE_VIDEO]=0,
[CODEC_TYPE_AUDIO]=-1,
[CODEC_TYPE_VIDEO]=-1,
[CODEC_TYPE_SUBTITLE]=-1,
};
static int seek_by_bytes=-1;
......@@ -1981,6 +1981,7 @@ static int decode_thread(void *arg)
int err, i, ret;
int st_index[CODEC_TYPE_NB];
int st_count[CODEC_TYPE_NB]={0};
int st_best_packet_count[CODEC_TYPE_NB];
AVPacket pkt1, *pkt = &pkt1;
AVFormatParameters params, *ap = &params;
int eof=0;
......@@ -1988,6 +1989,7 @@ static int decode_thread(void *arg)
ic = avformat_alloc_context();
memset(st_index, -1, sizeof(st_index));
memset(st_best_packet_count, -1, sizeof(st_best_packet_count));
is->video_stream = -1;
is->audio_stream = -1;
is->subtitle_stream = -1;
......@@ -2044,13 +2046,18 @@ static int decode_thread(void *arg)
}
for(i = 0; i < ic->nb_streams; i++) {
AVCodecContext *avctx = ic->streams[i]->codec;
AVStream *st= ic->streams[i];
AVCodecContext *avctx = st->codec;
ic->streams[i]->discard = AVDISCARD_ALL;
if(avctx->codec_type >= (unsigned)CODEC_TYPE_NB)
exit(1);
if(st_count[avctx->codec_type]++ != wanted_stream[avctx->codec_type] && wanted_stream[avctx->codec_type] >= 0)
continue;
if(st_best_packet_count[avctx->codec_type] >= st->codec_info_nb_frames)
continue;
st_best_packet_count[avctx->codec_type]= st->codec_info_nb_frames;
switch(avctx->codec_type) {
case CODEC_TYPE_AUDIO:
if (!audio_disable)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment