mirror of
https://github.com/mpv-player/mpv
synced 2024-12-11 09:25:56 +00:00
Try other demuxers if open() fails.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20309 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
a4a817a15f
commit
d4d22f49e9
@ -668,36 +668,41 @@ if (file_format) {
|
||||
fformat = demuxer_desc->type;
|
||||
if (fformat != 0) {
|
||||
if (fformat == demuxer_desc->type) {
|
||||
demuxer_t *demux2 = demuxer;
|
||||
// Move messages to demuxer detection code?
|
||||
mp_msg(MSGT_DEMUXER, MSGL_INFO, MSGTR_Detected_XXX_FileFormat, demuxer_desc->shortdesc);
|
||||
file_format = demuxer_desc->type = fformat;
|
||||
if (!demuxer->desc->open || (demux2 = demuxer->desc->open(demuxer))) {
|
||||
demuxer = demux2;
|
||||
goto dmx_open;
|
||||
}
|
||||
} else {
|
||||
// Format changed after check, recurse
|
||||
free_demuxer(demuxer);
|
||||
return demux_open_stream(stream, fformat, force,
|
||||
audio_id, video_id, dvdsub_id, filename);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
// Check failed for forced demuxer, quit
|
||||
free_demuxer(demuxer);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (demuxer)
|
||||
goto dmx_open;
|
||||
|
||||
// Test demuxers with safe file checks
|
||||
for (i = 0; (demuxer_desc = demuxer_list[i]); i++) {
|
||||
if (demuxer_desc->safe_check) {
|
||||
demuxer = new_demuxer(stream,demuxer_desc->type,audio_id,video_id,dvdsub_id,filename);
|
||||
if ((fformat = demuxer_desc->check_file(demuxer)) != 0) {
|
||||
if (fformat == demuxer_desc->type) {
|
||||
demuxer_t *demux2 = demuxer;
|
||||
mp_msg(MSGT_DEMUXER, MSGL_INFO, MSGTR_Detected_XXX_FileFormat, demuxer_desc->shortdesc);
|
||||
file_format = fformat;
|
||||
break;
|
||||
if (!demuxer->desc->open || (demux2 = demuxer->desc->open(demuxer))) {
|
||||
demuxer = demux2;
|
||||
goto dmx_open;
|
||||
}
|
||||
} else {
|
||||
if (fformat == DEMUXER_TYPE_PLAYLIST)
|
||||
return demuxer; // handled in mplayer.c
|
||||
@ -708,16 +713,12 @@ for (i = 0; (demuxer_desc = demuxer_list[i]); i++) {
|
||||
if(demuxer) return demuxer; // done!
|
||||
file_format = DEMUXER_TYPE_UNKNOWN;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
free_demuxer(demuxer);
|
||||
demuxer = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (demuxer)
|
||||
goto dmx_open;
|
||||
|
||||
// If no forced demuxer perform file extension based detection
|
||||
// Ok. We're over the stable detectable fileformats, the next ones are a bit
|
||||
// fuzzy. So by default (extension_parsing==1) try extension-based detection
|
||||
@ -740,9 +741,13 @@ for (i = 0; (demuxer_desc = demuxer_list[i]); i++) {
|
||||
demuxer = new_demuxer(stream,demuxer_desc->type,audio_id,video_id,dvdsub_id,filename);
|
||||
if ((fformat = demuxer_desc->check_file(demuxer)) != 0) {
|
||||
if (fformat == demuxer_desc->type) {
|
||||
demuxer_t *demux2 = demuxer;
|
||||
mp_msg(MSGT_DEMUXER, MSGL_INFO, MSGTR_Detected_XXX_FileFormat, demuxer_desc->shortdesc);
|
||||
file_format = fformat;
|
||||
break;
|
||||
if (!demuxer->desc->open || (demux2 = demuxer->desc->open(demuxer))) {
|
||||
demuxer = demux2;
|
||||
goto dmx_open;
|
||||
}
|
||||
} else {
|
||||
if (fformat == DEMUXER_TYPE_PLAYLIST)
|
||||
return demuxer; // handled in mplayer.c
|
||||
@ -753,27 +758,18 @@ for (i = 0; (demuxer_desc = demuxer_list[i]); i++) {
|
||||
if(demuxer) return demuxer; // done!
|
||||
file_format = DEMUXER_TYPE_UNKNOWN;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
free_demuxer(demuxer);
|
||||
demuxer = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============== Unknown, exiting... ===========================
|
||||
if(file_format==DEMUXER_TYPE_UNKNOWN || demuxer == NULL){
|
||||
//mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_FormatNotRecognized); // will be done by mplayer.c after fallback to playlist-parsing
|
||||
return NULL;
|
||||
}
|
||||
//====== File format recognized, set up these for compatibility: =========
|
||||
dmx_open:
|
||||
|
||||
demuxer->file_format=file_format;
|
||||
|
||||
if (demuxer->desc->open)
|
||||
if (!(demuxer = demuxer->desc->open(demuxer)))
|
||||
return NULL;
|
||||
|
||||
if ((sh_video=demuxer->video->sh) && sh_video->bih){
|
||||
int biComp=le2me_32(sh_video->bih->biCompression);
|
||||
mp_msg(MSGT_DEMUX,MSGL_INFO,"VIDEO: [%.4s] %dx%d %dbpp %5.3f fps %5.1f kbps (%4.1f kbyte/s)\n",
|
||||
|
Loading…
Reference in New Issue
Block a user