OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ |
| 7 |
| 8 #include <set> |
| 9 #include "media/base/android/media_codec_decoder.h" |
| 10 #include "ui/gl/android/scoped_java_surface.h" |
| 11 |
| 12 namespace media { |
| 13 |
| 14 class MediaCodecVideoDecoder : public MediaCodecDecoder { |
| 15 public: |
| 16 MediaCodecVideoDecoder( |
| 17 const scoped_refptr<base::SingleThreadTaskRunner>& media_runner, |
| 18 const scoped_refptr<base::SingleThreadTaskRunner>& ui_runner, |
| 19 const base::Closure& request_data_cb, |
| 20 const base::Closure& starvation_cb, |
| 21 const base::Closure& stop_done_cb, |
| 22 const base::Closure& error_cb, |
| 23 const base::Closure& request_resources_cb); |
| 24 ~MediaCodecVideoDecoder() override; |
| 25 |
| 26 const char * class_name() const override { return "VideoDecoder"; } |
| 27 |
| 28 bool HasStream() const override; |
| 29 void ReleaseDecoderResources() override; |
| 30 |
| 31 void SetPendingSurface(gfx::ScopedJavaSurface surface); |
| 32 bool HasPendingSurface() const; |
| 33 |
| 34 int GetVideoWidth() const; |
| 35 int GetVideoHeight() const; |
| 36 |
| 37 protected: |
| 38 bool IsCodecReconfigureNeeded(const DemuxerConfigs& curr, |
| 39 const DemuxerConfigs& next) const override; |
| 40 ConfigStatus ConfigureInternal() override; |
| 41 void SynchronizePTSWithTime(base::TimeDelta current_time) override; |
| 42 void Render(int buffer_index, size_t size, bool render_output, |
| 43 base::TimeDelta pts, bool eos_encountered) override; |
| 44 |
| 45 int NumDelayedRenderTasks() const override; |
| 46 void ReleaseDelayedBuffers() override; |
| 47 |
| 48 private: |
| 49 void ReleaseOutputBuffer(int buffer_index, bool render, |
| 50 bool eos_encountered); |
| 51 |
| 52 // Data. |
| 53 |
| 54 // Video surface that we render to. |
| 55 gfx::ScopedJavaSurface surface_; |
| 56 |
| 57 // Inform the caller that the MediaCodec is created. |
| 58 base::Closure request_resources_cb_; |
| 59 |
| 60 std::set<int> delayed_buffers_; |
| 61 |
| 62 // Associate presentation timestamps with time |
| 63 base::TimeTicks start_time_ticks_; |
| 64 base::TimeDelta start_pts_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(MediaCodecVideoDecoder); |
| 67 }; |
| 68 |
| 69 } // namespace media |
| 70 |
| 71 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ |
OLD | NEW |