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

Side by Side Diff: media/base/video_frame.h

Issue 1637793004: [WIP] Mojo Video Capture thingy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 (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
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // Only valid to call if this is a NATIVE_TEXTURE frame. Before using the 349 // Only valid to call if this is a NATIVE_TEXTURE frame. Before using the
350 // mailbox, the caller must wait for the included sync point. 350 // mailbox, the caller must wait for the included sync point.
351 const gpu::MailboxHolder& mailbox_holder(size_t texture_index) const; 351 const gpu::MailboxHolder& mailbox_holder(size_t texture_index) const;
352 352
353 // Returns the shared-memory handle, if present 353 // Returns the shared-memory handle, if present
354 base::SharedMemoryHandle shared_memory_handle() const; 354 base::SharedMemoryHandle shared_memory_handle() const;
355 355
356 // Returns the offset into the shared memory where the frame data begins. 356 // Returns the offset into the shared memory where the frame data begins.
357 size_t shared_memory_offset() const; 357 size_t shared_memory_offset() const;
358 358
359 const base::SharedMemory& shared_memory() const;
360
359 // Returns the vector of GpuMemoryBuffer handles, if present. 361 // Returns the vector of GpuMemoryBuffer handles, if present.
360 const std::vector<gfx::GpuMemoryBufferHandle>& gpu_memory_buffer_handles() 362 const std::vector<gfx::GpuMemoryBufferHandle>& gpu_memory_buffer_handles()
361 const; 363 const;
362 364
363 #if defined(OS_LINUX) 365 #if defined(OS_LINUX)
364 // Returns backing DmaBuf file descriptor for given |plane|, if present, or 366 // Returns backing DmaBuf file descriptor for given |plane|, if present, or
365 // -1 if not. 367 // -1 if not.
366 // TODO(mcasas): Rename to DmabufFd() to comply with Style Guide. 368 // TODO(mcasas): Rename to DmabufFd() to comply with Style Guide.
367 int dmabuf_fd(size_t plane) const; 369 int dmabuf_fd(size_t plane) const;
368 370
369 // Duplicates internally the |fds_in|, overwriting the current ones. Returns 371 // Duplicates internally the |fds_in|, overwriting the current ones. Returns
370 // false if something goes wrong, and leaves all internal fds closed. 372 // false if something goes wrong, and leaves all internal fds closed.
371 bool DuplicateFileDescriptors(const std::vector<int>& fds_in); 373 bool DuplicateFileDescriptors(const std::vector<int>& fds_in);
372 #endif 374 #endif
373 375
374 void AddSharedMemoryHandle(base::SharedMemoryHandle handle); 376 void AddSharedMemoryHandle(base::SharedMemoryHandle handle);
375 377
378 void AddSharedMemory(scoped_ptr<base::SharedMemory> shared_memory);
379
376 #if defined(OS_MACOSX) 380 #if defined(OS_MACOSX)
377 // Returns the backing CVPixelBuffer, if present. 381 // Returns the backing CVPixelBuffer, if present.
378 // TODO(mcasas): Rename to CvPixelBuffer() to comply with Style Guide. 382 // TODO(mcasas): Rename to CvPixelBuffer() to comply with Style Guide.
379 CVPixelBufferRef cv_pixel_buffer() const; 383 CVPixelBufferRef cv_pixel_buffer() const;
380 #endif 384 #endif
381 385
382 // Adds a callback to be run when the VideoFrame is about to be destroyed. 386 // Adds a callback to be run when the VideoFrame is about to be destroyed.
383 // The callback may be run from ANY THREAD, and so it is up to the client to 387 // The callback may be run from ANY THREAD, and so it is up to the client to
384 // ensure thread safety. Although read-only access to the members of this 388 // ensure thread safety. Although read-only access to the members of this
385 // VideoFrame is permitted while the callback executes (including 389 // VideoFrame is permitted while the callback executes (including
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 501
498 // Native texture mailboxes, if this is a IsTexture() frame. 502 // Native texture mailboxes, if this is a IsTexture() frame.
499 gpu::MailboxHolder mailbox_holders_[kMaxPlanes]; 503 gpu::MailboxHolder mailbox_holders_[kMaxPlanes];
500 ReleaseMailboxCB mailbox_holders_release_cb_; 504 ReleaseMailboxCB mailbox_holders_release_cb_;
501 505
502 // Shared memory handle and associated offset inside it, if this frame is 506 // Shared memory handle and associated offset inside it, if this frame is
503 // a STORAGE_SHMEM one. 507 // a STORAGE_SHMEM one.
504 base::SharedMemoryHandle shared_memory_handle_; 508 base::SharedMemoryHandle shared_memory_handle_;
505 size_t shared_memory_offset_; 509 size_t shared_memory_offset_;
506 510
511 // Users can store the shared_memory_ inside this VideoFrame.
512 scoped_ptr<base::SharedMemory> shared_memory_;
513
507 // GpuMemoryBuffer handles attached to the video_frame. 514 // GpuMemoryBuffer handles attached to the video_frame.
508 std::vector<gfx::GpuMemoryBufferHandle> gpu_memory_buffer_handles_; 515 std::vector<gfx::GpuMemoryBufferHandle> gpu_memory_buffer_handles_;
509 516
510 #if defined(OS_LINUX) 517 #if defined(OS_LINUX)
511 // Dmabufs for each plane. If set, this frame has DmaBuf backing in some way. 518 // Dmabufs for each plane. If set, this frame has DmaBuf backing in some way.
512 base::ScopedFD dmabuf_fds_[kMaxPlanes]; 519 base::ScopedFD dmabuf_fds_[kMaxPlanes];
513 #endif 520 #endif
514 521
515 #if defined(OS_MACOSX) 522 #if defined(OS_MACOSX)
516 // CVPixelBuffer, if this frame is wrapping one. 523 // CVPixelBuffer, if this frame is wrapping one.
517 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer_; 524 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer_;
518 #endif 525 #endif
519 526
520 std::vector<base::Closure> done_callbacks_; 527 std::vector<base::Closure> done_callbacks_;
521 528
522 base::TimeDelta timestamp_; 529 base::TimeDelta timestamp_;
523 530
524 base::Lock release_sync_token_lock_; 531 base::Lock release_sync_token_lock_;
525 gpu::SyncToken release_sync_token_; 532 gpu::SyncToken release_sync_token_;
526 533
527 VideoFrameMetadata metadata_; 534 VideoFrameMetadata metadata_;
528 535
529 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); 536 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame);
530 }; 537 };
531 538
532 } // namespace media 539 } // namespace media
533 540
534 #endif // MEDIA_BASE_VIDEO_FRAME_H_ 541 #endif // MEDIA_BASE_VIDEO_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698