diff options
Diffstat (limited to 'media/filters')
-rw-r--r-- | media/filters/dummy_demuxer.cc | 61 | ||||
-rw-r--r-- | media/filters/dummy_demuxer.h | 64 | ||||
-rw-r--r-- | media/filters/video_frame_generator.cc | 100 | ||||
-rw-r--r-- | media/filters/video_frame_generator.h | 63 |
4 files changed, 0 insertions, 288 deletions
diff --git a/media/filters/dummy_demuxer.cc b/media/filters/dummy_demuxer.cc deleted file mode 100644 index e1694d8..0000000 --- a/media/filters/dummy_demuxer.cc +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2012 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. - -#include "media/filters/dummy_demuxer.h" - -#include "base/logging.h" - -namespace media { - -DummyDemuxerStream::DummyDemuxerStream(Type type) - : type_(type) { -} - -DummyDemuxerStream::~DummyDemuxerStream() {} - -DemuxerStream::Type DummyDemuxerStream::type() { - return type_; -} - -const AudioDecoderConfig& DummyDemuxerStream::audio_decoder_config() { - CHECK_EQ(type_, AUDIO); - return audio_config_; -} - -const VideoDecoderConfig& DummyDemuxerStream::video_decoder_config() { - CHECK_EQ(type_, VIDEO); - return video_config_; -} - -void DummyDemuxerStream::Read(const ReadCB& read_cb) {} - -void DummyDemuxerStream::EnableBitstreamConverter() {} - -DummyDemuxer::DummyDemuxer(bool has_video, bool has_audio) { - streams_.resize(DemuxerStream::NUM_TYPES); - if (has_audio) - streams_[DemuxerStream::AUDIO] = - new DummyDemuxerStream(DemuxerStream::AUDIO); - if (has_video) - streams_[DemuxerStream::VIDEO] = - new DummyDemuxerStream(DemuxerStream::VIDEO); -} - -void DummyDemuxer::Initialize(DemuxerHost* host, - const PipelineStatusCB& status_cb) { - host->SetDuration(media::kInfiniteDuration()); - status_cb.Run(PIPELINE_OK); -} - -scoped_refptr<DemuxerStream> DummyDemuxer::GetStream(DemuxerStream::Type type) { - return streams_[type]; -} - -base::TimeDelta DummyDemuxer::GetStartTime() const { - return base::TimeDelta(); -} - -DummyDemuxer::~DummyDemuxer() {} - -} // namespace media diff --git a/media/filters/dummy_demuxer.h b/media/filters/dummy_demuxer.h deleted file mode 100644 index fceda30..0000000 --- a/media/filters/dummy_demuxer.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2012 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. - -// Implements the Demuxer interface. DummyDemuxer returns corresponding -// DummyDemuxerStream as signal for media pipeline to construct correct -// playback channels. Used in WebRTC local video capture pipeline, where -// demuxing is not needed. - -#ifndef MEDIA_FILTERS_DUMMY_DEMUXER_H_ -#define MEDIA_FILTERS_DUMMY_DEMUXER_H_ - -#include <vector> - -#include "media/base/audio_decoder_config.h" -#include "media/base/demuxer.h" -#include "media/base/video_decoder_config.h" - -namespace media { - -class DummyDemuxerStream : public DemuxerStream { - public: - explicit DummyDemuxerStream(Type type); - - // DemuxerStream implementation. - virtual void Read(const ReadCB& read_cb) OVERRIDE; - virtual Type type() OVERRIDE; - virtual const AudioDecoderConfig& audio_decoder_config() OVERRIDE; - virtual const VideoDecoderConfig& video_decoder_config() OVERRIDE; - virtual void EnableBitstreamConverter() OVERRIDE; - protected: - virtual ~DummyDemuxerStream(); - - private: - Type type_; - AudioDecoderConfig audio_config_; - VideoDecoderConfig video_config_; - - DISALLOW_COPY_AND_ASSIGN(DummyDemuxerStream); -}; - -class MEDIA_EXPORT DummyDemuxer : public Demuxer { - public: - DummyDemuxer(bool has_video, bool has_audio); - - // Demuxer implementation. - virtual void Initialize(DemuxerHost* host, - const PipelineStatusCB& status_cb) OVERRIDE; - virtual scoped_refptr<DemuxerStream> GetStream( - DemuxerStream::Type type) OVERRIDE; - virtual base::TimeDelta GetStartTime() const OVERRIDE; - - protected: - virtual ~DummyDemuxer(); - - private: - std::vector< scoped_refptr<DummyDemuxerStream> > streams_; - - DISALLOW_COPY_AND_ASSIGN(DummyDemuxer); -}; - -} // namespace media - -#endif // MEDIA_FILTERS_DUMMY_DEMUXER_H_ diff --git a/media/filters/video_frame_generator.cc b/media/filters/video_frame_generator.cc deleted file mode 100644 index c72fe13..0000000 --- a/media/filters/video_frame_generator.cc +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2012 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. - -#include "media/filters/video_frame_generator.h" - -#include "base/bind.h" -#include "base/message_loop.h" -#include "media/base/demuxer_stream.h" -#include "media/base/video_frame.h" - -namespace media { - -VideoFrameGenerator::VideoFrameGenerator( - const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, - const gfx::Size& size, - const base::TimeDelta& frame_duration) - : message_loop_proxy_(message_loop_proxy), - size_(size), - stopped_(true), - frame_duration_(frame_duration) { -} - -void VideoFrameGenerator::Initialize( - const scoped_refptr<DemuxerStream>& stream, - const PipelineStatusCB& status_cb, - const StatisticsCB& statistics_cb) { - message_loop_proxy_->PostTask( - FROM_HERE, - base::Bind(&VideoFrameGenerator::InitializeOnDecoderThread, - this, stream, status_cb, statistics_cb)); -} - -void VideoFrameGenerator::Read(const ReadCB& read_cb) { - message_loop_proxy_->PostTask( - FROM_HERE, - base::Bind(&VideoFrameGenerator::ReadOnDecoderThread, this, read_cb)); -} - -void VideoFrameGenerator::Reset(const base::Closure& closure) { - message_loop_proxy_->PostTask( - FROM_HERE, - base::Bind(&VideoFrameGenerator::ResetOnDecoderThread, this, closure)); -} - -void VideoFrameGenerator::Stop(const base::Closure& closure) { - message_loop_proxy_->PostTask( - FROM_HERE, - base::Bind(&VideoFrameGenerator::StopOnDecoderThread, this, closure)); -} - -VideoFrameGenerator::~VideoFrameGenerator() {} - -void VideoFrameGenerator::InitializeOnDecoderThread( - const scoped_refptr<DemuxerStream>& /* stream */, - const PipelineStatusCB& status_cb, - const StatisticsCB& statistics_cb) { - DVLOG(1) << "InitializeOnDecoderThread"; - DCHECK(message_loop_proxy_->BelongsToCurrentThread()); - - status_cb.Run(PIPELINE_OK); - stopped_ = false; -} - -void VideoFrameGenerator::ReadOnDecoderThread(const ReadCB& read_cb) { - DCHECK(message_loop_proxy_->BelongsToCurrentThread()); - CHECK(!read_cb.is_null()); - if (stopped_) - return; - - // Always allocate a new frame. - // - // TODO(scherkus): migrate this to proper buffer recycling. - scoped_refptr<VideoFrame> video_frame = - VideoFrame::CreateFrame(VideoFrame::YV12, size_, gfx::Rect(size_), size_, - current_time_); - current_time_ += frame_duration_; - - // TODO(wjia): set pixel data to pre-defined patterns if it's desired to - // verify frame content. - - read_cb.Run(kOk, video_frame); -} - -void VideoFrameGenerator::ResetOnDecoderThread(const base::Closure& closure) { - DVLOG(1) << "ResetOnDecoderThread"; - DCHECK(message_loop_proxy_->BelongsToCurrentThread()); - current_time_ = base::TimeDelta(); - closure.Run(); -} - -void VideoFrameGenerator::StopOnDecoderThread(const base::Closure& closure) { - DVLOG(1) << "StopOnDecoderThread"; - DCHECK(message_loop_proxy_->BelongsToCurrentThread()); - stopped_ = true; - current_time_ = base::TimeDelta(); - closure.Run(); -} - -} // namespace media diff --git a/media/filters/video_frame_generator.h b/media/filters/video_frame_generator.h deleted file mode 100644 index 2a4667f..0000000 --- a/media/filters/video_frame_generator.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2012 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. - -#ifndef MEDIA_FILTERS_VIDEO_FRAME_GENERATOR_H_ -#define MEDIA_FILTERS_VIDEO_FRAME_GENERATOR_H_ - -#include "base/time.h" -#include "media/base/video_decoder.h" -#include "media/base/pipeline_status.h" - -namespace base { -class MessageLoopProxy; -} - -namespace media { - -class DemuxerStream; -class VideoFrame; - -// A filter generates raw frames and passes them to media engine as a video -// decoder filter. -class MEDIA_EXPORT VideoFrameGenerator : public VideoDecoder { - public: - VideoFrameGenerator( - const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, - const gfx::Size& size, - const base::TimeDelta& frame_duration); - - // VideoDecoder implementation. - virtual void Initialize( - const scoped_refptr<DemuxerStream>& stream, - const PipelineStatusCB& status_cb, - const StatisticsCB& statistics_cb) OVERRIDE; - virtual void Read(const ReadCB& read_cb) OVERRIDE; - virtual void Reset(const base::Closure& closure) OVERRIDE; - virtual void Stop(const base::Closure& closure) OVERRIDE; - - protected: - virtual ~VideoFrameGenerator(); - - private: - void InitializeOnDecoderThread( - const scoped_refptr<DemuxerStream>& stream, - const PipelineStatusCB& status_cb, - const StatisticsCB& statistics_cb); - void ReadOnDecoderThread(const ReadCB& read_cb); - void ResetOnDecoderThread(const base::Closure& closure); - void StopOnDecoderThread(const base::Closure& closure); - - scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; - gfx::Size size_; - bool stopped_; - - base::TimeDelta current_time_; - base::TimeDelta frame_duration_; - - DISALLOW_COPY_AND_ASSIGN(VideoFrameGenerator); -}; - -} // namespace media - -#endif // MEDIA_FILTERS_VIDEO_FRAME_GENERATOR_H_ |