mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2025-01-04 09:15:05 +00:00
mmg outputs a more informative error message for known but unsupported input file types (e.g. ASF, FLV, MPEG TS) instead of the cryptic "file identification failed".
This commit is contained in:
parent
0de4e02cc4
commit
3cf5067d9c
@ -1,5 +1,9 @@
|
||||
2008-08-19 Moritz Bunkus <moritz@bunkus.org>
|
||||
|
||||
* mkvmerge: enhancement: mmg outputs a more informative error
|
||||
message for known but unsupported input file types (e.g. ASF, FLV,
|
||||
MPEG TS) instead of the cryptic "file identification failed".
|
||||
|
||||
* mkvmerge: bug fix: The VobSub reader would sometimes read too
|
||||
many bytes for a single SPU packet. Part of a fix for bug 245.
|
||||
|
||||
|
@ -33,7 +33,7 @@ asf_reader_c::probe_file(mm_io_c *io,
|
||||
io->setFilePointer(0, seek_beginning);
|
||||
|
||||
if (get_uint32_be(buf) == 0x3026b275) {
|
||||
mxerror(mxsprintf("The file '%s' is an ASF/WMV container which is not supported by mkvmerge.\n", io->get_file_name().c_str()).c_str());
|
||||
id_result_container_unsupported(io->get_file_name(), "Windows Media (ASF/WMV)");
|
||||
// Never reached:
|
||||
return 1;
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ flac_reader_c::probe_file(mm_io_c *io,
|
||||
}
|
||||
if (strncmp((char *)data, "fLaC", 4))
|
||||
return 0;
|
||||
mxerror("mkvmerge has not been compiled with FLAC support.\n");
|
||||
id_result_container_unsupported(io->get_file_name(), "FLAC");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -102,9 +102,12 @@ protected:
|
||||
|
||||
#else // HAVE_FLAC_FORMAT_H
|
||||
|
||||
class flac_reader_c {
|
||||
class flac_reader_c: public generic_reader_c {
|
||||
public:
|
||||
static int probe_file(mm_io_c *file, int64_t size);
|
||||
|
||||
public:
|
||||
flac_reader_c(track_info_c &n_ti): generic_reader_c(n_ti) { };
|
||||
};
|
||||
|
||||
#endif // HAVE_FLAC_FORMAT_H
|
||||
|
@ -33,7 +33,7 @@ flv_reader_c::probe_file(mm_io_c *io,
|
||||
io->setFilePointer(0, seek_beginning);
|
||||
|
||||
if (!memcmp(buf, "FLV", 3)) {
|
||||
mxerror(mxsprintf("The file '%s' is a Macromedia Flash Video (FLV) container which is not supported by mkvmerge.\n", io->get_file_name().c_str()).c_str());
|
||||
id_result_container_unsupported(io->get_file_name(), "Macromedia Flash Video (FLV)");
|
||||
// Never reached:
|
||||
return 1;
|
||||
}
|
||||
|
@ -1380,8 +1380,11 @@ mpeg_ts_reader_c::probe_file(mm_io_c *io,
|
||||
++num_startcodes;
|
||||
}
|
||||
|
||||
if (TS_CONSECUTIVE_PACKETS <= num_startcodes)
|
||||
if (TS_CONSECUTIVE_PACKETS <= num_startcodes) {
|
||||
id_result_container_unsupported(io->get_file_name(), "MPEG Transport Stream (TS)");
|
||||
// Never reached:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,12 +163,15 @@ private:
|
||||
void init_reader();
|
||||
};
|
||||
|
||||
class mpeg_ts_reader_c {
|
||||
class mpeg_ts_reader_c: public generic_reader_c {
|
||||
protected:
|
||||
static int potential_packet_sizes[];
|
||||
|
||||
public:
|
||||
static bool probe_file(mm_io_c *io, int64_t size);
|
||||
|
||||
public:
|
||||
mpeg_ts_reader_c(track_info_c &n_ti): generic_reader_c(n_ti) { };
|
||||
};
|
||||
|
||||
#endif // __R_MPEG_H
|
||||
|
@ -359,14 +359,14 @@ identify(const string &filename) {
|
||||
track_info_c ti;
|
||||
filelist_t file;
|
||||
|
||||
file.name = filename;
|
||||
get_file_type(file);
|
||||
ti.fname = file.name;
|
||||
verbose = 0;
|
||||
suppress_warnings = true;
|
||||
identifying = true;
|
||||
file.name = filename;
|
||||
|
||||
if (FILE_TYPE_MPEG_TS == file.type)
|
||||
mxerror(_("The file '%s' has been detected as a MPEG transport stream. "
|
||||
"This file format is not supported by mkvmerge.\n"),
|
||||
file.name.c_str());
|
||||
get_file_type(file);
|
||||
|
||||
ti.fname = file.name;
|
||||
|
||||
if (file.type == FILE_TYPE_IS_UNKNOWN)
|
||||
mxerror(_("File %s has unknown type. Please have a look "
|
||||
@ -379,9 +379,6 @@ identify(const string &filename) {
|
||||
|
||||
files.push_back(file);
|
||||
|
||||
verbose = 0;
|
||||
identifying = true;
|
||||
suppress_warnings = true;
|
||||
create_readers();
|
||||
|
||||
files[0].reader->identify();
|
||||
|
@ -1400,6 +1400,16 @@ generic_reader_c::flush_packetizers() {
|
||||
(*it)->flush();
|
||||
}
|
||||
|
||||
void
|
||||
generic_reader_c::id_result_container_unsupported(const string &filename,
|
||||
const string &info) {
|
||||
if (identifying) {
|
||||
mxinfo("File '%s': unsupported container: %s\n", filename.c_str(), info.c_str());
|
||||
mxexit(3);
|
||||
} else
|
||||
mxerror("The file '%s' is a non-supported file type (%s).\n", filename.c_str(), info.c_str());
|
||||
}
|
||||
|
||||
void
|
||||
generic_reader_c::id_result_container(const string &info,
|
||||
const string &verbose_info) {
|
||||
|
@ -296,6 +296,8 @@ protected:
|
||||
virtual void id_result_track(int64_t track_id, const string &type, const string &info, const string &verbose_info = empty_string);
|
||||
virtual void id_result_track(int64_t track_id, const string &type, const string &info, const vector<string> &verbose_info);
|
||||
virtual void id_result_attachment(int64_t attachment_id, const string &type, int size, const string &file_name = empty_string, const string &description = empty_string);
|
||||
|
||||
static void id_result_container_unsupported(const string &filename, const string &info);
|
||||
};
|
||||
|
||||
enum connection_result_e {
|
||||
|
@ -365,7 +365,21 @@ tab_input::add_file(const wxString &file_name,
|
||||
wxLogMessage(wxT("identify 1: errors[%d]: ``%s''"), i, errors[i].c_str());
|
||||
|
||||
wxRemoveFile(opt_file_name);
|
||||
if ((result < 0) || (result > 1)) {
|
||||
|
||||
if (3 == result) {
|
||||
wxString container = wxT("unknown");
|
||||
|
||||
if (output.Count() && (0 <= (pos = output[0].Find(wxT("container:")))))
|
||||
container = output[0].Mid(pos + 11);
|
||||
|
||||
wxString info;
|
||||
info.Printf(wxT("The file is an unsupported container format (%s)."), container.c_str());
|
||||
break_line(info, 60);
|
||||
|
||||
wxMessageBox(info, wxT("Unsupported format"), wxOK | wxCENTER | wxICON_ERROR);
|
||||
return;
|
||||
|
||||
} else if ((0 > result) || (1 < result)) {
|
||||
name.Printf(wxT("File identification failed for '%s'. Return code: "
|
||||
"%d\n\n"), file_name.c_str(), result);
|
||||
for (i = 0; i < output.Count(); i++)
|
||||
@ -376,7 +390,8 @@ tab_input::add_file(const wxString &file_name,
|
||||
wxMessageBox(name, wxT("File identification failed"), wxOK | wxCENTER |
|
||||
wxICON_ERROR);
|
||||
return;
|
||||
} else if (result > 0) {
|
||||
|
||||
} else if (0 < result) {
|
||||
name.Printf(wxT("File identification failed. Return code: %d. Errno: %d "
|
||||
"(%s). Make sure that you've selected a mkvmerge "
|
||||
"executable on the 'settings' tab."), result, errno,
|
||||
|
Loading…
Reference in New Issue
Block a user