OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/common/gpu_messages.h" | |
6 #include "chrome/gpu/gpu_channel.h" | |
7 #include "chrome/gpu/gpu_video_decoder_mft.h" | |
8 #include "chrome/gpu/gpu_video_service.h" | |
9 | |
10 GpuVideoService::GpuVideoService() : next_available_decoder_id_(0) { | |
11 // TODO(jiesun): move this time consuming stuff out of here. | |
12 IntializeGpuVideoService(); | |
13 } | |
14 GpuVideoService::~GpuVideoService() { | |
15 // TODO(jiesun): move this time consuming stuff out of here. | |
16 UnintializeGpuVideoService(); | |
17 } | |
18 | |
19 void GpuVideoService::OnChannelConnected(int32 peer_pid) { | |
20 LOG(ERROR) << "GpuVideoService::OnChannelConnected"; | |
21 } | |
22 | |
23 void GpuVideoService::OnChannelError() { | |
24 LOG(ERROR) << "GpuVideoService::OnChannelError"; | |
25 } | |
26 | |
27 void GpuVideoService::OnMessageReceived(const IPC::Message& msg) { | |
28 #if 0 | |
29 IPC_BEGIN_MESSAGE_MAP(GpuVideoService, msg) | |
30 IPC_MESSAGE_UNHANDLED_ERROR() | |
31 IPC_END_MESSAGE_MAP() | |
32 #endif | |
33 } | |
34 | |
35 bool GpuVideoService::IntializeGpuVideoService() { | |
36 return true; | |
37 } | |
38 | |
39 bool GpuVideoService::UnintializeGpuVideoService() { | |
40 return true; | |
41 } | |
42 | |
43 bool GpuVideoService::CreateVideoDecoder( | |
44 GpuChannel* channel, | |
45 MessageRouter* router, | |
46 GpuVideoDecoderInfoParam* param) { | |
47 // TODO(jiesun): find a better way to determine which GpuVideoDecoder | |
48 // to return on current platform. | |
49 #if defined(OS_WIN) | |
50 GpuVideoDecoderInfo decoder_info; | |
51 int32 decoder_id = GetNextAvailableDecoderID(); | |
52 param->decoder_id_ = decoder_id; | |
53 base::ProcessHandle handle = channel->renderer_handle(); | |
54 decoder_info.decoder_ = new GpuVideoDecoderMFT(param, channel, handle); | |
55 decoder_info.channel_ = channel; | |
56 decoder_info.param = *param; | |
57 decoder_map_[decoder_id] = decoder_info; | |
58 router->AddRoute(param->decoder_route_id_, decoder_info.decoder_); | |
59 return true; | |
60 #else | |
61 return false; | |
62 #endif | |
63 } | |
64 | |
65 void GpuVideoService::DestroyVideoDecoder( | |
66 MessageRouter* router, | |
67 int32 decoder_id) { | |
68 int32 route_id = decoder_map_[decoder_id].param.decoder_route_id_; | |
69 router->RemoveRoute(route_id); | |
70 decoder_map_.erase(decoder_id); | |
71 } | |
72 | |
73 int32 GpuVideoService::GetNextAvailableDecoderID() { | |
74 return ++next_available_decoder_id_; | |
75 } | |
76 | |
OLD | NEW |