Connect AdCueGenerator in the pipeline.
Change-Id: Iaae73661bc57ddecd2cc103dbd34d0c3102ffdaa
This commit is contained in:
parent
154e309f3f
commit
c4e7d02b80
|
@ -9,11 +9,33 @@
|
|||
namespace shaka {
|
||||
namespace media {
|
||||
|
||||
namespace {
|
||||
|
||||
// The AdCuGenerator only supports single input and single output.
|
||||
const size_t kStreamIndex = 0;
|
||||
|
||||
} // namespace
|
||||
|
||||
AdCueGenerator::AdCueGenerator(
|
||||
const AdCueGeneratorParams& ad_cue_generator_params)
|
||||
: ad_cue_generator_params_(ad_cue_generator_params) {}
|
||||
|
||||
AdCueGenerator::~AdCueGenerator() {}
|
||||
|
||||
Status AdCueGenerator::InitializeInternal() {
|
||||
return Status::OK;
|
||||
}
|
||||
|
||||
Status AdCueGenerator::Process(std::unique_ptr<StreamData> stream_data) {
|
||||
switch (stream_data->stream_data_type) {
|
||||
case StreamDataType::kStreamInfo:
|
||||
// TODO(kdevarakonda): dispatch scte35 events.
|
||||
return DispatchStreamInfo(kStreamIndex,
|
||||
std::move(stream_data->stream_info));
|
||||
default:
|
||||
return Dispatch(std::move(stream_data));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace media
|
||||
} // namespace shaka
|
||||
|
|
|
@ -23,6 +23,9 @@ class AdCueGenerator : public MediaHandler {
|
|||
AdCueGenerator(const AdCueGenerator&) = delete;
|
||||
AdCueGenerator& operator=(const AdCueGenerator&) = delete;
|
||||
|
||||
Status InitializeInternal() override;
|
||||
Status Process(std::unique_ptr<StreamData> stream_data) override;
|
||||
|
||||
const AdCueGeneratorParams ad_cue_generator_params_;
|
||||
};
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "packager/file/file.h"
|
||||
#include "packager/hls/base/hls_notifier.h"
|
||||
#include "packager/hls/base/simple_hls_notifier.h"
|
||||
#include "packager/media/ad_cue_generator/ad_cue_generator.h"
|
||||
#include "packager/media/base/container_names.h"
|
||||
#include "packager/media/base/fourccs.h"
|
||||
#include "packager/media/base/key_source.h"
|
||||
|
@ -495,6 +496,8 @@ Status CreateAudioVideoJobs(
|
|||
|
||||
// Demuxers are shared among all streams with the same input.
|
||||
std::shared_ptr<Demuxer> demuxer;
|
||||
// AdCueGenerator is shared among all streams.
|
||||
std::shared_ptr<AdCueGenerator> ad_cue_generator;
|
||||
// Replicators are shared among all streams with the same input and stream
|
||||
// selector.
|
||||
std::shared_ptr<MediaHandler> replicator;
|
||||
|
@ -506,6 +509,11 @@ Status CreateAudioVideoJobs(
|
|||
// iteration.
|
||||
int stream_number = first_stream_number - 1;
|
||||
|
||||
if (!packaging_params.ad_cue_generator_params.cue_points.empty()) {
|
||||
ad_cue_generator = std::make_shared<AdCueGenerator>(
|
||||
packaging_params.ad_cue_generator_params);
|
||||
}
|
||||
|
||||
for (const StreamDescriptor& stream : streams) {
|
||||
stream_number += 1;
|
||||
|
||||
|
@ -555,16 +563,17 @@ Status CreateAudioVideoJobs(
|
|||
packaging_params, stream, encryption_key_source);
|
||||
|
||||
Status status;
|
||||
|
||||
// The path is different if there is encryption. Even though there are
|
||||
// common elements, it is easier to understand the path if they are
|
||||
// expressed independently of each other.
|
||||
if (encryptor) {
|
||||
if (ad_cue_generator) {
|
||||
status.Update(
|
||||
demuxer->SetHandler(stream.stream_selector, ad_cue_generator));
|
||||
status.Update(ad_cue_generator->AddHandler(chunker));
|
||||
} else {
|
||||
status.Update(demuxer->SetHandler(stream.stream_selector, chunker));
|
||||
}
|
||||
if (encryptor) {
|
||||
status.Update(chunker->AddHandler(encryptor));
|
||||
status.Update(encryptor->AddHandler(replicator));
|
||||
} else {
|
||||
status.Update(demuxer->SetHandler(stream.stream_selector, chunker));
|
||||
status.Update(chunker->AddHandler(replicator));
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,10 @@
|
|||
'dependencies': [
|
||||
'file/file.gyp:file',
|
||||
'hls/hls.gyp:hls_builder',
|
||||
'media/ad_cue_generator/ad_cue_generator.gyp:ad_cue_generator',
|
||||
'media/chunking/chunking.gyp:chunking',
|
||||
'media/codecs/codecs.gyp:codecs',
|
||||
'media/crypto/crypto.gyp:crypto',
|
||||
'media/demuxer/demuxer.gyp:demuxer',
|
||||
'media/event/media_event.gyp:media_event',
|
||||
'media/formats/mp2t/mp2t.gyp:mp2t',
|
||||
|
|
Loading…
Reference in New Issue