OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_MOJO_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_ |
| 6 #define MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "media/base/decode_status.h" |
| 13 #include "media/mojo/interfaces/video_decoder.mojom.h" |
| 14 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 15 #include "mojo/public/cpp/system/data_pipe.h" |
| 16 |
| 17 namespace media { |
| 18 |
| 19 class MojoMediaClient; |
| 20 class VideoDecoder; |
| 21 class VideoFrame; |
| 22 |
| 23 class MojoVideoDecoderService : public interfaces::VideoDecoder { |
| 24 public: |
| 25 MojoVideoDecoderService( |
| 26 mojo::InterfaceRequest<interfaces::VideoDecoder> request, |
| 27 MojoMediaClient* mojo_media_client); |
| 28 ~MojoVideoDecoderService() final; |
| 29 |
| 30 // interfaces::VideoDecoder implementation |
| 31 void Construct(interfaces::VideoDecoderClientPtr client, |
| 32 mojo::ScopedDataPipeConsumerHandle decoder_buffer_pipe) final; |
| 33 void Initialize(interfaces::VideoDecoderConfigPtr config, |
| 34 bool low_delay, |
| 35 const InitializeCallback& callback) final; |
| 36 void Decode(interfaces::DecoderBufferPtr buffer, |
| 37 const DecodeCallback& callback) final; |
| 38 void Reset(const ResetCallback& callback) final; |
| 39 |
| 40 private: |
| 41 void OnDecoderInitialized(const InitializeCallback& callback, bool success); |
| 42 void OnDecoderDecoded(const DecodeCallback& callback, DecodeStatus status); |
| 43 void OnDecoderOutput(const scoped_refptr<VideoFrame>& frame); |
| 44 void OnDecoderReset(const ResetCallback& callback); |
| 45 |
| 46 mojo::StrongBinding<interfaces::VideoDecoder> binding_; |
| 47 interfaces::VideoDecoderClientPtr client_; |
| 48 mojo::ScopedDataPipeConsumerHandle decoder_buffer_pipe_; |
| 49 |
| 50 MojoMediaClient* mojo_media_client_; |
| 51 std::unique_ptr<VideoDecoder> decoder_; |
| 52 |
| 53 base::WeakPtr<MojoVideoDecoderService> weak_this_; |
| 54 base::WeakPtrFactory<MojoVideoDecoderService> weak_factory_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoderService); |
| 57 }; |
| 58 |
| 59 } // namespace media |
| 60 |
| 61 #endif // MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_ |
OLD | NEW |