OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 MEDIA_BASE_VIDEO_FRAME_H_ | 5 #ifndef MEDIA_BASE_VIDEO_FRAME_H_ |
6 #define MEDIA_BASE_VIDEO_FRAME_H_ | 6 #define MEDIA_BASE_VIDEO_FRAME_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
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/md5.h" | 16 #include "base/md5.h" |
17 #include "base/memory/shared_memory.h" | 17 #include "base/memory/shared_memory.h" |
| 18 #include "base/supports_user_data.h" |
18 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
20 #include "gpu/command_buffer/common/mailbox_holder.h" | 21 #include "gpu/command_buffer/common/mailbox_holder.h" |
21 #include "media/base/video_frame_metadata.h" | 22 #include "media/base/video_frame_metadata.h" |
22 #include "media/base/video_types.h" | 23 #include "media/base/video_types.h" |
23 #include "ui/gfx/geometry/rect.h" | 24 #include "ui/gfx/geometry/rect.h" |
24 #include "ui/gfx/geometry/size.h" | 25 #include "ui/gfx/geometry/size.h" |
25 #include "ui/gfx/gpu_memory_buffer.h" | 26 #include "ui/gfx/gpu_memory_buffer.h" |
26 | 27 |
27 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
28 #include <CoreVideo/CVPixelBuffer.h> | 29 #include <CoreVideo/CVPixelBuffer.h> |
29 #include "base/mac/scoped_cftyperef.h" | 30 #include "base/mac/scoped_cftyperef.h" |
30 #endif | 31 #endif |
31 | 32 |
32 namespace media { | 33 namespace media { |
33 | 34 |
34 class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { | 35 class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame>, |
| 36 public base::SupportsUserData { |
35 public: | 37 public: |
36 enum { | 38 enum { |
37 kFrameSizeAlignment = 16, | 39 kFrameSizeAlignment = 16, |
38 kFrameSizePadding = 16, | 40 kFrameSizePadding = 16, |
39 kFrameAddressAlignment = 32 | 41 kFrameAddressAlignment = 32 |
40 }; | 42 }; |
41 | 43 |
42 enum { | 44 enum { |
43 kMaxPlanes = 4, | 45 kMaxPlanes = 4, |
44 | 46 |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 base::SharedMemoryHandle handle, | 446 base::SharedMemoryHandle handle, |
445 size_t shared_memory_offset); | 447 size_t shared_memory_offset); |
446 VideoFrame(VideoPixelFormat format, | 448 VideoFrame(VideoPixelFormat format, |
447 StorageType storage_type, | 449 StorageType storage_type, |
448 const gfx::Size& coded_size, | 450 const gfx::Size& coded_size, |
449 const gfx::Rect& visible_rect, | 451 const gfx::Rect& visible_rect, |
450 const gfx::Size& natural_size, | 452 const gfx::Size& natural_size, |
451 const gpu::MailboxHolder(&mailbox_holders)[kMaxPlanes], | 453 const gpu::MailboxHolder(&mailbox_holders)[kMaxPlanes], |
452 const ReleaseMailboxCB& mailbox_holder_release_cb, | 454 const ReleaseMailboxCB& mailbox_holder_release_cb, |
453 base::TimeDelta timestamp); | 455 base::TimeDelta timestamp); |
454 virtual ~VideoFrame(); | 456 ~VideoFrame() override; |
455 | 457 |
456 static scoped_refptr<VideoFrame> CreateFrameInternal( | 458 static scoped_refptr<VideoFrame> CreateFrameInternal( |
457 VideoPixelFormat format, | 459 VideoPixelFormat format, |
458 const gfx::Size& coded_size, | 460 const gfx::Size& coded_size, |
459 const gfx::Rect& visible_rect, | 461 const gfx::Rect& visible_rect, |
460 const gfx::Size& natural_size, | 462 const gfx::Size& natural_size, |
461 base::TimeDelta timestamp, | 463 base::TimeDelta timestamp, |
462 bool zero_initialize_memory); | 464 bool zero_initialize_memory); |
463 | 465 |
464 void AllocateYUV(bool zero_initialize_memory); | 466 void AllocateYUV(bool zero_initialize_memory); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 gpu::SyncToken release_sync_token_; | 527 gpu::SyncToken release_sync_token_; |
526 | 528 |
527 VideoFrameMetadata metadata_; | 529 VideoFrameMetadata metadata_; |
528 | 530 |
529 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 531 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
530 }; | 532 }; |
531 | 533 |
532 } // namespace media | 534 } // namespace media |
533 | 535 |
534 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 536 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |