History

Use av_find_best_stream in ffplay.

Originally committed as revision 26105 to svn://svn.ffmpeg.org/ffmpeg/trunk

Nicolas George committed 15 years ago

Commit 406f0f11 parent 9128ae01 file · +18 −28Browse files

Unified · Split

ffplay.c+18−28
@@ -2398,8 +2398,6 @@ static int decode_thread(void *arg) · 2397 unmodified lines
2398 AVFormatContext *ic;2398 AVFormatContext *ic;
2399 int err, i, ret;2399 int err, i, ret;
2400 int st_index[AVMEDIA_TYPE_NB];2400 int st_index[AVMEDIA_TYPE_NB];
2401 int st_count[AVMEDIA_TYPE_NB]={0};
2402 int st_best_packet_count[AVMEDIA_TYPE_NB];
2403 AVPacket pkt1, *pkt = &pkt1;2401 AVPacket pkt1, *pkt = &pkt1;
2404 AVFormatParameters params, *ap = &params;2402 AVFormatParameters params, *ap = &params;
2405 int eof=0;2403 int eof=0;
@@ -2408,7 +2406,6 @@ static int decode_thread(void *arg) · 2 unmodified lines
2408 ic = avformat_alloc_context();2406 ic = avformat_alloc_context();
2409 2407
2410 memset(st_index, -1, sizeof(st_index));2408 memset(st_index, -1, sizeof(st_index));
2411 memset(st_best_packet_count, -1, sizeof(st_best_packet_count));
2412 is->video_stream = -1;2409 is->video_stream = -1;
2413 is->audio_stream = -1;2410 is->audio_stream = -1;
2414 is->subtitle_stream = -1;2411 is->subtitle_stream = -1;
@@ -2464,32 +2461,25 @@ static int decode_thread(void *arg) · 49 unmodified lines
2464 }2461 }
2465 }2462 }
2466 2463
2467 for(i = 0; i < ic->nb_streams; i++) {2464 for (i = 0; i < ic->nb_streams; i++)
2468 AVStream *st= ic->streams[i];
2469 AVCodecContext *avctx = st->codec;
2470 ic->streams[i]->discard = AVDISCARD_ALL;2465 ic->streams[i]->discard = AVDISCARD_ALL;
2471 if(avctx->codec_type >= (unsigned)AVMEDIA_TYPE_NB)2466 if (!audio_disable)
2472 continue;2467 st_index[AVMEDIA_TYPE_VIDEO] =
2473 if(st_count[avctx->codec_type]++ != wanted_stream[avctx->codec_type] && wanted_stream[avctx->codec_type] >= 0)2468 av_find_best_stream(ic, AVMEDIA_TYPE_VIDEO,
2474 continue;2469 wanted_stream[AVMEDIA_TYPE_VIDEO], -1, NULL, 0);
2475 2470 if (!video_disable) {
2476 if(st_best_packet_count[avctx->codec_type] >= st->codec_info_nb_frames)2471 st_index[AVMEDIA_TYPE_AUDIO] =
2477 continue;2472 av_find_best_stream(ic, AVMEDIA_TYPE_AUDIO,
2478 st_best_packet_count[avctx->codec_type]= st->codec_info_nb_frames;2473 wanted_stream[AVMEDIA_TYPE_AUDIO],
2479 2474 st_index[AVMEDIA_TYPE_VIDEO],
2480 switch(avctx->codec_type) {2475 NULL, 0);
2481 case AVMEDIA_TYPE_AUDIO:2476 st_index[AVMEDIA_TYPE_SUBTITLE] =
2482 if (!audio_disable)2477 av_find_best_stream(ic, AVMEDIA_TYPE_SUBTITLE,
2483 st_index[AVMEDIA_TYPE_AUDIO] = i;2478 wanted_stream[AVMEDIA_TYPE_SUBTITLE],
2484 break;2479 (st_index[AVMEDIA_TYPE_AUDIO] >= 0 ?
2485 case AVMEDIA_TYPE_VIDEO:2480 st_index[AVMEDIA_TYPE_AUDIO] :
2486 case AVMEDIA_TYPE_SUBTITLE:2481 st_index[AVMEDIA_TYPE_VIDEO]),
2487 if (!video_disable)2482 NULL, 0);
2488 st_index[avctx->codec_type] = i;
2489 break;
2490 default:
2491 break;
2492 }
2493 }2483 }
2494 if (show_status) {2484 if (show_status) {
2495 dump_format(ic, 0, is->filename, 0);2485 dump_format(ic, 0, is->filename, 0);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t