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

Side by Side Diff: content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h

Issue 2361173002: Move classses VideoCaptureDeviceClient and VideoCaptureBufferPool to media/capture/video (Closed)
Patch Set: mcasas@ comments Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_GPU_JPEG_DECODER_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_GPU_JPEG_DECODER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_GPU_JPEG_DECODER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_GPU_JPEG_DECODER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/threading/thread.h" 19 #include "base/threading/thread.h"
20 #include "content/common/content_export.h" 20 #include "content/common/content_export.h"
21 #include "media/capture/video/video_capture_device.h" 21 #include "media/capture/video/video_capture_jpeg_decoder.h"
22 #include "media/video/jpeg_decode_accelerator.h" 22 #include "media/video/jpeg_decode_accelerator.h"
23 23
24 namespace gpu { 24 namespace gpu {
25 class GpuChannelHost; 25 class GpuChannelHost;
26 } 26 }
27 27
28 namespace media { 28 namespace media {
29 class VideoFrame; 29 class VideoFrame;
30 } 30 }
31 31
32 namespace content { 32 namespace content {
33 33
34 class CONTENT_EXPORT VideoCaptureJpegDecoder {
35 public:
36 // Enumeration of decoder status. The enumeration is published for clients to
37 // decide the behavior according to STATUS.
38 enum STATUS {
39 INIT_PENDING, // Default value while waiting initialization finished.
40 INIT_PASSED, // Initialization succeed.
41 FAILED, // JPEG decode is not supported, initialization failed, or
42 // decode error.
43 };
44
45 using DecodeDoneCB = base::Callback<void(
46 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer>,
47 const scoped_refptr<media::VideoFrame>&)>;
48
49 virtual ~VideoCaptureJpegDecoder() {}
50
51 // Creates and intializes decoder asynchronously.
52 virtual void Initialize() = 0;
53
54 // Returns initialization status.
55 virtual STATUS GetStatus() const = 0;
56
57 // Decodes a JPEG picture.
58 virtual void DecodeCapturedData(
59 const uint8_t* data,
60 size_t in_buffer_size,
61 const media::VideoCaptureFormat& frame_format,
62 base::TimeTicks reference_time,
63 base::TimeDelta timestamp,
64 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer>
65 out_buffer) = 0;
66 };
67
68 // Adapter to GpuJpegDecodeAccelerator for VideoCaptureDevice::Client. It takes 34 // Adapter to GpuJpegDecodeAccelerator for VideoCaptureDevice::Client. It takes
69 // care of GpuJpegDecodeAccelerator creation, shared memory, and threading 35 // care of GpuJpegDecodeAccelerator creation, shared memory, and threading
70 // issues. 36 // issues.
71 // 37 //
72 // All public methods except JpegDecodeAccelerator::Client ones should be called 38 // All public methods except JpegDecodeAccelerator::Client ones should be called
73 // on the same thread. JpegDecodeAccelerator::Client methods should be called on 39 // on the same thread. JpegDecodeAccelerator::Client methods should be called on
74 // the IO thread. 40 // the IO thread.
75 class CONTENT_EXPORT VideoCaptureGpuJpegDecoder 41 class CONTENT_EXPORT VideoCaptureGpuJpegDecoder
76 : public VideoCaptureJpegDecoder, 42 : public media::VideoCaptureJpegDecoder,
77 public media::JpegDecodeAccelerator::Client, 43 public media::JpegDecodeAccelerator::Client,
78 public base::NonThreadSafe, 44 public base::NonThreadSafe,
79 public base::SupportsWeakPtr<VideoCaptureGpuJpegDecoder> { 45 public base::SupportsWeakPtr<VideoCaptureGpuJpegDecoder> {
80 public: 46 public:
81 // |decode_done_cb| is called on the IO thread when decode succeed. This can 47 // |decode_done_cb| is called on the IO thread when decode succeed. This can
82 // be on any thread. |decode_done_cb| is never called after 48 // be on any thread. |decode_done_cb| is never called after
83 // VideoCaptureGpuJpegDecoder is destroyed. 49 // VideoCaptureGpuJpegDecoder is destroyed.
84 explicit VideoCaptureGpuJpegDecoder(const DecodeDoneCB& decode_done_cb); 50 explicit VideoCaptureGpuJpegDecoder(const DecodeDoneCB& decode_done_cb);
85 ~VideoCaptureGpuJpegDecoder() override; 51 ~VideoCaptureGpuJpegDecoder() override;
86 52
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 std::unique_ptr<base::SharedMemory> in_shared_memory_; 113 std::unique_ptr<base::SharedMemory> in_shared_memory_;
148 114
149 STATUS decoder_status_; 115 STATUS decoder_status_;
150 116
151 DISALLOW_COPY_AND_ASSIGN(VideoCaptureGpuJpegDecoder); 117 DISALLOW_COPY_AND_ASSIGN(VideoCaptureGpuJpegDecoder);
152 }; 118 };
153 119
154 } // namespace content 120 } // namespace content
155 121
156 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_GPU_JPEG_DECODER_H_ 122 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_GPU_JPEG_DECODER_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_device_client_unittest.cc ('k') | media/capture/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698