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

Side by Side Diff: chromecast/media/cma/backend/media_component_device.cc

Issue 1257013003: Load CMA backend from shared library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 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
(Empty)
1 // Copyright 2014 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 "chromecast/media/cma/backend/media_component_device.h"
6
7 #include "base/logging.h"
8
9 namespace chromecast {
10 namespace media {
11
12 MediaComponentDevice::Client::Client() {
13 }
14
15 MediaComponentDevice::Client::~Client() {
16 }
17
18 MediaComponentDevice::MediaComponentDevice() {
19 }
20
21 MediaComponentDevice::~MediaComponentDevice() {
22 }
23
24 // static
25 bool MediaComponentDevice::IsValidStateTransition(State state1, State state2) {
26 if (state2 == state1)
27 return true;
28
29 // All states can transition to |kStateError|.
30 bool is_transition_valid = (state2 == kStateError);
31
32 // All the other valid FSM transitions.
33 is_transition_valid = is_transition_valid ||
34 (state1 == kStateUninitialized && (state2 == kStateIdle)) ||
35 (state1 == kStateIdle && (state2 == kStateRunning ||
36 state2 == kStatePaused ||
37 state2 == kStateUninitialized)) ||
38 (state1 == kStatePaused && (state2 == kStateIdle ||
39 state2 == kStateRunning)) ||
40 (state1 == kStateRunning && (state2 == kStateIdle ||
41 state2 == kStatePaused)) ||
42 (state1 == kStateError && (state2 == kStateUninitialized));
43
44 return is_transition_valid;
45 }
46
47 // static
48 std::string MediaComponentDevice::StateToString(const State& state) {
49 switch (state) {
50 case kStateUninitialized:
51 return "Uninitialized";
52 case kStateIdle:
53 return "Idle";
54 case kStateRunning:
55 return "Running";
56 case kStatePaused:
57 return "Paused";
58 case kStateError:
59 return "Error";
60 default:
61 NOTREACHED() << "Unknown MediaComponentDevice::State: " << state;
62 return "";
63 }
64 }
65
66 } // namespace media
67 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698