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