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_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 <memory> | 8 #include <memory> |
9 #include <queue> | 9 #include <queue> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 VideoDecoderConfig video_decoder_config() override; | 42 VideoDecoderConfig video_decoder_config() override; |
43 Type type() const override; | 43 Type type() const override; |
44 void EnableBitstreamConverter() override; | 44 void EnableBitstreamConverter() override; |
45 bool SupportsConfigChanges() override; | 45 bool SupportsConfigChanges() override; |
46 VideoRotation video_rotation() override; | 46 VideoRotation video_rotation() override; |
47 bool enabled() const override; | 47 bool enabled() const override; |
48 void set_enabled(bool enabled, base::TimeDelta timestamp) override; | 48 void set_enabled(bool enabled, base::TimeDelta timestamp) override; |
49 void SetStreamStatusChangeCB(const StreamStatusChangeCB& cb) override; | 49 void SetStreamStatusChangeCB(const StreamStatusChangeCB& cb) override; |
50 | 50 |
51 private: | 51 private: |
52 void OnStreamReady(mojom::DemuxerStream::Type type, | 52 void OnStreamReady(Type type, |
53 mojo::ScopedDataPipeConsumerHandle consumer_handle, | 53 mojo::ScopedDataPipeConsumerHandle consumer_handle, |
54 mojom::AudioDecoderConfigPtr audio_config, | 54 mojom::AudioDecoderConfigPtr audio_config, |
55 mojom::VideoDecoderConfigPtr video_config); | 55 mojom::VideoDecoderConfigPtr video_config); |
56 | 56 |
57 // The callback from |demuxer_stream_| that a read operation has completed. | 57 // The callback from |demuxer_stream_| that a read operation has completed. |
58 // |read_cb| is a callback from the client who invoked Read() on |this|. | 58 // |read_cb| is a callback from the client who invoked Read() on |this|. |
59 void OnBufferReady(mojom::DemuxerStream::Status status, | 59 void OnBufferReady(Status status, |
60 mojom::DecoderBufferPtr buffer, | 60 mojom::DecoderBufferPtr buffer, |
61 mojom::AudioDecoderConfigPtr audio_config, | 61 mojom::AudioDecoderConfigPtr audio_config, |
62 mojom::VideoDecoderConfigPtr video_config); | 62 mojom::VideoDecoderConfigPtr video_config); |
63 | 63 |
64 void UpdateConfig(mojom::AudioDecoderConfigPtr audio_config, | 64 void UpdateConfig(mojom::AudioDecoderConfigPtr audio_config, |
65 mojom::VideoDecoderConfigPtr video_config); | 65 mojom::VideoDecoderConfigPtr video_config); |
66 | 66 |
67 // See constructor for descriptions. | 67 // See constructor for descriptions. |
68 mojom::DemuxerStreamPtr demuxer_stream_; | 68 mojom::DemuxerStreamPtr demuxer_stream_; |
69 base::Closure stream_ready_cb_; | 69 base::Closure stream_ready_cb_; |
70 | 70 |
71 // The last ReadCB received through a call to Read(). | 71 // The last ReadCB received through a call to Read(). |
72 // Used to store the results of OnBufferReady() in the event it is called | 72 // Used to store the results of OnBufferReady() in the event it is called |
73 // with DemuxerStream::Status::kConfigChanged and we don't have an up to | 73 // with Status::kConfigChanged and we don't have an up to date |
74 // date AudioDecoderConfig yet. In that case we can't forward the results | 74 // AudioDecoderConfig yet. In that case we can't forward the results |
75 // on to the caller of Read() until OnAudioDecoderConfigChanged is observed. | 75 // on to the caller of Read() until OnAudioDecoderConfigChanged is observed. |
76 DemuxerStream::ReadCB read_cb_; | 76 ReadCB read_cb_; |
77 | 77 |
78 // The current config. | 78 // The current config. |
79 AudioDecoderConfig audio_config_; | 79 AudioDecoderConfig audio_config_; |
80 VideoDecoderConfig video_config_; | 80 VideoDecoderConfig video_config_; |
81 | 81 |
82 DemuxerStream::Type type_; | 82 Type type_; |
83 | 83 |
84 std::unique_ptr<MojoDecoderBufferReader> mojo_decoder_buffer_reader_; | 84 std::unique_ptr<MojoDecoderBufferReader> mojo_decoder_buffer_reader_; |
85 | 85 |
86 base::WeakPtrFactory<MojoDemuxerStreamAdapter> weak_factory_; | 86 base::WeakPtrFactory<MojoDemuxerStreamAdapter> weak_factory_; |
87 DISALLOW_COPY_AND_ASSIGN(MojoDemuxerStreamAdapter); | 87 DISALLOW_COPY_AND_ASSIGN(MojoDemuxerStreamAdapter); |
88 }; | 88 }; |
89 | 89 |
90 } // namespace media | 90 } // namespace media |
91 | 91 |
92 #endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_ | 92 #endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_ |
OLD | NEW |