| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_IPC_VIDEO_DECODER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_IPC_VIDEO_DECODER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_IPC_VIDEO_DECODER_H_ | 6 #define CONTENT_RENDERER_MEDIA_IPC_VIDEO_DECODER_H_ |
| 7 | 7 |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "media/base/pts_heap.h" | 9 #include "media/base/pts_heap.h" |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| 11 #include "media/filters/decoder_base.h" | 11 #include "media/filters/decoder_base.h" |
| 12 #include "media/video/video_decode_engine.h" | 12 #include "media/video/video_decode_engine.h" |
| 13 #include "media/video/video_decode_context.h" | 13 #include "media/video/video_decode_context.h" |
| 14 | 14 |
| 15 struct AVRational; | 15 struct AVRational; |
| 16 class RendererGLContext; | 16 class RendererGLContext; |
| 17 | 17 |
| 18 class IpcVideoDecoder : public media::VideoDecoder, | 18 class IpcVideoDecoder : public media::VideoDecoder, |
| 19 public media::VideoDecodeEngine::EventHandler { | 19 public media::VideoDecodeEngine::EventHandler { |
| 20 public: | 20 public: |
| 21 IpcVideoDecoder(MessageLoop* message_loop, RendererGLContext* gl_context); | 21 IpcVideoDecoder(MessageLoop* message_loop, RendererGLContext* gl_context); |
| 22 virtual ~IpcVideoDecoder(); | 22 virtual ~IpcVideoDecoder(); |
| 23 | 23 |
| 24 // media::Filter implementation. | 24 // media::Filter implementation. |
| 25 virtual void Stop(media::FilterCallback* callback); | 25 virtual void Stop(media::FilterCallback* callback); |
| 26 virtual void Seek(base::TimeDelta time, media::FilterCallback* callback); | 26 virtual void Seek(base::TimeDelta time, const media::FilterStatusCB& cb); |
| 27 virtual void Pause(media::FilterCallback* callback); | 27 virtual void Pause(media::FilterCallback* callback); |
| 28 virtual void Flush(media::FilterCallback* callback); | 28 virtual void Flush(media::FilterCallback* callback); |
| 29 | 29 |
| 30 // media::VideoDecoder implementation. | 30 // media::VideoDecoder implementation. |
| 31 virtual void Initialize(media::DemuxerStream* demuxer_stream, | 31 virtual void Initialize(media::DemuxerStream* demuxer_stream, |
| 32 media::FilterCallback* callback, | 32 media::FilterCallback* callback, |
| 33 media::StatisticsCallback* statsCallback); | 33 media::StatisticsCallback* statsCallback); |
| 34 virtual const media::MediaFormat& media_format(); | 34 virtual const media::MediaFormat& media_format(); |
| 35 virtual void ProduceVideoFrame(scoped_refptr<media::VideoFrame> video_frame); | 35 virtual void ProduceVideoFrame(scoped_refptr<media::VideoFrame> video_frame); |
| 36 | 36 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 50 virtual void ConsumeVideoFrame(scoped_refptr<media::VideoFrame> frame, | 50 virtual void ConsumeVideoFrame(scoped_refptr<media::VideoFrame> frame, |
| 51 const media::PipelineStatistics& statistics); | 51 const media::PipelineStatistics& statistics); |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 void OnReadComplete(media::Buffer* buffer); | 54 void OnReadComplete(media::Buffer* buffer); |
| 55 void OnDestroyComplete(); | 55 void OnDestroyComplete(); |
| 56 | 56 |
| 57 media::MediaFormat media_format_; | 57 media::MediaFormat media_format_; |
| 58 | 58 |
| 59 scoped_ptr<media::FilterCallback> flush_callback_; | 59 scoped_ptr<media::FilterCallback> flush_callback_; |
| 60 scoped_ptr<media::FilterCallback> seek_callback_; | 60 media::FilterStatusCB seek_cb_; |
| 61 scoped_ptr<media::FilterCallback> initialize_callback_; | 61 scoped_ptr<media::FilterCallback> initialize_callback_; |
| 62 scoped_ptr<media::FilterCallback> stop_callback_; | 62 scoped_ptr<media::FilterCallback> stop_callback_; |
| 63 scoped_ptr<media::StatisticsCallback> statistics_callback_; | 63 scoped_ptr<media::StatisticsCallback> statistics_callback_; |
| 64 | 64 |
| 65 // Pointer to the demuxer stream that will feed us compressed buffers. | 65 // Pointer to the demuxer stream that will feed us compressed buffers. |
| 66 scoped_refptr<media::DemuxerStream> demuxer_stream_; | 66 scoped_refptr<media::DemuxerStream> demuxer_stream_; |
| 67 | 67 |
| 68 // This is the message loop that we should assign to VideoDecodeContext. | 68 // This is the message loop that we should assign to VideoDecodeContext. |
| 69 MessageLoop* decode_context_message_loop_; | 69 MessageLoop* decode_context_message_loop_; |
| 70 | 70 |
| 71 // A context for allocating textures and issuing GLES2 commands. | 71 // A context for allocating textures and issuing GLES2 commands. |
| 72 // TODO(hclam): A RendererGLContext lives on the Render Thread while this | 72 // TODO(hclam): A RendererGLContext lives on the Render Thread while this |
| 73 // object lives on the Video Decoder Thread, we need to take care of context | 73 // object lives on the Video Decoder Thread, we need to take care of context |
| 74 // lost and destruction of the context. | 74 // lost and destruction of the context. |
| 75 RendererGLContext* gl_context_; | 75 RendererGLContext* gl_context_; |
| 76 | 76 |
| 77 // This VideoDecodeEngine translate our requests to IPC commands to the | 77 // This VideoDecodeEngine translate our requests to IPC commands to the |
| 78 // GPU process. | 78 // GPU process. |
| 79 // VideoDecodeEngine should run on IO Thread instead of Render Thread to | 79 // VideoDecodeEngine should run on IO Thread instead of Render Thread to |
| 80 // avoid dead lock during tear down of the media pipeline. | 80 // avoid dead lock during tear down of the media pipeline. |
| 81 scoped_ptr<media::VideoDecodeEngine> decode_engine_; | 81 scoped_ptr<media::VideoDecodeEngine> decode_engine_; |
| 82 | 82 |
| 83 // Decoding context to be used by VideoDecodeEngine. | 83 // Decoding context to be used by VideoDecodeEngine. |
| 84 scoped_ptr<media::VideoDecodeContext> decode_context_; | 84 scoped_ptr<media::VideoDecodeContext> decode_context_; |
| 85 | 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(IpcVideoDecoder); | 86 DISALLOW_COPY_AND_ASSIGN(IpcVideoDecoder); |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 #endif // CONTENT_RENDERER_MEDIA_IPC_VIDEO_DECODER_H_ | 89 #endif // CONTENT_RENDERER_MEDIA_IPC_VIDEO_DECODER_H_ |
| OLD | NEW |