1 /*
2 * Copyright (C) 2023 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 #include "avformat_inner_mock.h"
17
18 namespace OHOS {
19 namespace MediaAVCodec {
CreateFormat()20 std::shared_ptr<FormatMock> FormatMockFactory::CreateFormat()
21 {
22 return std::make_shared<AVFormatInnerMock>();
23 }
24
CreateAudioFormat(const std::string_view & mimeType,int32_t sampleRate,int32_t channelCount)25 std::shared_ptr<FormatMock> FormatMockFactory::CreateAudioFormat(
26 const std::string_view &mimeType, int32_t sampleRate, int32_t channelCount)
27 {
28 std::shared_ptr<FormatMock> format = std::make_shared<AVFormatInnerMock>();
29 format->InitAudioTrackFormat(mimeType, sampleRate, channelCount);
30 return format;
31 }
32
CreateVideoFormat(const std::string_view & mimeType,int32_t width,int32_t height)33 std::shared_ptr<FormatMock> FormatMockFactory::CreateVideoFormat(
34 const std::string_view &mimeType, int32_t width, int32_t height)
35 {
36 std::shared_ptr<FormatMock> format = std::make_shared<AVFormatInnerMock>();
37 format->InitVideoTrackFormat(mimeType, width, height);
38 return format;
39 }
40
CreateTimedMetadataFormat(const std::string_view & mimeType,const std::string_view & metadataKey,int32_t srcTrackID)41 std::shared_ptr<FormatMock> FormatMockFactory::CreateTimedMetadataFormat(
42 const std::string_view &mimeType, const std::string_view &metadataKey, int32_t srcTrackID)
43 {
44 std::shared_ptr<FormatMock> format = std::make_shared<AVFormatInnerMock>();
45 format->InitMetadataTrackFormat(mimeType, metadataKey, srcTrackID);
46 return format;
47 }
48 } // namespace MediaAVCodec
49 } // namespace OHOS