| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MEDIA_MOJO_CLIENTS_MOJO_DEMUXER_STREAM_IMPL_H_ | 5 #ifndef MEDIA_MOJO_CLIENTS_MOJO_DEMUXER_STREAM_IMPL_H_ |
| 6 #define MEDIA_MOJO_CLIENTS_MOJO_DEMUXER_STREAM_IMPL_H_ | 6 #define MEDIA_MOJO_CLIENTS_MOJO_DEMUXER_STREAM_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 11 #include "media/base/demuxer_stream.h" | 13 #include "media/base/demuxer_stream.h" |
| 12 #include "media/mojo/interfaces/demuxer_stream.mojom.h" | 14 #include "media/mojo/interfaces/demuxer_stream.mojom.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 14 | 16 |
| 15 namespace media { | 17 namespace media { |
| 18 |
| 16 class DemuxerStream; | 19 class DemuxerStream; |
| 20 class MojoDecoderBufferWriter; |
| 17 | 21 |
| 18 // This class wraps a media::DemuxerStream and exposes it as a | 22 // This class wraps a media::DemuxerStream and exposes it as a |
| 19 // mojom::DemuxerStream for use as a proxy from remote applications. | 23 // mojom::DemuxerStream for use as a proxy from remote applications. |
| 20 class MojoDemuxerStreamImpl : public mojom::DemuxerStream { | 24 class MojoDemuxerStreamImpl : public mojom::DemuxerStream { |
| 21 public: | 25 public: |
| 22 // |stream| is the underlying DemuxerStream we are proxying for. | 26 // |stream| is the underlying DemuxerStream we are proxying for. |
| 23 // Note: |this| does not take ownership of |stream|. | 27 // Note: |this| does not take ownership of |stream|. |
| 24 MojoDemuxerStreamImpl(media::DemuxerStream* stream, | 28 MojoDemuxerStreamImpl(media::DemuxerStream* stream, |
| 25 mojo::InterfaceRequest<mojom::DemuxerStream> request); | 29 mojo::InterfaceRequest<mojom::DemuxerStream> request); |
| 26 ~MojoDemuxerStreamImpl() override; | 30 ~MojoDemuxerStreamImpl() override; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 41 private: | 45 private: |
| 42 void OnBufferReady(const ReadCallback& callback, | 46 void OnBufferReady(const ReadCallback& callback, |
| 43 media::DemuxerStream::Status status, | 47 media::DemuxerStream::Status status, |
| 44 const scoped_refptr<media::DecoderBuffer>& buffer); | 48 const scoped_refptr<media::DecoderBuffer>& buffer); |
| 45 | 49 |
| 46 mojo::Binding<mojom::DemuxerStream> binding_; | 50 mojo::Binding<mojom::DemuxerStream> binding_; |
| 47 | 51 |
| 48 // See constructor. We do not own |stream_|. | 52 // See constructor. We do not own |stream_|. |
| 49 media::DemuxerStream* stream_; | 53 media::DemuxerStream* stream_; |
| 50 | 54 |
| 51 // DataPipe for serializing the data section of DecoderBuffer into. | 55 std::unique_ptr<MojoDecoderBufferWriter> mojo_decoder_buffer_writer_; |
| 52 mojo::ScopedDataPipeProducerHandle stream_pipe_; | |
| 53 | 56 |
| 54 base::WeakPtrFactory<MojoDemuxerStreamImpl> weak_factory_; | 57 base::WeakPtrFactory<MojoDemuxerStreamImpl> weak_factory_; |
| 55 DISALLOW_COPY_AND_ASSIGN(MojoDemuxerStreamImpl); | 58 DISALLOW_COPY_AND_ASSIGN(MojoDemuxerStreamImpl); |
| 56 }; | 59 }; |
| 57 | 60 |
| 58 } // namespace media | 61 } // namespace media |
| 59 | 62 |
| 60 #endif // MEDIA_MOJO_CLIENTS_MOJO_DEMUXER_STREAM_IMPL_H_ | 63 #endif // MEDIA_MOJO_CLIENTS_MOJO_DEMUXER_STREAM_IMPL_H_ |
| OLD | NEW |