From 9df2825f3d5617edda99cf0b64540404c1b8d3a7 Mon Sep 17 00:00:00 2001 From: Aaron Vaage Date: Wed, 6 Jun 2018 12:49:55 -0700 Subject: [PATCH] Remove WebVTT Mp4 To Mp4 Path Since the WebVtt mp4 to mp4 path did not include all the features we needed and we know of no-one who is asking for it. We are opted to remove the path so that there will be an error rather than incorrect output if they try to use it. Issue #405 Change-Id: Id2c37bb385c514dd8e31f7d3bd75fb3904b70d78 --- packager/packager.cc | 83 +++++++++++--------------------------------- 1 file changed, 20 insertions(+), 63 deletions(-) diff --git a/packager/packager.cc b/packager/packager.cc index 6c24cb7ff60..57bb6eba6ed 100644 --- a/packager/packager.cc +++ b/packager/packager.cc @@ -444,37 +444,6 @@ std::shared_ptr CreateEncryptionHandler( return std::make_shared(encryption_params, key_source); } -Status CreateMp4ToMp4TextJob(const StreamDescriptor& stream, - const PackagingParams& packaging_params, - std::unique_ptr muxer_listener, - SyncPointQueue* sync_points, - MuxerFactory* muxer_factory, - std::shared_ptr* root) { - // TODO(kqyang): This need to be integrated back to media pipeline since we - // may want to get not only text streams from the demuxer, in which case, the - // same demuxer should be used to get all streams instead of having a demuxer - // specifically for text. - // TODO(kqyang): Support Cue Alignment if |sync_points| is not null. - - std::shared_ptr demuxer; - RETURN_IF_ERROR(CreateDemuxer(stream, packaging_params, &demuxer)); - if (!stream.language.empty()) { - demuxer->SetLanguageOverride(stream.stream_selector, stream.language); - } - - auto chunker = - std::make_shared(packaging_params.chunking_params); - std::shared_ptr muxer = - muxer_factory->CreateMuxer(GetOutputFormat(stream), stream); - muxer->SetMuxerListener(std::move(muxer_listener)); - - RETURN_IF_ERROR(chunker->AddHandler(std::move(muxer))); - RETURN_IF_ERROR( - demuxer->SetHandler(stream.stream_selector, std::move(chunker))); - - return Status::OK; -} - std::unique_ptr CreateTextChunker( const ChunkingParams& chunking_params) { const float segment_length_in_seconds = @@ -572,36 +541,27 @@ Status CreateTextJobs( DCHECK(muxer_listener_factory); DCHECK(job_manager); for (const StreamDescriptor& stream : streams) { - if (GetOutputFormat(stream) == CONTAINER_MOV) { + // There are currently four options: + // TEXT WEBVTT --> TEXT WEBVTT [ supported ] + // TEXT WEBVTT --> MP4 WEBVTT [ supported ] + // MP4 WEBVTT --> MP4 WEBVTT [ unsupported ] + // MP4 WEBVTT --> TEXT WEBVTT [ unsupported ] + const auto input_container = DetermineContainerFromFileName(stream.input); + const auto output_container = GetOutputFormat(stream); + + if (input_container != CONTAINER_WEBVTT) { + return Status(error::INVALID_ARGUMENT, + "Text output format is not support for " + stream.input); + } + + if (output_container == CONTAINER_MOV) { std::unique_ptr muxer_listener = muxer_listener_factory->CreateListener(ToMuxerListenerData(stream)); std::shared_ptr root; - Status status; - - switch (DetermineContainerFromFileName(stream.input)) { - case CONTAINER_WEBVTT: - status.Update(CreateWebVttToMp4TextJob( - stream, packaging_params, std::move(muxer_listener), sync_points, - muxer_factory, &root)); - break; - - case CONTAINER_MOV: - status.Update(CreateMp4ToMp4TextJob( - stream, packaging_params, std::move(muxer_listener), sync_points, - muxer_factory, &root)); - break; - - default: - status.Update( - Status(error::INVALID_ARGUMENT, - "Text output format is not support for " + stream.input)); - break; - } - - if (!status.ok()) { - return status; - } + RETURN_IF_ERROR(CreateWebVttToMp4TextJob( + stream, packaging_params, std::move(muxer_listener), sync_points, + muxer_factory, &root)); job_manager->Add("MP4 text job", std::move(root)); } else { @@ -626,12 +586,9 @@ Status CreateTextJobs( // If we are outputting to HLS, then create the HLS test pipeline that // will create segmented text output. if (hls_listener) { - Status status = - CreateHlsTextJob(stream, packaging_params, std::move(hls_listener), - sync_points, job_manager); - if (!status.ok()) { - return status; - } + RETURN_IF_ERROR(CreateHlsTextJob(stream, packaging_params, + std::move(hls_listener), sync_points, + job_manager)); } if (!stream.output.empty()) {