mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Also favor streams with more packets in ffplay.
Originally committed as revision 22008 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
256ab3ed9d
commit
9f7490a09c
13
ffplay.c
13
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 = ¶ms;
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user