| 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_H_ |
| 6 #define MEDIA_MOJO_SERVICES_MOJO_DEMUXER_SERVICE_H_ |
| 7 |
| 8 #include "media/base/demuxer.h" |
| 9 #include "media/mojo/interfaces/data_source.mojom.h" |
| 10 #include "media/mojo/interfaces/demuxer.mojom.h" |
| 11 #include "media/mojo/services/media_mojo_export.h" |
| 12 #include "media/mojo/services/mojo_demuxer_service_context.h" |
| 13 |
| 14 namespace media { |
| 15 |
| 16 class DataSource; |
| 17 class DemuxerFactory; |
| 18 class MediaTracks; |
| 19 class SourceBuffer; |
| 20 |
| 21 // A mojom::Demuxer implementation backed by a |
| 22 // media::Demuxer. |
| 23 class MEDIA_MOJO_EXPORT MojoDemuxerService |
| 24 : public DemuxerHost, |
| 25 NON_EXPORTED_BASE(public mojom::Demuxer) { |
| 26 public: |
| 27 MojoDemuxerService(base::WeakPtr<MojoDemuxerServiceContext> context, |
| 28 DemuxerFactory* demuxer_factory); |
| 29 |
| 30 ~MojoDemuxerService() final; |
| 31 |
| 32 media::Demuxer* GetDemuxerSourceBuffer( |
| 33 media::SourceBuffer** source_buffer_out); |
| 34 media::Demuxer* GetDemuxer(const PipelineStatusCB& demuxer_init_cb); |
| 35 |
| 36 void OnEncryptedMediaInitData(EmeInitDataType init_data_type, |
| 37 const std::vector<uint8_t>& init_data); |
| 38 void OnMediaTracksUpdated(std::unique_ptr<MediaTracks> tracks); |
| 39 |
| 40 // DemuxHost implementation. |
| 41 void OnBufferedTimeRangesChanged(const Ranges<base::TimeDelta>& ranges) final; |
| 42 void SetDuration(base::TimeDelta duration) final; |
| 43 void OnDemuxerError(PipelineStatus error) final; |
| 44 void AddTextStream(DemuxerStream* text_stream, |
| 45 const TextTrackConfig& config) final; |
| 46 void RemoveTextStream(DemuxerStream* text_stream) final; |
| 47 |
| 48 // mojom::Demuxer implementation. |
| 49 void Initialize(mojom::DemuxerClientAssociatedPtrInfo client, |
| 50 int32_t demuxer_id, |
| 51 media::Demuxer::LoadType load_type, |
| 52 mojom::DataSourcePtr mojo_data_source, |
| 53 const InitializeCallback& callback) final; |
| 54 void StartWaitingForSeek(base::TimeDelta seek_time) final; |
| 55 void CancelPendingSeek(base::TimeDelta seek_time) final; |
| 56 void Seek(base::TimeDelta time, const SeekCallback& callback) final; |
| 57 void Stop() final; |
| 58 void AbortPendingReads() final; |
| 59 void GetStartTime(const GetStartTimeCallback& callback) final; |
| 60 void GetTimelineOffset(const GetTimelineOffsetCallback& callback) final; |
| 61 void GetMemoryUsage(const GetMemoryUsageCallback& callback) final; |
| 62 void OnEnabledAudioTracksChanged(const std::vector<MediaTrack::Id>& track_ids, |
| 63 base::TimeDelta current_time) final; |
| 64 void OnSelectedVideoTrackChanged(const std::vector<MediaTrack::Id>& track_ids, |
| 65 base::TimeDelta current_time) final; |
| 66 |
| 67 private: |
| 68 void OnDataSourceReady(const InitializeCallback& callback); |
| 69 |
| 70 void OnDemuxerInitialized(PipelineStatus status); |
| 71 |
| 72 void OnSeek(const SeekCallback& callback, PipelineStatus status); |
| 73 |
| 74 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 75 |
| 76 base::WeakPtr<MojoDemuxerServiceContext> context_; |
| 77 DemuxerFactory* demuxer_factory_; |
| 78 |
| 79 mojom::DemuxerClientAssociatedPtr client_; |
| 80 |
| 81 std::unique_ptr<media::DataSource> data_source_; |
| 82 |
| 83 int32_t demuxer_id_; |
| 84 std::unique_ptr<media::Demuxer> demuxer_; |
| 85 media::SourceBuffer* source_buffer_; |
| 86 |
| 87 PipelineStatusCB demuxer_init_cb_; |
| 88 |
| 89 base::WeakPtrFactory<MojoDemuxerService> weak_factory_; |
| 90 }; |
| 91 |
| 92 } // namespace media |
| 93 |
| 94 #endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_SERVICE_H_ |
| OLD | NEW |