mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2025-01-03 00:35:55 +00:00
mkvmerge: chapters: support specifying MPLS with --chapters
Fixes/implements #3735
This commit is contained in:
parent
b3b6b06cad
commit
a82f6e6a6d
4
NEWS.md
4
NEWS.md
@ -7,6 +7,10 @@
|
||||
* MKVToolNix GUI: jobs: the status bar now differentiates between numbers of
|
||||
warnings/errors that occurred in the current session and those that occurred
|
||||
before the current session. Implements #3732.
|
||||
* mkvmerge: chapters: added support for specifying MPLS files with
|
||||
`--chapters`, too, not just as regular source files. The documentation
|
||||
stated this was possible already, but that wasn't actually the
|
||||
case. Implements/fixes #3735.
|
||||
|
||||
## Bug fixes
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "common/chapters/chapters.h"
|
||||
#include "common/construct.h"
|
||||
#include "common/ebml.h"
|
||||
#include "common/hacks.h"
|
||||
#include "common/mm_file_io.h"
|
||||
#include "common/unique_numbers.h"
|
||||
|
||||
namespace mtx::chapters {
|
||||
@ -66,4 +68,19 @@ convert_mpls_chapters_kax_chapters(mtx::bluray::mpls::chapters_t const &mpls_cha
|
||||
return kax_chapters;
|
||||
}
|
||||
|
||||
std::shared_ptr<libmatroska::KaxChapters>
|
||||
maybe_parse_bluray(std::string const &file_name,
|
||||
mtx::bcp47::language_c const &language) {
|
||||
|
||||
mm_file_io_c in{file_name};
|
||||
auto parser = mtx::bluray::mpls::parser_c{};
|
||||
|
||||
parser.enable_dropping_last_entry_if_at_end(!mtx::hacks::is_engaged(mtx::hacks::KEEP_LAST_CHAPTER_IN_MPLS));
|
||||
|
||||
if (parser.parse(in))
|
||||
return mtx::chapters::convert_mpls_chapters_kax_chapters(parser.get_chapters(), language, g_chapter_generation_name_template.get_translated());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,5 +21,6 @@ class KaxChapters;
|
||||
namespace mtx::chapters {
|
||||
|
||||
std::shared_ptr<libmatroska::KaxChapters> convert_mpls_chapters_kax_chapters(mtx::bluray::mpls::chapters_t const &chapters, mtx::bcp47::language_c const &main_language, std::string const &name_template = {});
|
||||
std::shared_ptr<libmatroska::KaxChapters> maybe_parse_bluray(std::string const &file_name, mtx::bcp47::language_c const &language);
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "common/bcp47.h"
|
||||
#include "common/chapters/chapters.h"
|
||||
#include "common/chapters/bluray.h"
|
||||
#include "common/chapters/dvd.h"
|
||||
#include "common/construct.h"
|
||||
#include "common/container.h"
|
||||
@ -548,6 +549,16 @@ parse(const std::string &file_name,
|
||||
}
|
||||
#endif
|
||||
|
||||
auto parsed_bluray_chapters = maybe_parse_bluray(file_name, language);
|
||||
if (parsed_bluray_chapters) {
|
||||
unify_legacy_and_bcp47_languages_and_countries(*parsed_bluray_chapters);
|
||||
|
||||
if (format)
|
||||
*format = format_e::bluray;
|
||||
|
||||
return parsed_bluray_chapters;
|
||||
}
|
||||
|
||||
mm_text_io_c in(std::make_shared<mm_file_io_c>(file_name));
|
||||
auto parsed_chapters = parse(&in, min_ts, max_ts, offset, language, charset, exception_on_error, format, tags);
|
||||
|
||||
|
@ -56,6 +56,7 @@ enum class format_e {
|
||||
cue,
|
||||
ffmpeg_meta,
|
||||
dvd,
|
||||
bluray,
|
||||
};
|
||||
|
||||
mtx::chapters::kax_cptr
|
||||
|
Loading…
Reference in New Issue
Block a user