Defined CueEvent struct.
Change-Id: If4ba55a7ff403248de9d0411c2ba8553b88c491b
This commit is contained in:
parent
c4e7d02b80
commit
cc778f60ab
|
@ -26,6 +26,7 @@ enum class StreamDataType {
|
|||
kTextSample,
|
||||
kSegmentInfo,
|
||||
kScte35Event,
|
||||
kCueEvent,
|
||||
};
|
||||
|
||||
// Scte35Event represents cuepoint markers in input streams. It will be used
|
||||
|
@ -39,6 +40,16 @@ struct Scte35Event {
|
|||
std::string cue_data;
|
||||
};
|
||||
|
||||
enum class CueEventType { kCueIn, kCueOut, kCuePoint };
|
||||
|
||||
// In server-based model, Chunking Handler consolidates SCTE-35 events and
|
||||
// generates CueEvent before an ad is about to be inserted.
|
||||
struct CueEvent {
|
||||
int64_t timestamp = 0;
|
||||
CueEventType type = CueEventType::kCuePoint;
|
||||
std::string cue_data;
|
||||
};
|
||||
|
||||
struct SegmentInfo {
|
||||
bool is_subsegment = false;
|
||||
bool is_encrypted = false;
|
||||
|
@ -60,6 +71,7 @@ struct StreamData {
|
|||
std::shared_ptr<const TextSample> text_sample;
|
||||
std::shared_ptr<const SegmentInfo> segment_info;
|
||||
std::shared_ptr<const Scte35Event> scte35_event;
|
||||
std::shared_ptr<const CueEvent> cue_event;
|
||||
|
||||
static std::unique_ptr<StreamData> FromStreamInfo(
|
||||
size_t stream_index, std::shared_ptr<const StreamInfo> stream_info) {
|
||||
|
@ -106,6 +118,16 @@ struct StreamData {
|
|||
stream_data->scte35_event = std::move(scte35_event);
|
||||
return stream_data;
|
||||
}
|
||||
|
||||
static std::unique_ptr<StreamData> FromCueEvent(
|
||||
size_t stream_index,
|
||||
std::shared_ptr<const CueEvent> cue_event) {
|
||||
std::unique_ptr<StreamData> stream_data(new StreamData);
|
||||
stream_data->stream_index = stream_index;
|
||||
stream_data->stream_data_type = StreamDataType::kCueEvent;
|
||||
stream_data->cue_event = std::move(cue_event);
|
||||
return stream_data;
|
||||
}
|
||||
};
|
||||
|
||||
/// MediaHandler is the base media processing unit. Media handlers transform
|
||||
|
@ -196,6 +218,12 @@ class MediaHandler {
|
|||
return Dispatch(StreamData::FromScte35Event(stream_index, scte35_event));
|
||||
}
|
||||
|
||||
/// Dispatch the cue event to downstream handlers.
|
||||
Status DispatchCueEvent(size_t stream_index,
|
||||
std::shared_ptr<const CueEvent> cue_event) {
|
||||
return Dispatch(StreamData::FromCueEvent(stream_index, cue_event));
|
||||
}
|
||||
|
||||
/// Flush the downstream connected at the specified output stream index.
|
||||
Status FlushDownstream(size_t output_stream_index);
|
||||
|
||||
|
|
Loading…
Reference in New Issue