• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef NATIVE_AVSOURCE_H
17 #define NATIVE_AVSOURCE_H
18 
19 #include <stdint.h>
20 #include "native_avcodec_base.h"
21 #include "native_averrors.h"
22 #include "native_avformat.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 typedef struct OH_AVSource OH_AVSource;
29 
30 /**
31  * @brief Creates an OH_AVSource instance that models the media at the URI.
32  * @syscap SystemCapability.Multimedia.Media.Spliter
33  * @param uri An URI for a remote media resource.
34  * @return Returns a pointer to an OH_AVSource instance
35  * @since 10
36 */
37 OH_AVSource *OH_AVSource_CreateWithURI(char *uri);
38 
39 /**
40  * @brief Creates an OH_AVSource instance that models the media at the FileDescriptor.
41  * @syscap SystemCapability.Multimedia.Media.Spliter
42  * @param fd The fileDescriptor of data source.
43  * @param offset The offset into the file to start reading.
44  * @param size The file size in bytes.
45  * @return Returns a pointer to an OH_AVSource instance
46  * @since 10
47 */
48 OH_AVSource *OH_AVSource_CreateWithFD(int32_t fd, int64_t offset, int64_t size);
49 
50 /**
51  * @brief Destroy the OH_AVSource instance and free the internal resources.
52  * @syscap SystemCapability.Multimedia.Media.Spliter
53  * @param source Pointer to an OH_AVSource instance.
54  * @return Returns AV_ERR_OK if the execution is successful,
55  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
56  * @since 10
57 */
58 OH_AVErrCode OH_AVSource_Destroy(OH_AVSource *source);
59 
60 /**
61  * @brief Get the format info of source.
62  * @syscap SystemCapability.Multimedia.Media.Spliter
63  * @param source Pointer to an OH_AVSource instance.
64  * @return Returns the source's format info.
65  * @since 10
66 */
67 OH_AVFormat *OH_AVSource_GetSourceFormat(OH_AVSource *source);
68 
69 /**
70  * @brief Get the format info of track.
71  * @syscap SystemCapability.Multimedia.Media.Spliter
72  * @param source Pointer to an OH_AVSource instance.
73  * @param trackIndex The track index to get format.
74  * @return Returns the track's format info.
75  * @since 10
76 */
77 OH_AVFormat *OH_AVSource_GetTrackFormat(OH_AVSource *source, uint32_t trackIndex);
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif // NATIVE_AVSOURCE_H