Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_IMPL_H_ | |
| 6 #define MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_IMPL_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "media/base/demuxer_stream.h" | |
| 11 #include "media/mojo/interfaces/demuxer_stream.mojom.h" | |
| 12 #include "mojo/public/cpp/bindings/interface_impl.h" | |
| 13 | |
| 14 namespace media { | |
| 15 class DemuxerStream; | |
| 16 | |
| 17 // This class wraps a media::DemuxerStream and exposes it as a | |
| 18 // mojo::DemuxerStream for use as a proxy from remote applications. | |
| 19 class MojoDemuxerStreamImpl : public mojo::InterfaceImpl<mojo::DemuxerStream> { | |
| 20 public: | |
| 21 // |stream| is the underlying DemuxerStream we are proxying for. | |
| 22 // Note: |this| does not take ownership of |stream|. | |
| 23 explicit MojoDemuxerStreamImpl(media::DemuxerStream* stream); | |
| 24 virtual ~MojoDemuxerStreamImpl(); | |
| 25 | |
| 26 // mojo::DemuxerStream implementation. | |
| 27 virtual void Read(const mojo::Callback<void( | |
| 28 mojo::DemuxerStream::Status, | |
| 29 mojo::MediaDecoderBufferPtr)>& callback) OVERRIDE; | |
| 30 | |
| 31 // mojo::InterfaceImpl overrides. | |
| 32 virtual void OnConnectionEstablished() OVERRIDE; | |
| 33 | |
| 34 private: | |
| 35 // |callback| is the callback that was passed to the initiating Read() | |
| 36 // call by our client. | |
| 37 // |status| and |buffer| are the standard media::ReadCB parameters. | |
| 38 void OnBufferReady( | |
| 39 mojo::Callback<void(mojo::DemuxerStream::Status, | |
| 40 mojo::MediaDecoderBufferPtr)> callback, | |
|
xhwang
2014/09/10 00:00:52
nit: typedef this callback?
tim (not reviewing)
2014/09/10 23:08:29
OK, although it feels weird to use the typedef in
xhwang
2014/09/15 04:57:28
Yeah.. it's a pretty long callback, may just be ty
tim (not reviewing)
2014/09/15 21:52:51
Done.
| |
| 41 media::DemuxerStream::Status status, | |
|
scherkus (not reviewing)
2014/09/09 20:35:32
remove media:: here and everywhere else
(80 chara
tim (not reviewing)
2014/09/10 23:08:29
Well... there's media::DemuxerStream and mojo::Dem
| |
| 42 const scoped_refptr<media::DecoderBuffer>& buffer); | |
| 43 | |
| 44 // See constructor. We do not own |stream_|. | |
| 45 media::DemuxerStream* stream_; | |
| 46 | |
| 47 base::WeakPtrFactory<MojoDemuxerStreamImpl> weak_factory_; | |
| 48 DISALLOW_COPY_AND_ASSIGN(MojoDemuxerStreamImpl); | |
| 49 }; | |
| 50 | |
| 51 } // namespace media | |
| 52 | |
| 53 #endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_IMPL_H_ | |
| OLD | NEW |