• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 AVMUXER_H
17 #define AVMUXER_H
18 
19 #include <string>
20 #include <vector>
21 #include <memory>
22 #include "avcontainer_common.h"
23 #include "media_description.h"
24 
25 namespace OHOS {
26 namespace Media {
27 class AVMuxer {
28 public:
29     virtual ~AVMuxer() = default;
30 
31     virtual std::vector<std::string> GetAVMuxerFormatList() = 0;
32     virtual int32_t SetOutput(int32_t fd, const std::string &format) = 0;
33     virtual int32_t SetLocation(float latitude, float longtitude) = 0;
34     virtual int32_t SetRotation(int32_t rotation) = 0;
35     virtual int32_t AddTrack(const MediaDescription &trackDesc, int32_t &trackIdx) = 0;
36     virtual int32_t Start() = 0;
37     virtual int32_t WriteTrackSample(std::shared_ptr<AVContainerMemory> sampleData, const TrackSampleInfo &info) = 0;
38     virtual int32_t Stop() = 0;
39     virtual void Release() = 0;
40 };
41 
42 class __attribute__((visibility("default"))) AVMuxerFactory {
43 public:
44 #ifdef UNSUPPORT_MUXER
CreateAVMuxer()45     static std::shared_ptr<AVMuxer> CreateAVMuxer()
46     {
47         return nullptr;
48     }
49 #else
50     static std::shared_ptr<AVMuxer> CreateAVMuxer();
51 #endif
52 private:
53     AVMuxerFactory() = default;
54     ~AVMuxerFactory() = default;
55 };
56 } // namespace Media
57 } // namespace OHOS
58 #endif // AVMUXER_H