MPEG TS reader: output playlist details for MPLS files

This commit is contained in:
Moritz Bunkus 2013-02-14 16:52:29 +01:00
parent 8d35a5a20b
commit b65bafe694
4 changed files with 23 additions and 2 deletions

View File

@ -4,6 +4,7 @@
#include "common/debugging.h"
#include "common/mm_mpls_multi_file_io.h"
#include "common/strings/formatting.h"
mm_mpls_multi_file_io_c::mm_mpls_multi_file_io_c(std::vector<bfs::path> const &file_names,
std::string const &display_file_name,
@ -92,3 +93,16 @@ mm_mpls_multi_file_io_c::open_multi(mm_io_c *in) {
return mm_io_cptr{new mm_mpls_multi_file_io_c{file_names, in->get_file_name(), mpls_parser}};
}
void
mm_mpls_multi_file_io_c::create_verbose_identification_info(std::vector<std::string> &verbose_info) {
boost::system::error_code ec;
auto total_size = boost::accumulate(m_files, 0ull, [&ec](unsigned long long accu, file_t const &file) { return accu + file.m_size; });
verbose_info.push_back("playlist:1");
verbose_info.push_back((boost::format("playlist_duration:%1%") % m_mpls_parser->get_playlist().duration.to_ns()).str());
verbose_info.push_back((boost::format("playlist_size:%1%") % total_size) .str());
verbose_info.push_back((boost::format("playlist_chapters:%1%") % m_mpls_parser->get_chapters().size()) .str());
for (auto &file : m_files)
verbose_info.push_back((boost::format("playlist_file:%1%") % escape(file.m_file_name.string())).str());
}

View File

@ -28,6 +28,7 @@ public:
virtual ~mm_mpls_multi_file_io_c();
std::vector<timecode_c> const &get_chapters() const;
virtual void create_verbose_identification_info(std::vector<std::string> &verbose_info);
static mm_io_cptr open_multi(std::string const &display_file_name);
static mm_io_cptr open_multi(mm_io_c *in);

View File

@ -22,6 +22,7 @@ class mm_multi_file_io_c;
typedef std::shared_ptr<mm_multi_file_io_c> mm_multi_file_io_cptr;
class mm_multi_file_io_c: public mm_io_c {
protected:
struct file_t {
bfs::path m_file_name;
uint64_t m_size, m_global_start;

View File

@ -496,7 +496,12 @@ mpeg_ts_reader_c::~mpeg_ts_reader_c() {
void
mpeg_ts_reader_c::identify() {
id_result_container();
std::vector<std::string> verbose_info;
auto mpls_in = dynamic_cast<mm_mpls_multi_file_io_c *>(get_underlying_input_as_multi_file_io());
if (mpls_in)
mpls_in->create_verbose_identification_info(verbose_info);
id_result_container(verbose_info);
size_t i;
for (i = 0; i < tracks.size(); i++) {
@ -524,7 +529,7 @@ mpeg_ts_reader_c::identify() {
if (!fourcc)
continue;
std::vector<std::string> verbose_info;
verbose_info.clear();
if (!track->language.empty())
verbose_info.push_back((boost::format("language:%1%") % escape(track->language)).str());