2017-06-09 15:30:16 +00:00
|
|
|
// Copyright 2017 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
|
|
|
|
|
|
|
#ifndef PACKAGER_MEDIA_BASE_TEXT_SAMPLE_H_
|
|
|
|
#define PACKAGER_MEDIA_BASE_TEXT_SAMPLE_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace shaka {
|
|
|
|
namespace media {
|
|
|
|
|
2020-08-24 22:23:15 +00:00
|
|
|
struct TextSettings {
|
|
|
|
// TODO(modmaker): Convert to generic structure.
|
|
|
|
std::string settings;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TextFragment {
|
|
|
|
// TODO(modmaker): Fill with settings and sub-fragments.
|
|
|
|
std::string body;
|
|
|
|
|
|
|
|
bool is_empty() const;
|
|
|
|
};
|
|
|
|
|
2017-06-09 15:30:16 +00:00
|
|
|
class TextSample {
|
|
|
|
public:
|
2020-08-24 22:23:15 +00:00
|
|
|
TextSample(const std::string& id,
|
|
|
|
int64_t start_time,
|
|
|
|
int64_t end_time,
|
|
|
|
const TextSettings& settings,
|
|
|
|
const TextFragment& body);
|
2017-06-09 15:30:16 +00:00
|
|
|
|
|
|
|
const std::string& id() const { return id_; }
|
2018-03-26 18:04:09 +00:00
|
|
|
int64_t start_time() const { return start_time_; }
|
|
|
|
int64_t duration() const { return duration_; }
|
2020-08-24 22:23:15 +00:00
|
|
|
const TextSettings& settings() const { return settings_; }
|
|
|
|
const TextFragment& body() const { return body_; }
|
2018-03-26 18:04:09 +00:00
|
|
|
int64_t EndTime() const;
|
2017-06-09 15:30:16 +00:00
|
|
|
|
|
|
|
private:
|
2017-05-22 16:35:49 +00:00
|
|
|
// Allow the compiler generated copy constructor and assignment operator
|
|
|
|
// intentionally. Since the text data is typically small, the performance
|
|
|
|
// impact is minimal.
|
2017-06-09 15:30:16 +00:00
|
|
|
|
2020-08-24 22:23:15 +00:00
|
|
|
const std::string id_;
|
|
|
|
const int64_t start_time_ = 0;
|
|
|
|
const int64_t duration_ = 0;
|
|
|
|
const TextSettings settings_;
|
|
|
|
const TextFragment body_;
|
2017-06-09 15:30:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace media
|
|
|
|
} // namespace shaka
|
|
|
|
|
2017-12-20 00:56:36 +00:00
|
|
|
#endif // PACKAGER_MEDIA_BASE_TEXT_SAMPLE_H_
|