| 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 #include "media/base/video_frame.h" | 5 #include "media/base/video_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 case VideoFrame::UNKNOWN: | 47 case VideoFrame::UNKNOWN: |
| 48 return "UNKNOWN"; | 48 return "UNKNOWN"; |
| 49 case VideoFrame::YV12: | 49 case VideoFrame::YV12: |
| 50 return "YV12"; | 50 return "YV12"; |
| 51 case VideoFrame::YV16: | 51 case VideoFrame::YV16: |
| 52 return "YV16"; | 52 return "YV16"; |
| 53 case VideoFrame::I420: | 53 case VideoFrame::I420: |
| 54 return "I420"; | 54 return "I420"; |
| 55 case VideoFrame::NATIVE_TEXTURE: | 55 case VideoFrame::NATIVE_TEXTURE: |
| 56 return "NATIVE_TEXTURE"; | 56 return "NATIVE_TEXTURE"; |
| 57 #if defined(GOOGLE_TV) | 57 #if defined(VIDEO_HOLE) |
| 58 case VideoFrame::HOLE: | 58 case VideoFrame::HOLE: |
| 59 return "HOLE"; | 59 return "HOLE"; |
| 60 #endif | 60 #endif // defined(VIDEO_HOLE) |
| 61 case VideoFrame::YV12A: | 61 case VideoFrame::YV12A: |
| 62 return "YV12A"; | 62 return "YV12A"; |
| 63 case VideoFrame::YV12J: | 63 case VideoFrame::YV12J: |
| 64 return "YV12J"; | 64 return "YV12J"; |
| 65 case VideoFrame::HISTOGRAM_MAX: | 65 case VideoFrame::HISTOGRAM_MAX: |
| 66 return "HISTOGRAM_MAX"; | 66 return "HISTOGRAM_MAX"; |
| 67 } | 67 } |
| 68 NOTREACHED() << "Invalid videoframe format provided: " << format; | 68 NOTREACHED() << "Invalid videoframe format provided: " << format; |
| 69 return ""; | 69 return ""; |
| 70 } | 70 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 220 } |
| 221 | 221 |
| 222 // static | 222 // static |
| 223 scoped_refptr<VideoFrame> VideoFrame::CreateBlackFrame(const gfx::Size& size) { | 223 scoped_refptr<VideoFrame> VideoFrame::CreateBlackFrame(const gfx::Size& size) { |
| 224 const uint8 kBlackY = 0x00; | 224 const uint8 kBlackY = 0x00; |
| 225 const uint8 kBlackUV = 0x80; | 225 const uint8 kBlackUV = 0x80; |
| 226 const base::TimeDelta kZero; | 226 const base::TimeDelta kZero; |
| 227 return CreateColorFrame(size, kBlackY, kBlackUV, kBlackUV, kZero); | 227 return CreateColorFrame(size, kBlackY, kBlackUV, kBlackUV, kZero); |
| 228 } | 228 } |
| 229 | 229 |
| 230 #if defined(GOOGLE_TV) | 230 #if defined(VIDEO_HOLE) |
| 231 // This block and other blocks wrapped around #if defined(GOOGLE_TV) is not | 231 // This block and other blocks wrapped around #if defined(VIDEO_HOLE) is not |
| 232 // maintained by the general compositor team. Please contact the following | 232 // maintained by the general compositor team. Please contact the following |
| 233 // people instead: | 233 // people instead: |
| 234 // | 234 // |
| 235 // wonsik@chromium.org | 235 // wonsik@chromium.org |
| 236 // ycheo@chromium.org | 236 // ycheo@chromium.org |
| 237 | 237 |
| 238 // static | 238 // static |
| 239 scoped_refptr<VideoFrame> VideoFrame::CreateHoleFrame( | 239 scoped_refptr<VideoFrame> VideoFrame::CreateHoleFrame( |
| 240 const gfx::Size& size) { | 240 const gfx::Size& size) { |
| 241 DCHECK(IsValidConfig(VideoFrame::HOLE, size, gfx::Rect(size), size)); | 241 DCHECK(IsValidConfig(VideoFrame::HOLE, size, gfx::Rect(size), size)); |
| 242 scoped_refptr<VideoFrame> frame(new VideoFrame( | 242 scoped_refptr<VideoFrame> frame(new VideoFrame( |
| 243 VideoFrame::HOLE, size, gfx::Rect(size), size, base::TimeDelta(), false)); | 243 VideoFrame::HOLE, size, gfx::Rect(size), size, base::TimeDelta(), false)); |
| 244 return frame; | 244 return frame; |
| 245 } | 245 } |
| 246 #endif | 246 #endif // defined(VIDEO_HOLE) |
| 247 | 247 |
| 248 // static | 248 // static |
| 249 size_t VideoFrame::NumPlanes(Format format) { | 249 size_t VideoFrame::NumPlanes(Format format) { |
| 250 switch (format) { | 250 switch (format) { |
| 251 case VideoFrame::NATIVE_TEXTURE: | 251 case VideoFrame::NATIVE_TEXTURE: |
| 252 #if defined(GOOGLE_TV) | 252 #if defined(VIDEO_HOLE) |
| 253 case VideoFrame::HOLE: | 253 case VideoFrame::HOLE: |
| 254 #endif | 254 #endif // defined(VIDEO_HOLE) |
| 255 return 0; | 255 return 0; |
| 256 case VideoFrame::YV12: | 256 case VideoFrame::YV12: |
| 257 case VideoFrame::YV16: | 257 case VideoFrame::YV16: |
| 258 case VideoFrame::I420: | 258 case VideoFrame::I420: |
| 259 case VideoFrame::YV12J: | 259 case VideoFrame::YV12J: |
| 260 return 3; | 260 return 3; |
| 261 case VideoFrame::YV12A: | 261 case VideoFrame::YV12A: |
| 262 return 4; | 262 return 4; |
| 263 case VideoFrame::UNKNOWN: | 263 case VideoFrame::UNKNOWN: |
| 264 case VideoFrame::HISTOGRAM_MAX: | 264 case VideoFrame::HISTOGRAM_MAX: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 case VideoFrame::kUPlane: | 321 case VideoFrame::kUPlane: |
| 322 case VideoFrame::kVPlane: | 322 case VideoFrame::kVPlane: |
| 323 return area / 2; | 323 return area / 2; |
| 324 default: | 324 default: |
| 325 break; | 325 break; |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 case VideoFrame::UNKNOWN: | 328 case VideoFrame::UNKNOWN: |
| 329 case VideoFrame::NATIVE_TEXTURE: | 329 case VideoFrame::NATIVE_TEXTURE: |
| 330 case VideoFrame::HISTOGRAM_MAX: | 330 case VideoFrame::HISTOGRAM_MAX: |
| 331 #if defined(GOOGLE_TV) | 331 #if defined(VIDEO_HOLE) |
| 332 case VideoFrame::HOLE: | 332 case VideoFrame::HOLE: |
| 333 #endif | 333 #endif // defined(VIDEO_HOLE) |
| 334 break; | 334 break; |
| 335 } | 335 } |
| 336 NOTREACHED() << "Unsupported video frame format/plane: " | 336 NOTREACHED() << "Unsupported video frame format/plane: " |
| 337 << format << "/" << plane; | 337 << format << "/" << plane; |
| 338 return 0; | 338 return 0; |
| 339 } | 339 } |
| 340 | 340 |
| 341 // Release data allocated by AllocateYUV(). | 341 // Release data allocated by AllocateYUV(). |
| 342 static void ReleaseData(uint8* data) { | 342 static void ReleaseData(uint8* data) { |
| 343 DCHECK(data); | 343 DCHECK(data); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 : mailbox_(mailbox), | 520 : mailbox_(mailbox), |
| 521 sync_point_(sync_point), | 521 sync_point_(sync_point), |
| 522 release_callback_(release_callback) {} | 522 release_callback_(release_callback) {} |
| 523 | 523 |
| 524 VideoFrame::MailboxHolder::~MailboxHolder() { | 524 VideoFrame::MailboxHolder::~MailboxHolder() { |
| 525 if (!release_callback_.is_null()) | 525 if (!release_callback_.is_null()) |
| 526 release_callback_.Run(sync_point_); | 526 release_callback_.Run(sync_point_); |
| 527 } | 527 } |
| 528 | 528 |
| 529 } // namespace media | 529 } // namespace media |
| OLD | NEW |