It is wasteful to open the subdemuxer if an error occurs while initializing streams or reading IFO headers.
Unified · Split
| @@ -1565,9 +1565,9 @@ static int dvdvideo_read_header(AVFormatContext *s) · 1564 unmodified lines | |||
| 1565 | if ((ret = dvdvideo_ifo_open(s)) < 0 || | 1565 | if ((ret = dvdvideo_ifo_open(s)) < 0 || |
| 1566 | (c->opt_preindex && (ret = dvdvideo_chapters_setup_preindex(s)) < 0) || | 1566 | (c->opt_preindex && (ret = dvdvideo_chapters_setup_preindex(s)) < 0) || |
| 1567 | (ret = dvdvideo_menu_open(s, &c->play_state)) < 0 || | 1567 | (ret = dvdvideo_menu_open(s, &c->play_state)) < 0 || |
| 1568 | (ret = dvdvideo_subdemux_open(s)) < 0 || | ||
| 1569 | (ret = dvdvideo_video_stream_setup(s)) < 0 || | 1568 | (ret = dvdvideo_video_stream_setup(s)) < 0 || |
| 1570 | (ret = dvdvideo_audio_stream_add_all(s)) < 0) | 1569 | (ret = dvdvideo_audio_stream_add_all(s)) < 0 || |
| 1570 | (ret = dvdvideo_subdemux_open(s)) < 0) | ||
| 1571 | return ret; | 1571 | return ret; |
| 1572 | 1572 | ||
| 1573 | return 0; | 1573 | return 0; |
| @@ -1599,16 +1599,14 @@ static int dvdvideo_read_header(AVFormatContext *s) · 25 unmodified lines | |||
| 1599 | if (!c->opt_pgc && c->opt_preindex && (ret = dvdvideo_chapters_setup_preindex(s)) < 0) | 1599 | if (!c->opt_pgc && c->opt_preindex && (ret = dvdvideo_chapters_setup_preindex(s)) < 0) |
| 1600 | return ret; | 1600 | return ret; |
| 1601 | 1601 | ||
| 1602 | if ((ret = dvdvideo_play_open(s, &c->play_state)) < 0 || | 1602 | if ((ret = dvdvideo_play_open(s, &c->play_state)) < 0 || |
| 1603 | (ret = dvdvideo_subdemux_open(s)) < 0 || | 1603 | (!c->opt_pgc && !c->opt_preindex && (ret = dvdvideo_chapters_setup_simple(s)) < 0) || |
| 1604 | (ret = dvdvideo_video_stream_setup(s)) < 0 || | 1604 | (ret = dvdvideo_video_stream_setup(s)) < 0 || |
| 1605 | (ret = dvdvideo_audio_stream_add_all(s)) < 0 || | 1605 | (ret = dvdvideo_audio_stream_add_all(s)) < 0 || |
| 1606 | (ret = dvdvideo_subp_stream_add_all(s)) < 0) | 1606 | (ret = dvdvideo_subp_stream_add_all(s)) < 0 || |
| 1607 | (ret = dvdvideo_subdemux_open(s)) < 0) | ||
| 1607 | return ret; | 1608 | return ret; |
| 1608 | 1609 | ||
| 1609 | if (!c->opt_pgc && !c->opt_preindex) | ||
| 1610 | return dvdvideo_chapters_setup_simple(s); | ||
| 1611 | |||
| 1612 | return 0; | 1610 | return 0; |
| 1613 | } | 1611 | } |
| 1614 | 1612 | ||