Add driver program flags for dumping MediaInfo
Change-Id: I314027b799271e95fc12b8716f5977be00013737
This commit is contained in:
parent
f8949ae311
commit
e65e2ea220
|
@ -67,4 +67,18 @@ DEFINE_string(temp_file,
|
||||||
"not specified, a new file will be created in an OS-dependent "
|
"not specified, a new file will be created in an OS-dependent "
|
||||||
"temporary directory.");
|
"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_
|
#endif // APP_MUXER_FLAGS_H_
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
#include "media/base/muxer_options.h"
|
#include "media/base/muxer_options.h"
|
||||||
#include "media/base/request_signer.h"
|
#include "media/base/request_signer.h"
|
||||||
#include "media/base/stream_info.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.h"
|
||||||
|
#include "media/file/file_closer.h"
|
||||||
#include "media/mp4/mp4_muxer.h"
|
#include "media/mp4/mp4_muxer.h"
|
||||||
|
|
||||||
DEFINE_bool(dump_stream_info, false, "Dump demuxed stream info.");
|
DEFINE_bool(dump_stream_info, false, "Dump demuxed stream info.");
|
||||||
|
@ -171,6 +173,24 @@ bool RunPackager(const std::string& input) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
scoped_ptr<Muxer> muxer(new mp4::MP4Muxer(muxer_options));
|
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()))
|
if (!AddStreamToMuxer(demuxer.streams(), muxer.get()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ class MuxerListener {
|
||||||
kContainerWebM
|
kContainerWebM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual ~MuxerListener() {};
|
||||||
|
|
||||||
// Called when muxing starts. This event happens before any other events.
|
// Called when muxing starts. This event happens before any other events.
|
||||||
// For MPEG DASH Live profile, the initialization segment information is
|
// For MPEG DASH Live profile, the initialization segment information is
|
||||||
// available from StreamInfo.
|
// available from StreamInfo.
|
||||||
|
@ -64,7 +66,6 @@ class MuxerListener {
|
||||||
uint64 segment_file_size) = 0;
|
uint64 segment_file_size) = 0;
|
||||||
protected:
|
protected:
|
||||||
MuxerListener() {};
|
MuxerListener() {};
|
||||||
virtual ~MuxerListener() {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace event
|
} // namespace event
|
||||||
|
|
|
@ -297,6 +297,7 @@
|
||||||
],
|
],
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'file',
|
'file',
|
||||||
|
'media_event',
|
||||||
'mp4',
|
'mp4',
|
||||||
'third_party/gflags/gflags.gyp:gflags',
|
'third_party/gflags/gflags.gyp:gflags',
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue