Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: media/mojo/services/mojo_demuxer_stream_adapter.h

Issue 1977173002: Rename media::interfaces to media::mojom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_ 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_ 6 #define MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "media/base/audio_decoder_config.h" 12 #include "media/base/audio_decoder_config.h"
13 #include "media/base/demuxer_stream.h" 13 #include "media/base/demuxer_stream.h"
14 #include "media/base/video_decoder_config.h" 14 #include "media/base/video_decoder_config.h"
15 #include "media/mojo/interfaces/demuxer_stream.mojom.h" 15 #include "media/mojo/interfaces/demuxer_stream.mojom.h"
16 16
17 namespace media { 17 namespace media {
18 18
19 // This class acts as a MojoRendererService-side stub for a real DemuxerStream 19 // This class acts as a MojoRendererService-side stub for a real DemuxerStream
20 // that is part of a Pipeline in a remote application. Roughly speaking, it 20 // that is part of a Pipeline in a remote application. Roughly speaking, it
21 // takes a interfaces::DemuxerStreamPtr and exposes it as a DemuxerStream for 21 // takes a mojom::DemuxerStreamPtr and exposes it as a DemuxerStream for
22 // use by 22 // use by
23 // media components. 23 // media components.
24 class MojoDemuxerStreamAdapter : public DemuxerStream { 24 class MojoDemuxerStreamAdapter : public DemuxerStream {
25 public: 25 public:
26 // |demuxer_stream| is connected to the interfaces::DemuxerStream that |this| 26 // |demuxer_stream| is connected to the mojom::DemuxerStream that |this|
27 // will 27 // will
28 // become the client of. 28 // become the client of.
29 // |stream_ready_cb| will be invoked when |demuxer_stream| has fully 29 // |stream_ready_cb| will be invoked when |demuxer_stream| has fully
30 // initialized and |this| is ready for use. 30 // initialized and |this| is ready for use.
31 // NOTE: Illegal to call any methods until |stream_ready_cb| is invoked. 31 // NOTE: Illegal to call any methods until |stream_ready_cb| is invoked.
32 MojoDemuxerStreamAdapter(interfaces::DemuxerStreamPtr demuxer_stream, 32 MojoDemuxerStreamAdapter(mojom::DemuxerStreamPtr demuxer_stream,
33 const base::Closure& stream_ready_cb); 33 const base::Closure& stream_ready_cb);
34 ~MojoDemuxerStreamAdapter() override; 34 ~MojoDemuxerStreamAdapter() override;
35 35
36 // DemuxerStream implementation. 36 // DemuxerStream implementation.
37 void Read(const ReadCB& read_cb) override; 37 void Read(const ReadCB& read_cb) override;
38 AudioDecoderConfig audio_decoder_config() override; 38 AudioDecoderConfig audio_decoder_config() override;
39 VideoDecoderConfig video_decoder_config() override; 39 VideoDecoderConfig video_decoder_config() override;
40 Type type() const override; 40 Type type() const override;
41 void EnableBitstreamConverter() override; 41 void EnableBitstreamConverter() override;
42 bool SupportsConfigChanges() override; 42 bool SupportsConfigChanges() override;
43 VideoRotation video_rotation() override; 43 VideoRotation video_rotation() override;
44 44
45 private: 45 private:
46 void OnStreamReady(interfaces::DemuxerStream::Type type, 46 void OnStreamReady(mojom::DemuxerStream::Type type,
47 mojo::ScopedDataPipeConsumerHandle pipe, 47 mojo::ScopedDataPipeConsumerHandle pipe,
48 interfaces::AudioDecoderConfigPtr audio_config, 48 mojom::AudioDecoderConfigPtr audio_config,
49 interfaces::VideoDecoderConfigPtr video_config); 49 mojom::VideoDecoderConfigPtr video_config);
50 50
51 // The callback from |demuxer_stream_| that a read operation has completed. 51 // The callback from |demuxer_stream_| that a read operation has completed.
52 // |read_cb| is a callback from the client who invoked Read() on |this|. 52 // |read_cb| is a callback from the client who invoked Read() on |this|.
53 void OnBufferReady(interfaces::DemuxerStream::Status status, 53 void OnBufferReady(mojom::DemuxerStream::Status status,
54 interfaces::DecoderBufferPtr buffer, 54 mojom::DecoderBufferPtr buffer,
55 interfaces::AudioDecoderConfigPtr audio_config, 55 mojom::AudioDecoderConfigPtr audio_config,
56 interfaces::VideoDecoderConfigPtr video_config); 56 mojom::VideoDecoderConfigPtr video_config);
57 57
58 void UpdateConfig(interfaces::AudioDecoderConfigPtr audio_config, 58 void UpdateConfig(mojom::AudioDecoderConfigPtr audio_config,
59 interfaces::VideoDecoderConfigPtr video_config); 59 mojom::VideoDecoderConfigPtr video_config);
60 60
61 // See constructor for descriptions. 61 // See constructor for descriptions.
62 interfaces::DemuxerStreamPtr demuxer_stream_; 62 mojom::DemuxerStreamPtr demuxer_stream_;
63 base::Closure stream_ready_cb_; 63 base::Closure stream_ready_cb_;
64 64
65 // The last ReadCB received through a call to Read(). 65 // The last ReadCB received through a call to Read().
66 // Used to store the results of OnBufferReady() in the event it is called 66 // Used to store the results of OnBufferReady() in the event it is called
67 // with DemuxerStream::Status::kConfigChanged and we don't have an up to 67 // with DemuxerStream::Status::kConfigChanged and we don't have an up to
68 // date AudioDecoderConfig yet. In that case we can't forward the results 68 // date AudioDecoderConfig yet. In that case we can't forward the results
69 // on to the caller of Read() until OnAudioDecoderConfigChanged is observed. 69 // on to the caller of Read() until OnAudioDecoderConfigChanged is observed.
70 DemuxerStream::ReadCB read_cb_; 70 DemuxerStream::ReadCB read_cb_;
71 71
72 // The current config. 72 // The current config.
73 AudioDecoderConfig audio_config_; 73 AudioDecoderConfig audio_config_;
74 VideoDecoderConfig video_config_; 74 VideoDecoderConfig video_config_;
75 75
76 DemuxerStream::Type type_; 76 DemuxerStream::Type type_;
77 77
78 // DataPipe for deserializing the data section of DecoderBuffers from. 78 // DataPipe for deserializing the data section of DecoderBuffers from.
79 mojo::ScopedDataPipeConsumerHandle stream_pipe_; 79 mojo::ScopedDataPipeConsumerHandle stream_pipe_;
80 80
81 base::WeakPtrFactory<MojoDemuxerStreamAdapter> weak_factory_; 81 base::WeakPtrFactory<MojoDemuxerStreamAdapter> weak_factory_;
82 DISALLOW_COPY_AND_ASSIGN(MojoDemuxerStreamAdapter); 82 DISALLOW_COPY_AND_ASSIGN(MojoDemuxerStreamAdapter);
83 }; 83 };
84 84
85 } // namespace media 85 } // namespace media
86 86
87 #endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_ 87 #endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698