| Index: media/mojo/clients/mojo_demuxer.h
|
| diff --git a/media/mojo/clients/mojo_demuxer.h b/media/mojo/clients/mojo_demuxer.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7dd59a3602e4c925c84a2e4732a8b17e72c15b32
|
| --- /dev/null
|
| +++ b/media/mojo/clients/mojo_demuxer.h
|
| @@ -0,0 +1,99 @@
|
| +// Copyright (c) 2017 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_CLIENTS_MOJO_DEMUXER_H_
|
| +#define MEDIA_MOJO_CLIENTS_MOJO_DEMUXER_H_
|
| +
|
| +#include "media/base/demuxer.h"
|
| +#include "media/base/demuxer_stream.h"
|
| +#include "media/mojo/interfaces/demuxer.mojom.h"
|
| +#include "mojo/public/cpp/bindings/associated_binding.h"
|
| +
|
| +namespace media {
|
| +
|
| +class DataSource;
|
| +class MojoDataSourceImpl;
|
| +
|
| +class MojoDemuxer : public Demuxer, public mojom::DemuxerClient {
|
| + public:
|
| + MojoDemuxer(
|
| + int32_t remote_id,
|
| + Demuxer::LoadType load_type,
|
| + DataSource* data_source,
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
|
| + mojom::DemuxerPtr mojo_demuxer,
|
| + const base::Closure& open_cb,
|
| + const Demuxer::EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
|
| + const Demuxer::MediaTracksUpdatedCB& media_tracks_updated_cb);
|
| + ~MojoDemuxer() override;
|
| +
|
| + // MediaResource interface.
|
| + DemuxerStream* GetStream(DemuxerStream::Type type) override;
|
| + MediaResource::Type GetType() const override;
|
| +
|
| + // Demuxer interface.
|
| + std::string GetDisplayName() const override;
|
| + void Initialize(DemuxerHost* host,
|
| + const PipelineStatusCB& status_cb,
|
| + bool enable_text_tracks) override;
|
| + void StartWaitingForSeek(base::TimeDelta seek_time) override;
|
| + void CancelPendingSeek(base::TimeDelta seek_time) override;
|
| + void Seek(base::TimeDelta time, const PipelineStatusCB& status_cb) override;
|
| + void Stop() override;
|
| + void AbortPendingReads() override;
|
| + base::TimeDelta GetStartTime() const override;
|
| + base::Time GetTimelineOffset() const override;
|
| + int64_t GetMemoryUsage() const override;
|
| + void OnEnabledAudioTracksChanged(const std::vector<MediaTrack::Id>& track_ids,
|
| + base::TimeDelta current_time) override;
|
| + void OnSelectedVideoTrackChanged(const std::vector<MediaTrack::Id>& track_ids,
|
| + base::TimeDelta current_time) override;
|
| +
|
| + // mojom::DemuxerClient implementation.
|
| + void OnEncryptedMediaInitData(EmeInitDataType init_data_type,
|
| + const std::vector<uint8_t>& init_data) final;
|
| + void OnMediaTracksUpdated(mojom::MediaTracksPtr mojo_tracks) final;
|
| + void OnBufferedTimeRangesChanged(mojom::RangesTimeDeltaPtr mojo_ranges) final;
|
| + void OnSetDuration(base::TimeDelta duration) final;
|
| + void OnDemuxerError(PipelineStatus error) final;
|
| +
|
| + protected:
|
| + scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
|
| +
|
| + private:
|
| + void OnDataSourceConnectionError();
|
| + void OnInitialized(bool success);
|
| + void OnSeek(const PipelineStatusCB& status_cb, PipelineStatus status);
|
| + void OnConnectionError();
|
| +
|
| + Demuxer::LoadType load_type_;
|
| +
|
| + std::unique_ptr<MojoDataSourceImpl> mojo_data_source_;
|
| + DataSource* data_source_;
|
| +
|
| + base::Closure open_cb_;
|
| + Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_;
|
| + Demuxer::MediaTracksUpdatedCB media_tracks_updated_cb_;
|
| + PipelineStatusCB status_cb_;
|
| +
|
| + DemuxerHost* host_;
|
| +
|
| + // This class is constructed on one thread and used exclusively on another
|
| + // thread. This member is used to safely pass the DemuxerPtr from one thread
|
| + // to another. It is set in the constructor and is consumed in Initialize().
|
| + mojom::DemuxerPtrInfo remote_demuxer_info_;
|
| +
|
| + mojom::DemuxerPtr remote_demuxer_;
|
| +
|
| + // Binding for DemuxerClient, bound to the |media_task_runner_|.
|
| + mojo::AssociatedBinding<DemuxerClient> client_binding_;
|
| +
|
| + base::WeakPtrFactory<MojoDemuxer> weak_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MojoDemuxer);
|
| +};
|
| +
|
| +} // namespace media
|
| +
|
| +#endif // MEDIA_MOJO_CLIENTS_MOJO_DEMUXER_H_
|
|
|