Skip to content

Commit

Permalink
fix: minor PR updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lee.fordyce committed Feb 17, 2024
1 parent a945459 commit 826a31e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packager/live_packager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,27 @@ constexpr double DEFAULT_SEGMENT_DURATION = 5.0;
const std::string INPUT_FNAME = "memory://input_file";
const std::string INIT_SEGMENT_FNAME = "init.mp4";

template <typename Enumeration>
auto enum_as_integer(Enumeration const value) ->
typename std::underlying_type<Enumeration>::type {
return static_cast<typename std::underlying_type<Enumeration>::type>(value);
}

std::string getSegmentTemplate(const LiveConfig& config) {
switch (config.format) {
case LiveConfig::OutputFormat::TS:
return "$Number$.ts";
case LiveConfig::OutputFormat::TTML:
return "$Number$.ttml";
case LiveConfig::OutputFormat::VTTMP4:
FALLTHROUGH_INTENDED;
case LiveConfig::OutputFormat::TTMLMP4:
FALLTHROUGH_INTENDED;
case LiveConfig::OutputFormat::FMP4:
return "$Number$.m4s";
default:
LOG(ERROR) << "Unrecognized output format: " << &config.format;
LOG(ERROR) << "Unrecognized output format: "
<< enum_as_integer(config.format);
return "unknown";
}
}
Expand All @@ -67,7 +76,8 @@ std::string getStreamSelector(const LiveConfig& config) {
case LiveConfig::TrackType::TEXT:
return "text";
default:
LOG(ERROR) << "Unrecognized track type: " << &config.track_type;
LOG(ERROR) << "Unrecognized track type: "
<< enum_as_integer(config.track_type);
return "unknown";
}
}
Expand Down Expand Up @@ -98,8 +108,7 @@ StreamDescriptors setupStreamDescriptors(
desc.output =
File::MakeCallbackFileName(init_cb_params, INIT_SEGMENT_FNAME);
break;
case LiveConfig::OutputFormat::TS:
case LiveConfig::OutputFormat::TTML:
default:
break;
}

Expand Down

0 comments on commit 826a31e

Please sign in to comment.