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_FFMPEG_TRACK_META_H
17 #define HISTREAMER_FFMPEG_TRACK_META_H
18 
19 #include <memory>
20 #include <vector>
21 #include "plugin/common/plugin_tags.h"
22 #include "plugin/common/plugin_meta.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 #include "libavformat/avformat.h"
28 #include "libavcodec/avcodec.h"
29 #ifdef __cplusplus
30 };
31 #endif
32 
33 namespace OHOS {
34 namespace Media {
35 namespace Plugin {
36 namespace Ffmpeg {
37 void ConvertRawAudioStreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
38                                      const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
39 
40 void ConvertMP1StreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
41                                 const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
42 
43 void ConvertMP2StreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
44                                 const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
45 
46 void ConvertMP3StreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
47                                 const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
48 
49 void ConvertAACStreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
50                                 const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
51 
52 void ConvertAACLatmStreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
53                                     const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
54 
55 void ConvertVorbisStreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
56                                    const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
57 
58 void ConvertFLACStreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
59                                  const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
60 
61 void ConvertAPEStreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
62                                 const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
63 
64 #ifdef AVS3DA_SUPPORT
65 void ConvertAVS3DAStreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
66                                    const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
67 #endif
68 
69 #ifdef VIDEO_SUPPORT
70 void ConvertAVCStreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
71                                 const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
72 #endif
73 
74 void ConvertAVStreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
75                                const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
76 
77 void ConvertAMRnbStreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
78                                   const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
79 
80 void ConvertAMRwbStreamToMetaInfo(const AVStream& avStream, const std::shared_ptr<AVFormatContext>& avFormatContext,
81                                   const std::shared_ptr<AVCodecContext>& avCodecContext, Meta& meta);
82 } // namespace Ffmpeg
83 } // namespace Plugin
84 } // namespace Media
85 } // namespace OHOS
86 #endif // HISTREAMER_FFMPEG_TRACK_META_H
87