DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
packager_main.cc
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include <gflags/gflags.h>
8 #include <iostream>
9 
10 #include "packager/app/fixed_key_encryption_flags.h"
11 #include "packager/app/hls_flags.h"
12 #include "packager/app/libcrypto_threading.h"
13 #include "packager/app/mpd_flags.h"
14 #include "packager/app/muxer_flags.h"
15 #include "packager/app/packager_util.h"
16 #include "packager/app/playready_key_encryption_flags.h"
17 #include "packager/app/stream_descriptor.h"
18 #include "packager/app/vlog_flags.h"
19 #include "packager/app/widevine_encryption_flags.h"
20 #include "packager/base/at_exit.h"
21 #include "packager/base/command_line.h"
22 #include "packager/base/files/file_path.h"
23 #include "packager/base/logging.h"
24 #include "packager/base/path_service.h"
25 #include "packager/base/strings/string_split.h"
26 #include "packager/base/strings/stringprintf.h"
27 #include "packager/base/threading/simple_thread.h"
28 #include "packager/base/time/clock.h"
29 #include "packager/hls/base/hls_notifier.h"
30 #include "packager/hls/base/simple_hls_notifier.h"
31 #include "packager/media/base/container_names.h"
32 #include "packager/media/base/demuxer.h"
33 #include "packager/media/base/fourccs.h"
34 #include "packager/media/base/key_source.h"
35 #include "packager/media/base/muxer_options.h"
36 #include "packager/media/base/muxer_util.h"
37 #include "packager/media/chunking/chunking_handler.h"
38 #include "packager/media/crypto/encryption_handler.h"
39 #include "packager/media/event/hls_notify_muxer_listener.h"
40 #include "packager/media/event/mpd_notify_muxer_listener.h"
41 #include "packager/media/event/vod_media_info_dump_muxer_listener.h"
42 #include "packager/media/file/file.h"
43 #include "packager/media/formats/mp2t/ts_muxer.h"
44 #include "packager/media/formats/mp4/mp4_muxer.h"
45 #include "packager/media/formats/webm/webm_muxer.h"
46 #include "packager/mpd/base/dash_iop_mpd_notifier.h"
47 #include "packager/mpd/base/media_info.pb.h"
48 #include "packager/mpd/base/mpd_builder.h"
49 #include "packager/mpd/base/simple_mpd_notifier.h"
50 #include "packager/version/version.h"
51 
52 #if defined(OS_WIN)
53 #include <codecvt>
54 #include <functional>
55 #include <locale>
56 #endif // defined(OS_WIN)
57 
58 DEFINE_bool(use_fake_clock_for_muxer,
59  false,
60  "Set to true to use a fake clock for muxer. With this flag set, "
61  "creation time and modification time in outputs are set to 0. "
62  "Should only be used for testing.");
63 DEFINE_bool(override_version,
64  false,
65  "Override packager version in the generated outputs with "
66  "--test_version if it is set to true. Should be used for "
67  "testing only.");
68 DEFINE_string(test_version,
69  "",
70  "Packager version for testing. Ignored if --override_version is "
71  "false. Should be used for testing only.");
72 
73 namespace shaka {
74 namespace media {
75 namespace {
76 
77 const char kUsage[] =
78  "%s [flags] <stream_descriptor> ...\n\n"
79  " stream_descriptor consists of comma separated field_name/value pairs:\n"
80  " field_name=value,[field_name=value,]...\n"
81  " Supported field names are as follows:\n"
82  " - input (in): Required input/source media file path or network stream\n"
83  " URL.\n"
84  " - stream_selector (stream): Required field with value 'audio',\n"
85  " 'video', 'text', or stream number (zero based).\n"
86  " - output (out): Required output file (single file) or initialization\n"
87  " file path (multiple file).\n"
88  " - segment_template (segment): Optional value which specifies the\n"
89  " naming pattern for the segment files, and that the stream should be\n"
90  " split into multiple files. Its presence should be consistent across\n"
91  " streams.\n"
92  " - bandwidth (bw): Optional value which contains a user-specified\n"
93  " content bit rate for the stream, in bits/sec. If specified, this\n"
94  " value is propagated to the $Bandwidth$ template parameter for\n"
95  " segment names. If not specified, its value may be estimated.\n"
96  " - language (lang): Optional value which contains a user-specified\n"
97  " language tag. If specified, this value overrides any language\n"
98  " metadata in the input track.\n"
99  " - output_format (format): Optional value which specifies the format\n"
100  " of the output files (MP4 or WebM). If not specified, it will be\n"
101  " derived from the file extension of the output file.\n"
102  " - hls_name: Required for audio when outputting HLS.\n"
103  " name of the output stream. This is not (necessarily) the same as\n"
104  " output. This is used as the NAME attribute for EXT-X-MEDIA\n"
105  " - hls_group_id: Required for audio when outputting HLS.\n"
106  " The group ID for the output stream. For HLS this is used as the\n"
107  " GROUP-ID attribute for EXT-X-MEDIA.\n"
108  " - playlist_name: Required for HLS output.\n"
109  " Name of the playlist for the stream. Usually ends with '.m3u8'.\n";
110 
111 const char kMediaInfoSuffix[] = ".media_info";
112 
113 enum ExitStatus {
114  kSuccess = 0,
115  kArgumentValidationFailed,
116  kPackagingFailed,
117  kInternalError,
118 };
119 
120 // TODO(rkuroiwa): Write TTML and WebVTT parser (demuxing) for a better check
121 // and for supporting live/segmenting (muxing). With a demuxer and a muxer,
122 // CreateRemuxJobs() shouldn't treat text as a special case.
123 std::string DetermineTextFileFormat(const std::string& file) {
124  std::string content;
125  if (!File::ReadFileToString(file.c_str(), &content)) {
126  LOG(ERROR) << "Failed to open file " << file
127  << " to determine file format.";
128  return "";
129  }
130  MediaContainerName container_name = DetermineContainer(
131  reinterpret_cast<const uint8_t*>(content.data()), content.size());
132  if (container_name == CONTAINER_WEBVTT) {
133  return "vtt";
134  } else if (container_name == CONTAINER_TTML) {
135  return "ttml";
136  }
137 
138  return "";
139 }
140 
141 } // namespace
142 
143 // A fake clock that always return time 0 (epoch). Should only be used for
144 // testing.
145 class FakeClock : public base::Clock {
146  public:
147  base::Time Now() override { return base::Time(); }
148 };
149 
150 // Demux, Mux(es) and worker thread used to remux a source file/stream.
151 class RemuxJob : public base::SimpleThread {
152  public:
153  RemuxJob(std::unique_ptr<Demuxer> demuxer)
154  : SimpleThread("RemuxJob"), demuxer_(std::move(demuxer)) {}
155 
156  ~RemuxJob() override {}
157 
158  Demuxer* demuxer() { return demuxer_.get(); }
159  Status status() { return status_; }
160 
161  private:
162  void Run() override {
163  DCHECK(demuxer_);
164  status_ = demuxer_->Run();
165  }
166 
167  std::unique_ptr<Demuxer> demuxer_;
168  Status status_;
169 
170  DISALLOW_COPY_AND_ASSIGN(RemuxJob);
171 };
172 
173 bool StreamInfoToTextMediaInfo(const StreamDescriptor& stream_descriptor,
174  const MuxerOptions& stream_muxer_options,
175  MediaInfo* text_media_info) {
176  const std::string& language = stream_descriptor.language;
177  std::string format = DetermineTextFileFormat(stream_descriptor.input);
178  if (format.empty()) {
179  LOG(ERROR) << "Failed to determine the text file format for "
180  << stream_descriptor.input;
181  return false;
182  }
183 
184  if (!File::Copy(stream_descriptor.input.c_str(),
185  stream_muxer_options.output_file_name.c_str())) {
186  LOG(ERROR) << "Failed to copy the input file (" << stream_descriptor.input
187  << ") to output file (" << stream_muxer_options.output_file_name
188  << ").";
189  return false;
190  }
191 
192  text_media_info->set_media_file_name(stream_muxer_options.output_file_name);
193  text_media_info->set_container_type(MediaInfo::CONTAINER_TEXT);
194 
195  if (stream_muxer_options.bandwidth != 0) {
196  text_media_info->set_bandwidth(stream_muxer_options.bandwidth);
197  } else {
198  // Text files are usually small and since the input is one file; there's no
199  // way for the player to do ranged requests. So set this value to something
200  // reasonable.
201  text_media_info->set_bandwidth(256);
202  }
203 
204  MediaInfo::TextInfo* text_info = text_media_info->mutable_text_info();
205  text_info->set_format(format);
206  if (!language.empty())
207  text_info->set_language(language);
208 
209  return true;
210 }
211 
212 std::shared_ptr<Muxer> CreateOutputMuxer(const MuxerOptions& options,
213  MediaContainerName container) {
214  if (container == CONTAINER_WEBM) {
215  return std::shared_ptr<Muxer>(new webm::WebMMuxer(options));
216  } else if (container == CONTAINER_MPEG2TS) {
217  return std::shared_ptr<Muxer>(new mp2t::TsMuxer(options));
218  } else {
219  DCHECK_EQ(container, CONTAINER_MOV);
220  return std::shared_ptr<Muxer>(new mp4::MP4Muxer(options));
221  }
222 }
223 
224 bool CreateRemuxJobs(const StreamDescriptorList& stream_descriptors,
225  const ChunkingOptions& chunking_options,
226  const EncryptionOptions& encryption_options,
227  const MuxerOptions& muxer_options,
228  FakeClock* fake_clock,
229  KeySource* encryption_key_source,
230  MpdNotifier* mpd_notifier,
231  hls::HlsNotifier* hls_notifier,
232  std::vector<std::unique_ptr<RemuxJob>>* remux_jobs) {
233  // No notifiers OR (mpd_notifier XOR hls_notifier); which is NAND.
234  DCHECK(!(mpd_notifier && hls_notifier));
235  DCHECK(remux_jobs);
236 
237  std::string previous_input;
238  int stream_number = 0;
239  for (StreamDescriptorList::const_iterator
240  stream_iter = stream_descriptors.begin();
241  stream_iter != stream_descriptors.end();
242  ++stream_iter, ++stream_number) {
243  // Process stream descriptor.
244  MuxerOptions stream_muxer_options(muxer_options);
245  stream_muxer_options.output_file_name = stream_iter->output;
246  if (!stream_iter->segment_template.empty()) {
247  if (!ValidateSegmentTemplate(stream_iter->segment_template)) {
248  LOG(ERROR) << "ERROR: segment template with '"
249  << stream_iter->segment_template << "' is invalid.";
250  return false;
251  }
252  stream_muxer_options.segment_template = stream_iter->segment_template;
253  }
254  stream_muxer_options.bandwidth = stream_iter->bandwidth;
255 
256  if (stream_iter->stream_selector == "text" &&
257  stream_iter->output_format != CONTAINER_MOV) {
258  MediaInfo text_media_info;
259  if (!StreamInfoToTextMediaInfo(*stream_iter, stream_muxer_options,
260  &text_media_info)) {
261  return false;
262  }
263 
264  if (mpd_notifier) {
265  uint32_t unused;
266  if (!mpd_notifier->NotifyNewContainer(text_media_info, &unused)) {
267  LOG(ERROR) << "Failed to process text file " << stream_iter->input;
268  } else {
269  mpd_notifier->Flush();
270  }
271  } else if (FLAGS_output_media_info) {
273  text_media_info,
274  stream_muxer_options.output_file_name + kMediaInfoSuffix);
275  } else {
276  NOTIMPLEMENTED()
277  << "--mpd_output or --output_media_info flags are "
278  "required for text output. Skipping manifest related output for "
279  << stream_iter->input;
280  }
281  continue;
282  }
283 
284  if (stream_iter->input != previous_input) {
285  // New remux job needed. Create demux and job thread.
286  std::unique_ptr<Demuxer> demuxer(new Demuxer(stream_iter->input));
287  demuxer->set_dump_stream_info(FLAGS_dump_stream_info);
288  if (FLAGS_enable_widevine_decryption ||
289  FLAGS_enable_fixed_key_decryption) {
290  std::unique_ptr<KeySource> decryption_key_source(
291  CreateDecryptionKeySource());
292  if (!decryption_key_source)
293  return false;
294  demuxer->SetKeySource(std::move(decryption_key_source));
295  }
296  remux_jobs->emplace_back(new RemuxJob(std::move(demuxer)));
297  previous_input = stream_iter->input;
298  // Skip setting up muxers if output is not needed.
299  if (stream_iter->output.empty() && stream_iter->segment_template.empty())
300  continue;
301  }
302  DCHECK(!remux_jobs->empty());
303 
304  std::shared_ptr<Muxer> muxer(
305  CreateOutputMuxer(stream_muxer_options, stream_iter->output_format));
306  if (FLAGS_use_fake_clock_for_muxer) muxer->set_clock(fake_clock);
307 
308  std::unique_ptr<MuxerListener> muxer_listener;
309  DCHECK(!(FLAGS_output_media_info && mpd_notifier));
310  if (FLAGS_output_media_info) {
311  const std::string output_media_info_file_name =
312  stream_muxer_options.output_file_name + kMediaInfoSuffix;
313  std::unique_ptr<VodMediaInfoDumpMuxerListener>
314  vod_media_info_dump_muxer_listener(
315  new VodMediaInfoDumpMuxerListener(output_media_info_file_name));
316  muxer_listener = std::move(vod_media_info_dump_muxer_listener);
317  }
318  if (mpd_notifier) {
319  std::unique_ptr<MpdNotifyMuxerListener> mpd_notify_muxer_listener(
320  new MpdNotifyMuxerListener(mpd_notifier));
321  muxer_listener = std::move(mpd_notify_muxer_listener);
322  }
323 
324  if (hls_notifier) {
325  // TODO(rkuroiwa): Do some smart stuff to group the audios, e.g. detect
326  // languages.
327  std::string group_id = stream_iter->hls_group_id;
328  std::string name = stream_iter->hls_name;
329  std::string hls_playlist_name = stream_iter->hls_playlist_name;
330  if (group_id.empty())
331  group_id = "audio";
332  if (name.empty())
333  name = base::StringPrintf("stream_%d", stream_number);
334  if (hls_playlist_name.empty())
335  hls_playlist_name = base::StringPrintf("stream_%d.m3u8", stream_number);
336 
337  muxer_listener.reset(new HlsNotifyMuxerListener(hls_playlist_name, name,
338  group_id, hls_notifier));
339  }
340 
341  if (muxer_listener)
342  muxer->SetMuxerListener(std::move(muxer_listener));
343 
344  Status status;
345  auto chunking_handler = std::make_shared<ChunkingHandler>(chunking_options);
346  if (encryption_key_source) {
347  auto new_encryption_options = encryption_options;
348  // Use Sample AES in MPEG2TS.
349  // TODO(kqyang): Consider adding a new flag to enable Sample AES as we
350  // will support CENC in TS in the future.
351  if (stream_iter->output_format == CONTAINER_MPEG2TS) {
352  LOG(INFO) << "Use Apple Sample AES encryption for MPEG2TS.";
353  new_encryption_options.protection_scheme =
354  kAppleSampleAesProtectionScheme;
355  }
356  auto encryption_handler = std::make_shared<EncryptionHandler>(
357  new_encryption_options, encryption_key_source);
358  status.Update(encryption_handler->SetHandler(0, std::move(muxer)));
359  status.Update(
360  chunking_handler->SetHandler(0, std::move(encryption_handler)));
361  } else {
362  status.Update(chunking_handler->SetHandler(0, std::move(muxer)));
363  }
364 
365  auto* demuxer = remux_jobs->back()->demuxer();
366  const std::string& stream_selector = stream_iter->stream_selector;
367  status.Update(demuxer->SetHandler(stream_selector, chunking_handler));
368 
369  if (!status.ok()) {
370  LOG(ERROR) << "Failed to setup graph: " << status;
371  return false;
372  }
373  if (!stream_iter->language.empty())
374  demuxer->SetLanguageOverride(stream_selector, stream_iter->language);
375  }
376 
377  // Initialize processing graph.
378  for (const std::unique_ptr<RemuxJob>& job : *remux_jobs) {
379  Status status = job->demuxer()->Initialize();
380  if (!status.ok()) {
381  LOG(ERROR) << "Failed to initialize processing graph " << status;
382  return false;
383  }
384  }
385  return true;
386 }
387 
388 Status RunRemuxJobs(const std::vector<std::unique_ptr<RemuxJob>>& remux_jobs) {
389  // Start the job threads.
390  for (const std::unique_ptr<RemuxJob>& job : remux_jobs)
391  job->Start();
392 
393  // Wait for all jobs to complete or an error occurs.
394  Status status;
395  bool all_joined;
396  do {
397  all_joined = true;
398  for (const std::unique_ptr<RemuxJob>& job : remux_jobs) {
399  if (job->HasBeenJoined()) {
400  status = job->status();
401  if (!status.ok())
402  break;
403  } else {
404  all_joined = false;
405  job->Join();
406  }
407  }
408  } while (!all_joined && status.ok());
409 
410  return status;
411 }
412 
413 bool RunPackager(const StreamDescriptorList& stream_descriptors) {
414  if (FLAGS_output_media_info && !FLAGS_mpd_output.empty()) {
415  NOTIMPLEMENTED() << "ERROR: --output_media_info and --mpd_output do not "
416  "work together.";
417  return false;
418  }
419 
420  // Since there isn't a muxer listener that can output both MPD and HLS,
421  // disallow specifying both MPD and HLS flags.
422  if (!FLAGS_mpd_output.empty() && !FLAGS_hls_master_playlist_output.empty()) {
423  LOG(ERROR) << "Cannot output both MPD and HLS.";
424  return false;
425  }
426 
427  ChunkingOptions chunking_options = GetChunkingOptions();
428  EncryptionOptions encryption_options = GetEncryptionOptions();
429 
430  MuxerOptions muxer_options = GetMuxerOptions();
431 
432  DCHECK(!stream_descriptors.empty());
433  // On demand profile generates single file segment while live profile
434  // generates multiple segments specified using segment template.
435  const bool on_demand_dash_profile =
436  stream_descriptors.begin()->segment_template.empty();
437  for (const auto& stream_descriptor : stream_descriptors) {
438  if (on_demand_dash_profile != stream_descriptor.segment_template.empty()) {
439  LOG(ERROR) << "Inconsistent stream descriptor specification: "
440  "segment_template should be specified for none or all "
441  "stream descriptors.";
442  return false;
443  }
444  }
445  if (FLAGS_output_media_info && !on_demand_dash_profile) {
446  // TODO(rkuroiwa, kqyang): Support partial media info dump for live.
447  NOTIMPLEMENTED() << "ERROR: --output_media_info is only supported for "
448  "on-demand profile (not using segment_template).";
449  return false;
450  }
451 
452  MpdOptions mpd_options = GetMpdOptions(on_demand_dash_profile);
453 
454  // Create encryption key source if needed.
455  std::unique_ptr<KeySource> encryption_key_source;
456  if (FLAGS_enable_widevine_encryption || FLAGS_enable_fixed_key_encryption ||
457  FLAGS_enable_playready_encryption) {
458  if (encryption_options.protection_scheme == FOURCC_NULL)
459  return false;
460  encryption_key_source = CreateEncryptionKeySource();
461  if (!encryption_key_source)
462  return false;
463  }
464 
465  std::unique_ptr<MpdNotifier> mpd_notifier;
466  if (!FLAGS_mpd_output.empty()) {
467  std::vector<std::string> base_urls = base::SplitString(
468  FLAGS_base_urls, ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
469  if (FLAGS_generate_dash_if_iop_compliant_mpd) {
470  mpd_notifier.reset(
471  new DashIopMpdNotifier(mpd_options, base_urls, FLAGS_mpd_output));
472  } else {
473  mpd_notifier.reset(
474  new SimpleMpdNotifier(mpd_options, base_urls, FLAGS_mpd_output));
475  }
476  if (!mpd_notifier->Init()) {
477  LOG(ERROR) << "MpdNotifier failed to initialize.";
478  return false;
479  }
480  }
481 
482  std::unique_ptr<hls::HlsNotifier> hls_notifier;
483  if (!FLAGS_hls_master_playlist_output.empty()) {
484  base::FilePath master_playlist_path(
485  base::FilePath::FromUTF8Unsafe(FLAGS_hls_master_playlist_output));
486  base::FilePath master_playlist_name = master_playlist_path.BaseName();
487 
488  hls_notifier.reset(new hls::SimpleHlsNotifier(
489  hls::HlsNotifier::HlsProfile::kOnDemandProfile, FLAGS_hls_base_url,
490  master_playlist_path.DirName().AsEndingWithSeparator().AsUTF8Unsafe(),
491  master_playlist_name.AsUTF8Unsafe()));
492  }
493 
494  std::vector<std::unique_ptr<RemuxJob>> remux_jobs;
495  FakeClock fake_clock;
496  if (!CreateRemuxJobs(stream_descriptors, chunking_options, encryption_options,
497  muxer_options, &fake_clock, encryption_key_source.get(),
498  mpd_notifier.get(), hls_notifier.get(), &remux_jobs)) {
499  return false;
500  }
501 
502  Status status = RunRemuxJobs(remux_jobs);
503  if (!status.ok()) {
504  LOG(ERROR) << "Packaging Error: " << status.ToString();
505  return false;
506  }
507 
508  if (hls_notifier) {
509  if (!hls_notifier->Flush())
510  return false;
511  }
512  if (mpd_notifier) {
513  if (!mpd_notifier->Flush())
514  return false;
515  }
516 
517  printf("Packaging completed successfully.\n");
518  return true;
519 }
520 
521 int PackagerMain(int argc, char** argv) {
522  base::AtExitManager exit;
523  // Needed to enable VLOG/DVLOG through --vmodule or --v.
524  base::CommandLine::Init(argc, argv);
525 
526  // Set up logging.
527  logging::LoggingSettings log_settings;
528  log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
529  CHECK(logging::InitLogging(log_settings));
530 
531  google::SetVersionString(GetPackagerVersion());
532  google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
533  google::ParseCommandLineFlags(&argc, &argv, true);
534  if (argc < 2) {
535  google::ShowUsageWithFlags("Usage");
536  return kSuccess;
537  }
538 
541  return kArgumentValidationFailed;
542  }
543 
544  if (FLAGS_override_version)
545  SetPackagerVersionForTesting(FLAGS_test_version);
546 
547  LibcryptoThreading libcrypto_threading;
548  // TODO(tinskip): Make InsertStreamDescriptor a member of
549  // StreamDescriptorList.
550  StreamDescriptorList stream_descriptors;
551  for (int i = 1; i < argc; ++i) {
552  if (!InsertStreamDescriptor(argv[i], &stream_descriptors))
553  return kArgumentValidationFailed;
554  }
555  return RunPackager(stream_descriptors) ? kSuccess : kPackagingFailed;
556 }
557 
558 } // namespace media
559 } // namespace shaka
560 
561 #if defined(OS_WIN)
562 // Windows wmain, which converts wide character arguments to UTF-8.
563 int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
564  std::unique_ptr<char* [], std::function<void(char**)>> utf8_argv(
565  new char*[argc], [argc](char** utf8_args) {
566  // TODO(tinskip): This leaks, but if this code is enabled, it crashes.
567  // Figure out why. I suspect gflags does something funny with the
568  // argument array.
569  // for (int idx = 0; idx < argc; ++idx)
570  // delete[] utf8_args[idx];
571  delete[] utf8_args;
572  });
573  std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
574  for (int idx = 0; idx < argc; ++idx) {
575  std::string utf8_arg(converter.to_bytes(argv[idx]));
576  utf8_arg += '\0';
577  utf8_argv[idx] = new char[utf8_arg.size()];
578  memcpy(utf8_argv[idx], &utf8_arg[0], utf8_arg.size());
579  }
580  return shaka::media::PackagerMain(argc, utf8_argv.get());
581 }
582 #else
583 int main(int argc, char** argv) {
584  return shaka::media::PackagerMain(argc, argv);
585 }
586 #endif // defined(OS_WIN)
static bool Copy(const char *from_file_name, const char *to_file_name)
Definition: file.cc:203
bool ValidateWidevineCryptoFlags()
static bool WriteMediaInfoToFile(const MediaInfo &media_info, const std::string &output_file_path)
static bool ReadFileToString(const char *file_name, std::string *contents)
Definition: file.cc:185
bool ValidateFixedCryptoFlags()