| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_FILTERS_OMX_VIDEO_DECODER_H_ | |
| 6 #define MEDIA_FILTERS_OMX_VIDEO_DECODER_H_ | |
| 7 | |
| 8 #include <queue> | |
| 9 | |
| 10 #include "media/base/filters.h" | |
| 11 #include "media/base/media_format.h" | |
| 12 #include "media/base/pts_stream.h" | |
| 13 #include "media/video/video_decode_context.h" | |
| 14 #include "media/video/video_decode_engine.h" | |
| 15 | |
| 16 class MessageLoop; | |
| 17 | |
| 18 namespace media { | |
| 19 | |
| 20 class Buffer; | |
| 21 class OmxVideoDecodeEngine; | |
| 22 class VideoFrame; | |
| 23 | |
| 24 class OmxVideoDecoder : public VideoDecoder, | |
| 25 public VideoDecodeEngine::EventHandler { | |
| 26 public: | |
| 27 OmxVideoDecoder(MessageLoop* message_loop, | |
| 28 VideoDecodeContext* decode_context); | |
| 29 virtual ~OmxVideoDecoder(); | |
| 30 | |
| 31 // Filter implementations. | |
| 32 virtual void Initialize(DemuxerStream* stream, | |
| 33 FilterCallback* callback, | |
| 34 StatisticsCallback* stats_callback); | |
| 35 virtual void Stop(FilterCallback* callback); | |
| 36 virtual void Flush(FilterCallback* callback); | |
| 37 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb); | |
| 38 virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> frame); | |
| 39 virtual bool ProvidesBuffer(); | |
| 40 virtual const MediaFormat& media_format(); | |
| 41 | |
| 42 private: | |
| 43 // VideoDecodeEngine::EventHandler interface. | |
| 44 virtual void OnInitializeComplete(const VideoCodecInfo& info); | |
| 45 virtual void OnUninitializeComplete(); | |
| 46 virtual void OnFlushComplete(); | |
| 47 virtual void OnSeekComplete(); | |
| 48 virtual void OnError(); | |
| 49 virtual void OnFormatChange(VideoStreamInfo stream_info); | |
| 50 virtual void ProduceVideoSample(scoped_refptr<Buffer> buffer); | |
| 51 virtual void ConsumeVideoFrame(scoped_refptr<VideoFrame> frame, | |
| 52 const PipelineStatistics& statistics); | |
| 53 | |
| 54 // TODO(hclam): This is very ugly that we keep reference instead of | |
| 55 // scoped_refptr. | |
| 56 void DemuxCompleteTask(Buffer* buffer); | |
| 57 void ConsumeVideoSample(scoped_refptr<Buffer> buffer); | |
| 58 | |
| 59 MessageLoop* message_loop_; | |
| 60 | |
| 61 // Pointer to the demuxer stream that will feed us compressed buffers. | |
| 62 scoped_refptr<DemuxerStream> demuxer_stream_; | |
| 63 scoped_ptr<VideoDecodeEngine> decode_engine_; | |
| 64 scoped_ptr<VideoDecodeContext> decode_context_; | |
| 65 MediaFormat media_format_; | |
| 66 | |
| 67 scoped_ptr<FilterCallback> initialize_callback_; | |
| 68 scoped_ptr<FilterCallback> uninitialize_callback_; | |
| 69 scoped_ptr<FilterCallback> flush_callback_; | |
| 70 FilterStatusCB seek_cb_; | |
| 71 scoped_ptr<StatisticsCallback> statistics_callback_; | |
| 72 | |
| 73 VideoCodecInfo info_; | |
| 74 | |
| 75 PtsStream pts_stream_; // Stream of presentation timestamps. | |
| 76 | |
| 77 DISALLOW_COPY_AND_ASSIGN(OmxVideoDecoder); | |
| 78 }; | |
| 79 | |
| 80 } // namespace media | |
| 81 | |
| 82 #endif // MEDIA_FILTERS_OMX_VIDEO_DECODER_H_ | |
| OLD | NEW |