1 /* 2 * Copyright (c) 2021-2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef HISTREAMER_HIRECORDER_READY_STATE_H 17 #define HISTREAMER_HIRECORDER_READY_STATE_H 18 19 #include <memory> 20 #include "pipeline/core/error_code.h" 21 #include "recorder_executor.h" 22 #include "state.h" 23 24 namespace OHOS { 25 namespace Media { 26 namespace Record { 27 class ReadyState : public State { 28 public: ReadyState(StateId stateId,RecorderExecutor & executor)29 explicit ReadyState(StateId stateId, RecorderExecutor& executor) : State(stateId, "ReadyState", executor) 30 { 31 } 32 33 ~ReadyState() override = default; 34 Start()35 std::tuple<ErrorCode, Action> Start() override 36 { 37 MEDIA_LOG_D("Start in ready state."); 38 return {ErrorCode::SUCCESS, Action::TRANS_TO_RECORDING}; 39 } 40 Stop(const Plugin::Any & param)41 std::tuple<ErrorCode, Action> Stop(const Plugin::Any& param) override 42 { 43 return {ErrorCode::ERROR_INVALID_OPERATION, Action::TRANS_TO_ERROR}; 44 } 45 }; 46 } // namespace Record 47 } // namespace Media 48 } // namespace OHOS 49 #endif // HISTREAMER_HIRECORDER_READY_STATE_H 50