1 /*
2  * Copyright (C) 2024 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 TRANSCODER_IMPL_H
17 #define TRANSCODER_IMPL_H
18 
19 #include "transcoder.h"
20 #include "nocopyable.h"
21 #include "i_transcoder_service.h"
22 #include "hitrace/tracechain.h"
23 
24 namespace OHOS {
25 namespace Media {
26 class TransCoderImpl : public TransCoder, public NoCopyable {
27 public:
28     TransCoderImpl();
29     ~TransCoderImpl();
30 
31     int32_t SetVideoEncoder(VideoCodecFormat encoder) override;
32     int32_t SetVideoEncodingBitRate(int32_t rate) override;
33     int32_t SetVideoSize(int32_t width, int32_t height) override;
34     int32_t SetAudioEncoder(AudioCodecFormat encoder) override;
35     int32_t SetAudioEncodingBitRate(int32_t bitRate) override;
36     int32_t SetOutputFormat(OutputFormatType format) override;
37     int32_t SetInputFile(int32_t fd, int64_t offset, int64_t size) override;
38     int32_t SetOutputFile(int32_t fd) override;
39     int32_t SetTransCoderCallback(const std::shared_ptr<TransCoderCallback> &callback) override;
40     int32_t Prepare() override;
41     int32_t Start() override;
42     int32_t Pause() override;
43     int32_t Resume() override;
44     int32_t Cancel() override;
45     int32_t Release() override;
46     int32_t Init();
47 
48 private:
49     std::shared_ptr<ITransCoderService> transCoderService_ = nullptr;
50     HiviewDFX::HiTraceId traceId_;
51 };
52 } // namespace Media
53 } // namespace OHOS
54 #endif // TRANSCODER_IMPL_H
55