Defined Scte35Event struct and out of band cue marker flags

Change-Id: I5a4db1a691544cbedf2ccfbaf6f71169a8eed6e7
This commit is contained in:
Kamesh Devarakonda 2017-11-13 13:08:44 -05:00
parent 5cf2b17ade
commit 8c877379b6
5 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,19 @@
// 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
//
// Defines cuepoint generator flags.
#include "packager/app/ad_cue_generator_flags.h"
DEFINE_string(ad_cues,
"",
"List of cuepoint markers."
"This flag accepts semicolon separated pairs and components in "
"the pair are separated by a comma and the second component "
"duration is optional. For example --ad_cues "
"{start_time}[,{duration}][;{start_time}[,{duration}]]..."
"The start_time represents the start of the cue marker in "
"seconds relative to the start of the program.");

View File

@ -0,0 +1,14 @@
// 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_APP_AD_CUE_GENERATOR_FLAGS_H_
#define PACKAGER_APP_AD_CUE_GENERATOR_FLAGS_H_
#include <gflags/gflags.h>
DECLARE_string(ad_cues);
#endif // PACKAGER_APP_AD_CUE_GENERATOR_FLAGS_H_

View File

@ -25,6 +25,18 @@ enum class StreamDataType {
kMediaSample,
kTextSample,
kSegmentInfo,
kScte35Event,
};
// Scte35Event represents cuepoint markers in input streams. It will be used
// to represent out of band cuepoint markers too.
struct Scte35Event {
std::string id;
// Segmentation type id from SCTE35 segmentation descriptor.
int type = 0;
int64_t start_time = 0;
int64_t duration = 0;
std::string cue_data;
};
struct SegmentInfo {
@ -47,6 +59,7 @@ struct StreamData {
std::shared_ptr<const MediaSample> media_sample;
std::shared_ptr<const TextSample> text_sample;
std::shared_ptr<const SegmentInfo> segment_info;
std::shared_ptr<const Scte35Event> scte35_event;
static std::unique_ptr<StreamData> FromStreamInfo(
size_t stream_index, std::shared_ptr<const StreamInfo> stream_info) {
@ -83,6 +96,16 @@ struct StreamData {
stream_data->segment_info = std::move(segment_info);
return stream_data;
}
static std::unique_ptr<StreamData> FromScte35Event(
size_t stream_index,
std::shared_ptr<const Scte35Event> scte35_event) {
std::unique_ptr<StreamData> stream_data(new StreamData);
stream_data->stream_index = stream_index;
stream_data->stream_data_type = StreamDataType::kScte35Event;
stream_data->scte35_event = std::move(scte35_event);
return stream_data;
}
};
/// MediaHandler is the base media processing unit. Media handlers transform
@ -167,6 +190,12 @@ class MediaHandler {
return Dispatch(StreamData::FromSegmentInfo(stream_index, segment_info));
}
/// Dispatch the scte35 event to downstream handlers.
Status DispatchScte35Event(size_t stream_index,
std::shared_ptr<const Scte35Event> scte35_event) {
return Dispatch(StreamData::FromScte35Event(stream_index, scte35_event));
}
/// Flush the downstream connected at the specified output stream index.
Status FlushDownstream(size_t output_stream_index);

View File

@ -0,0 +1,30 @@
// 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_PUBLIC_AD_CUE_GENERATOR_PARAMS_H_
#define PACKAGER_MEDIA_PUBLIC_AD_CUE_GENERATOR_PARAMS_H_
#include <vector>
namespace shaka {
struct Cuepoint {
/// Start time of the cuepoint relative to start of the stream.
double start_time_in_seconds = 0;
/// Duration of the ad.
double duration_in_seconds = 0;
};
/// Cuepoint generator related parameters.
struct AdCueGeneratorParams {
/// List of cuepoints.
std::vector<Cuepoint> cue_points;
};
} // namespace shaka
#endif // PACKAGER_MEDIA_PUBLIC_AD_CUE_GENERATOR_PARAMS_H_

View File

@ -55,6 +55,8 @@
'target_name': 'packager',
'type': 'executable',
'sources': [
'app/ad_cue_generator_flags.cc',
'app/ad_cue_generator_flags.h',
'app/crypto_flags.cc',
'app/crypto_flags.h',
'app/gflags_hex_bytes.cc',