mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-23 19:31:44 +00:00
Use STL maps instead of vectors and structs in many places in the track info class. Easier to read, and for this task maps are suited way better than vectors anyway.
This commit is contained in:
parent
4ab272cbcc
commit
3eaed084ed
@ -287,6 +287,7 @@ extern int MTX_DLL_API verbose;
|
||||
#define mxfind(value, cont) std::find(cont.begin(), cont.end(), value)
|
||||
#define mxfind2(it, value, cont) \
|
||||
((id = std::find((cont).begin(), (cont).end(), value)) != (cont).end())
|
||||
#define map_has_key(m, k) ((m).end() != (m).find(k))
|
||||
|
||||
class MTX_DLL_API bitvalue_c {
|
||||
private:
|
||||
|
@ -1338,7 +1338,7 @@ kax_reader_c::init_passthrough_packetizer(kax_track_t *t) {
|
||||
if (t->v_dheight != 0)
|
||||
ptzr->set_video_display_height(t->v_dheight);
|
||||
}
|
||||
if ((ptzr->ti.pixel_cropping.id == -2) &&
|
||||
if (!ptzr->ti.pixel_cropping_specified &&
|
||||
((t->v_pcleft > 0) || (t->v_pctop > 0) ||
|
||||
(t->v_pcright > 0) || (t->v_pcbottom > 0)))
|
||||
ptzr->set_video_pixel_cropping(t->v_pcleft, t->v_pctop,
|
||||
@ -1488,7 +1488,7 @@ kax_reader_c::create_packetizer(int64_t tid) {
|
||||
if (t->v_dheight != 0)
|
||||
PTZR(t->ptzr)->set_video_display_height(t->v_dheight);
|
||||
}
|
||||
if ((PTZR(t->ptzr)->ti.pixel_cropping.id == -2) &&
|
||||
if (!PTZR(t->ptzr)->ti.pixel_cropping_specified &&
|
||||
((t->v_pcleft > 0) || (t->v_pctop > 0) ||
|
||||
(t->v_pcright > 0) || (t->v_pcbottom > 0)))
|
||||
PTZR(t->ptzr)->set_video_pixel_cropping(t->v_pcleft, t->v_pctop,
|
||||
|
@ -54,9 +54,6 @@ ssa_reader_c::ssa_reader_c(track_info_c &_ti)
|
||||
m_is_ass(false) {
|
||||
|
||||
auto_ptr<mm_text_io_c> io;
|
||||
bool sub_charset_found;
|
||||
int i;
|
||||
|
||||
|
||||
try {
|
||||
io = auto_ptr<mm_text_io_c>(new mm_text_io_c(new mm_file_io_c(ti.fname)));
|
||||
@ -67,20 +64,14 @@ ssa_reader_c::ssa_reader_c(track_info_c &_ti)
|
||||
if (!ssa_reader_c::probe_file(io.get(), 0))
|
||||
throw error_c("ssa_reader: Source is not a valid SSA/ASS file.");
|
||||
|
||||
sub_charset_found = false;
|
||||
for (i = 0; i < ti.sub_charsets.size(); i++)
|
||||
if ((ti.sub_charsets[i].id == 0) || (ti.sub_charsets[i].id == -1)) {
|
||||
sub_charset_found = true;
|
||||
m_cc_utf8 = utf8_init(ti.sub_charsets[i].charset);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!sub_charset_found) {
|
||||
if (io->get_byte_order() != BO_NONE)
|
||||
m_cc_utf8 = utf8_init("UTF-8");
|
||||
else
|
||||
m_cc_utf8 = utf8_init(ti.sub_charset);
|
||||
}
|
||||
if (map_has_key(ti.sub_charsets, 0))
|
||||
m_cc_utf8 = utf8_init(ti.sub_charsets[0]);
|
||||
else if (map_has_key(ti.sub_charsets, -1))
|
||||
m_cc_utf8 = utf8_init(ti.sub_charsets[-1]);
|
||||
else if (io->get_byte_order() != BO_NONE)
|
||||
m_cc_utf8 = utf8_init("UTF-8");
|
||||
else
|
||||
m_cc_utf8 = cc_local_utf8;
|
||||
|
||||
parse_file(io.get());
|
||||
|
||||
|
@ -479,6 +479,7 @@ parse_sync(string s,
|
||||
string orig, linear, div;
|
||||
int idx;
|
||||
double d1, d2;
|
||||
int64_t id;
|
||||
|
||||
// Extract the track number.
|
||||
orig = s;
|
||||
@ -487,7 +488,8 @@ parse_sync(string s,
|
||||
mxerror(_("Invalid sync option. No track ID specified in '%s %s'.\n"),
|
||||
opt.c_str(), s.c_str());
|
||||
|
||||
if (!parse_int(parts[0], async.id))
|
||||
id = 0;
|
||||
if (!parse_int(parts[0], id))
|
||||
mxerror(_("Invalid track ID specified in '%s %s'.\n"), opt.c_str(),
|
||||
s.c_str());
|
||||
|
||||
@ -524,7 +526,7 @@ parse_sync(string s,
|
||||
async.linear = 1.0;
|
||||
async.displacement = atoi(s.c_str());
|
||||
|
||||
ti.audio_syncs.push_back(async);
|
||||
ti.audio_syncs[id] = async;
|
||||
}
|
||||
|
||||
/** \brief Parse the \c --aspect-ratio argument
|
||||
@ -542,6 +544,7 @@ parse_aspect_ratio(const string &s,
|
||||
vector<string> parts;
|
||||
display_properties_t dprop;
|
||||
const char *msg;
|
||||
int64_t id;
|
||||
|
||||
if (is_factor)
|
||||
msg = _("Aspect ratio factor");
|
||||
@ -553,7 +556,8 @@ parse_aspect_ratio(const string &s,
|
||||
if (parts.size() != 2)
|
||||
mxerror(_("%s: missing track ID in '%s %s'.\n"), msg, opt.c_str(),
|
||||
s.c_str());
|
||||
if (!parse_int(parts[0], dprop.id))
|
||||
id = 0;
|
||||
if (!parse_int(parts[0], id))
|
||||
mxerror(_("%s: invalid track ID in '%s %s'.\n"), msg, opt.c_str(),
|
||||
s.c_str());
|
||||
dprop.width = -1;
|
||||
@ -564,7 +568,7 @@ parse_aspect_ratio(const string &s,
|
||||
idx = parts[1].find(':');
|
||||
if (idx < 0) {
|
||||
dprop.aspect_ratio = strtod(parts[1].c_str(), NULL);
|
||||
ti.display_properties.push_back(dprop);
|
||||
ti.display_properties[id] = dprop;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -585,7 +589,7 @@ parse_aspect_ratio(const string &s,
|
||||
s.c_str());
|
||||
|
||||
dprop.aspect_ratio = w / h;
|
||||
ti.display_properties.push_back(dprop);
|
||||
ti.display_properties[id] = dprop;
|
||||
}
|
||||
|
||||
/** \brief Parse the \c --display-dimensions argument
|
||||
@ -598,6 +602,7 @@ parse_display_dimensions(const string s,
|
||||
vector<string> parts, dims;
|
||||
int w, h;
|
||||
display_properties_t dprop;
|
||||
int64_t id;
|
||||
|
||||
parts = split(s, ":", 2);
|
||||
strip(parts);
|
||||
@ -607,7 +612,8 @@ parse_display_dimensions(const string s,
|
||||
s.c_str());
|
||||
|
||||
dims = split(parts[1], "x", 2);
|
||||
if ((dims.size() != 2) || !parse_int(parts[0], dprop.id) ||
|
||||
id = 0;
|
||||
if ((dims.size() != 2) || !parse_int(parts[0], id) ||
|
||||
!parse_int(dims[0], w) || !parse_int(dims[1], h) ||
|
||||
(w <= 0) || (h <= 0))
|
||||
mxerror(_("Display dimensions: not given in the form "
|
||||
@ -618,7 +624,7 @@ parse_display_dimensions(const string s,
|
||||
dprop.width = w;
|
||||
dprop.height = h;
|
||||
|
||||
ti.display_properties.push_back(dprop);
|
||||
ti.display_properties[id] = dprop;
|
||||
}
|
||||
|
||||
/** \brief Parse the \c --cropping argument
|
||||
@ -631,13 +637,15 @@ parse_cropping(const string &s,
|
||||
track_info_c &ti) {
|
||||
pixel_crop_t crop;
|
||||
vector<string> v;
|
||||
int64_t id;
|
||||
|
||||
v = split(s, ":");
|
||||
if (v.size() != 2)
|
||||
mxerror(_("Cropping parameters: not given in the form "
|
||||
"<TID>:<left>,<top>,<right>,<bottom> e.g. 0:10,5,10,5 "
|
||||
"(argument was '%s').\n"), s.c_str());
|
||||
if (!parse_int(v[0], crop.id))
|
||||
id = 0;
|
||||
if (!parse_int(v[0], id))
|
||||
mxerror(_("Cropping parameters: not given in the form "
|
||||
"<TID>:<left>,<top>,<right>,<bottom> e.g. 0:10,5,10,5 "
|
||||
"(argument was '%s').\n"), s.c_str());
|
||||
@ -655,7 +663,7 @@ parse_cropping(const string &s,
|
||||
"<TID>:<left>,<top>,<right>,<bottom> e.g. 0:10,5,10,5 "
|
||||
"(argument was '%s').\n"), s.c_str());
|
||||
|
||||
ti.pixel_crop_list.push_back(crop);
|
||||
ti.pixel_crop_list[id] = crop;
|
||||
}
|
||||
|
||||
/** \brief Parse the duration formats to \c --split
|
||||
@ -811,7 +819,7 @@ parse_delay(const string &s,
|
||||
track_info_c &ti) {
|
||||
string unit;
|
||||
vector<string> parts;
|
||||
packet_delay_t delay;
|
||||
int64_t id;
|
||||
|
||||
// Extract the track number.
|
||||
parts = split(s, ":", 2);
|
||||
@ -820,12 +828,12 @@ parse_delay(const string &s,
|
||||
mxerror(_("Invalid delay option. No track ID specified in "
|
||||
"'--delay %s'.\n"), s.c_str());
|
||||
|
||||
if (!parse_int(parts[0], delay.id))
|
||||
id = 0;
|
||||
if (!parse_int(parts[0], id))
|
||||
mxerror(_("Invalid track ID specified in '--delay %s'.\n"), s.c_str());
|
||||
|
||||
delay.delay = parse_number_with_unit(parts[1], "delay", "--delay", s);
|
||||
|
||||
ti.packet_delays.push_back(delay);
|
||||
ti.packet_delays[id] = parse_number_with_unit(parts[1], "delay", "--delay",
|
||||
s);
|
||||
}
|
||||
|
||||
/** \brief Parse the \c --cues argument
|
||||
@ -836,7 +844,7 @@ static void
|
||||
parse_cues(const string &s,
|
||||
track_info_c &ti) {
|
||||
vector<string> parts;
|
||||
cue_creation_t cues;
|
||||
int64_t id;
|
||||
|
||||
// Extract the track number.
|
||||
parts = split(s, ":", 2);
|
||||
@ -845,7 +853,8 @@ parse_cues(const string &s,
|
||||
mxerror(_("Invalid cues option. No track ID specified in '--cues %s'.\n"),
|
||||
s.c_str());
|
||||
|
||||
if (!parse_int(parts[0], cues.id))
|
||||
id = 0;
|
||||
if (!parse_int(parts[0], id))
|
||||
mxerror(_("Invalid track ID specified in '--cues %s'.\n"), s.c_str());
|
||||
|
||||
if (parts[1].size() == 0)
|
||||
@ -853,15 +862,13 @@ parse_cues(const string &s,
|
||||
s.c_str());
|
||||
|
||||
if (parts[1] == "all")
|
||||
cues.cues = CUE_STRATEGY_ALL;
|
||||
ti.cue_creations[id] = CUE_STRATEGY_ALL;
|
||||
else if (parts[1] == "iframes")
|
||||
cues.cues = CUE_STRATEGY_IFRAMES;
|
||||
ti.cue_creations[id] = CUE_STRATEGY_IFRAMES;
|
||||
else if (parts[1] == "none")
|
||||
cues.cues = CUE_STRATEGY_NONE;
|
||||
ti.cue_creations[id] = CUE_STRATEGY_NONE;
|
||||
else
|
||||
mxerror(_("'%s' is an unsupported argument for --cues.\n"), s.c_str());
|
||||
|
||||
ti.cue_creations.push_back(cues);
|
||||
}
|
||||
|
||||
/** \brief Parse the \c --compression argument
|
||||
@ -872,7 +879,7 @@ static void
|
||||
parse_compression(const string &s,
|
||||
track_info_c &ti) {
|
||||
vector<string> parts;
|
||||
compression_method_t compression;
|
||||
int64_t id;
|
||||
|
||||
// Extract the track number.
|
||||
parts = split(s, ":", 2);
|
||||
@ -881,7 +888,8 @@ parse_compression(const string &s,
|
||||
mxerror(_("Invalid compression option. No track ID specified in "
|
||||
"'--compression %s'.\n"), s.c_str());
|
||||
|
||||
if (!parse_int(parts[0], compression.id))
|
||||
id = 0;
|
||||
if (!parse_int(parts[0], id))
|
||||
mxerror(_("Invalid track ID specified in '--compression %s'.\n"),
|
||||
s.c_str());
|
||||
|
||||
@ -889,25 +897,23 @@ parse_compression(const string &s,
|
||||
mxerror(_("Invalid compression option specified in '--compression %s'.\n"),
|
||||
s.c_str());
|
||||
|
||||
compression.method = COMPRESSION_UNSPECIFIED;
|
||||
ti.compression_list[id] = COMPRESSION_UNSPECIFIED;
|
||||
parts[1] = downcase(parts[1]);
|
||||
#ifdef HAVE_LZO1X_H
|
||||
if ((parts[1] == "lzo") || (parts[1] == "lzo1x"))
|
||||
compression.method = COMPRESSION_LZO;
|
||||
ti.compression_list[id] = COMPRESSION_LZO;
|
||||
#endif
|
||||
if (parts[1] == "zlib")
|
||||
compression.method = COMPRESSION_ZLIB;
|
||||
ti.compression_list[id] = COMPRESSION_ZLIB;
|
||||
#ifdef HAVE_BZLIB_H
|
||||
if ((parts[1] == "bz2") || (parts[1] == "bzlib"))
|
||||
compression.method = COMPRESSION_BZ2;
|
||||
ti.compression_list[id] = COMPRESSION_BZ2;
|
||||
#endif
|
||||
if (parts[1] == "none")
|
||||
compression.method = COMPRESSION_NONE;
|
||||
if (compression.method == COMPRESSION_UNSPECIFIED)
|
||||
ti.compression_list[id] = COMPRESSION_NONE;
|
||||
if (ti.compression_list[id] == COMPRESSION_UNSPECIFIED)
|
||||
mxerror(_("'%s' is an unsupported argument for --compression. Available "
|
||||
"compression methods are 'none' and 'zlib'.\n"), s.c_str());
|
||||
|
||||
ti.compression_list.push_back(compression);
|
||||
}
|
||||
|
||||
/** \brief Parse the argument for a couple of options
|
||||
@ -917,12 +923,13 @@ parse_compression(const string &s,
|
||||
*/
|
||||
static void
|
||||
parse_language(const string &s,
|
||||
language_t &lang,
|
||||
map<int64_t, string> &storage,
|
||||
const string &opt,
|
||||
const char *topic,
|
||||
bool check,
|
||||
bool empty_ok = false) {
|
||||
vector<string> parts;
|
||||
int64_t id;
|
||||
|
||||
// Extract the track number.
|
||||
parts = split(s, ":", 2);
|
||||
@ -937,7 +944,8 @@ parse_language(const string &s,
|
||||
parts.push_back("");
|
||||
}
|
||||
|
||||
if (!parse_int(parts[0], lang.id))
|
||||
id = 0;
|
||||
if (!parse_int(parts[0], id))
|
||||
mxerror(_("Invalid track ID specified in '--%s %s'.\n"), opt.c_str(),
|
||||
s.c_str());
|
||||
|
||||
@ -959,7 +967,7 @@ parse_language(const string &s,
|
||||
}
|
||||
}
|
||||
|
||||
lang.language = parts[1];
|
||||
storage[id] = parts[1];
|
||||
}
|
||||
|
||||
/** \brief Parse the \c --subtitle-charset argument
|
||||
@ -970,7 +978,7 @@ static void
|
||||
parse_sub_charset(const string &s,
|
||||
track_info_c &ti) {
|
||||
vector<string> parts;
|
||||
subtitle_charset_t sub_charset;
|
||||
int64_t id;
|
||||
|
||||
// Extract the track number.
|
||||
parts = split(s, ":", 2);
|
||||
@ -979,7 +987,8 @@ parse_sub_charset(const string &s,
|
||||
mxerror(_("Invalid sub charset option. No track ID specified in "
|
||||
"'--sub-charset %s'.\n"), s.c_str());
|
||||
|
||||
if (!parse_int(parts[0], sub_charset.id))
|
||||
id = 0;
|
||||
if (!parse_int(parts[0], id))
|
||||
mxerror(_("Invalid track ID specified in '--sub-charset %s'.\n"),
|
||||
s.c_str());
|
||||
|
||||
@ -987,8 +996,7 @@ parse_sub_charset(const string &s,
|
||||
mxerror(_("Invalid sub charset specified in '--sub-charset %s'.\n"),
|
||||
s.c_str());
|
||||
|
||||
sub_charset.charset = parts[1];
|
||||
ti.sub_charsets.push_back(sub_charset);
|
||||
ti.sub_charsets[id] = parts[1];
|
||||
}
|
||||
|
||||
/** \brief Parse the \c --tags argument
|
||||
@ -1000,7 +1008,7 @@ parse_tags(const string &s,
|
||||
const string &opt,
|
||||
track_info_c &ti) {
|
||||
vector<string> parts;
|
||||
tags_t tags;
|
||||
int64_t id;
|
||||
|
||||
// Extract the track number.
|
||||
parts = split(s, ":", 2);
|
||||
@ -1009,7 +1017,8 @@ parse_tags(const string &s,
|
||||
mxerror(_("Invalid tags option. No track ID specified in '%s %s'.\n"),
|
||||
opt.c_str(), s.c_str());
|
||||
|
||||
if (!parse_int(parts[0], tags.id))
|
||||
id = 0;
|
||||
if (!parse_int(parts[0], id))
|
||||
mxerror(_("Invalid track ID specified in '%s %s'.\n"), opt.c_str(),
|
||||
s.c_str());
|
||||
|
||||
@ -1017,8 +1026,7 @@ parse_tags(const string &s,
|
||||
mxerror(_("Invalid tags file name specified in '%s %s'.\n"), opt.c_str(),
|
||||
s.c_str());
|
||||
|
||||
tags.file_name = safestrdup(parts[1]);
|
||||
ti.all_tags.push_back(tags);
|
||||
ti.all_tags[id] = parts[1];
|
||||
}
|
||||
|
||||
/** \brief Parse the \c --fourcc argument
|
||||
@ -1031,22 +1039,22 @@ parse_fourcc(const string &s,
|
||||
track_info_c &ti) {
|
||||
vector<string> parts;
|
||||
string orig = s;
|
||||
fourcc_t fourcc;
|
||||
int64_t id;
|
||||
|
||||
parts = split(s, ":", 2);
|
||||
strip(parts);
|
||||
if (parts.size() != 2)
|
||||
mxerror(_("FourCC: Missing track ID in '%s %s'.\n"), opt.c_str(),
|
||||
orig.c_str());
|
||||
if (!parse_int(parts[0], fourcc.id))
|
||||
id = 0;
|
||||
if (!parse_int(parts[0], id))
|
||||
mxerror(_("FourCC: Invalid track ID in '%s %s'.\n"), opt.c_str(),
|
||||
orig.c_str());
|
||||
if (parts[1].size() != 4)
|
||||
mxerror(_("The FourCC must be exactly four characters long in '%s %s'."
|
||||
"\n"), opt.c_str(), orig.c_str());
|
||||
memcpy(fourcc.fourcc, parts[1].c_str(), 4);
|
||||
fourcc.fourcc[4] = 0;
|
||||
ti.all_fourccs.push_back(fourcc);
|
||||
|
||||
ti.all_fourccs[id] = parts[1];
|
||||
}
|
||||
|
||||
/** \brief Parse the argument for \c --track-order
|
||||
@ -1125,18 +1133,20 @@ static void
|
||||
parse_default_duration(const string &s,
|
||||
track_info_c &ti) {
|
||||
vector<string> parts;
|
||||
default_duration_t dd;
|
||||
int64_t id;
|
||||
|
||||
parts = split(s, ":");
|
||||
if (parts.size() != 2)
|
||||
mxerror(_("'%s' is not a valid parts of track ID and default duration in "
|
||||
"'--default-duration %s'.\n"), s.c_str(), s.c_str());
|
||||
if (!parse_int(parts[0], dd.id))
|
||||
|
||||
id = 0;
|
||||
if (!parse_int(parts[0], id))
|
||||
mxerror(_("'%s' is not a valid track ID in '--default-duration %s'.\n"),
|
||||
parts[0].c_str(), s.c_str());
|
||||
dd.default_duration = parse_number_with_unit(parts[1], "default duration",
|
||||
"--default-duration");
|
||||
ti.default_durations.push_back(dd);
|
||||
|
||||
ti.default_durations[id] =
|
||||
parse_number_with_unit(parts[1], "default duration", "--default-duration");
|
||||
}
|
||||
|
||||
/** \brief Parse the argument for \c --blockadd
|
||||
@ -1148,20 +1158,23 @@ static void
|
||||
parse_max_blockadd_id(const string &s,
|
||||
track_info_c &ti) {
|
||||
vector<string> parts;
|
||||
max_blockadd_id_t mbi;
|
||||
int64_t id, max_blockadd_id;
|
||||
|
||||
parts = split(s, ":");
|
||||
if (parts.size() != 2)
|
||||
mxerror(_("'%s' is not a valid parts of track ID and block additional in "
|
||||
"'--blockadd %s'.\n"), s.c_str(), s.c_str());
|
||||
if (!parse_int(parts[0], mbi.id))
|
||||
|
||||
id = 0;
|
||||
if (!parse_int(parts[0], id))
|
||||
mxerror(_("'%s' is not a valid track ID in '--blockadd %s'.\n"),
|
||||
parts[0].c_str(), s.c_str());
|
||||
if (!parse_int(parts[1], mbi.max_blockadd_id) || (mbi.max_blockadd_id < 0))
|
||||
max_blockadd_id = 0;
|
||||
if (!parse_int(parts[1], max_blockadd_id) || (max_blockadd_id < 0))
|
||||
mxerror(_("'%s' is not a valid block additional max in '--blockadd %s'."
|
||||
"\n"),
|
||||
parts[1].c_str(), s.c_str());
|
||||
ti.max_blockadd_ids.push_back(mbi);
|
||||
ti.max_blockadd_ids[id] = max_blockadd_id;
|
||||
}
|
||||
|
||||
/** \brief Sets the priority mkvmerge runs with
|
||||
@ -1809,13 +1822,10 @@ parse_args(vector<string> args) {
|
||||
sit++;
|
||||
|
||||
} else if (this_arg == "--language") {
|
||||
language_t lang;
|
||||
|
||||
if (no_next_arg)
|
||||
mxerror(_("'--language' lacks its argument.\n"));
|
||||
|
||||
parse_language(next_arg, lang, "language", "language", true);
|
||||
ti->languages.push_back(lang);
|
||||
parse_language(next_arg, ti->languages, "language", "language", true);
|
||||
sit++;
|
||||
|
||||
} else if (this_arg == "--default-language") {
|
||||
@ -1856,8 +1866,6 @@ parse_args(vector<string> args) {
|
||||
sit++;
|
||||
|
||||
} else if (this_arg == "--compression") {
|
||||
compression_method_t compression;
|
||||
|
||||
if (no_next_arg)
|
||||
mxerror(_("'--compression' lacks its argument.\n"));
|
||||
|
||||
@ -1872,24 +1880,19 @@ parse_args(vector<string> args) {
|
||||
sit++;
|
||||
|
||||
} else if (this_arg == "--track-name") {
|
||||
language_t lang;
|
||||
|
||||
if (no_next_arg)
|
||||
mxerror(_("'--track-name' lacks its argument.\n"));
|
||||
|
||||
parse_language(next_arg, lang, "track-name", "track name", false, true);
|
||||
ti->track_names.push_back(track_name_t(lang.language, lang.id));
|
||||
parse_language(next_arg, ti->track_names, "track-name", "track name",
|
||||
false, true);
|
||||
sit++;
|
||||
|
||||
} else if (this_arg == "--timecodes") {
|
||||
language_t lang;
|
||||
string s;
|
||||
|
||||
if (no_next_arg)
|
||||
mxerror(_("'--timecodes' lacks its argument.\n"));
|
||||
|
||||
parse_language(next_arg, lang, "timecodes", "timecodes", false);
|
||||
ti->all_ext_timecodes.push_back(ext_timecodes_t(lang.language, lang.id));
|
||||
parse_language(next_arg, ti->all_ext_timecodes, "timecodes",
|
||||
"timecodes", false);
|
||||
sit++;
|
||||
|
||||
} else if (this_arg == "--track-order") {
|
||||
|
@ -54,7 +54,6 @@ generic_packetizer_c::generic_packetizer_c(generic_reader_c *nreader,
|
||||
track_info_c &_ti)
|
||||
throw(error_c): ti(_ti) {
|
||||
int i;
|
||||
bool found;
|
||||
|
||||
#ifdef DEBUG
|
||||
debug_facility.add_packetizer(this);
|
||||
@ -78,125 +77,93 @@ generic_packetizer_c::generic_packetizer_c(generic_reader_c *nreader,
|
||||
timecode_factory_application_mode = TFA_AUTOMATIC;
|
||||
|
||||
// Let's see if the user specified audio sync for this track.
|
||||
found = false;
|
||||
for (i = 0; i < ti.audio_syncs.size(); i++) {
|
||||
audio_sync_t &as = ti.audio_syncs[i];
|
||||
if ((as.id == ti.id) || (as.id == -1)) { // -1 == all tracks
|
||||
found = true;
|
||||
ti.async = as;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found && (ti.async.linear == 0.0)) {
|
||||
if (map_has_key(ti.audio_syncs, ti.id))
|
||||
ti.async = ti.audio_syncs[ti.id];
|
||||
else if (map_has_key(ti.audio_syncs, -1))
|
||||
ti.async = ti.audio_syncs[-1];
|
||||
if (0.0 == ti.async.linear)
|
||||
ti.async.linear = 1.0;
|
||||
ti.async.displacement = 0;
|
||||
} else
|
||||
ti.async.displacement *= (int64_t)1000000; // ms to ns
|
||||
ti.async.displacement *= (int64_t)1000000; // ms to ns
|
||||
initial_displacement = ti.async.displacement;
|
||||
ti.async.displacement = 0;
|
||||
|
||||
// Let's see if the user has specified a delay for this track.
|
||||
ti.packet_delay = 0;
|
||||
for (i = 0; i < ti.packet_delays.size(); i++) {
|
||||
packet_delay_t &pd = ti.packet_delays[i];
|
||||
if ((pd.id == ti.id) || (pd.id == -1)) { // -1 == all tracks
|
||||
ti.packet_delay = pd.delay;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (map_has_key(ti.packet_delays, ti.id))
|
||||
ti.packet_delay = ti.packet_delays[ti.id];
|
||||
else if (map_has_key(ti.packet_delays, -1))
|
||||
ti.packet_delay = ti.packet_delays[-1];
|
||||
|
||||
// Let's see if the user has specified which cues he wants for this track.
|
||||
ti.cues = CUE_STRATEGY_UNSPECIFIED;
|
||||
for (i = 0; i < ti.cue_creations.size(); i++) {
|
||||
cue_creation_t &cc = ti.cue_creations[i];
|
||||
if ((cc.id == ti.id) || (cc.id == -1)) { // -1 == all tracks
|
||||
ti.cues = cc.cues;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (map_has_key(ti.cue_creations, ti.id))
|
||||
ti.cues = ti.cue_creations[ti.id];
|
||||
else if (map_has_key(ti.cue_creations, -1))
|
||||
ti.cues = ti.cue_creations[-1];
|
||||
|
||||
// Let's see if the user has given a default track flag for this track.
|
||||
for (i = 0; i < ti.default_track_flags.size(); i++) {
|
||||
int64_t id = ti.default_track_flags[i];
|
||||
if ((id == ti.id) || (id == -1)) { // -1 == all tracks
|
||||
for (i = 0; ti.default_track_flags.size() > i; ++i)
|
||||
if ((-1 == ti.default_track_flags[i]) ||
|
||||
(ti.id == ti.default_track_flags[i])) {
|
||||
ti.default_track = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Let's see if the user has specified a language for this track.
|
||||
for (i = 0; i < ti.languages.size(); i++) {
|
||||
language_t &lang = ti.languages[i];
|
||||
if ((lang.id == ti.id) || (lang.id == -1)) { // -1 == all tracks
|
||||
ti.language = lang.language;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (map_has_key(ti.languages, ti.id))
|
||||
ti.language = ti.languages[ti.id];
|
||||
else if (map_has_key(ti.languages, -1))
|
||||
ti.language = ti.languages[-1];
|
||||
|
||||
// Let's see if the user has specified a sub charset for this track.
|
||||
for (i = 0; i < ti.sub_charsets.size(); i++) {
|
||||
subtitle_charset_t &sc = ti.sub_charsets[i];
|
||||
if ((sc.id == ti.id) || (sc.id == -1)) { // -1 == all tracks
|
||||
ti.sub_charset = sc.charset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (map_has_key(ti.sub_charsets, ti.id))
|
||||
ti.sub_charset = ti.sub_charsets[ti.id];
|
||||
else if (map_has_key(ti.sub_charsets, -1))
|
||||
ti.sub_charset = ti.sub_charsets[-1];
|
||||
|
||||
// Let's see if the user has specified a sub charset for this track.
|
||||
for (i = 0; i < ti.all_tags.size(); i++) {
|
||||
tags_t &tags = ti.all_tags[i];
|
||||
if ((tags.id == ti.id) || (tags.id == -1)) { // -1 == all tracks
|
||||
ti.tags_ptr = i;
|
||||
if (ti.tags != NULL)
|
||||
delete ti.tags;
|
||||
ti.tags = new KaxTags;
|
||||
parse_xml_tags(ti.all_tags[ti.tags_ptr].file_name, ti.tags);
|
||||
break;
|
||||
}
|
||||
if (map_has_key(ti.all_tags, ti.id))
|
||||
ti.tags_file_name = ti.all_tags[ti.id];
|
||||
else if (map_has_key(ti.all_tags, -1))
|
||||
ti.tags_file_name = ti.all_tags[-1];
|
||||
if (ti.tags_file_name != "") {
|
||||
ti.tags = new KaxTags;
|
||||
parse_xml_tags(ti.tags_file_name, ti.tags);
|
||||
}
|
||||
|
||||
// Let's see if the user has specified how this track should be compressed.
|
||||
ti.compression = COMPRESSION_UNSPECIFIED;
|
||||
for (i = 0; i < ti.compression_list.size(); i++) {
|
||||
compression_method_t &cm = ti.compression_list[i];
|
||||
if ((cm.id == ti.id) || (cm.id == -1)) { // -1 == all tracks
|
||||
ti.compression = cm.method;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (map_has_key(ti.compression_list, ti.id))
|
||||
ti.compression = ti.compression_list[ti.id];
|
||||
else if (map_has_key(ti.compression_list, -1))
|
||||
ti.compression = ti.compression_list[-1];
|
||||
|
||||
// Let's see if the user has specified a name for this track.
|
||||
for (i = 0; i < ti.track_names.size(); i++) {
|
||||
track_name_t &tn = ti.track_names[i];
|
||||
if ((tn.id == ti.id) || (tn.id == -1)) { // -1 == all tracks
|
||||
ti.track_name = tn.name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (map_has_key(ti.track_names, ti.id))
|
||||
ti.track_name = ti.track_names[ti.id];
|
||||
else if (map_has_key(ti.track_names, -1))
|
||||
ti.track_name = ti.track_names[-1];
|
||||
|
||||
// Let's see if the user has specified external timecodes for this track.
|
||||
for (i = 0; i < ti.all_ext_timecodes.size(); i++) {
|
||||
ext_timecodes_t &et = ti.all_ext_timecodes[i];
|
||||
if ((et.id == ti.id) || (et.id == -1)) { // -1 == all tracks
|
||||
ti.ext_timecodes = et.ext_timecodes;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (map_has_key(ti.all_ext_timecodes, ti.id))
|
||||
ti.ext_timecodes = ti.all_ext_timecodes[ti.id];
|
||||
else if (map_has_key(ti.all_ext_timecodes, -1))
|
||||
ti.ext_timecodes = ti.all_ext_timecodes[-1];
|
||||
|
||||
// Let's see if the user has specified an aspect ratio or display dimensions
|
||||
// for this track.
|
||||
for (i = 0; i < ti.display_properties.size(); i++) {
|
||||
i = -2;
|
||||
if (map_has_key(ti.display_properties, ti.id))
|
||||
i = ti.id;
|
||||
else if (map_has_key(ti.display_properties, -1))
|
||||
i = -1;
|
||||
if (-2 != i) {
|
||||
display_properties_t &dprop = ti.display_properties[i];
|
||||
if ((dprop.id == ti.id) || (dprop.id == -1)) { // -1 == all tracks
|
||||
if (dprop.aspect_ratio < 0) {
|
||||
ti.display_width = dprop.width;
|
||||
ti.display_height = dprop.height;
|
||||
ti.display_dimensions_given = true;
|
||||
} else {
|
||||
ti.aspect_ratio = dprop.aspect_ratio;
|
||||
ti.aspect_ratio_given = true;
|
||||
ti.aspect_ratio_is_factor = dprop.ar_factor;
|
||||
}
|
||||
if (dprop.aspect_ratio < 0) {
|
||||
ti.display_width = dprop.width;
|
||||
ti.display_height = dprop.height;
|
||||
ti.display_dimensions_given = true;
|
||||
} else {
|
||||
ti.aspect_ratio = dprop.aspect_ratio;
|
||||
ti.aspect_ratio_given = true;
|
||||
ti.aspect_ratio_is_factor = dprop.ar_factor;
|
||||
}
|
||||
}
|
||||
if (ti.aspect_ratio_given && ti.display_dimensions_given)
|
||||
@ -205,49 +172,37 @@ generic_packetizer_c::generic_packetizer_c(generic_reader_c *nreader,
|
||||
_("Aspect ratio factor") : _("Aspect ratio"), ti.id,
|
||||
ti.fname.c_str());
|
||||
|
||||
memset(ti.fourcc, 0, 5);
|
||||
// Let's see if the user has specified a FourCC for this track.
|
||||
for (i = 0; i < ti.all_fourccs.size(); i++) {
|
||||
fourcc_t &fourcc = ti.all_fourccs[i];
|
||||
if ((fourcc.id == ti.id) || (fourcc.id == -1)) { // -1 == all tracks
|
||||
memcpy(ti.fourcc, fourcc.fourcc, 4);
|
||||
ti.fourcc[4] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (map_has_key(ti.all_fourccs, ti.id))
|
||||
ti.fourcc = ti.all_fourccs[ti.id];
|
||||
else if (map_has_key(ti.all_fourccs, -1))
|
||||
ti.fourcc = ti.all_fourccs[-1];
|
||||
|
||||
memset(&ti.pixel_cropping, 0, sizeof(pixel_crop_t));
|
||||
ti.pixel_cropping.id = -2;
|
||||
// Let's see if the user has specified a FourCC for this track.
|
||||
for (i = 0; i < ti.pixel_crop_list.size(); i++) {
|
||||
pixel_crop_t &cropping = ti.pixel_crop_list[i];
|
||||
if ((cropping.id == ti.id) || (cropping.id == -1)) { // -1 == all tracks
|
||||
ti.pixel_cropping = cropping;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ti.pixel_cropping_specified = true;
|
||||
if (map_has_key(ti.pixel_crop_list, ti.id))
|
||||
ti.pixel_cropping = ti.pixel_crop_list[ti.id];
|
||||
else if (map_has_key(ti.pixel_crop_list, -1))
|
||||
ti.pixel_cropping = ti.pixel_crop_list[-1];
|
||||
else
|
||||
ti.pixel_cropping_specified = false;
|
||||
|
||||
// Let's see if the user has specified a default duration for this track.
|
||||
htrack_default_duration = -1;
|
||||
default_duration_forced = false;
|
||||
for (i = 0; i < ti.default_durations.size(); i++) {
|
||||
default_duration_t &dd = ti.default_durations[i];
|
||||
if ((dd.id == ti.id) || (dd.id == -1)) { // -1 == all tracks
|
||||
htrack_default_duration = dd.default_duration;
|
||||
default_duration_forced = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
default_duration_forced = true;
|
||||
if (map_has_key(ti.default_durations, ti.id))
|
||||
htrack_default_duration = ti.default_durations[ti.id];
|
||||
else if (map_has_key(ti.default_durations, -1))
|
||||
htrack_default_duration = ti.default_durations[-1];
|
||||
else
|
||||
default_duration_forced = false;
|
||||
|
||||
// Let's see if the user has set a max_block_add_id
|
||||
htrack_max_add_block_ids = -1;
|
||||
for (i = 0; i < ti.max_blockadd_ids.size(); i++) {
|
||||
max_blockadd_id_t &mbi = ti.max_blockadd_ids[i];
|
||||
if ((mbi.id == ti.id) || (mbi.id == -1)) { // -1 == all tracks
|
||||
htrack_max_add_block_ids = mbi.max_blockadd_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (map_has_key(ti.max_blockadd_ids, ti.id))
|
||||
htrack_max_add_block_ids = ti.max_blockadd_ids[ti.id];
|
||||
else if (map_has_key(ti.max_blockadd_ids, -1))
|
||||
htrack_max_add_block_ids = ti.max_blockadd_ids[-1];
|
||||
|
||||
// Set default header values to 'unset'.
|
||||
if (!reader->appending)
|
||||
@ -323,8 +278,8 @@ generic_packetizer_c::set_tag_track_uid() {
|
||||
if (!tag->CheckMandatory())
|
||||
mxerror(_("The tags in '%s' could not be parsed: some mandatory "
|
||||
"elements are missing.\n"),
|
||||
ti.tags_ptr >= 0 ? ti.all_tags[ti.tags_ptr].file_name.c_str()
|
||||
: ti.fname.c_str());
|
||||
ti.tags_file_name != "" ? ti.tags_file_name.c_str():
|
||||
ti.fname.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -554,7 +509,6 @@ generic_packetizer_c::set_video_pixel_cropping(int left,
|
||||
int top,
|
||||
int right,
|
||||
int bottom) {
|
||||
ti.pixel_cropping.id = 0;
|
||||
ti.pixel_cropping.left = left;
|
||||
ti.pixel_cropping.top = top;
|
||||
ti.pixel_cropping.right = right;
|
||||
@ -726,7 +680,7 @@ generic_packetizer_c::set_headers() {
|
||||
dheight.SetDefaultSize(4);
|
||||
ti.display_height = disp_height;
|
||||
|
||||
if (ti.pixel_cropping.id != -2) {
|
||||
if (ti.pixel_cropping_specified) {
|
||||
*(static_cast<EbmlUInteger *>
|
||||
(&GetChild<KaxVideoPixelCropLeft>(video))) =
|
||||
ti.pixel_cropping.left;
|
||||
@ -1232,16 +1186,16 @@ generic_packetizer_c::flush() {
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
#define add_all_requested_track_ids(container) \
|
||||
for (i = 0; i < ti.container.size(); i++) \
|
||||
add_requested_track_id(ti.container[i].id);
|
||||
#define add_all_requested_track_ids(type, container) \
|
||||
for (map<int64_t, type>::const_iterator i = ti.container.begin(); \
|
||||
ti.container.end() != i; ++i) \
|
||||
add_requested_track_id(i->first);
|
||||
#define add_all_requested_track_ids2(container) \
|
||||
for (i = 0; i < ti.container.size(); i++) \
|
||||
for (int i = 0; i < ti.container.size(); i++) \
|
||||
add_requested_track_id(ti.container[i]);
|
||||
|
||||
generic_reader_c::generic_reader_c(track_info_c &_ti):
|
||||
ti(_ti) {
|
||||
int i;
|
||||
|
||||
max_timecode_seen = 0;
|
||||
appending = false;
|
||||
@ -1255,20 +1209,20 @@ generic_reader_c::generic_reader_c(track_info_c &_ti):
|
||||
add_all_requested_track_ids2(vtracks);
|
||||
add_all_requested_track_ids2(stracks);
|
||||
add_all_requested_track_ids2(btracks);
|
||||
add_all_requested_track_ids(all_fourccs);
|
||||
add_all_requested_track_ids(display_properties);
|
||||
add_all_requested_track_ids(audio_syncs);
|
||||
add_all_requested_track_ids(cue_creations);
|
||||
add_all_requested_track_ids(string, all_fourccs);
|
||||
add_all_requested_track_ids(display_properties_t, display_properties);
|
||||
add_all_requested_track_ids(audio_sync_t, audio_syncs);
|
||||
add_all_requested_track_ids(cue_strategy_e, cue_creations);
|
||||
add_all_requested_track_ids2(default_track_flags);
|
||||
add_all_requested_track_ids(languages);
|
||||
add_all_requested_track_ids(sub_charsets);
|
||||
add_all_requested_track_ids(all_tags);
|
||||
add_all_requested_track_ids(string, languages);
|
||||
add_all_requested_track_ids(string, sub_charsets);
|
||||
add_all_requested_track_ids(string, all_tags);
|
||||
add_all_requested_track_ids2(aac_is_sbr);
|
||||
add_all_requested_track_ids(packet_delays);
|
||||
add_all_requested_track_ids(compression_list);
|
||||
add_all_requested_track_ids(track_names);
|
||||
add_all_requested_track_ids(all_ext_timecodes);
|
||||
add_all_requested_track_ids(pixel_crop_list);
|
||||
add_all_requested_track_ids(int64_t, packet_delays);
|
||||
add_all_requested_track_ids(compression_method_e, compression_list);
|
||||
add_all_requested_track_ids(string, track_names);
|
||||
add_all_requested_track_ids(string, all_ext_timecodes);
|
||||
add_all_requested_track_ids(pixel_crop_t, pixel_crop_list);
|
||||
}
|
||||
|
||||
generic_reader_c::~generic_reader_c() {
|
||||
@ -1445,22 +1399,20 @@ track_info_c::track_info_c():
|
||||
aspect_ratio_given(false),
|
||||
aspect_ratio_is_factor(false),
|
||||
display_dimensions_given(false),
|
||||
cues(CUE_STRATEGY_NONE),
|
||||
cues(CUE_STRATEGY_UNSPECIFIED),
|
||||
default_track(false),
|
||||
tags_ptr(-1),
|
||||
tags(NULL),
|
||||
packet_delay(0),
|
||||
compression(COMPRESSION_NONE),
|
||||
compression(COMPRESSION_UNSPECIFIED),
|
||||
pixel_cropping_specified(false),
|
||||
no_chapters(false),
|
||||
no_attachments(false),
|
||||
no_tags(false),
|
||||
avi_audio_sync_enabled(false) {
|
||||
|
||||
memset(fourcc, 0, 5);
|
||||
async.linear = 1.0;
|
||||
async.displacement = 0;
|
||||
memset(&pixel_cropping, 0, sizeof(pixel_crop_t));
|
||||
pixel_cropping.id = -2;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1495,7 +1447,6 @@ track_info_c::operator =(const track_info_c &src) {
|
||||
private_data = (unsigned char *)safememdup(src.private_data, private_size);
|
||||
|
||||
all_fourccs = src.all_fourccs;
|
||||
memcpy(fourcc, src.fourcc, 5);
|
||||
|
||||
display_properties = src.display_properties;
|
||||
aspect_ratio = src.aspect_ratio;
|
||||
@ -1519,7 +1470,7 @@ track_info_c::operator =(const track_info_c &src) {
|
||||
sub_charset = src.sub_charset;
|
||||
|
||||
all_tags = src.all_tags;
|
||||
tags_ptr = src.tags_ptr;
|
||||
tags_file_name = src.tags_file_name;
|
||||
if (src.tags != NULL)
|
||||
tags = static_cast<KaxTags *>(src.tags->Clone());
|
||||
else
|
||||
@ -1541,6 +1492,7 @@ track_info_c::operator =(const track_info_c &src) {
|
||||
|
||||
pixel_crop_list = src.pixel_crop_list;
|
||||
pixel_cropping = src.pixel_cropping;
|
||||
pixel_cropping_specified = src.pixel_cropping_specified;
|
||||
|
||||
no_chapters = src.no_chapters;
|
||||
no_attachments = src.no_attachments;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "os.h"
|
||||
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <matroska/KaxAttachments.h>
|
||||
@ -73,16 +74,8 @@ enum file_status_e {
|
||||
struct audio_sync_t {
|
||||
int64_t displacement;
|
||||
double linear;
|
||||
int64_t id;
|
||||
|
||||
audio_sync_t(): displacement(0), linear(0.0), id(0) {}
|
||||
};
|
||||
|
||||
struct packet_delay_t {
|
||||
int64_t delay;
|
||||
int64_t id;
|
||||
|
||||
packet_delay_t(): delay(0), id(0) {}
|
||||
audio_sync_t(): displacement(0), linear(0.0) {}
|
||||
};
|
||||
|
||||
enum default_track_priority_e {
|
||||
@ -95,96 +88,19 @@ enum default_track_priority_e {
|
||||
#define FMT_FN "'%s': "
|
||||
#define FMT_TID "'%s' track %lld: "
|
||||
|
||||
struct cue_creation_t {
|
||||
cue_strategy_e cues;
|
||||
int64_t id;
|
||||
|
||||
cue_creation_t(): cues(CUE_STRATEGY_NONE), id(0) {}
|
||||
};
|
||||
|
||||
struct compression_method_t {
|
||||
compression_method_e method;
|
||||
int64_t id;
|
||||
|
||||
compression_method_t(): method(COMPRESSION_UNSPECIFIED), id(0) {}
|
||||
};
|
||||
|
||||
struct language_t {
|
||||
string language;
|
||||
int64_t id;
|
||||
|
||||
language_t(): id(0) {}
|
||||
};
|
||||
|
||||
struct track_name_t {
|
||||
string name;
|
||||
int64_t id;
|
||||
|
||||
track_name_t(): id(0) {}
|
||||
track_name_t(const string &_name, int64_t _id): name(_name), id(_id) {}
|
||||
};
|
||||
|
||||
struct ext_timecodes_t {
|
||||
string ext_timecodes;
|
||||
int64_t id;
|
||||
|
||||
ext_timecodes_t(): id(0) {}
|
||||
ext_timecodes_t(const string &_ext_timecodes, int64_t _id):
|
||||
ext_timecodes(_ext_timecodes), id(_id) {}
|
||||
};
|
||||
|
||||
struct subtitle_charset_t {
|
||||
string charset;
|
||||
int64_t id;
|
||||
|
||||
subtitle_charset_t(): id(0) {}
|
||||
};
|
||||
|
||||
struct tags_t {
|
||||
string file_name;
|
||||
int64_t id;
|
||||
|
||||
tags_t(): id(0) {}
|
||||
};
|
||||
|
||||
struct display_properties_t {
|
||||
float aspect_ratio;
|
||||
bool ar_factor;
|
||||
int width, height;
|
||||
int64_t id;
|
||||
|
||||
display_properties_t(): aspect_ratio(0), ar_factor(false), width(0),
|
||||
height(0), id(0) {}
|
||||
};
|
||||
|
||||
typedef struct fourcc_t {
|
||||
char fourcc[5];
|
||||
int64_t id;
|
||||
|
||||
fourcc_t(): id(0) {
|
||||
memset(fourcc, 0, 5);
|
||||
}
|
||||
height(0) {}
|
||||
};
|
||||
|
||||
struct pixel_crop_t {
|
||||
int left, top, right, bottom;
|
||||
int64_t id;
|
||||
|
||||
pixel_crop_t(): left(0), top(0), right(0), bottom(0), id(0) {}
|
||||
};
|
||||
|
||||
struct max_blockadd_id_t {
|
||||
int64_t max_blockadd_id;
|
||||
int64_t id;
|
||||
|
||||
max_blockadd_id_t(): max_blockadd_id(0), id(0) {}
|
||||
};
|
||||
|
||||
struct default_duration_t {
|
||||
int64_t default_duration;
|
||||
int64_t id;
|
||||
|
||||
default_duration_t(): default_duration(0), id(0) {}
|
||||
pixel_crop_t(): left(0), top(0), right(0), bottom(0) {}
|
||||
};
|
||||
|
||||
class track_info_c {
|
||||
@ -203,51 +119,52 @@ public:
|
||||
unsigned char *private_data;
|
||||
int private_size;
|
||||
|
||||
vector<fourcc_t> all_fourccs;
|
||||
char fourcc[5];
|
||||
vector<display_properties_t> display_properties;
|
||||
map<int64_t, string> all_fourccs;
|
||||
string fourcc;
|
||||
map<int64_t, display_properties_t> display_properties;
|
||||
float aspect_ratio;
|
||||
int display_width, display_height;
|
||||
bool aspect_ratio_given, aspect_ratio_is_factor, display_dimensions_given;
|
||||
|
||||
vector<audio_sync_t> audio_syncs; // As given on the command line
|
||||
map<int64_t, audio_sync_t> audio_syncs; // As given on the command line
|
||||
audio_sync_t async; // For this very track
|
||||
|
||||
vector<cue_creation_t> cue_creations; // As given on the command line
|
||||
map<int64_t, cue_strategy_e> cue_creations; // As given on the command line
|
||||
cue_strategy_e cues; // For this very track
|
||||
|
||||
vector<int64_t> default_track_flags; // As given on the command line
|
||||
bool default_track; // For this very track
|
||||
|
||||
vector<language_t> languages; // As given on the command line
|
||||
map<int64_t, string> languages; // As given on the command line
|
||||
string language; // For this very track
|
||||
|
||||
vector<subtitle_charset_t> sub_charsets; // As given on the command line
|
||||
map<int64_t, string> sub_charsets; // As given on the command line
|
||||
string sub_charset; // For this very track
|
||||
|
||||
vector<tags_t> all_tags; // As given on the command line
|
||||
int tags_ptr; // For this very track
|
||||
map<int64_t, string> all_tags; // As given on the command line
|
||||
string tags_file_name; // For this very track
|
||||
KaxTags *tags; // For this very track
|
||||
|
||||
vector<int64_t> aac_is_sbr; // For AAC+/HE-AAC/SBR
|
||||
|
||||
vector<packet_delay_t> packet_delays; // As given on the command line
|
||||
map<int64_t, int64_t> packet_delays; // As given on the command line
|
||||
int64_t packet_delay; // For this very track
|
||||
|
||||
vector<compression_method_t> compression_list; // As given on the cmd line
|
||||
map<int64_t, compression_method_e> compression_list; // As given on the cmd line
|
||||
compression_method_e compression; // For this very track
|
||||
|
||||
vector<track_name_t> track_names; // As given on the command line
|
||||
map<int64_t, string> track_names; // As given on the command line
|
||||
string track_name; // For this very track
|
||||
|
||||
vector<ext_timecodes_t> all_ext_timecodes; // As given on the command line
|
||||
map<int64_t, string> all_ext_timecodes; // As given on the command line
|
||||
string ext_timecodes; // For this very track
|
||||
|
||||
vector<pixel_crop_t> pixel_crop_list; // As given on the command line
|
||||
map<int64_t, pixel_crop_t> pixel_crop_list; // As given on the command line
|
||||
pixel_crop_t pixel_cropping; // For this very track
|
||||
bool pixel_cropping_specified;
|
||||
|
||||
vector<default_duration_t> default_durations; // As given on the command line
|
||||
vector<max_blockadd_id_t> max_blockadd_ids; // As given on the command line
|
||||
map<int64_t, int64_t> default_durations; // As given on the command line
|
||||
map<int64_t, int> max_blockadd_ids; // As given on the command line
|
||||
|
||||
bool no_chapters, no_attachments, no_tags;
|
||||
|
||||
|
@ -61,9 +61,9 @@ video_packetizer_c::check_fourcc() {
|
||||
if ((hcodec_id == MKV_V_MSCOMP) &&
|
||||
(ti.private_data != NULL) &&
|
||||
(ti.private_size >= sizeof(alBITMAPINFOHEADER)) &&
|
||||
(ti.fourcc[0] != 0)) {
|
||||
!ti.fourcc.empty()) {
|
||||
memcpy(&((alBITMAPINFOHEADER *)ti.private_data)->bi_compression,
|
||||
ti.fourcc, 4);
|
||||
ti.fourcc.c_str(), 4);
|
||||
set_codec_private(ti.private_data, ti.private_size);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user