| 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 "content/browser/android/media_player_manager_impl.h" | 5 #include "content/browser/android/media_player_manager_impl.h" |
| 6 | 6 |
| 7 #include "content/browser/android/content_view_core_impl.h" | 7 #include "content/browser/android/content_view_core_impl.h" |
| 8 #include "content/browser/android/media_resource_getter_impl.h" | 8 #include "content/browser/android/media_resource_getter_impl.h" |
| 9 #include "content/browser/web_contents/web_contents_view_android.h" | 9 #include "content/browser/web_contents/web_contents_view_android.h" |
| 10 #include "content/common/media/media_player_messages_android.h" | 10 #include "content/common/media/media_player_messages_android.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyAllMediaPlayers, | 68 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DestroyAllMediaPlayers, |
| 69 DestroyAllMediaPlayers) | 69 DestroyAllMediaPlayers) |
| 70 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DemuxerReady, | 70 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DemuxerReady, |
| 71 OnDemuxerReady) | 71 OnDemuxerReady) |
| 72 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_ReadFromDemuxerAck, | 72 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_ReadFromDemuxerAck, |
| 73 OnReadFromDemuxerAck) | 73 OnReadFromDemuxerAck) |
| 74 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DurationChanged, | 74 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_DurationChanged, |
| 75 OnDurationChanged) | 75 OnDurationChanged) |
| 76 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_MediaSeekRequestAck, | 76 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_MediaSeekRequestAck, |
| 77 OnMediaSeekRequestAck) | 77 OnMediaSeekRequestAck) |
| 78 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_InitializeCDM, |
| 79 OnInitializeCDM) |
| 78 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_GenerateKeyRequest, | 80 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_GenerateKeyRequest, |
| 79 OnGenerateKeyRequest) | 81 OnGenerateKeyRequest) |
| 80 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_AddKey, OnAddKey) | 82 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_AddKey, OnAddKey) |
| 81 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_CancelKeyRequest, | 83 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_CancelKeyRequest, |
| 82 OnCancelKeyRequest) | 84 OnCancelKeyRequest) |
| 83 #if defined(GOOGLE_TV) | 85 #if defined(GOOGLE_TV) |
| 84 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_NotifyExternalSurface, | 86 IPC_MESSAGE_HANDLER(MediaPlayerHostMsg_NotifyExternalSurface, |
| 85 OnNotifyExternalSurface) | 87 OnNotifyExternalSurface) |
| 86 #endif | 88 #endif |
| 87 IPC_MESSAGE_UNHANDLED(handled = false) | 89 IPC_MESSAGE_UNHANDLED(handled = false) |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 player->ReadFromDemuxerAck(params); | 430 player->ReadFromDemuxerAck(params); |
| 429 } | 431 } |
| 430 | 432 |
| 431 void MediaPlayerManagerImpl::OnMediaSeekRequestAck( | 433 void MediaPlayerManagerImpl::OnMediaSeekRequestAck( |
| 432 int player_id, unsigned seek_request_id) { | 434 int player_id, unsigned seek_request_id) { |
| 433 MediaPlayerAndroid* player = GetPlayer(player_id); | 435 MediaPlayerAndroid* player = GetPlayer(player_id); |
| 434 if (player) | 436 if (player) |
| 435 player->OnSeekRequestAck(seek_request_id); | 437 player->OnSeekRequestAck(seek_request_id); |
| 436 } | 438 } |
| 437 | 439 |
| 440 void MediaPlayerManagerImpl::OnInitializeCDM(int media_keys_id, |
| 441 const std::vector<uint8>& uuid) { |
| 442 // TODO(qinmin/xhwang): Create a MediaDrmBridge. |
| 443 } |
| 444 |
| 438 void MediaPlayerManagerImpl::OnGenerateKeyRequest( | 445 void MediaPlayerManagerImpl::OnGenerateKeyRequest( |
| 439 int media_keys_id, | 446 int media_keys_id, |
| 440 const std::string& type, | 447 const std::string& type, |
| 441 const std::vector<uint8>& init_data) { | 448 const std::vector<uint8>& init_data) { |
| 442 // TODO(qinmin): add a new MediaDrmBridge if GetDrmBridge() returns NULL. | |
| 443 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); | 449 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); |
| 444 if (drm_bridge) { | 450 if (drm_bridge) { |
| 445 drm_bridge->GenerateKeyRequest(type, &init_data[0], init_data.size()); | 451 drm_bridge->GenerateKeyRequest(type, &init_data[0], init_data.size()); |
| 446 } | 452 } |
| 447 } | 453 } |
| 448 | 454 |
| 449 void MediaPlayerManagerImpl::OnAddKey(int media_keys_id, | 455 void MediaPlayerManagerImpl::OnAddKey(int media_keys_id, |
| 450 const std::vector<uint8>& key, | 456 const std::vector<uint8>& key, |
| 451 const std::vector<uint8>& init_data, | 457 const std::vector<uint8>& init_data, |
| 452 const std::string& session_id) { | 458 const std::string& session_id) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 for (ScopedVector<MediaDrmBridge>::iterator it = drm_bridges_.begin(); | 496 for (ScopedVector<MediaDrmBridge>::iterator it = drm_bridges_.begin(); |
| 491 it != drm_bridges_.end(); ++it) { | 497 it != drm_bridges_.end(); ++it) { |
| 492 if ((*it)->media_keys_id() == media_keys_id) { | 498 if ((*it)->media_keys_id() == media_keys_id) { |
| 493 drm_bridges_.erase(it); | 499 drm_bridges_.erase(it); |
| 494 break; | 500 break; |
| 495 } | 501 } |
| 496 } | 502 } |
| 497 } | 503 } |
| 498 | 504 |
| 499 } // namespace content | 505 } // namespace content |
| OLD | NEW |