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

Unified Diff: media/mojo/services/mojo_video_decoder_service.h

Issue 1899363002: Finish plumbing MojoVideoDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows needs some more headers, apaprently. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/mojo/services/mojo_video_decoder.cc ('k') | media/mojo/services/mojo_video_decoder_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/mojo_video_decoder_service.h
diff --git a/media/mojo/services/mojo_video_decoder_service.h b/media/mojo/services/mojo_video_decoder_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..7101a372b8b47232a86658e0b8a3a2a08dd716c1
--- /dev/null
+++ b/media/mojo/services/mojo_video_decoder_service.h
@@ -0,0 +1,62 @@
+// Copyright 2016 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_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_
+#define MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "media/base/decode_status.h"
+#include "media/mojo/interfaces/video_decoder.mojom.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/public/cpp/system/data_pipe.h"
+
+namespace media {
+
+class MojoMediaClient;
+class VideoDecoder;
+class VideoFrame;
+
+// Implementation of a mojom::VideoDecoder which runs in the GPU process,
+// and wraps a media::VideoDecoder.
+class MojoVideoDecoderService : public mojom::VideoDecoder {
+ public:
+ MojoVideoDecoderService(mojo::InterfaceRequest<mojom::VideoDecoder> request,
+ MojoMediaClient* mojo_media_client);
+ ~MojoVideoDecoderService() final;
+
+ // mojom::VideoDecoder implementation
+ void Construct(mojom::VideoDecoderClientPtr client,
+ mojo::ScopedDataPipeConsumerHandle decoder_buffer_pipe) final;
+ void Initialize(mojom::VideoDecoderConfigPtr config,
+ bool low_delay,
+ const InitializeCallback& callback) final;
+ void Decode(mojom::DecoderBufferPtr buffer,
+ const DecodeCallback& callback) final;
+ void Reset(const ResetCallback& callback) final;
+
+ private:
+ void OnDecoderInitialized(const InitializeCallback& callback, bool success);
+ void OnDecoderDecoded(const DecodeCallback& callback, DecodeStatus status);
+ void OnDecoderOutput(const scoped_refptr<VideoFrame>& frame);
+ void OnDecoderReset(const ResetCallback& callback);
+
+ mojo::StrongBinding<mojom::VideoDecoder> binding_;
+ mojom::VideoDecoderClientPtr client_;
+ mojo::ScopedDataPipeConsumerHandle decoder_buffer_pipe_;
+
+ MojoMediaClient* mojo_media_client_;
+ std::unique_ptr<media::VideoDecoder> decoder_;
+
+ base::WeakPtr<MojoVideoDecoderService> weak_this_;
+ base::WeakPtrFactory<MojoVideoDecoderService> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoderService);
+};
+
+} // namespace media
+
+#endif // MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_
« no previous file with comments | « media/mojo/services/mojo_video_decoder.cc ('k') | media/mojo/services/mojo_video_decoder_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698