| 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 "webkit/media/android/webmediaplayer_android.h" | 5 #include "webkit/media/android/webmediaplayer_android.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 WebMediaSource* media_source, | 87 WebMediaSource* media_source, |
| 88 CORSMode cors_mode) { | 88 CORSMode cors_mode) { |
| 89 NOTIMPLEMENTED(); | 89 NOTIMPLEMENTED(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void WebMediaPlayerAndroid::cancelLoad() { | 92 void WebMediaPlayerAndroid::cancelLoad() { |
| 93 NOTIMPLEMENTED(); | 93 NOTIMPLEMENTED(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void WebMediaPlayerAndroid::play() { | 96 void WebMediaPlayerAndroid::play() { |
| 97 #if defined(GOOGLE_TV) |
| 97 if (hasVideo() && needs_external_surface_) { | 98 if (hasVideo() && needs_external_surface_) { |
| 98 DCHECK(!needs_establish_peer_); | 99 DCHECK(!needs_establish_peer_); |
| 99 RequestExternalSurface(); | 100 RequestExternalSurface(); |
| 100 } | 101 } |
| 102 #endif |
| 101 if (hasVideo() && needs_establish_peer_) | 103 if (hasVideo() && needs_establish_peer_) |
| 102 EstablishSurfaceTexturePeer(); | 104 EstablishSurfaceTexturePeer(); |
| 103 | 105 |
| 104 PlayInternal(); | 106 PlayInternal(); |
| 105 is_playing_ = true; | 107 is_playing_ = true; |
| 106 } | 108 } |
| 107 | 109 |
| 108 void WebMediaPlayerAndroid::pause() { | 110 void WebMediaPlayerAndroid::pause() { |
| 109 PauseInternal(); | 111 PauseInternal(); |
| 110 is_playing_ = false; | 112 is_playing_ = false; |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 } | 520 } |
| 519 | 521 |
| 520 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { | 522 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { |
| 521 needs_establish_peer_ = needs_establish_peer; | 523 needs_establish_peer_ = needs_establish_peer; |
| 522 } | 524 } |
| 523 | 525 |
| 524 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { | 526 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { |
| 525 is_playing_ = is_playing; | 527 is_playing_ = is_playing; |
| 526 } | 528 } |
| 527 | 529 |
| 530 #if defined(GOOGLE_TV) |
| 531 bool WebMediaPlayerAndroid::RetrieveGeometryChange(gfx::RectF* rect) { |
| 532 if (!video_weblayer_) |
| 533 return false; |
| 534 |
| 535 // Compute the geometry of video frame layer. |
| 536 cc::Layer* layer = video_weblayer_->layer(); |
| 537 rect->set_size(layer->bounds()); |
| 538 while (layer) { |
| 539 rect->Offset(layer->position().OffsetFromOrigin()); |
| 540 layer = layer->parent(); |
| 541 } |
| 542 |
| 543 // Return false when the geometry hasn't been changed from the last time. |
| 544 if (last_computed_rect_ == *rect) |
| 545 return false; |
| 546 |
| 547 // Store the changed geometry information when it is actually changed. |
| 548 last_computed_rect_ = *rect; |
| 549 return true; |
| 550 } |
| 551 #endif |
| 552 |
| 528 } // namespace webkit_media | 553 } // namespace webkit_media |
| OLD | NEW |