Move demuxer.cc/h to packager/media/demuxer

- Also fix the misleading error if an invalid input is provided
  The command line app now correctly reports that the file is not
  found instead of stream not available.

Change-Id: I8cfccb62d7a50de57766666f126cf061e3df5ded
This commit is contained in:
Kongqun Yang 2017-03-28 12:31:32 -07:00
parent 1af8f04e40
commit 5d71d8cc9f
8 changed files with 72 additions and 5 deletions

View File

@ -29,13 +29,13 @@
#include "packager/hls/base/hls_notifier.h"
#include "packager/hls/base/simple_hls_notifier.h"
#include "packager/media/base/container_names.h"
#include "packager/media/base/demuxer.h"
#include "packager/media/base/fourccs.h"
#include "packager/media/base/key_source.h"
#include "packager/media/base/muxer_options.h"
#include "packager/media/base/muxer_util.h"
#include "packager/media/chunking/chunking_handler.h"
#include "packager/media/crypto/encryption_handler.h"
#include "packager/media/demuxer/demuxer.h"
#include "packager/media/event/hls_notify_muxer_listener.h"
#include "packager/media/event/mpd_notify_muxer_listener.h"
#include "packager/media/event/vod_media_info_dump_muxer_listener.h"

View File

@ -37,8 +37,6 @@
'closure_thread.h',
'container_names.cc',
'container_names.h',
'demuxer.cc',
'demuxer.h',
'decrypt_config.cc',
'decrypt_config.h',
'decryptor_source.cc',

View File

@ -4,7 +4,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#include "packager/media/base/demuxer.h"
#include "packager/media/demuxer/demuxer.h"
#include <algorithm>
@ -95,6 +95,8 @@ Status Demuxer::Run() {
// info.
if (all_streams_ready_ && output_handlers().empty())
return Status::OK;
if (!status.ok())
return status;
// Check if all specified outputs exists.
for (const auto& pair : output_handlers()) {
if (std::find(stream_indexes_.begin(), stream_indexes_.end(), pair.first) ==

View File

@ -0,0 +1,42 @@
# 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
{
'includes': [
'../../common.gypi',
],
'targets': [
{
'target_name': 'demuxer',
'type': '<(component)',
'sources': [
'demuxer.cc',
'demuxer.h',
],
'dependencies': [
'../base/media_base.gyp:media_base',
'../formats/mp2t/mp2t.gyp:mp2t',
'../formats/mp4/mp4.gyp:mp4',
'../formats/mpeg/mpeg.gyp:mpeg',
'../formats/webm/webm.gyp:webm',
'../formats/webvtt/webvtt.gyp:webvtt',
'../formats/wvm/wvm.gyp:wvm',
],
},
{
'target_name': 'demuxer_unittest',
'type': '<(gtest_target_type)',
'sources': [
'demuxer_unittest.cc',
],
'dependencies': [
'../../testing/gtest.gyp:gtest',
'../test/media_test.gyp:media_test_support',
'demuxer',
]
},
],
}

View File

@ -0,0 +1,22 @@
// 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/demuxer/demuxer.h"
#include <gtest/gtest.h>
namespace shaka {
namespace media {
TEST(DemuxerTest, FileNotFound) {
Demuxer demuxer("file_not_exist.mp4");
EXPECT_EQ(error::FILE_FAILURE, demuxer.Run().error_code());
}
// TODO(kqyang): Add more tests.
} // namespace media
} // namespace shaka

View File

@ -10,7 +10,6 @@
#include "packager/base/strings/string_number_conversions.h"
#include "packager/base/strings/stringprintf.h"
#include "packager/base/time/clock.h"
#include "packager/media/base/demuxer.h"
#include "packager/media/base/fixed_key_source.h"
#include "packager/media/base/fourccs.h"
#include "packager/media/base/muxer.h"
@ -19,6 +18,7 @@
#include "packager/media/base/test/status_test_util.h"
#include "packager/media/chunking/chunking_handler.h"
#include "packager/media/crypto/encryption_handler.h"
#include "packager/media/demuxer/demuxer.h"
#include "packager/media/formats/mp4/mp4_muxer.h"
#include "packager/media/test/test_data_util.h"

View File

@ -45,6 +45,7 @@
'hls/hls.gyp:hls_builder',
'media/codecs/codecs.gyp:codecs',
'media/chunking/chunking.gyp:chunking',
'media/demuxer/demuxer.gyp:demuxer',
'media/event/media_event.gyp:media_event',
'media/file/file.gyp:file',
'media/formats/mp2t/mp2t.gyp:mp2t',
@ -89,6 +90,7 @@
'dependencies': [
'media/codecs/codecs.gyp:codecs',
'media/chunking/chunking.gyp:chunking',
'media/demuxer/demuxer.gyp:demuxer',
'media/file/file.gyp:file',
'media/formats/mp2t/mp2t.gyp:mp2t',
'media/formats/mp4/mp4.gyp:mp4',
@ -122,6 +124,7 @@
'media/chunking/chunking.gyp:chunking_unittest',
'media/codecs/codecs.gyp:codecs_unittest',
'media/crypto/crypto.gyp:crypto_unittest',
'media/demuxer/demuxer.gyp:demuxer_unittest',
'media/event/media_event.gyp:media_event_unittest',
'media/file/file.gyp:file_unittest',
'media/formats/mp2t/mp2t.gyp:mp2t_unittest',