timestamp_calculator_c: add_timestamp overload with boost::optional<int64_t>

This commit is contained in:
Moritz Bunkus 2018-06-13 19:35:06 +02:00
parent 9afc43b209
commit 07ab76f377
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
2 changed files with 9 additions and 1 deletions

View File

@ -45,10 +45,17 @@ timestamp_calculator_c::add_timestamp(timestamp_c const &timestamp,
void
timestamp_calculator_c::add_timestamp(int64_t timestamp,
boost::optional<uint64_t> stream_position) {
if (-1 != timestamp)
if (0 <= timestamp)
add_timestamp(timestamp_c::ns(timestamp), stream_position);
}
void
timestamp_calculator_c::add_timestamp(boost::optional<int64_t> const &timestamp,
boost::optional<uint64_t> stream_position) {
if (timestamp && (0 <= *timestamp))
add_timestamp(timestamp_c::ns(*timestamp), stream_position);
}
void
timestamp_calculator_c::add_timestamp(packet_cptr const &packet,
boost::optional<uint64_t> stream_position) {

View File

@ -34,6 +34,7 @@ private:
public:
timestamp_calculator_c(int64_t samples_per_second);
void add_timestamp(boost::optional<int64_t> const &timestamp, boost::optional<uint64_t> stream_position = boost::none);
void add_timestamp(timestamp_c const &timestamp, boost::optional<uint64_t> stream_position = boost::none);
void add_timestamp(int64_t timestamp, boost::optional<uint64_t> stream_position = boost::none);
void add_timestamp(packet_cptr const &packet, boost::optional<uint64_t> stream_position = boost::none);