Add driver program flags for dumping MediaInfo

Change-Id: I314027b799271e95fc12b8716f5977be00013737
This commit is contained in:
Rintaro Kuroiwa 2014-01-29 15:19:22 -08:00
parent f8949ae311
commit e65e2ea220
4 changed files with 37 additions and 1 deletions

View File

@ -67,4 +67,18 @@ DEFINE_string(temp_file,
"not specified, a new file will be created in an OS-dependent "
"temporary directory.");
// Flags for MuxerListener.
DEFINE_bool(output_media_info,
true,
"Create a human readable format of MediaInfo. The output file name "
"will be the name specified by output flag, suffixed with "
"'.media_info'.");
DEFINE_string(scheme_id_uri,
"",
"This flag only applies if output_media_info is true. This value "
"will be set in MediaInfo if the stream is encrypted. "
"Use scheme_id_uri when you generate an MPD. If the "
"stream is encrypted, MPD requires a <ContentProtection> "
"element which requires the schemeIdUri attribute.");
#endif // APP_MUXER_FLAGS_H_

View File

@ -18,7 +18,9 @@
#include "media/base/muxer_options.h"
#include "media/base/request_signer.h"
#include "media/base/stream_info.h"
#include "media/event/vod_media_info_dump_muxer_listener.h"
#include "media/file/file.h"
#include "media/file/file_closer.h"
#include "media/mp4/mp4_muxer.h"
DEFINE_bool(dump_stream_info, false, "Dump demuxed stream info.");
@ -171,6 +173,24 @@ bool RunPackager(const std::string& input) {
return false;
scoped_ptr<Muxer> muxer(new mp4::MP4Muxer(muxer_options));
scoped_ptr<event::MuxerListener> muxer_listener;
scoped_ptr<File, FileCloser> mpd_file;
if (FLAGS_output_media_info) {
std::string output_mpd_file_name = FLAGS_output + ".media_info";
mpd_file.reset(File::Open(output_mpd_file_name.c_str(), "w"));
if (!mpd_file) {
LOG(ERROR) << "Failed to open " << output_mpd_file_name;
return false;
}
scoped_ptr<event::VodMediaInfoDumpMuxerListener> media_info_muxer_listener(
new event::VodMediaInfoDumpMuxerListener(mpd_file.get()));
media_info_muxer_listener->SetContentProtectionSchemeIdUri(
FLAGS_scheme_id_uri);
muxer_listener = media_info_muxer_listener.Pass();
muxer->SetMuxerListener(muxer_listener.get());
}
if (!AddStreamToMuxer(demuxer.streams(), muxer.get()))
return false;

View File

@ -24,6 +24,8 @@ class MuxerListener {
kContainerWebM
};
virtual ~MuxerListener() {};
// Called when muxing starts. This event happens before any other events.
// For MPEG DASH Live profile, the initialization segment information is
// available from StreamInfo.
@ -64,7 +66,6 @@ class MuxerListener {
uint64 segment_file_size) = 0;
protected:
MuxerListener() {};
virtual ~MuxerListener() {};
};
} // namespace event

View File

@ -297,6 +297,7 @@
],
'dependencies': [
'file',
'media_event',
'mp4',
'third_party/gflags/gflags.gyp:gflags',
],