mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
Fixes for mingw which uses the MS C library which in turn treats %lld and %llu as %ld and %lu respectively.
This commit is contained in:
parent
3a8caabf0b
commit
4a257a51b1
@ -63,10 +63,12 @@ using namespace libmatroska;
|
||||
|
||||
static void chapter_error(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
string new_fmt;
|
||||
|
||||
mxprint(stderr, "Error parsing chapters: ");
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fix_format(fmt, new_fmt);
|
||||
vfprintf(stderr, new_fmt.c_str(), ap);
|
||||
va_end(ap);
|
||||
mxprint(stderr, "\n");
|
||||
exit(1);
|
||||
|
@ -1009,11 +1009,63 @@ void debug_c::dump_info() {
|
||||
/*
|
||||
* Other related news
|
||||
*/
|
||||
|
||||
void fix_format(const char *fmt, string &new_fmt) {
|
||||
#if defined(COMP_MINGW) || defined(COMP_MSC)
|
||||
int i, len;
|
||||
bool state;
|
||||
|
||||
new_fmt = "";
|
||||
len = strlen(fmt);
|
||||
state = false;
|
||||
for (i = 0; i < len; i++) {
|
||||
if (fmt[i] == '%') {
|
||||
state = !state;
|
||||
new_fmt += '%';
|
||||
|
||||
} else if (!state)
|
||||
new_fmt += fmt[i];
|
||||
|
||||
else {
|
||||
if (((i + 3) <= len) && (fmt[i] == 'l') && (fmt[i + 1] == 'l') &&
|
||||
((fmt[i + 2] == 'u') || (fmt[i + 2] == 'd'))) {
|
||||
new_fmt += "I64";
|
||||
new_fmt += fmt[i + 2];
|
||||
i += 2;
|
||||
state = false;
|
||||
|
||||
} else {
|
||||
new_fmt += fmt[i];
|
||||
if (isalpha(fmt[i]))
|
||||
state = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
new_fmt = fmt;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void mxprint(void *stream, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
string new_fmt;
|
||||
|
||||
fix_format(fmt, new_fmt);
|
||||
va_start(ap, fmt);
|
||||
vfprintf((FILE *)stream, fmt, ap);
|
||||
vfprintf((FILE *)stream, new_fmt.c_str(), ap);
|
||||
fflush((FILE *)stream);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void mxprints(char *dst, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
string new_fmt;
|
||||
|
||||
fix_format(fmt, new_fmt);
|
||||
va_start(ap, fmt);
|
||||
vsprintf(dst, new_fmt.c_str(), ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -72,6 +72,8 @@ using namespace libebml;
|
||||
|
||||
void die(const char *fmt, ...);
|
||||
void mxprint(void *stream, const char *fmt, ...);
|
||||
void mxprints(char *dst, const char *fmt, ...);
|
||||
void fix_format(const char *fmt, string &new_fmt);
|
||||
|
||||
#define trace() _trace(__func__, __FILE__, __LINE__)
|
||||
void _trace(const char *func, const char *file, int line);
|
||||
|
@ -275,6 +275,7 @@ static char args_buffer[ARGS_BUFFER_LEN];
|
||||
void show_element(EbmlElement *l, int level, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
char level_buffer[10];
|
||||
string new_fmt;
|
||||
|
||||
if (level > 9)
|
||||
die("mkvextract.cpp/show_element(): level > 9: %d", level);
|
||||
@ -282,9 +283,10 @@ void show_element(EbmlElement *l, int level, const char *fmt, ...) {
|
||||
if (verbose == 0)
|
||||
return;
|
||||
|
||||
fix_format(fmt, new_fmt);
|
||||
va_start(ap, fmt);
|
||||
args_buffer[ARGS_BUFFER_LEN - 1] = 0;
|
||||
vsnprintf(args_buffer, ARGS_BUFFER_LEN - 1, fmt, ap);
|
||||
vsnprintf(args_buffer, ARGS_BUFFER_LEN - 1, new_fmt.c_str(), ap);
|
||||
va_end(ap);
|
||||
|
||||
memset(&level_buffer[1], ' ', 9);
|
||||
@ -298,10 +300,12 @@ void show_element(EbmlElement *l, int level, const char *fmt, ...) {
|
||||
|
||||
void show_error(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
string new_fmt;
|
||||
|
||||
fix_format(fmt, new_fmt);
|
||||
va_start(ap, fmt);
|
||||
args_buffer[ARGS_BUFFER_LEN - 1] = 0;
|
||||
vsnprintf(args_buffer, ARGS_BUFFER_LEN - 1, fmt, ap);
|
||||
vsnprintf(args_buffer, ARGS_BUFFER_LEN - 1, new_fmt.c_str(), ap);
|
||||
va_end(ap);
|
||||
|
||||
mxprint(stderr, "(%s) %s\n", NAME, args_buffer);
|
||||
|
@ -484,17 +484,17 @@ static void handle_data(KaxBlock *block, int64_t block_duration,
|
||||
s[len + 2] = 0;
|
||||
|
||||
// Print the entry's number.
|
||||
sprintf(buffer, "%d\n", tracks[i].srt_num);
|
||||
mxprints(buffer, "%d\n", tracks[i].srt_num);
|
||||
tracks[i].srt_num++;
|
||||
tracks[i].out->write(buffer, strlen(buffer));
|
||||
|
||||
// Print the timestamps.
|
||||
sprintf(buffer, "%02lld:%02lld:%02lld,%03lld --> %02lld:%02lld:%02lld,"
|
||||
"%03lld\n",
|
||||
start / 1000 / 60 / 60, (start / 1000 / 60) % 60,
|
||||
(start / 1000) % 60, start % 1000,
|
||||
end / 1000 / 60 / 60, (end / 1000 / 60) % 60,
|
||||
(end / 1000) % 60, end % 1000);
|
||||
mxprints(buffer, "%02lld:%02lld:%02lld,%03lld --> %02lld:%02lld:"
|
||||
"%02lld,%03lld\n",
|
||||
start / 1000 / 60 / 60, (start / 1000 / 60) % 60,
|
||||
(start / 1000) % 60, start % 1000,
|
||||
end / 1000 / 60 / 60, (end / 1000 / 60) % 60,
|
||||
(end / 1000) % 60, end % 1000);
|
||||
tracks[i].out->write(buffer, strlen(buffer));
|
||||
|
||||
// Print the text itself.
|
||||
@ -534,14 +534,14 @@ static void handle_data(KaxBlock *block, int64_t block_duration,
|
||||
line = string("Dialogue: Marked=0,");
|
||||
|
||||
// Append the start and end time.
|
||||
sprintf(buffer, "%lld:%02lld:%02lld.%02lld",
|
||||
start / 1000 / 60 / 60, (start / 1000 / 60) % 60,
|
||||
(start / 1000) % 60, (start % 1000) / 10);
|
||||
mxprints(buffer, "%lld:%02lld:%02lld.%02lld",
|
||||
start / 1000 / 60 / 60, (start / 1000 / 60) % 60,
|
||||
(start / 1000) % 60, (start % 1000) / 10);
|
||||
line += string(buffer) + comma;
|
||||
|
||||
sprintf(buffer, "%lld:%02lld:%02lld.%02lld",
|
||||
end / 1000 / 60 / 60, (end / 1000 / 60) % 60,
|
||||
(end / 1000) % 60, (end % 1000) / 10);
|
||||
mxprints(buffer, "%lld:%02lld:%02lld.%02lld",
|
||||
end / 1000 / 60 / 60, (end / 1000 / 60) % 60,
|
||||
(end / 1000) % 60, (end % 1000) / 10);
|
||||
line += string(buffer) + comma;
|
||||
|
||||
// Append the other fields.
|
||||
@ -1002,14 +1002,14 @@ bool extract_tracks(const char *file_name) {
|
||||
alBITMAPINFOHEADER *bih =
|
||||
(alBITMAPINFOHEADER *)&binary(c_priv);
|
||||
unsigned char *fcc = (unsigned char *)&bih->bi_compression;
|
||||
sprintf(pbuffer, " (FourCC: %c%c%c%c, 0x%08x)",
|
||||
fcc[0], fcc[1], fcc[2], fcc[3],
|
||||
get_uint32(&bih->bi_compression));
|
||||
mxprints(pbuffer, " (FourCC: %c%c%c%c, 0x%08x)",
|
||||
fcc[0], fcc[1], fcc[2], fcc[3],
|
||||
get_uint32(&bih->bi_compression));
|
||||
} else if (ms_compat && (kax_track_type == 'a') &&
|
||||
(c_priv.GetSize() >= sizeof(alWAVEFORMATEX))) {
|
||||
alWAVEFORMATEX *wfe = (alWAVEFORMATEX *)&binary(c_priv);
|
||||
sprintf(pbuffer, " (format tag: 0x%04x)",
|
||||
get_uint16(&wfe->w_format_tag));
|
||||
mxprints(pbuffer, " (format tag: 0x%04x)",
|
||||
get_uint16(&wfe->w_format_tag));
|
||||
} else
|
||||
pbuffer[0] = 0;
|
||||
show_element(l3, 3, "CodecPrivate, length %llu%s",
|
||||
|
@ -140,10 +140,12 @@ static char args_buffer[ARGS_BUFFER_LEN];
|
||||
|
||||
void show_error(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
string new_fmt;
|
||||
|
||||
fix_format(fmt, new_fmt);
|
||||
va_start(ap, fmt);
|
||||
args_buffer[ARGS_BUFFER_LEN - 1] = 0;
|
||||
vsnprintf(args_buffer, ARGS_BUFFER_LEN - 1, fmt, ap);
|
||||
vsnprintf(args_buffer, ARGS_BUFFER_LEN - 1, new_fmt.c_str(), ap);
|
||||
va_end(ap);
|
||||
|
||||
#ifdef HAVE_WXWINDOWS
|
||||
@ -158,13 +160,15 @@ void _show_element(EbmlElement *l, EbmlStream *es, bool skip, int level,
|
||||
const char *fmt, ...) {
|
||||
va_list ap;
|
||||
char level_buffer[10];
|
||||
string new_fmt;
|
||||
|
||||
if (level > 9)
|
||||
die("mkvinfo.cpp/show_element(): level > 9: %d", level);
|
||||
|
||||
fix_format(fmt, new_fmt);
|
||||
va_start(ap, fmt);
|
||||
args_buffer[ARGS_BUFFER_LEN - 1] = 0;
|
||||
vsnprintf(args_buffer, ARGS_BUFFER_LEN - 1, fmt, ap);
|
||||
vsnprintf(args_buffer, ARGS_BUFFER_LEN - 1, new_fmt.c_str(), ap);
|
||||
va_end(ap);
|
||||
|
||||
if (!use_gui) {
|
||||
@ -179,8 +183,8 @@ void _show_element(EbmlElement *l, EbmlStream *es, bool skip, int level,
|
||||
#ifdef HAVE_WXWINDOWS
|
||||
else {
|
||||
if (l != NULL)
|
||||
sprintf(&args_buffer[strlen(args_buffer)], " at %llu",
|
||||
l->GetElementPosition());
|
||||
mxprints(&args_buffer[strlen(args_buffer)], " at %llu",
|
||||
l->GetElementPosition());
|
||||
frame->add_item(level, args_buffer);
|
||||
}
|
||||
#endif // HAVE_WXWINDOWS
|
||||
@ -515,7 +519,7 @@ bool process_file(const char *file_name) {
|
||||
const unsigned char *b = (const unsigned char *)&binary(uid);
|
||||
buffer[0] = 0;
|
||||
for (i = 0; i < uid.GetSize(); i++)
|
||||
sprintf(&buffer[strlen(buffer)], " 0x%02x", b[i]);
|
||||
mxprints(&buffer[strlen(buffer)], " 0x%02x", b[i]);
|
||||
show_element(l2, 2, "Segment UID:%s", buffer);
|
||||
|
||||
} else if (EbmlId(*l2) == KaxPrevUID::ClassInfos.GlobalId) {
|
||||
@ -525,7 +529,7 @@ bool process_file(const char *file_name) {
|
||||
const unsigned char *b = (const unsigned char *)&binary(uid);
|
||||
buffer[0] = 0;
|
||||
for (i = 0; i < uid.GetSize(); i++)
|
||||
sprintf(&buffer[strlen(buffer)], " 0x%02x", b[i]);
|
||||
mxprints(&buffer[strlen(buffer)], " 0x%02x", b[i]);
|
||||
show_element(l2, 2, "Previous segment UID:%s", buffer);
|
||||
|
||||
} else if (EbmlId(*l2) == KaxNextUID::ClassInfos.GlobalId) {
|
||||
@ -535,7 +539,7 @@ bool process_file(const char *file_name) {
|
||||
const unsigned char *b = (const unsigned char *)&binary(uid);
|
||||
buffer[0] = 0;
|
||||
for (i = 0; i < uid.GetSize(); i++)
|
||||
sprintf(&buffer[strlen(buffer)], " 0x%02x", b[i]);
|
||||
mxprints(&buffer[strlen(buffer)], " 0x%02x", b[i]);
|
||||
show_element(l2, 2, "Next segment UID:%s", buffer);
|
||||
|
||||
} else if (EbmlId(*l2) == KaxSegmentFilename::ClassInfos.GlobalId) {
|
||||
@ -782,14 +786,14 @@ bool process_file(const char *file_name) {
|
||||
alBITMAPINFOHEADER *bih =
|
||||
(alBITMAPINFOHEADER *)&binary(c_priv);
|
||||
unsigned char *fcc = (unsigned char *)&bih->bi_compression;
|
||||
sprintf(pbuffer, " (FourCC: %c%c%c%c, 0x%08x)",
|
||||
fcc[0], fcc[1], fcc[2], fcc[3],
|
||||
get_uint32(&bih->bi_compression));
|
||||
mxprints(pbuffer, " (FourCC: %c%c%c%c, 0x%08x)",
|
||||
fcc[0], fcc[1], fcc[2], fcc[3],
|
||||
get_uint32(&bih->bi_compression));
|
||||
} else if (ms_compat && (kax_track_type == 'a') &&
|
||||
(c_priv.GetSize() >= sizeof(alWAVEFORMATEX))) {
|
||||
alWAVEFORMATEX *wfe = (alWAVEFORMATEX *)&binary(c_priv);
|
||||
sprintf(pbuffer, " (format tag: 0x%04x)",
|
||||
get_uint16(&wfe->w_format_tag));
|
||||
mxprints(pbuffer, " (format tag: 0x%04x)",
|
||||
get_uint16(&wfe->w_format_tag));
|
||||
} else
|
||||
pbuffer[0] = 0;
|
||||
show_element(l3, 3, "CodecPrivate, length %d%s",
|
||||
@ -930,8 +934,8 @@ bool process_file(const char *file_name) {
|
||||
EbmlId id(b, s);
|
||||
pbuffer[0] = 0;
|
||||
for (i = 0; i < s; i++)
|
||||
sprintf(&pbuffer[strlen(pbuffer)], "0x%02x ",
|
||||
((unsigned char *)b)[i]);
|
||||
mxprints(&pbuffer[strlen(pbuffer)], "0x%02x ",
|
||||
((unsigned char *)b)[i]);
|
||||
show_element(l3, 3, "Seek ID: %s (%s)", pbuffer,
|
||||
(id == KaxInfo::ClassInfos.GlobalId) ?
|
||||
"KaxInfo" :
|
||||
@ -948,8 +952,6 @@ bool process_file(const char *file_name) {
|
||||
(id == KaxTags::ClassInfos.GlobalId) ?
|
||||
"KaxTags" :
|
||||
"unknown");
|
||||
if (id == KaxCues::ClassInfos.GlobalId)
|
||||
printf("yugga\n");
|
||||
|
||||
} else if (EbmlId(*l3) == KaxSeekPosition::ClassInfos.GlobalId) {
|
||||
KaxSeekPosition &seek_pos =
|
||||
@ -1067,8 +1069,8 @@ bool process_file(const char *file_name) {
|
||||
for (i = 0; i < (int)block.NumberFrames(); i++) {
|
||||
DataBuffer &data = block.GetBuffer(i);
|
||||
if (calc_checksums)
|
||||
sprintf(adler, " (adler: 0x%08x)",
|
||||
calc_adler32(data.Buffer(), data.Size()));
|
||||
mxprints(adler, " (adler: 0x%08x)",
|
||||
calc_adler32(data.Buffer(), data.Size()));
|
||||
else
|
||||
adler[0] = 0;
|
||||
show_element(NULL, 4, "Frame with size %u%s", data.Size(),
|
||||
@ -1708,7 +1710,7 @@ bool process_file(const char *file_name) {
|
||||
", data: ";
|
||||
b = &binary(rating);
|
||||
for (i = 0; i < rating.GetSize(); i++) {
|
||||
sprintf(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
mxprints(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
strc += buf;
|
||||
}
|
||||
show_element(l4, 4, strc.c_str());
|
||||
@ -1895,7 +1897,7 @@ bool process_file(const char *file_name) {
|
||||
to_string(video_genre.GetSize()) + ", data: ";
|
||||
b = &binary(video_genre);
|
||||
for (i = 0; i < video_genre.GetSize(); i++) {
|
||||
sprintf(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
mxprints(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
strc += buf;
|
||||
}
|
||||
show_element(l4, 4, strc.c_str());
|
||||
@ -1961,7 +1963,7 @@ bool process_file(const char *file_name) {
|
||||
to_string(encryption.GetSize()) + ", data: ";
|
||||
b = &binary(encryption);
|
||||
for (i = 0; i < encryption.GetSize(); i++) {
|
||||
sprintf(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
mxprints(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
strc += buf;
|
||||
}
|
||||
show_element(l4, 4, strc.c_str());
|
||||
@ -1998,7 +2000,7 @@ bool process_file(const char *file_name) {
|
||||
to_string(equalisation.GetSize()) + ", data: ";
|
||||
b = &binary(equalisation);
|
||||
for (i = 0; i < equalisation.GetSize(); i++) {
|
||||
sprintf(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
mxprints(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
strc += buf;
|
||||
}
|
||||
show_element(l4, 4, strc.c_str());
|
||||
@ -2101,7 +2103,7 @@ bool process_file(const char *file_name) {
|
||||
to_string(capture_lightness.GetSize()) + ", data: ";
|
||||
b = &binary(capture_lightness);
|
||||
for (i = 0; i < capture_lightness.GetSize(); i++) {
|
||||
sprintf(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
mxprints(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
strc += buf;
|
||||
}
|
||||
show_element(l4, 4, strc.c_str());
|
||||
@ -2126,7 +2128,7 @@ bool process_file(const char *file_name) {
|
||||
to_string(capture_sharpness.GetSize()) + ", data: ";
|
||||
b = &binary(capture_sharpness);
|
||||
for (i = 0; i < capture_sharpness.GetSize(); i++) {
|
||||
sprintf(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
mxprints(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
strc += buf;
|
||||
}
|
||||
show_element(l4, 4, strc.c_str());
|
||||
@ -2685,7 +2687,7 @@ bool process_file(const char *file_name) {
|
||||
to_string(i_binary.GetSize()) + ", data: ";
|
||||
b = &binary(i_binary);
|
||||
for (i = 0; i < i_binary.GetSize(); i++) {
|
||||
sprintf(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
mxprints(buf, "0x%02x ", (unsigned char)b[i]);
|
||||
strc += buf;
|
||||
}
|
||||
show_element(l5, 5, strc.c_str());
|
||||
|
@ -1740,7 +1740,7 @@ string create_output_name() {
|
||||
// First possibility: %d
|
||||
p = s.find("%d");
|
||||
if (p >= 0) {
|
||||
sprintf(buffer, "%d", file_num);
|
||||
mxprints(buffer, "%d", file_num);
|
||||
s.replace(p, 2, buffer);
|
||||
|
||||
return s;
|
||||
@ -1764,13 +1764,13 @@ string create_output_name() {
|
||||
len.erase(0, 1);
|
||||
len.erase(p2 - p - 1);
|
||||
char buffer[strtol(len.c_str(), NULL, 10) + 1];
|
||||
sprintf(buffer, format.c_str(), file_num);
|
||||
mxprints(buffer, format.c_str(), file_num);
|
||||
s.replace(p, format.size(), buffer);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
sprintf(buffer, "-%03d", file_num);
|
||||
mxprints(buffer, "-%03d", file_num);
|
||||
|
||||
// See if we can find a '.'.
|
||||
p = s.rfind(".");
|
||||
|
@ -166,10 +166,8 @@ uint64 mm_io_c::getFilePointer() {
|
||||
DWORD low;
|
||||
|
||||
low = SetFilePointer((HANDLE)file, 0, &high, FILE_CURRENT);
|
||||
if ((low == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR)) {
|
||||
printf("nonono\n");
|
||||
if ((low == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR))
|
||||
return (uint64)-1;
|
||||
}
|
||||
|
||||
return (((uint64)high) << 32) | (uint64)low;
|
||||
}
|
||||
|
10
src/os.h
10
src/os.h
@ -22,7 +22,7 @@
|
||||
|
||||
#if defined(COMP_MSC)
|
||||
# define PACKAGE "mkvtoolnix"
|
||||
# define VERSION "0.6.2"
|
||||
# define VERSION "0.6.3"
|
||||
|
||||
# define strncasecmp _strnicmp
|
||||
# define strcasecmp _stricmp
|
||||
@ -31,6 +31,14 @@
|
||||
# define vfprintf _vfprintf
|
||||
#endif // COMP_MSC
|
||||
|
||||
#if defined(COMP_MINGW) || defined(COMP_MSC)
|
||||
# define LLD "%I64d"
|
||||
# define LLU "%I64u"
|
||||
#else
|
||||
# define LLD "%lld"
|
||||
# define LLU "%llu"
|
||||
#endif // COMP_MINGW || COMP_MSC
|
||||
|
||||
#if !defined(COMP_CYGWIN)
|
||||
#include <stdint.h>
|
||||
#endif // !COMP_CYGWIN
|
||||
|
@ -84,7 +84,7 @@ avi_reader_c::avi_reader_c(track_info_t *nti) throw (error_c):
|
||||
char *s, *error;
|
||||
error = AVI_strerror();
|
||||
s = (char *)safemalloc(strlen(msg) + strlen(error) + 1);
|
||||
sprintf(s, "%s%s", msg, error);
|
||||
mxprints(s, "%s%s", msg, error);
|
||||
throw error_c(s);
|
||||
}
|
||||
|
||||
|
@ -221,11 +221,11 @@ void kax_reader_c::verify_tracks() {
|
||||
if ((t->private_data == NULL) ||
|
||||
(t->private_size < sizeof(alBITMAPINFOHEADER))) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: WARNING: CodecID for track %u is '"
|
||||
MKV_V_MSCOMP
|
||||
"', but there was no BITMAPINFOHEADER struct present. "
|
||||
"Therefore we don't have a FourCC to identify the video "
|
||||
"codec used.\n", t->tnum);
|
||||
mxprint(stdout, "matroska_reader: WARNING: CodecID for track %u "
|
||||
"is '" MKV_V_MSCOMP
|
||||
"', but there was no BITMAPINFOHEADER struct present. "
|
||||
"Therefore we don't have a FourCC to identify the video "
|
||||
"codec used.\n", t->tnum);
|
||||
continue;
|
||||
} else {
|
||||
t->ms_compat = 1;
|
||||
@ -235,9 +235,10 @@ void kax_reader_c::verify_tracks() {
|
||||
u = get_uint32(&bih->bi_width);
|
||||
if (t->v_width != u) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: WARNING: (MS compatibility mode, "
|
||||
"track %u) Matrosa says video width is %u, but the "
|
||||
"BITMAPINFOHEADER says %u.\n", t->tnum, t->v_width, u);
|
||||
mxprint(stdout, "matroska_reader: WARNING: (MS compatibility "
|
||||
"mode, track %u) Matrosa says video width is %u, but "
|
||||
"the BITMAPINFOHEADER says %u.\n", t->tnum, t->v_width,
|
||||
u);
|
||||
if (t->v_width == 0)
|
||||
t->v_width = u;
|
||||
}
|
||||
@ -245,9 +246,9 @@ void kax_reader_c::verify_tracks() {
|
||||
u = get_uint32(&bih->bi_height);
|
||||
if (t->v_height != u) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: WARNING: (MS compatibility mode, "
|
||||
"track %u) Matrosa video height is %u, but the "
|
||||
"BITMAPINFOHEADER says %u.\n", t->tnum, t->v_height, u);
|
||||
mxprint(stdout, "matroska_reader: WARNING: (MS compatibility "
|
||||
"mode, track %u) Matrosa video height is %u, but the "
|
||||
"BITMAPINFOHEADER says %u.\n", t->tnum, t->v_height, u);
|
||||
if (t->v_height == 0)
|
||||
t->v_height = u;
|
||||
}
|
||||
@ -256,8 +257,9 @@ void kax_reader_c::verify_tracks() {
|
||||
|
||||
if (t->v_frate == 0.0) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: ERROR: (MS compatibility mode, track "
|
||||
"%u) No VideoFrameRate element was found.\n", t->tnum);
|
||||
mxprint(stdout, "matroska_reader: ERROR: (MS compatibility "
|
||||
"mode, track %u) No VideoFrameRate/DefaultDuration "
|
||||
"element was found.\n", t->tnum);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -265,14 +267,14 @@ void kax_reader_c::verify_tracks() {
|
||||
|
||||
if (t->v_width == 0) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: The width for track %u was not set.\n",
|
||||
t->tnum);
|
||||
mxprint(stdout, "matroska_reader: The width for track %u was not "
|
||||
"set.\n", t->tnum);
|
||||
continue;
|
||||
}
|
||||
if (t->v_height == 0) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: The height for track %u was not set.\n",
|
||||
t->tnum);
|
||||
mxprint(stdout, "matroska_reader: The height for track %u was not "
|
||||
"set.\n", t->tnum);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -288,10 +290,11 @@ void kax_reader_c::verify_tracks() {
|
||||
if ((t->private_data == NULL) ||
|
||||
(t->private_size < sizeof(alWAVEFORMATEX))) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: WARNING: CodecID for track %u is '"
|
||||
MKV_A_ACM "', but there was no WAVEFORMATEX struct "
|
||||
"present. Therefore we don't have a format ID to "
|
||||
"identify the audio codec used.\n", t->tnum);
|
||||
mxprint(stdout, "matroska_reader: WARNING: CodecID for track "
|
||||
"%u is '"
|
||||
MKV_A_ACM "', but there was no WAVEFORMATEX struct "
|
||||
"present. Therefore we don't have a format ID to "
|
||||
"identify the audio codec used.\n", t->tnum);
|
||||
continue;
|
||||
} else {
|
||||
t->ms_compat = 1;
|
||||
@ -300,10 +303,11 @@ void kax_reader_c::verify_tracks() {
|
||||
u = get_uint32(&wfe->n_samples_per_sec);
|
||||
if (((uint32_t)t->a_sfreq) != u) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: WARNING: (MS compatibility mode for "
|
||||
"track %u) Matroska says that there are %u samples per "
|
||||
"second, but WAVEFORMATEX says that there are %u.\n",
|
||||
t->tnum, (uint32_t)t->a_sfreq, u);
|
||||
mxprint(stdout, "matroska_reader: WARNING: (MS compatibility "
|
||||
"mode for "
|
||||
"track %u) Matroska says that there are %u samples per"
|
||||
" second, but WAVEFORMATEX says that there are %u.\n",
|
||||
t->tnum, (uint32_t)t->a_sfreq, u);
|
||||
if (t->a_sfreq == 0.0)
|
||||
t->a_sfreq = (float)u;
|
||||
}
|
||||
@ -311,10 +315,11 @@ void kax_reader_c::verify_tracks() {
|
||||
u = get_uint16(&wfe->n_channels);
|
||||
if (t->a_channels != u) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: WARNING: (MS compatibility mode for "
|
||||
"track %u) Matroska says that there are %u channels, "
|
||||
"but the WAVEFORMATEX says that there are %u.\n",
|
||||
t->tnum, t->a_channels, u);
|
||||
mxprint(stdout, "matroska_reader: WARNING: (MS compatibility "
|
||||
"mode for "
|
||||
"track %u) Matroska says that there are %u channels, "
|
||||
"but the WAVEFORMATEX says that there are %u.\n",
|
||||
t->tnum, t->a_channels, u);
|
||||
if (t->a_channels == 0)
|
||||
t->a_channels = u;
|
||||
}
|
||||
@ -322,10 +327,11 @@ void kax_reader_c::verify_tracks() {
|
||||
u = get_uint16(&wfe->w_bits_per_sample);
|
||||
if (t->a_bps != u) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: WARNING: (MS compatibility mode for "
|
||||
"track %u) Matroska says that there are %u bits per "
|
||||
"sample, but the WAVEFORMATEX says that there are %u."
|
||||
"\n", t->tnum, t->a_bps, u);
|
||||
mxprint(stdout, "matroska_reader: WARNING: (MS compatibility "
|
||||
"mode for "
|
||||
"track %u) Matroska says that there are %u bits per "
|
||||
"sample, but the WAVEFORMATEX says that there are %u."
|
||||
"\n", t->tnum, t->a_bps, u);
|
||||
if (t->a_bps == 0)
|
||||
t->a_bps = u;
|
||||
}
|
||||
@ -344,17 +350,18 @@ void kax_reader_c::verify_tracks() {
|
||||
else if (!strcmp(t->codec_id, MKV_A_VORBIS)) {
|
||||
if (t->private_data == NULL) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: WARNING: CodecID for track %u is "
|
||||
"'A_VORBIS', but there are no header packets present.",
|
||||
t->tnum);
|
||||
mxprint(stdout, "matroska_reader: WARNING: CodecID for track "
|
||||
"%u is "
|
||||
"'A_VORBIS', but there are no header packets present.",
|
||||
t->tnum);
|
||||
continue;
|
||||
}
|
||||
|
||||
c = (unsigned char *)t->private_data;
|
||||
if (c[0] != 2) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: Vorbis track does not contain valid "
|
||||
"headers.\n");
|
||||
mxprint(stdout, "matroska_reader: Vorbis track does not "
|
||||
"contain valid headers.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -368,8 +375,8 @@ void kax_reader_c::verify_tracks() {
|
||||
}
|
||||
if (offset >= (t->private_size - 1)) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: Vorbis track does not contain valid"
|
||||
" headers.\n");
|
||||
mxprint(stdout, "matroska_reader: Vorbis track does not "
|
||||
"contain valid headers.\n");
|
||||
continue;
|
||||
}
|
||||
length += c[offset];
|
||||
@ -397,30 +404,30 @@ void kax_reader_c::verify_tracks() {
|
||||
t->a_formattag = FOURCC('M', 'P', '4', 'A');
|
||||
else {
|
||||
if (verbose)
|
||||
printf("matroska_reader: Unknown/unsupported audio codec ID '%s'"
|
||||
" for track %u.\n", t->codec_id, t->tnum);
|
||||
mxprint(stdout, "matroska_reader: Unknown/unsupported audio "
|
||||
"codec ID '%s' for track %u.\n", t->codec_id, t->tnum);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (t->a_sfreq == 0.0) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: The sampling frequency was not set for "
|
||||
"track %u.\n", t->tnum);
|
||||
mxprint(stdout, "matroska_reader: The sampling frequency was not "
|
||||
"set for track %u.\n", t->tnum);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (t->a_channels == 0) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: The number of channels was not set for "
|
||||
"track %u.\n", t->tnum);
|
||||
mxprint(stdout, "matroska_reader: The number of channels was not "
|
||||
"set for track %u.\n", t->tnum);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (t->a_formattag == 0) {
|
||||
if (verbose)
|
||||
printf("matroska_reader: The audio format tag was not set for "
|
||||
"track %u.\n", t->tnum);
|
||||
mxprint(stdout, "matroska_reader: The audio format tag was not "
|
||||
"set for track %u.\n", t->tnum);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -435,13 +442,13 @@ void kax_reader_c::verify_tracks() {
|
||||
|
||||
default: // unknown track type!? error in demuxer...
|
||||
if (verbose)
|
||||
printf("matroska_reader: Error: matroska_reader: unknown demuxer "
|
||||
"type for track %u: '%c'\n", t->tnum, t->type);
|
||||
mxprint(stdout, "matroska_reader: Error: matroska_reader: unknown "
|
||||
"demuxer type for track %u: '%c'\n", t->tnum, t->type);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (t->ok && (verbose > 1))
|
||||
printf("matroska_reader: Track %u seems to be ok.\n", t->tnum);
|
||||
mxprint(stdout, "matroska_reader: Track %u seems to be ok.\n", t->tnum);
|
||||
}
|
||||
}
|
||||
|
||||
@ -714,22 +721,22 @@ int kax_reader_c::read_headers() {
|
||||
switch (uint8(ttype)) {
|
||||
case track_audio:
|
||||
if (verbose > 1)
|
||||
printf("Audio\n");
|
||||
mxprint(stdout, "Audio\n");
|
||||
track->type = 'a';
|
||||
break;
|
||||
case track_video:
|
||||
if (verbose > 1)
|
||||
printf("Video\n");
|
||||
mxprint(stdout, "Video\n");
|
||||
track->type = 'v';
|
||||
break;
|
||||
case track_subtitle:
|
||||
if (verbose > 1)
|
||||
printf("Subtitle\n");
|
||||
mxprint(stdout, "Subtitle\n");
|
||||
track->type = 's';
|
||||
break;
|
||||
default:
|
||||
if (verbose > 1)
|
||||
printf("unknown\n");
|
||||
mxprint(stdout, "unknown\n");
|
||||
track->type = '?';
|
||||
break;
|
||||
}
|
||||
@ -1416,7 +1423,7 @@ int kax_reader_c::read() {
|
||||
|
||||
|
||||
} catch (exception ex) {
|
||||
printf("matroska_reader: exception caught\n");
|
||||
mxprint(stdout, "matroska_reader: exception caught\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,6 @@ void real_reader_c::parse_headers() {
|
||||
num_packets_in_chunk = io->read_uint32_be();
|
||||
num_packets = 0;
|
||||
io->skip(4); // next_data_header
|
||||
printf("HEAD#: %lld\n", num_packets_in_chunk);
|
||||
|
||||
break; // We're finished!
|
||||
|
||||
@ -447,7 +446,7 @@ void real_reader_c::create_packetizers() {
|
||||
if (dmx->type == 'v') {
|
||||
char buffer[20];
|
||||
|
||||
sprintf(buffer, "V_REAL/%s", dmx->fourcc);
|
||||
mxprints(buffer, "V_REAL/%s", dmx->fourcc);
|
||||
dmx->packetizer = new video_packetizer_c(this, buffer, dmx->fps,
|
||||
dmx->width, dmx->height,
|
||||
false, ti);
|
||||
@ -478,9 +477,9 @@ void real_reader_c::create_packetizers() {
|
||||
ptzr = new passthrough_packetizer_c(this, ti);
|
||||
dmx->packetizer = ptzr;
|
||||
|
||||
sprintf(buffer, "A_REAL/%c%c%c%c", toupper(dmx->fourcc[0]),
|
||||
toupper(dmx->fourcc[1]), toupper(dmx->fourcc[2]),
|
||||
toupper(dmx->fourcc[3]));
|
||||
mxprints(buffer, "A_REAL/%c%c%c%c", toupper(dmx->fourcc[0]),
|
||||
toupper(dmx->fourcc[1]), toupper(dmx->fourcc[2]),
|
||||
toupper(dmx->fourcc[3]));
|
||||
|
||||
ptzr->set_track_type(track_audio);
|
||||
ptzr->set_codec_id(buffer);
|
||||
|
@ -282,7 +282,7 @@ int ssa_reader_c::read() {
|
||||
for (i = 0; i < clines.size(); i++) {
|
||||
char buffer[20];
|
||||
// Let the packetizer handle this line.
|
||||
sprintf(buffer, "%d", clines[i].num);
|
||||
mxprints(buffer, "%d", clines[i].num);
|
||||
line = string(buffer) + string(clines[i].line);
|
||||
textsubs_packetizer->process((unsigned char *)line.c_str(), 0,
|
||||
clines[i].start,
|
||||
|
@ -813,23 +813,25 @@ void start_element(void *user_data, const char *name,
|
||||
|
||||
void perror(parser_data_t *pdata, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
string new_fmt;
|
||||
|
||||
fprintf(stderr, "Tag parsing error in '%s', line %d, column %d: ",
|
||||
mxprint(stderr, "Tag parsing error in '%s', line %d, column %d: ",
|
||||
pdata->file_name, XML_GetCurrentLineNumber(pdata->parser),
|
||||
XML_GetCurrentColumnNumber(pdata->parser));
|
||||
fix_format(fmt, new_fmt);
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
vfprintf(stderr, new_fmt.c_str(), ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, "\n");
|
||||
mxprint(stderr, "\n");
|
||||
|
||||
#ifdef DEBUG
|
||||
int i;
|
||||
fprintf(stderr, "Parent names:\n");
|
||||
mxprint(stderr, "Parent names:\n");
|
||||
for (i = 0; i < pdata->parent_names->size(); i++)
|
||||
fprintf(stderr, " %s\n", (*pdata->parent_names)[i].c_str());
|
||||
fprintf(stderr, "Parent types:\n");
|
||||
mxprint(stderr, " %s\n", (*pdata->parent_names)[i].c_str());
|
||||
mxprint(stderr, "Parent types:\n");
|
||||
for (i = 0; i < pdata->parents->size(); i++)
|
||||
fprintf(stderr, " %d\n", (*pdata->parents)[i]);
|
||||
mxprint(stderr, " %d\n", (*pdata->parents)[i]);
|
||||
#endif
|
||||
|
||||
exit(1);
|
||||
|
@ -38,10 +38,12 @@ static FILE *o;
|
||||
static void print_tag(int level, const char *name, const char *fmt, ...) {
|
||||
int idx;
|
||||
va_list ap;
|
||||
string new_fmt;
|
||||
|
||||
fix_format(fmt, new_fmt);
|
||||
for (idx = 0; idx < level; idx++)
|
||||
fprintf(o, " ");
|
||||
fprintf(o, "<%s>", name);
|
||||
mxprint(o, " ");
|
||||
mxprint(o, "<%s>", name);
|
||||
va_start(ap, fmt);
|
||||
vfprintf(o, fmt, ap);
|
||||
va_end(ap);
|
||||
@ -103,17 +105,17 @@ static void print_date(int level, const char *name, EbmlElement *e) {
|
||||
char buffer[100];
|
||||
|
||||
for (idx = 0; idx < level; idx++)
|
||||
fprintf(o, " ");
|
||||
fprintf(o, "<%s>", name);
|
||||
mxprint(o, " ");
|
||||
mxprint(o, "<%s>", name);
|
||||
|
||||
tme = ((EbmlDate *)e)->GetEpochDate();
|
||||
tm = gmtime(&tme);
|
||||
if (tm == NULL)
|
||||
fprintf(o, "INVALID: %llu", (uint64_t)tme);
|
||||
mxprint(o, "INVALID: %llu", (uint64_t)tme);
|
||||
else {
|
||||
buffer[99] = 0;
|
||||
strftime(buffer, 99, "%Y-%m-%dT%H:%M:%S+0000", tm);
|
||||
fprintf(o, buffer);
|
||||
mxprint(o, buffer);
|
||||
}
|
||||
|
||||
mxprint(o, "</%s>\n", name);
|
||||
@ -123,8 +125,8 @@ static void print_unknown(int level, EbmlElement *e) {
|
||||
int idx;
|
||||
|
||||
for (idx = 0; idx < level; idx++)
|
||||
fprintf(o, " ");
|
||||
fprintf(o, "<!-- Unknown element: %s -->\n", e->Generic().DebugName);
|
||||
mxprint(o, " ");
|
||||
mxprint(o, "<!-- Unknown element: %s -->\n", e->Generic().DebugName);
|
||||
}
|
||||
|
||||
#define pr_ui(n) print_tag(level, n, "%llu", \
|
||||
@ -543,19 +545,19 @@ static void dumpsizes(EbmlElement *e, int level) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < level; i++)
|
||||
printf(" ");
|
||||
printf("%s", e->Generic().DebugName);
|
||||
mxprint(stdout, " ");
|
||||
mxprint(stdout, "%s", e->Generic().DebugName);
|
||||
|
||||
try {
|
||||
EbmlMaster *m = &dynamic_cast<EbmlMaster &>(*e);
|
||||
if (m != NULL) {
|
||||
printf(" (size: %u)\n", m->ListSize());
|
||||
mxprint(stdout, " (size: %u)\n", m->ListSize());
|
||||
for (i = 0; i < m->ListSize(); i++)
|
||||
dumpsizes((*m)[i], level + 1);
|
||||
} else
|
||||
printf("\n");
|
||||
mxprint(stdout, "\n");
|
||||
} catch (...) {
|
||||
printf("\n");
|
||||
mxprint(stdout, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user