• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# avtranscoder_base.h
2<!--Kit: Media Kit-->
3<!--Subsystem: Multimedia-->
4<!--Owner: @wang-haizhou6-->
5<!--Designer: @HmQQQ-->
6<!--Tester: @xchaosioda-->
7<!--Adviser: @zengyawen-->
8
9## Overview
10
11The file declares the struct and enums used by the AVTranscoder.
12
13**File to include**: <multimedia/player_framework/avtranscoder_base.h>
14
15**Library**: libavtranscoder.so
16
17**System capability**: SystemCapability.Multimedia.Media.AVTranscoder
18
19**Since**: 20
20
21**Related module**: [AVTranscoder](capi-avtranscoder.md)
22
23## Summary
24
25### Structs
26
27| Name| typedef Keyword| Description|
28| -- | -- | -- |
29| [OH_AVTranscoder](capi-avtranscoder-oh-avtranscoder.md) | OH_AVTranscoder | Initializes an AVTranscoder.|
30| [OH_AVTranscoder_Config](capi-avtranscoder-oh-avtranscoder-config.md) | OH_AVTranscoder_Config | Initializes an AVTranscoder_Config.|
31
32### Enums
33
34| Name| typedef Keyword| Description|
35| -- | -- | -- |
36| [OH_AVTranscoder_State](#oh_avtranscoder_state) | OH_AVTranscoder_State | Enumerates the transcoding states.|
37
38### Functions
39
40| Name| typedef Keyword| Description|
41| -- | -- | -- |
42| [typedef void (\*OH_AVTranscoder_OnStateChange)(OH_AVTranscoder *transcoder, OH_AVTranscoder_State state, void *userData)](#oh_avtranscoder_onstatechange) | OH_AVTranscoder_OnStateChange | Defines a callback invoked when the state of the transcoding process changes.|
43| [typedef void (\*OH_AVTranscoder_OnError)(OH_AVTranscoder *transcoder, int32_t errorCode, const char *errorMsg, void *userData)](#oh_avtranscoder_onerror) | OH_AVTranscoder_OnError | Defines a callback invoked when an error occurs during the transcoding process.|
44| [typedef void (\*OH_AVTranscoder_OnProgressUpdate)(OH_AVTranscoder *transcoder, int32_t progress, void *userData)](#oh_avtranscoder_onprogressupdate) | OH_AVTranscoder_OnProgressUpdate | Defines a callback invoked when the progress of the transcoding process is updated.|
45
46## Enum Description
47
48### OH_AVTranscoder_State
49
50```
51enum OH_AVTranscoder_State
52```
53
54**Description**
55
56Enumerates the transcoding states.
57
58**System capability**: SystemCapability.Multimedia.Media.AVTranscoder
59
60**Since**: 20
61
62| Enum Item| Description|
63| -- | -- |
64| AVTRANSCODER_PREPARED = 1 | The transcoding process is prepared and ready to start.|
65| AVTRANSCODER_STARTED = 2 | The transcoding process has started.|
66| AVTRANSCODER_PAUSED = 3 | The transcoding process is paused.|
67| AVTRANSCODER_CANCELLED = 4 | The transcoding process has been canceled.|
68| AVTRANSCODER_COMPLETED = 5 | The transcoding process is completed.|
69
70
71## Function Description
72
73### OH_AVTranscoder_OnStateChange()
74
75```
76typedef void (*OH_AVTranscoder_OnStateChange)(OH_AVTranscoder *transcoder, OH_AVTranscoder_State state, void *userData)
77```
78
79**Description**
80
81Defines a callback invoked when the state of the transcoding process changes.
82
83**System capability**: SystemCapability.Multimedia.Media.AVTranscoder
84
85**Since**: 20
86
87
88**Parameters**
89
90| Name| Description|
91| -- | -- |
92| [OH_AVTranscoder](capi-avtranscoder-oh-avtranscoder.md) *transcoder | Pointer to an OH_AVTranscoder instance.|
93| [OH_AVTranscoder_State](#oh_avtranscoder_state) state | Transcoding state. For details, see [OH_AVTranscoder_State](#oh_avtranscoder_state).|
94|  void *userData | Pointer to user-defined data.|
95
96### OH_AVTranscoder_OnError()
97
98```
99typedef void (*OH_AVTranscoder_OnError)(OH_AVTranscoder *transcoder, int32_t errorCode, const char *errorMsg,void *userData)
100```
101
102**Description**
103
104Defines a callback invoked when an error occurs during the transcoding process.
105
106**System capability**: SystemCapability.Multimedia.Media.AVTranscoder
107
108**Since**: 20
109
110
111**Parameters**
112
113| Name| Description|
114| -- | -- |
115| [OH_AVTranscoder](capi-avtranscoder-oh-avtranscoder.md) *transcoder | Pointer to an OH_AVTranscoder instance.|
116| int32_t errorCode | Error code.<br>                  **AV_ERR_NO_MEMORY**: No memory. The value is **1**.<br>                  **AV_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The value is **2**.<br>                  **AV_ERR_INVALID_VAL**: The parameter check fails. The value is **3**.<br>                  **AV_ERR_IO**: I/O error. The value is **4**.<br>                  **AV_ERR_INVALID_STATE**: The operation is not supported in the current state. The value is **8**.<br>                  **AV_ERR_UNSUPPORT**: The function is not supported. The value is **9**.|
117| const char *errorMsg | Pointer to the error message.|
118| void *userData | Pointer to user-defined data.|
119
120### OH_AVTranscoder_OnProgressUpdate()
121
122```
123typedef void (*OH_AVTranscoder_OnProgressUpdate)(OH_AVTranscoder *transcoder, int32_t progress, void *userData)
124```
125
126**Description**
127
128Defines a callback invoked when the progress of the transcoding process is updated.
129
130**System capability**: SystemCapability.Multimedia.Media.AVTranscoder
131
132**Since**: 20
133
134
135**Parameters**
136
137| Name| Description|
138| -- | -- |
139| [OH_AVTranscoder](capi-avtranscoder-oh-avtranscoder.md) *transcoder | Pointer to an OH_AVTranscoder instance.|
140| int32_t progress | Transcoding progress.|
141| void *userData | Pointer to user-defined data.|
142