1# Multimedia Subsystem Changelog 2 3## cl.multimedia.1 Core Module APIs Changed 4 5**Access Level** 6 7Public API 8 9**Reason for Change** 10 11The **AVMemory** struct is deprecated and replaced by **AVBuffer**. 12 13**Change Impact** 14 15The change is compatible with earlier versions. Use the new APIs in your code. 16 17 18**API Level** 19 20| Deprecated API | API Level | 21| ----------------------- | :--------------------------------| 22| OH_AVMemory_Create | 10 | 23| OH_AVMemory_GetAddr | 9 | 24| OH_AVMemory_GetSize | 9 | 25| OH_AVMemory_Destroy | 10 | 26 27**Change Since** 28 29OpenHarmony SDK 4.1.6.3 30 31**Key API/Component Changes** 32 33| Deprecated API | Deprecated Description | Substitute API | 34| ----------------------- | :--------------------------------| :----------------------------| 35| OH_AVMemory_Create | The API for creating an **AVMemory** instance is deprecated, and the API for creating an **AVBuffer** instance is supported.|OH_AVBuffer_Create| 36| OH_AVMemory_GetAddr | The API for obtaining the virtual address of the memory is deprecated, and the API for obtaining the buffer address is supported.|OH_AVBuffer_GetAddr| 37| OH_AVMemory_GetSize | The API for obtaining the memory length is deprecated, and the API for obtaining the buffer length is supported.|OH_AVBuffer_GetCapacity | 38| OH_AVMemory_Destroy | The API for destroying an **AVMemory** instance is deprecated, and the API for destroying an **AVBuffer** instance is supported.|OH_AVBuffer_Destroy | 39 40 41**Adaptation Guide** 42 43Before change: 44 45In the code for implementing media encoding/decoding and muxing/demuxing, use the **AVMemory** APIs to operate the data memory. 46 47After change: 48 49In the code for implementing media encoding/decoding and muxing/demuxing, use the **AVBuffer** APIs to operate the data memory. 50 51## cl.multimedia.2 CodecBase Module APIs Changed 52 53**Access Level** 54 55Public API 56 57**Reason for Change** 58 59The **AVMemory** struct is deprecated and replaced by **AVBuffer**. Unsupported specifications are removed. 60 61**Change Impact** 62 63The change is compatible with earlier versions. Use the new APIs in your code. 64 65**API Level** 66 67| API | API Level | 68| ----------------------- | :--------------------------------| 69| OH_AVCodecOnNeedInputData | 9 | 70| OH_AVCodecOnNewOutputData | 9 | 71| OH_AVCodecAsyncCallback | 9 | 72| const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4 | 10 | 73| AudioChannelSet | 10 | 74| AudioChanelLayout | 10 | 75 76**Change Since** 77 78OpenHarmony SDK 4.1.6.3 79 80**Key API/Component Changes** 81 82| Deprecated API | Deprecated Description | Substitute API | 83| ----------------------- | :--------------------------------| :----------------------------| 84| OH_AVCodecOnNeedInputData | The callback function for codec input data is changed from **AVMemory** to **AVBuffer**.|OH_AVCodecOnNeedInputBuffer| 85| OH_AVCodecOnNewOutputData | The callback function for codec output data is changed from **AVMemory** to **AVBuffer**.|OH_AVCodecOnNewOutputBuffer| 86| OH_AVCodecAsyncCallback | The pointer to the registered callback functions is changed from **AVMemory** to **AVBuffer**.|OH_AVCodecCallback | 87| const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4 | This specification is no longer supported.|None| 88| AudioChannelSet | The API name is changed.| OH_AudioChannelSet | 89| AudioChanelLayout | The API name is changed.| OH_AudioChannelLayout | 90 91**Adaptation Guide** 92 93Before change: 94 95Pointer to the registered callback functions **OH_AVCodecAsyncCallback** for the audio and video codec: 96 97Implementation of the codec input callback: **OH_AVCodecOnNeedInputData** 98 99Implementation of the codec output callback: **OH_AVCodecOnNewOutputData** 100 101Container format: **OH_AVCODEC_MIMETYPE_VIDEO_MPEG4** 102 103Audio channel settings: **AudioChannelSet** 104 105Audio channel layouts: **AudioChanelLayout** 106 107After change: 108 109Pointer to the registered callback functions **OH_AVCodecCallback** for the audio and video codec: 110 111Implementation of the codec input callback: **OH_AVCodecOnNeedInputBuffer** 112 113Implementation of the codec output callback: **OH_AVCodecOnNewOutputBuffer** 114 115Container format **OH_AVCODEC_MIMETYPE_VIDEO_MPEG4**: no longer supported 116 117Audio channel settings: **OH_AudioChannelSet** 118 119Audio channel layouts: **OH_AudioChannelLayout** 120 121## cl.multimedia.3 VideoDecoder Module APIs Changed 122 123**Access Level** 124 125Public API 126 127**Reason for Change** 128 129The **AVMemory** struct is deprecated and replaced by **AVBuffer**. 130 131**Change Impact** 132 133The change is compatible with earlier versions. Use the new APIs in your code. 134 135**API Level** 136 137| API | API Level | 138| ----------------------- | :--------------------------------| 139| OH_VideoDecoder_SetCallback | 9 | 140| OH_VideoDecoder_PushInputData | 9 | 141| OH_VideoDecoder_RenderOutputData | 9 | 142| OH_VideoDecoder_FreeOutputData | 9 | 143 144**Change Since** 145 146OpenHarmony SDK 4.1.6.3 147 148**Key API/Component Changes** 149 150| Deprecated API | Deprecated Description | Substitute API | 151| ----------------------- | :--------------------------------| :----------------------------| 152| OH_VideoDecoder_SetCallback | The **AVBuffer** struct is used in the callback function registration.|OH_VideoDecoder_RegisterCallback| 153| OH_VideoDecoder_PushInputData | The **AVBuffer** struct is used in the decoder's input stream data.|OH_VideoDecoder_PushInputBuffer| 154| OH_VideoDecoder_RenderOutputData | The **AVBuffer** struct is used in the decoder's output rendering control.|OH_VideoDecoder_RenderOutputBuffer | 155| OH_VideoDecoder_FreeOutputData | The **AVBuffer** struct is used in the decoder's output rendering release.|OH_VideoDecoder_FreeOutputBuffer | 156 157**Adaptation Guide** 158 159Before change: 160 161Call **OH_VideoDecoder_SetCallback()** to set callback functions. 162 163Call **OH_VideoDecoder_PushInputData** to fill in stream data when an input callback is received. 164 165Call **OH_VideoDecoder_FreeOutputData** to release the output image or **OH_VideoDecoder_RenderOutputData** to render the image when an output callback is received. 166 167After change: 168 169Call **OH_VideoDecoder_RegisterCallback()** to set callback functions. 170 171Call **OH_VideoDecoder_PushInputBuffer** to fill in stream data when an input callback is received. 172 173Call **OH_VideoDecoder_FreeOutputBuffer** to release the output image or **OH_VideoDecoder_RenderOutputBuffer** to render the image when an output callback is received. 174 175 176## cl.multimedia.4 VideoEncoder Module APIs Changed 177 178**Access Level** 179 180Public API 181 182**Reason for Change** 183 184The **AVMemory** struct is deprecated and replaced by **AVBuffer**. 185 186**Change Impact** 187 188The change is compatible with earlier versions. Use the new APIs in your code. 189 190**API Level** 191 192| API | API Level | 193| ----------------------- | :--------------------------------| 194| OH_VideoEncoder_SetCallback | 9 | 195| OH_VideoEncoder_PushInputData | 9 | 196| OH_VideoEncoder_FreeOutputData | 9 | 197 198**Change Since** 199 200OpenHarmony SDK 4.1.6.3 201 202**Key API/Component Changes** 203 204| Deprecated API | Deprecated Description | Substitute API | 205| ----------------------- | :--------------------------------| :----------------------------| 206| OH_VideoEncoder_SetCallback | The **AVBuffer** struct is used in the callback function registration.|OH_VideoEncoder_RegisterCallback| 207| OH_VideoEncoder_PushInputData | The **AVBuffer** struct is used in the encoder's input stream data.|OH_VideoEncoder_PushInputBuffer| 208| OH_VideoEncoder_FreeOutputData | The **AVBuffer** struct is used in the encoder's output rendering release.|OH_VideoEncoder_FreeOutputBuffer | 209 210**Adaptation Guide** 211 212Before change: 213 214Call **OH_VideoEncoder_SetCallback()** to set callback functions. 215 216Call **OH_VideoEncoder_PushInputData** to fill in data to encode when an input callback is received. 217 218Call **OH_VideoEncoder_FreeOutputData** to release output data when an output callback is received. 219 220After change: 221 222Call **OH_VideoEncoder_RegisterCallback()** to set callback functions. 223 224Call **OH_VideoEncoder_PushInputBuffer** to fill in data to encode when an input callback is received. 225 226Call **OH_VideoEncoder_FreeOutputBuffer** to release output data when an output callback is received. 227 228 229## cl.multimedia.5 AVDemuxer Module APIs Changed 230 231**Access Level** 232 233Public API 234 235**Reason for Change** 236 237The **AVMemory** struct is deprecated and replaced by **AVBuffer**. 238 239**Change Impact** 240 241The change is compatible with earlier versions. Use the new API in your code. 242 243**API Level** 244 245| API | API Level | 246| ----------------------- | :--------------------------------| 247| OH_AVDemuxer_ReadSample | 10 | 248 249**Change Since** 250 251OpenHarmony SDK 4.1.6.3 252 253**Key API/Component Changes** 254 255| Deprecated API | Deprecated Description | Substitute API | 256| ----------------------- | :--------------------------------| :----------------------------| 257| OH_AVDemuxer_ReadSample | The **AVBuffer** struct is used when the demuxer reads frames.|OH_AVDemuxer_ReadSampleBuffer| 258 259**Adaptation Guide** 260 261Before change: 262 263**OH_AVDemuxer_ReadSample()** is used to read compressed frames and related information. 264 265After change: 266 267Call **OH_AVDemuxer_ReadSampleBuffer()** to read compressed frames and related information. 268 269## cl.multimedia.6 AVMuxer Module APIs Changed 270 271**Access Level** 272 273Public API 274 275**Reason for Change** 276 277The **AVMemory** struct is deprecated and replaced by **AVBuffer**. 278 279**Change Impact** 280 281The change is compatible with earlier versions. Use the new API in your code. 282 283**API Level** 284 285| API | API Level | 286| ----------------------- | :--------------------------------| 287| OH_AVMuxer_WriteSample | 10 | 288 289**Change Since** 290 291OpenHarmony SDK 4.1.6.3 292 293**Key API/Component Changes** 294 295| Deprecated API | Deprecated Description | Substitute API | 296| ----------------------- | :--------------------------------| :----------------------------| 297| OH_AVMuxer_WriteSample | The **AVBuffer** struct is used when the muxer writes frames.|OH_AVMuxer_WriteSampleBuffer| 298 299**Adaptation Guide** 300 301Before change: 302 303Call **OH_AVMuxer_WriteSample()** to write compressed frames and related information. 304 305After change: 306 307Call **OH_AVMuxer_WriteSampleBuffer()** to write compressed frames and related information. 308 309## cl.multimedia.7 AudioDecoder Module APIs Changed 310 311**Access Level** 312 313Public API 314 315**Reason for Change** 316 317The **AVMemory** struct is deprecated and replaced by **AVBuffer**. The **AudioDecoder** module is changed to the **AudioCodec** module. 318 319**Change Impact** 320 321The change is compatible with earlier versions. Use the new APIs in your code. 322 323**API Level** 324 325| API | API Level | 326| ----------------------- | :--------------------------------| 327| OH_AudioDecoder_CreateByName | 9 | 328| OH_AudioDecoder_CreateByMime | 9 | 329| OH_AudioDecoder_SetCallback | 9 | 330| OH_AudioDecoder_Configure | 9 | 331| OH_AudioDecoder_Prepare | 9 | 332| OH_AudioDecoder_Start | 9 | 333| OH_AudioDecoder_PushInputData | 9 | 334| OH_AudioDecoder_FreeOutputData | 9 | 335| OH_AudioDecoder_Flush | 9 | 336| OH_AudioDecoder_IsValid | 10 | 337| OH_AudioDecoder_Reset | 9 | 338| OH_AudioDecoder_Stop | 9 | 339| OH_AudioDecoder_Destroy | 9 | 340 341 342**Change Since** 343 344OpenHarmony SDK 4.1.6.3 345 346**Key API/Component Changes** 347 348| Deprecated API | Deprecated Description | Substitute API | 349| ----------------------- | :--------------------------------| :----------------------------| 350| OH_AudioDecoder_CreateByName | The **AudioDecoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_CreateByName | 351| OH_AudioDecoder_CreateByMime | The **AudioDecoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_CreateByMime | 352| OH_AudioDecoder_SetCallback | The **AudioDecoder** module is changed to the **AudioCodec** module. The **AVBuffer** struct is used in the callback function registration.| OH_AudioCodec_RegisterCallback | 353| OH_AudioDecoder_Configure | The **AudioDecoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Configure | 354| OH_AudioDecoder_Prepare | The **AudioDecoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Prepare | 355| OH_AudioDecoder_Start | The **AudioDecoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Start | 356| OH_AudioDecoder_PushInputData | The **AudioDecoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_PushInputBuffer | 357| OH_AudioDecoder_FreeOutputData | The **AudioDecoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_FreeOutputBuffer | 358| OH_AudioDecoder_Flush | The **AudioDecoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Flush | 359| OH_AudioDecoder_IsValid | The **AudioDecoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_IsValid | 360| OH_AudioDecoder_Reset | The **AudioDecoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Reset | 361| OH_AudioDecoder_Stop | The **AudioDecoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Stop | 362| OH_AudioDecoder_Destroy | The **AudioDecoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Destroy | 363 364**Adaptation Guide** 365 366Before change: 367 368Call **OH_AudioDecoder_CreateByName()** or **OH_AudioDecoder_CreateByMime()** to create a decoder. 369 370Call **OH_AudioDecoder_SetCallback()** to set callback functions. 371 372Call **OH_AudioDecoder_Configure()** to configure the decoder. 373 374Call **OH_AudioDecoder_Prepare()** to prepare internal resources for the decoder. 375 376Call **OH_AudioDecoder_Start()** to start the decoder. 377 378Call **OH_AudioDecoder_PushInputData()** to write the data to decode. 379 380Call **OH_AudioDecoder_FreeOutputData()** to output decoded PCM streams. 381 382(Optional) Call **OH_AudioDecoder_Flush()** to refresh the decoder. 383 384(Optional) Call **OH_AudioDecoder_IsValid()** to determine whether the execution can be continued. 385 386(Optional) Call **OH_AudioDecoder_Reset()** to reset the decoder. 387 388Call **OH_AudioDecoder_Stop()** to stop the decoder. 389 390Call **OH_AudioDecoder_Destroy()** to destroy the decoder instance and release resources. 391 392After change: 393 394Call **OH_AudioCodec_CreateByName()** or **OH_AudioCodec_CreateByMime** to create a codec. 395 396Call **OH_AudioCodec_SetCallback()** to set callback functions. 397 398Call **OH_AudioCodec_Configure()** to configure the codec. 399 400Call **OH_AudioCodec_Prepare()** to prepare internal resources for the codec. 401 402Call **OH_AudioCodec_Start()** to start the codec. 403 404Call **OH_AudioCodec_PushInputData()** to write the data to decode. 405 406Call **OH_AudioCodec_FreeOutputData()** to output the codec stream. 407 408(Optional) Call **OH_AudioCodec_Flush()** to refresh the codec. 409 410(Optional) Call **OH_AudioCodec_IsValid()** to determine whether the execution can be continued. 411 412(Optional) Call **OH_AudioCodec_Reset()** to reset the codec. 413 414Call **OH_AudioCodec_Stop()** to stop the codec. 415 416Call **OH_AudioCodec_Destroy()** to destroy the codec instance and release resources. 417 418## cl.multimedia.8 AudioEncoder Module APIs Changed 419 420**Access Level** 421 422Public API 423 424**Reason for Change** 425 426The **AVMemory** struct is deprecated and replaced by **AVBuffer**. The **AudioEncoder** module is changed to the **AudioCodec** module. 427 428**Change Impact** 429 430The change is compatible with earlier versions. Use the new APIs in your code. 431 432**API Level** 433 434| API | API Level | 435| ----------------------- | :--------------------------------| 436| OH_AudioEncoder_CreateByName | 9 | 437| OH_AudioEncoder_CreateByMime | 9 | 438| OH_AudioEncoder_SetCallback | 9 | 439| OH_AudioEncoder_Configure | 9 | 440| OH_AudioEncoder_Prepare | 9 | 441| OH_AudioEncoder_Start | 9 | 442| OH_AudioEncoder_PushInputData | 9 | 443| OH_AudioEncoder_FreeOutputData | 9 | 444| OH_AudioEncoder_Flush | 9 | 445| OH_AudioEncoder_IsValid | 10 | 446| OH_AudioEncoder_Reset | 9 | 447| OH_AudioEncoder_Stop | 9 | 448| OH_AudioEncoder_Destroy | 9 | 449 450 451**Change Since** 452 453OpenHarmony SDK 4.1.6.3 454 455**Key API/Component Changes** 456 457| Deprecated API | Deprecated Description | Substitute API | 458| ----------------------- | :--------------------------------| :----------------------------| 459| OH_AudioEncoder_CreateByName | The **AudioEncoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_CreateByName | 460| OH_AudioEncoder_CreateByMime | The **AudioEncoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_CreateByMime | 461| OH_AudioEncoder_SetCallback | The **AudioEncoder** module is changed to the **AudioCodec** module. The **AVBuffer** struct is used in the callback function registration.| OH_AudioCodec_RegisterCallback | 462| OH_AudioEncoder_Configure | The **AudioEncoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Configure | 463| OH_AudioEncoder_Prepare | The **AudioEncoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Prepare | 464| OH_AudioEncoder_Start | The **AudioEncoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Start | 465| OH_AudioEncoder_PushInputData | The **AudioEncoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_PushInputBuffer | 466| OH_AudioEncoder_FreeOutputData | The **AudioEncoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_FreeOutputBuffer | 467| OH_AudioEncoder_Flush | The **AudioEncoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Flush | 468| OH_AudioEncoder_IsValid | The **AudioEncoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_IsValid | 469| OH_AudioEncoder_Reset | The **AudioEncoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Reset | 470| OH_AudioEncoder_Stop | The **AudioEncoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Stop | 471| OH_AudioEncoder_Destroy | The **AudioEncoder** module is changed to the **AudioCodec** module.| OH_AudioCodec_Destroy | 472 473**Adaptation Guide** 474 475Before change: 476 477Call **OH_AudioEncoder_CreateByName()** or **OH_AudioEncoder_CreateByMime** to create an encoder. 478 479Call **OH_AudioEncoder_SetCallback()** to set callback functions. 480 481Call **OH_AudioEncoder_Configure()** to configure the encoder. 482 483Call **OH_AudioEncoder_Prepare()** to prepare internal resources for the encoder. 484 485Call **OH_AudioEncoder_Start()** to start the encoder. 486 487Call **OH_AudioEncoder_PushInputData()** to write the data to encode. 488 489Call **OH_AudioEncoder_FreeOutputData()** to output the encoded stream. 490 491(Optional) Call **OH_AudioEncoder_Flush()** to refresh the encoder. 492 493(Optional) Call **OH_AudioEncoder_IsValid()** to determine whether the execution can be continued. 494 495(Optional) Call **OH_AudioEncoder_Reset()** to reset the encoder. 496 497Call **OH_AudioEncoder_Stop()** to stop the encoder. 498 499Call **OH_AudioEncoder_Destroy()** to destroy the encoder instance and release resources. 500 501After change: 502 503Call **OH_AudioCodec_CreateByName()** or **OH_AudioCodec_CreateByMime** to create a codec. 504 505Call **OH_AudioCodec_SetCallback()** to set callback functions. 506 507Call **OH_AudioCodec_Configure()** to configure the codec. 508 509Call **OH_AudioCodec_Prepare()** to prepare internal resources for the codec. 510 511Call **OH_AudioCodec_Start()** to start the codec. 512 513Call **OH_AudioCodec_PushInputData()** to write the data to decode. 514 515Call **OH_AudioCodec_FreeOutputData()** to output the codec stream. 516 517(Optional) Call **OH_AudioCodec_Flush()** to refresh the codec. 518 519(Optional) Call **OH_AudioCodec_IsValid()** to determine whether the execution can be continued. 520 521(Optional) Call **OH_AudioCodec_Reset()** to reset the codec. 522 523Call **OH_AudioCodec_Stop()** to stop the codec. 524 525Call **OH_AudioCodec_Destroy()** to destroy the codec instance and release resources. 526 527## cl.multimedia.9 Format Specifications Supported by AVPlayer and AVRecorder Changed 528 529**Access Level** 530 531Public API 532 533**Reason for Change** 534 535The **AVCodec** struct is used for muxing/demuxing and encoding/decoding. 536 537**Change Impact** 538 539The following formats are not supported: 540Container format: WebM 541Video decoding formats: H.263, MPEG2, MPEG4, and VP8 542Video encoding format: MPEG4 543 544**API Level** 545 54611 547 548**Change Since** 549 550OpenHarmony SDK 4.1.6.3 551 552**Key API/Component Changes** 553**AVPlayer** and **AVRecorder** 554 555**Adaptation Guide** 5561. Use MPEG4 rather than AVC for video encoding. 5572. If the container format WebM or video decoding format H.263/MPEG2/MPEG4/VP8 is used, the playback fails. In this case, you are advised to use the resources in the container format MP4 and video decoding format AVC. 558