summaryrefslogtreecommitdiffstats
path: root/media/base
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 15:58:16 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 15:58:16 +0000
commitcee323423df2894048258daa02e2b1c3c24e7c46 (patch)
tree88b6b5da7c1b92daae8c1ff206d2f3c7399814f3 /media/base
parent4b571e6b3efa2f510f64de4718a1f37a9542a251 (diff)
downloadchromium_src-cee323423df2894048258daa02e2b1c3c24e7c46.zip
chromium_src-cee323423df2894048258daa02e2b1c3c24e7c46.tar.gz
chromium_src-cee323423df2894048258daa02e2b1c3c24e7c46.tar.bz2
Remove the silly notion of MIME types from media code.
This was one of the first things I checked into Chromium and I've been wanting to remove it for a long, long time now. BUG=28206 TEST=media_unittests Review URL: http://codereview.chromium.org/6623087 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77468 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r--media/base/composite_filter.cc6
-rw-r--r--media/base/composite_filter.h3
-rw-r--r--media/base/filters.cc22
-rw-r--r--media/base/filters.h22
-rw-r--r--media/base/media_format.cc52
-rw-r--r--media/base/media_format.h35
-rw-r--r--media/base/mock_filters.h1
-rw-r--r--media/base/pipeline.h12
-rw-r--r--media/base/pipeline_impl.cc53
-rw-r--r--media/base/pipeline_impl.h21
-rw-r--r--media/base/pipeline_impl_unittest.cc49
11 files changed, 72 insertions, 204 deletions
diff --git a/media/base/composite_filter.cc b/media/base/composite_filter.cc
index 7d26035..3e7b60c 100644
--- a/media/base/composite_filter.cc
+++ b/media/base/composite_filter.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -69,10 +69,6 @@ bool CompositeFilter::AddFilter(scoped_refptr<Filter> filter) {
return true;
}
-const char* CompositeFilter::major_mime_type() const {
- return "";
-}
-
void CompositeFilter::set_host(FilterHost* host) {
DCHECK_EQ(message_loop_, MessageLoop::current());
DCHECK(host);
diff --git a/media/base/composite_filter.h b/media/base/composite_filter.h
index daac421..5fa8531 100644
--- a/media/base/composite_filter.h
+++ b/media/base/composite_filter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,7 +25,6 @@ class CompositeFilter : public Filter {
bool AddFilter(scoped_refptr<Filter> filter);
// media::Filter methods.
- virtual const char* major_mime_type() const;
virtual void set_host(FilterHost* host);
virtual FilterHost* host();
virtual void Play(FilterCallback* play_callback);
diff --git a/media/base/filters.cc b/media/base/filters.cc
index eff50b4..1328dd1 100644
--- a/media/base/filters.cc
+++ b/media/base/filters.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,10 +12,6 @@ Filter::Filter() : host_(NULL) {}
Filter::~Filter() {}
-const char* Filter::major_mime_type() const {
- return "";
-}
-
void Filter::set_host(FilterHost* host) {
DCHECK(host);
DCHECK(!host_);
@@ -74,22 +70,6 @@ bool DataSource::IsUrlSupported(const std::string& url) {
return true;
}
-const char* AudioDecoder::major_mime_type() const {
- return mime_type::kMajorTypeAudio;
-}
-
-const char* AudioRenderer::major_mime_type() const {
- return mime_type::kMajorTypeAudio;
-}
-
-const char* VideoDecoder::major_mime_type() const {
- return mime_type::kMajorTypeVideo;
-}
-
-const char* VideoRenderer::major_mime_type() const {
- return mime_type::kMajorTypeVideo;
-}
-
void* DemuxerStream::QueryInterface(const char* interface_id) {
return NULL;
}
diff --git a/media/base/filters.h b/media/base/filters.h
index 06f44c2..11bf526 100644
--- a/media/base/filters.h
+++ b/media/base/filters.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -53,9 +53,6 @@ class Filter : public base::RefCountedThreadSafe<Filter> {
public:
Filter();
- // Return the major mime type for this filter.
- virtual const char* major_mime_type() const;
-
// Sets the private member |host_|. This is the first method called by
// the FilterHost after a filter is created. The host holds a strong
// reference to the filter. The reference held by the host is guaranteed
@@ -156,6 +153,12 @@ class Demuxer : public Filter {
class DemuxerStream : public base::RefCountedThreadSafe<DemuxerStream> {
public:
+ enum Type {
+ UNKNOWN,
+ AUDIO,
+ VIDEO,
+ };
+
// Schedules a read. When the |read_callback| is called, the downstream
// filter takes ownership of the buffer by AddRef()'ing the buffer.
//
@@ -173,6 +176,9 @@ class DemuxerStream : public base::RefCountedThreadSafe<DemuxerStream> {
return (NULL != i);
};
+ // Returns the type of stream.
+ virtual Type type() = 0;
+
// Returns the media format of this stream.
virtual const MediaFormat& media_format() = 0;
@@ -194,8 +200,6 @@ class DemuxerStream : public base::RefCountedThreadSafe<DemuxerStream> {
class VideoDecoder : public Filter {
public:
- virtual const char* major_mime_type() const;
-
// Initialize a VideoDecoder with the given DemuxerStream, executing the
// callback upon completion.
// stats_callback is used to update global pipeline statistics.
@@ -238,8 +242,6 @@ class VideoDecoder : public Filter {
class AudioDecoder : public Filter {
public:
- virtual const char* major_mime_type() const;
-
// Initialize a AudioDecoder with the given DemuxerStream, executing the
// callback upon completion.
// stats_callback is used to update global pipeline statistics.
@@ -277,8 +279,6 @@ class AudioDecoder : public Filter {
class VideoRenderer : public Filter {
public:
- virtual const char* major_mime_type() const;
-
// Initialize a VideoRenderer with the given VideoDecoder, executing the
// callback upon completion.
virtual void Initialize(VideoDecoder* decoder, FilterCallback* callback,
@@ -292,8 +292,6 @@ class VideoRenderer : public Filter {
class AudioRenderer : public Filter {
public:
- virtual const char* major_mime_type() const;
-
// Initialize a AudioRenderer with the given AudioDecoder, executing the
// callback upon completion.
virtual void Initialize(AudioDecoder* decoder, FilterCallback* callback) = 0;
diff --git a/media/base/media_format.cc b/media/base/media_format.cc
index 80c60e0..45df6b6 100644
--- a/media/base/media_format.cc
+++ b/media/base/media_format.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,52 +6,6 @@
namespace media {
-namespace mime_type {
-
-// Represents a URL, typically used to create a DataSourceInterface.
-// Expected keys:
-// kURL String The URL
-const char kURL[] = "text/x-url";
-
-// Represents a generic byte stream, typically from a DataSourceInterface.
-// Expected keys:
-// None
-const char kApplicationOctetStream[] = "application/octet-stream";
-
-// Represents encoded audio data, typically from an DemuxerStreamInterface.
-// Expected keys:
-// None
-const char kMPEGAudio[] = "audio/mpeg";
-const char kAACAudio[] = "audio/aac";
-
-// Represents encoded video data, typically from a DemuxerStreamInterface.
-// Expected keys:
-// None
-const char kH264AnnexB[] = "video/x-h264-annex-b";
-
-// Represents decoded audio data, typically from an AudioDecoderInterface.
-// Expected keys:
-// kChannels Integer Number of audio channels
-// kSampleRate Integer Audio sample rate (i.e., 44100)
-// kSampleBits Integer Audio bits-per-sample (i.e., 16)
-const char kUncompressedAudio[] = "audio/x-uncompressed";
-
-// Represents decoded video data, typically from a VideoDecoderInterface.
-// Other information, such as surface format (i.e., YV12), stride and planes are
-// included with the buffer itself and is not part of the MediaFormat.
-// Expected keys:
-// kWidth Integer Display width of the surface
-// kHeight Integer Display height of the surface
-const char kUncompressedVideo[] = "video/x-uncompressed";
-
-// Major types of media types begin with the prefix "audio/" or "video/".
-const char kMajorTypeVideo[] = "video/";
-const char kMajorTypeAudio[] = "audio/";
-
-} // namespace mime_type
-
-// Common keys.
-const char MediaFormat::kMimeType[] = "MimeType";
const char MediaFormat::kURL[] = "URL";
const char MediaFormat::kSurfaceFormat[] = "SurfaceFormat";
const char MediaFormat::kSurfaceType[] = "SurfaceType";
@@ -60,10 +14,8 @@ const char MediaFormat::kSampleBits[] = "SampleBits";
const char MediaFormat::kChannels[] = "Channels";
const char MediaFormat::kWidth[] = "Width";
const char MediaFormat::kHeight[] = "Height";
-const char MediaFormat::kFFmpegCodecID[] = "FFmpegCodecID";
-MediaFormat::MediaFormat() {
-}
+MediaFormat::MediaFormat() {}
MediaFormat::~MediaFormat() {
Clear();
diff --git a/media/base/media_format.h b/media/base/media_format.h
index 7b53d63..781afd4 100644
--- a/media/base/media_format.h
+++ b/media/base/media_format.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,40 +12,16 @@
namespace media {
-// Common MIME types.
-namespace mime_type {
-extern const char kURL[];
-extern const char kApplicationOctetStream[];
-extern const char kMPEGAudio[];
-extern const char kAACAudio[];
-extern const char kH264AnnexB[];
-extern const char kUncompressedAudio[];
-extern const char kUncompressedVideo[];
-extern const char kUncompressedVideoEglImage[];
-extern const char kMajorTypeAudio[];
-extern const char kMajorTypeVideo[];
-} // namespace mime_type
-
// MediaFormat is used to describe the output of a Filter to determine whether
// a downstream filter can accept the output from an upstream filter.
-// In general, every MediaFormat contains a MIME type describing its output as
-// well as additional key-values describing additional details.
-//
-// For example, an audio decoder could output audio/x-uncompressed and include
-// additional key-values such as the number of channels and the sample rate.
-// An audio renderer would use this information to properly initialize the
-// audio hardware before playback started.
//
-// It's also perfectly acceptable to create your own MIME types and standards
-// to allow communication between two filters that goes beyond the basics
-// described here. For example, you could write a video decoder that outputs
-// a MIME type video/x-special for which your video renderer knows it's some
-// special form of decompressed video output that regular video renderers
-// couldn't handle.
+// For example, an audio decoder could output key-values for the number of
+// channels and the sample rate. A downstream audio renderer would use this
+// information to properly initialize the audio hardware before playback
+// started.
class MediaFormat {
public:
// Common keys.
- static const char kMimeType[];
static const char kURL[];
static const char kSurfaceType[];
static const char kSurfaceFormat[];
@@ -54,7 +30,6 @@ class MediaFormat {
static const char kChannels[];
static const char kWidth[];
static const char kHeight[];
- static const char kFFmpegCodecID[];
MediaFormat();
~MediaFormat();
diff --git a/media/base/mock_filters.h b/media/base/mock_filters.h
index e54e5da..dd391ac 100644
--- a/media/base/mock_filters.h
+++ b/media/base/mock_filters.h
@@ -119,6 +119,7 @@ class MockDemuxerStream : public DemuxerStream {
MockDemuxerStream();
// DemuxerStream implementation.
+ MOCK_METHOD0(type, Type());
MOCK_METHOD0(media_format, const MediaFormat&());
MOCK_METHOD1(Read, void(Callback1<Buffer*>::Type* read_callback));
MOCK_METHOD1(QueryInterface, void*(const char* interface_id));
diff --git a/media/base/pipeline.h b/media/base/pipeline.h
index 0b87d29..8e7a8db 100644
--- a/media/base/pipeline.h
+++ b/media/base/pipeline.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -121,11 +121,11 @@ class Pipeline : public base::RefCountedThreadSafe<Pipeline> {
// Returns true if there has been network activity.
virtual bool IsNetworkActive() const = 0;
- // If the |major_mime_type| exists in the pipeline and is being rendered, this
- // method will return true. Types are defined in media/base/media_foramt.h.
- // For example, to determine if a pipeline contains video:
- // bool has_video = pipeline->IsRendered(mime_type::kMajorTypeVideo);
- virtual bool IsRendered(const std::string& major_mime_type) const = 0;
+ // Returns true if the media has audio.
+ virtual bool HasAudio() const = 0;
+
+ // Returns true if the media has video.
+ virtual bool HasVideo() const = 0;
// Gets the current playback rate of the pipeline. When the pipeline is
// started, the playback rate will be 0.0f. A rate of 1.0f indicates
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index 9bce38c..d4009c8 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -135,11 +135,14 @@ bool PipelineImpl::IsNetworkActive() const {
return network_activity_;
}
-bool PipelineImpl::IsRendered(const std::string& major_mime_type) const {
+bool PipelineImpl::HasAudio() const {
base::AutoLock auto_lock(lock_);
- bool is_rendered = (rendered_mime_types_.find(major_mime_type) !=
- rendered_mime_types_.end());
- return is_rendered;
+ return has_audio_;
+}
+
+bool PipelineImpl::HasVideo() const {
+ base::AutoLock auto_lock(lock_);
+ return has_video_;
}
float PipelineImpl::GetPlaybackRate() const {
@@ -321,10 +324,11 @@ void PipelineImpl::ResetState() {
volume_ = 1.0f;
playback_rate_ = 0.0f;
error_ = PIPELINE_OK;
+ has_audio_ = false;
+ has_video_ = false;
waiting_for_clock_update_ = false;
audio_disabled_ = false;
clock_->SetTime(kZero);
- rendered_mime_types_.clear();
}
void PipelineImpl::set_state(State next_state) {
@@ -509,18 +513,6 @@ void PipelineImpl::DisableAudioRenderer() {
NewRunnableMethod(this, &PipelineImpl::DisableAudioRendererTask));
}
-void PipelineImpl::InsertRenderedMimeType(const std::string& major_mime_type) {
- DCHECK(IsRunning());
- base::AutoLock auto_lock(lock_);
- rendered_mime_types_.insert(major_mime_type);
-}
-
-bool PipelineImpl::HasRenderedMimeTypes() const {
- DCHECK(IsRunning());
- base::AutoLock auto_lock(lock_);
- return !rendered_mime_types_.empty();
-}
-
// Called from any thread.
void PipelineImpl::OnFilterInitialize() {
// Continue the initialize task by proceeding to the next stage.
@@ -627,7 +619,8 @@ void PipelineImpl::InitializeTask() {
set_state(kInitAudioRenderer);
// Returns false if there's no audio stream.
if (InitializeAudioRenderer(pipeline_init_state_->audio_decoder_)) {
- InsertRenderedMimeType(mime_type::kMajorTypeAudio);
+ base::AutoLock auto_lock(lock_);
+ has_audio_ = true;
return;
}
}
@@ -644,13 +637,14 @@ void PipelineImpl::InitializeTask() {
if (state_ == kInitVideoDecoder) {
set_state(kInitVideoRenderer);
if (InitializeVideoRenderer(pipeline_init_state_->video_decoder_)) {
- InsertRenderedMimeType(mime_type::kMajorTypeVideo);
+ base::AutoLock auto_lock(lock_);
+ has_video_ = true;
return;
}
}
if (state_ == kInitVideoRenderer) {
- if (!IsPipelineOk() || !HasRenderedMimeTypes()) {
+ if (!IsPipelineOk() || !(HasAudio() || HasVideo())) {
SetError(PIPELINE_ERROR_COULD_NOT_RENDER);
return;
}
@@ -856,11 +850,8 @@ void PipelineImpl::NotifyNetworkEventTask() {
void PipelineImpl::DisableAudioRendererTask() {
DCHECK_EQ(MessageLoop::current(), message_loop_);
- // |rendered_mime_types_| is read through public methods so we need to lock
- // this variable.
base::AutoLock auto_lock(lock_);
- rendered_mime_types_.erase(mime_type::kMajorTypeAudio);
-
+ has_audio_ = false;
audio_disabled_ = true;
// Notify all filters of disabled audio renderer. If the filter isn't
@@ -929,9 +920,7 @@ void PipelineImpl::FilterStateTransitionTask() {
base::AutoLock auto_lock(lock_);
// We use audio stream to update the clock. So if there is such a stream,
// we pause the clock until we receive a valid timestamp.
- waiting_for_clock_update_ =
- rendered_mime_types_.find(mime_type::kMajorTypeAudio) !=
- rendered_mime_types_.end();
+ waiting_for_clock_update_ = has_audio_;
if (!waiting_for_clock_update_)
clock_->Play();
@@ -1073,7 +1062,7 @@ bool PipelineImpl::InitializeAudioDecoder(
DCHECK(IsPipelineOk());
scoped_refptr<DemuxerStream> stream =
- FindDemuxerStream(demuxer, mime_type::kMajorTypeAudio);
+ FindDemuxerStream(demuxer, DemuxerStream::AUDIO);
if (!stream)
return false;
@@ -1103,7 +1092,7 @@ bool PipelineImpl::InitializeVideoDecoder(
DCHECK(IsPipelineOk());
scoped_refptr<DemuxerStream> stream =
- FindDemuxerStream(demuxer, mime_type::kMajorTypeVideo);
+ FindDemuxerStream(demuxer, DemuxerStream::VIDEO);
if (!stream)
return false;
@@ -1175,15 +1164,13 @@ bool PipelineImpl::InitializeVideoRenderer(
scoped_refptr<DemuxerStream> PipelineImpl::FindDemuxerStream(
const scoped_refptr<Demuxer>& demuxer,
- std::string major_mime_type) {
+ DemuxerStream::Type type) {
DCHECK(demuxer);
const int num_outputs = demuxer->GetNumberOfStreams();
for (int i = 0; i < num_outputs; ++i) {
std::string value;
- if (demuxer->GetStream(i)->media_format().GetAsString(
- MediaFormat::kMimeType, &value) &&
- !value.compare(0, major_mime_type.length(), major_mime_type)) {
+ if (demuxer->GetStream(i)->type() == type) {
return demuxer->GetStream(i);
}
}
diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h
index e817eed..fa4b5d1 100644
--- a/media/base/pipeline_impl.h
+++ b/media/base/pipeline_impl.h
@@ -78,7 +78,8 @@ class PipelineImpl : public Pipeline, public FilterHost {
virtual bool IsRunning() const;
virtual bool IsInitialized() const;
virtual bool IsNetworkActive() const;
- virtual bool IsRendered(const std::string& major_mime_type) const;
+ virtual bool HasAudio() const;
+ virtual bool HasVideo() const;
virtual float GetPlaybackRate() const;
virtual void SetPlaybackRate(float playback_rate);
virtual float GetVolume() const;
@@ -172,13 +173,6 @@ class PipelineImpl : public Pipeline, public FilterHost {
virtual void SetCurrentReadPosition(int64 offset);
virtual int64 GetCurrentReadPosition();
- // Method called during initialization to insert a mime type into the
- // |rendered_mime_types_| set.
- void InsertRenderedMimeType(const std::string& major_mime_type);
-
- // Method called during initialization to determine if we rendered anything.
- bool HasRenderedMimeTypes() const;
-
// Callback executed by filters upon completing initialization.
void OnFilterInitialize();
@@ -267,10 +261,11 @@ class PipelineImpl : public Pipeline, public FilterHost {
bool InitializeAudioRenderer(const scoped_refptr<AudioDecoder>& decoder);
bool InitializeVideoRenderer(const scoped_refptr<VideoDecoder>& decoder);
- // Helper to find the demuxer of |major_mime_type| from Demuxer.
+ // Returns a reference to the DemuxerStream of the requested type if it
+ // exists, NULL otherwise.
scoped_refptr<DemuxerStream> FindDemuxerStream(
const scoped_refptr<Demuxer>& demuxer,
- std::string major_mime_type);
+ DemuxerStream::Type type);
// Kicks off destroying filters. Called by StopTask() and ErrorChangedTask().
// When we start to tear down the pipeline, we will consider two cases:
@@ -359,9 +354,9 @@ class PipelineImpl : public Pipeline, public FilterHost {
// reset the pipeline state, and restore this to PIPELINE_OK.
PipelineError error_;
- // Vector of major mime types that have been rendered by this pipeline.
- typedef std::set<std::string> RenderedMimeTypesSet;
- RenderedMimeTypesSet rendered_mime_types_;
+ // Whether the media contains rendered audio and video streams.
+ bool has_audio_;
+ bool has_video_;
// The following data members are only accessed by tasks posted to
// |message_loop_|.
diff --git a/media/base/pipeline_impl_unittest.cc b/media/base/pipeline_impl_unittest.cc
index 0762cb35..b583879 100644
--- a/media/base/pipeline_impl_unittest.cc
+++ b/media/base/pipeline_impl_unittest.cc
@@ -79,9 +79,6 @@ class PipelineImplTest : public ::testing::Test {
&CallbackHelper::OnStop));
message_loop_.RunAllPending();
- // Free allocated media formats (if any).
- STLDeleteElements(&stream_media_formats_);
-
mocks_.reset();
}
@@ -125,19 +122,11 @@ class PipelineImplTest : public ::testing::Test {
}
}
- // Create a stream with an associated media format.
- StrictMock<MockDemuxerStream>* CreateStream(const std::string& mime_type) {
+ StrictMock<MockDemuxerStream>* CreateStream(DemuxerStream::Type type) {
StrictMock<MockDemuxerStream>* stream =
new StrictMock<MockDemuxerStream>();
-
- // Sets the mime type of this stream's media format, which is usually
- // checked to determine the type of decoder to create.
- MediaFormat* media_format = new MediaFormat();
- media_format->SetAsString(MediaFormat::kMimeType, mime_type);
- EXPECT_CALL(*stream, media_format())
- .WillRepeatedly(ReturnRef(*media_format));
- stream_media_formats_.push_back(media_format);
-
+ EXPECT_CALL(*stream, type())
+ .WillRepeatedly(Return(type));
return stream;
}
@@ -209,11 +198,11 @@ class PipelineImplTest : public ::testing::Test {
}
void CreateAudioStream() {
- audio_stream_ = CreateStream("audio/x-foo");
+ audio_stream_ = CreateStream(DemuxerStream::AUDIO);
}
void CreateVideoStream() {
- video_stream_ = CreateStream("video/x-foo");
+ video_stream_ = CreateStream(DemuxerStream::VIDEO);
}
MockDemuxerStream* audio_stream() {
@@ -269,9 +258,6 @@ class PipelineImplTest : public ::testing::Test {
scoped_refptr<StrictMock<MockDemuxerStream> > audio_stream_;
scoped_refptr<StrictMock<MockDemuxerStream> > video_stream_;
- typedef std::vector<MediaFormat*> MediaFormatVector;
- MediaFormatVector stream_media_formats_;
-
private:
DISALLOW_COPY_AND_ASSIGN(PipelineImplTest);
};
@@ -291,9 +277,8 @@ TEST_F(PipelineImplTest, NotStarted) {
EXPECT_FALSE(pipeline_->IsRunning());
EXPECT_FALSE(pipeline_->IsInitialized());
- EXPECT_FALSE(pipeline_->IsRendered(""));
- EXPECT_FALSE(pipeline_->IsRendered(mime_type::kMajorTypeAudio));
- EXPECT_FALSE(pipeline_->IsRendered(mime_type::kMajorTypeVideo));
+ EXPECT_FALSE(pipeline_->HasAudio());
+ EXPECT_FALSE(pipeline_->HasVideo());
// Setting should still work.
EXPECT_EQ(0.0f, pipeline_->GetPlaybackRate());
@@ -424,8 +409,8 @@ TEST_F(PipelineImplTest, AudioStream) {
InitializePipeline();
EXPECT_TRUE(pipeline_->IsInitialized());
EXPECT_EQ(PIPELINE_OK, pipeline_->GetError());
- EXPECT_TRUE(pipeline_->IsRendered(media::mime_type::kMajorTypeAudio));
- EXPECT_FALSE(pipeline_->IsRendered(media::mime_type::kMajorTypeVideo));
+ EXPECT_TRUE(pipeline_->HasAudio());
+ EXPECT_FALSE(pipeline_->HasVideo());
}
TEST_F(PipelineImplTest, VideoStream) {
@@ -441,8 +426,8 @@ TEST_F(PipelineImplTest, VideoStream) {
InitializePipeline();
EXPECT_TRUE(pipeline_->IsInitialized());
EXPECT_EQ(PIPELINE_OK, pipeline_->GetError());
- EXPECT_FALSE(pipeline_->IsRendered(media::mime_type::kMajorTypeAudio));
- EXPECT_TRUE(pipeline_->IsRendered(media::mime_type::kMajorTypeVideo));
+ EXPECT_FALSE(pipeline_->HasAudio());
+ EXPECT_TRUE(pipeline_->HasVideo());
}
TEST_F(PipelineImplTest, AudioVideoStream) {
@@ -462,8 +447,8 @@ TEST_F(PipelineImplTest, AudioVideoStream) {
InitializePipeline();
EXPECT_TRUE(pipeline_->IsInitialized());
EXPECT_EQ(PIPELINE_OK, pipeline_->GetError());
- EXPECT_TRUE(pipeline_->IsRendered(media::mime_type::kMajorTypeAudio));
- EXPECT_TRUE(pipeline_->IsRendered(media::mime_type::kMajorTypeVideo));
+ EXPECT_TRUE(pipeline_->HasAudio());
+ EXPECT_TRUE(pipeline_->HasVideo());
}
TEST_F(PipelineImplTest, Seek) {
@@ -618,8 +603,8 @@ TEST_F(PipelineImplTest, DisableAudioRenderer) {
InitializePipeline();
EXPECT_TRUE(pipeline_->IsInitialized());
EXPECT_EQ(PIPELINE_OK, pipeline_->GetError());
- EXPECT_TRUE(pipeline_->IsRendered(mime_type::kMajorTypeAudio));
- EXPECT_TRUE(pipeline_->IsRendered(mime_type::kMajorTypeVideo));
+ EXPECT_TRUE(pipeline_->HasAudio());
+ EXPECT_TRUE(pipeline_->HasVideo());
EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(1.0f))
.WillOnce(DisableAudioRenderer(mocks_->audio_renderer()));
@@ -676,8 +661,8 @@ TEST_F(PipelineImplTest, DisableAudioRendererDuringInit) {
InitializePipeline();
EXPECT_TRUE(pipeline_->IsInitialized());
EXPECT_EQ(PIPELINE_OK, pipeline_->GetError());
- EXPECT_FALSE(pipeline_->IsRendered(mime_type::kMajorTypeAudio));
- EXPECT_TRUE(pipeline_->IsRendered(mime_type::kMajorTypeVideo));
+ EXPECT_FALSE(pipeline_->HasAudio());
+ EXPECT_TRUE(pipeline_->HasVideo());
// Verify that ended event is fired when video ends.
EXPECT_CALL(*mocks_->video_renderer(), HasEnded())