Chromium Code Reviews| Index: media/mojo/services/mojo_demuxer_stream_impl.h |
| diff --git a/media/mojo/services/mojo_demuxer_stream_impl.h b/media/mojo/services/mojo_demuxer_stream_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8af74d0551d2c89d39ad1b08e00fb24a96e13f39 |
| --- /dev/null |
| +++ b/media/mojo/services/mojo_demuxer_stream_impl.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_IMPL_H_ |
| +#define MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_IMPL_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "media/base/demuxer_stream.h" |
| +#include "media/mojo/interfaces/demuxer_stream.mojom.h" |
| +#include "mojo/public/cpp/bindings/interface_impl.h" |
| + |
| +namespace media { |
| +class DemuxerStream; |
| + |
| +// This class wraps a media::DemuxerStream and exposes it as a |
| +// mojo::DemuxerStream for use as a proxy from remote applications. |
| +class MojoDemuxerStreamImpl : public mojo::InterfaceImpl<mojo::DemuxerStream> { |
| + public: |
| + // |stream| is the underlying DemuxerStream we are proxying for. |
| + // Note: |this| does not take ownership of |stream|. |
| + explicit MojoDemuxerStreamImpl(media::DemuxerStream* stream); |
| + virtual ~MojoDemuxerStreamImpl(); |
| + |
| + // mojo::DemuxerStream implementation. |
| + virtual void Read(const mojo::Callback<void( |
| + mojo::DemuxerStream::Status, |
| + mojo::MediaDecoderBufferPtr)>& callback) OVERRIDE; |
| + |
| + // mojo::InterfaceImpl overrides. |
| + virtual void OnConnectionEstablished() OVERRIDE; |
| + |
| + private: |
| + // |callback| is the callback that was passed to the initiating Read() |
| + // call by our client. |
| + // |status| and |buffer| are the standard media::ReadCB parameters. |
| + void OnBufferReady( |
| + mojo::Callback<void(mojo::DemuxerStream::Status, |
| + 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.
|
| + 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
|
| + const scoped_refptr<media::DecoderBuffer>& buffer); |
| + |
| + // See constructor. We do not own |stream_|. |
| + media::DemuxerStream* stream_; |
| + |
| + base::WeakPtrFactory<MojoDemuxerStreamImpl> weak_factory_; |
| + DISALLOW_COPY_AND_ASSIGN(MojoDemuxerStreamImpl); |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_IMPL_H_ |