| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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_SERVICE_CONTEXT_H_ |
| 6 #define MEDIA_MOJO_SERVICES_MOJO_DEMUXER_SERVICE_CONTEXT_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "media/base/pipeline.h" |
| 12 #include "media/mojo/services/media_mojo_export.h" |
| 13 |
| 14 namespace media { |
| 15 |
| 16 class Demuxer; |
| 17 class MojoDemuxerService; |
| 18 class SourceBuffer; |
| 19 |
| 20 // A class that creates, owns and manages all MojoDemuxerService instances. |
| 21 class MEDIA_MOJO_EXPORT MojoDemuxerServiceContext { |
| 22 public: |
| 23 MojoDemuxerServiceContext(); |
| 24 ~MojoDemuxerServiceContext(); |
| 25 |
| 26 base::WeakPtr<MojoDemuxerServiceContext> GetWeakPtr(); |
| 27 |
| 28 // Registers The |demuxer_service| with |demuxer_id|. |
| 29 void RegisterDemuxer(int demuxer_id, MojoDemuxerService* demuxer_service); |
| 30 |
| 31 // Unregisters the Demuxer. Must be called before the Demuxer is destroyed. |
| 32 void UnregisterDemuxer(int demuxer_id); |
| 33 |
| 34 // Returns the Demuxer associated with |demuxer_id|. |
| 35 Demuxer* GetDemuxer(int demuxer_id, const PipelineStatusCB& demuxer_init_cb); |
| 36 |
| 37 media::Demuxer* GetDemuxerSourceBuffer( |
| 38 int demuxer_id, |
| 39 media::SourceBuffer** source_buffer_out); |
| 40 |
| 41 private: |
| 42 // A map between Demuxer ID and MojoDemuxerService. |
| 43 std::map<int, MojoDemuxerService*> demuxer_services_; |
| 44 |
| 45 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 46 base::WeakPtrFactory<MojoDemuxerServiceContext> weak_ptr_factory_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(MojoDemuxerServiceContext); |
| 49 }; |
| 50 |
| 51 } // namespace media |
| 52 |
| 53 #endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_SERVICE_CONTEXT_H_ |
| OLD | NEW |