From 0734ba998bb54ec825b22dd5f5b54e41fbfb3d3f Mon Sep 17 00:00:00 2001 From: Aaron Vaage Date: Thu, 21 Jun 2018 10:52:54 -0700 Subject: [PATCH] Remove Old Cue Insertion Code When we built the cue alignment media handler, we did not remove the old solution. This change removes all the code for the old solution. Change-Id: I851b284c449c7d25aaabc2f55df5579ba7b5aad1 --- .../ad_cue_generator/ad_cue_generator.cc | 64 ------------------- .../ad_cue_generator/ad_cue_generator.gyp | 26 -------- .../media/ad_cue_generator/ad_cue_generator.h | 38 ----------- packager/packager.cc | 1 - packager/packager.gyp | 1 - 5 files changed, 130 deletions(-) delete mode 100644 packager/media/ad_cue_generator/ad_cue_generator.cc delete mode 100644 packager/media/ad_cue_generator/ad_cue_generator.gyp delete mode 100644 packager/media/ad_cue_generator/ad_cue_generator.h diff --git a/packager/media/ad_cue_generator/ad_cue_generator.cc b/packager/media/ad_cue_generator/ad_cue_generator.cc deleted file mode 100644 index 4cea44c952..0000000000 --- a/packager/media/ad_cue_generator/ad_cue_generator.cc +++ /dev/null @@ -1,64 +0,0 @@ -// 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 - -#include "packager/media/ad_cue_generator/ad_cue_generator.h" - -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() { - if (num_input_streams() != 1 || next_output_stream_index() != 1) { - return Status(error::INVALID_ARGUMENT, - "Expects exactly one input and one output."); - } - return Status::OK; -} - -Status AdCueGenerator::Process(std::unique_ptr stream_data) { - switch (stream_data->stream_data_type) { - case StreamDataType::kStreamInfo: { - const uint32_t time_scale = stream_data->stream_info->time_scale(); - Status status = Dispatch(std::move(stream_data)); - if (!status.ok()) { - return status; - } - return DispatchScte35Events(kStreamIndex, time_scale); - } - default: - return Dispatch(std::move(stream_data)); - } -} - -Status AdCueGenerator::DispatchScte35Events(size_t stream_index, - uint32_t time_scale) { - Status status; - for (const auto& cue_point : ad_cue_generator_params_.cue_points) { - std::shared_ptr scte35_event = std::make_shared(); - scte35_event->start_time_in_seconds = cue_point.start_time_in_seconds; - scte35_event->duration_in_seconds = cue_point.duration_in_seconds; - status.Update(DispatchScte35Event(stream_index, std::move(scte35_event))); - if (!status.ok()) { - return status; - } - } - return Status::OK; -} - -} // namespace media -} // namespace shaka diff --git a/packager/media/ad_cue_generator/ad_cue_generator.gyp b/packager/media/ad_cue_generator/ad_cue_generator.gyp deleted file mode 100644 index 373e16fcf8..0000000000 --- a/packager/media/ad_cue_generator/ad_cue_generator.gyp +++ /dev/null @@ -1,26 +0,0 @@ -# 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 - -{ - 'variables': { - 'shaka_code': 1, - }, - 'targets': [ - { - 'target_name': 'ad_cue_generator', - 'type': '<(component)', - 'sources': [ - 'ad_cue_generator.cc', - 'ad_cue_generator.h', - ], - 'dependencies': [ - '../base/media_base.gyp:media_base', - '../public/public.gyp:public', - ], - }, - ], -} - diff --git a/packager/media/ad_cue_generator/ad_cue_generator.h b/packager/media/ad_cue_generator/ad_cue_generator.h deleted file mode 100644 index be43bd63db..0000000000 --- a/packager/media/ad_cue_generator/ad_cue_generator.h +++ /dev/null @@ -1,38 +0,0 @@ -// 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_AD_CUE_GENERATOR_AD_CUE_GENERATOR_H_ -#define PACKAGER_MEDIA_AD_CUE_GENERATOR_AD_CUE_GENERATOR_H_ - -#include "packager/media/base/media_handler.h" -#include "packager/media/public/ad_cue_generator_params.h" - -namespace shaka { -namespace media { - -/// AdCueGenerator converts out of band cuepoint markers into SCTE-35 events. -class AdCueGenerator : public MediaHandler { - public: - explicit AdCueGenerator(const AdCueGeneratorParams& ad_cue_generator_params); - ~AdCueGenerator() override; - - private: - AdCueGenerator(const AdCueGenerator&) = delete; - AdCueGenerator& operator=(const AdCueGenerator&) = delete; - - Status InitializeInternal() override; - Status Process(std::unique_ptr stream_data) override; - - // Dispatches SCTE35 events that are built from AdCueGenerator params. - Status DispatchScte35Events(size_t stream_index, uint32_t time_scale); - - const AdCueGeneratorParams ad_cue_generator_params_; -}; - -} // namespace media -} // namespace shaka - -#endif // PACKAGER_MEDIA_AD_CUE_GENERATOR_AD_CUE_GENERATOR_H_ diff --git a/packager/packager.cc b/packager/packager.cc index b58585e26e..ead61cdb33 100644 --- a/packager/packager.cc +++ b/packager/packager.cc @@ -25,7 +25,6 @@ #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" diff --git a/packager/packager.gyp b/packager/packager.gyp index f4c03647ea..ab213c7fbe 100644 --- a/packager/packager.gyp +++ b/packager/packager.gyp @@ -28,7 +28,6 @@ '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',