aboutsummaryrefslogtreecommitdiffstats
path: root/ffplay.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-02-23 17:35:44 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-02-23 17:35:44 +0000
commit9f7490a09c1e6736623c2909f045254fb6b31499 (patch)
tree01b4eaf5c6fcdf28d78153526986c065e611fef2 /ffplay.c
parent256ab3ed9d1b77e3a6d5dbb46b760908d1eceed4 (diff)
downloadffmpeg-9f7490a09c1e6736623c2909f045254fb6b31499.tar.gz
Also favor streams with more packets in ffplay.
Originally committed as revision 22008 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ffplay.c b/ffplay.c
index f79e3acb04..101f663ba1 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -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)