未验证 提交 94f8fb98 编写于 作者: O openharmony_ci 提交者: Gitee

!21421 翻译完成:20953+20904+20954+20554 media 文件夹更新

Merge pull request !21421 from wusongqing/TR20953
......@@ -73,33 +73,33 @@ The figure below shows the call relationship of audio decoding.
```
2. Call **OH_AudioDecoder_SetCallback()** to set callback functions.
Register the **OH_AVCodecAsyncCallback** struct that defines the following callback function pointers:
- **OnError**, a callback used to report a codec operation error
- **OnOutputFormatChanged**, a callback used to report a codec stream change, for example, audio channel change
- **OnInputBufferAvailable**, a callback used to report input data required, which means that the decoder is ready for receiving data
- **OnOutputBufferAvailable**, a callback used to report output data generated, which means that decoding is complete
- **OH_AVCodecOnError**, a callback used to report a codec operation error
- **OH_AVCodecOnStreamChanged**, a callback used to report a codec stream change, for example, audio channel change
- **OH_AVCodecOnNeedInputData**, a callback used to report input data required, which means that the decoder is ready for receiving data
- **OH_AVCodecOnNewOutputData**, a callback used to report output data generated, which means that decoding is complete
You need to process the callback functions to ensure that the decoder runs properly.
```cpp
// Set the OnError callback function.
```cpp
// Implement the OH_AVCodecOnError callback function.
static void OnError(OH_AVCodec *codec, int32_t errorCode, void *userData)
{
(void)codec;
(void)errorCode;
(void)userData;
}
// Set the OnOutputFormatChanged callback function.
static void OnOutputFormatChanged(OH_AVCodec *codec, OH_AVFormat *format, void*userData)
// Implement the OH_AVCodecOnStreamChanged callback function.
static void OnStreamChanged(OH_AVCodec *codec, OH_AVFormat *format, void*userData)
{
(void)codec;
(void)format;
(void)userData;
}
// Set the OnInputBufferAvailable callback function, which is used to send the input stream to the InputBuffer queue.
static void OnInputBufferAvailable(OH_AVCodec *codec, uint32_t index, OH_AVMemory*data, void *userData)
// Implement the OH_AVCodecOnNeedInputData callback function.
static void onNeedInputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory*data, void *userData)
{
(void)codec;
ADecSignal *signal = static_cast<ADecSignal *>(userData);
......@@ -109,8 +109,8 @@ The figure below shows the call relationship of audio decoding.
signal->inCond_.notify_all();
// The input stream is sent to the InputBuffer queue.
}
// Set the OnOutputBufferAvailable callback function, which is used to send the PCM stream obtained after decoding to the OutputBuffer queue.
static void OnOutputBufferAvailable(OH_AVCodec *codec, uint32_t index, OH_AVMemory*data, OH_AVCodecBufferAttr *attr,
// Implement the OH_AVCodecOnNewOutputData callback function.
static void onNeedOutputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory*data, OH_AVCodecBufferAttr *attr,
void *userData)
{
(void)codec;
......@@ -126,14 +126,13 @@ The figure below shows the call relationship of audio decoding.
// The decoded data is sent to the OutputBuffer queue.
}
signal_ = new ADecSignal();
OH_AVCodecAsyncCallback cb = {&OnError, &OnOutputFormatChanged, OnInputBufferAvailable, &OnOutputBufferAvailable};
OH_AVCodecAsyncCallback cb = {&OnError, &OnStreamChanged, &onNeedInputData, &onNeedOutputData};
// Set the asynchronous callbacks.
int32_t ret = OH_AudioDecoder_SetCallback(audioDec, cb, signal_);
if (ret != AV_ERR_OK) {
// Exception handling.
}
```
```
3. Call **OH_AudioDecoder_Configure()** to configure the decoder.
The following options are mandatory: sampling rate, bit rate, and number of audio channels. The maximum input length is optional.
......@@ -141,7 +140,7 @@ The figure below shows the call relationship of audio decoding.
- For AAC decoding, the parameter that specifies whether the data type is Audio Data Transport Stream (ADTS) must be specified. If this parameter is not specified, the data type is considered as Low Overhead Audio Transport Multiplex (LATM).
- For Vorbis decoding, the ID header and setup header must also be specified.
```cpp
```cpp
enum AudioFormatType : int32_t {
TYPE_AAC = 0,
TYPE_FLAC = 1,
......@@ -176,8 +175,7 @@ The figure below shows the call relationship of audio decoding.
if (ret != AV_ERR_OK) {
// Exception handling.
}
```
```
4. Call **OH_AudioDecoder_Prepare()** to prepare internal resources for the decoder.
```cpp
......@@ -186,7 +184,6 @@ The figure below shows the call relationship of audio decoding.
// Exception handling.
}
```
5. Call **OH_AudioDecoder_Start()** to start the decoder.
```c++
......@@ -202,12 +199,10 @@ The figure below shows the call relationship of audio decoding.
// Exception handling.
}
```
6. Call **OH_AudioDecoder_PushInputData()** to write the data to decode.
To indicate the End of Stream (EOS), pass in the **AVCODEC_BUFFER_FLAGS_EOS** flag.
```c++
```c++
// Configure the buffer information.
OH_AVCodecBufferAttr info;
// Set the package size, offset, and timestamp.
......@@ -228,8 +223,7 @@ The figure below shows the call relationship of audio decoding.
if (ret != AV_ERR_OK) {
// Exception handling.
}
```
```
7. Call **OH_AudioDecoder_FreeOutputData()** to output decoded PCM streams.
```c++
......@@ -244,7 +238,6 @@ The figure below shows the call relationship of audio decoding.
// Exception handling.
}
```
8. (Optional) Call **OH_AudioDecoder_Flush()** to refresh the decoder.
After **OH_AudioDecoder_Flush()** is called, the decoder remains in the running state, but the current queue is cleared and the buffer storing the decoded data is freed. To continue decoding, you must call **OH_AudioDecoder_Start()** again.
......@@ -265,24 +258,22 @@ The figure below shows the call relationship of audio decoding.
// Exception handling.
}
```
9. (Optional) Call **OH_AudioDecoder_Reset()** to reset the decoder.
After **OH_AudioDecoder_Reset()** is called, the decoder returns to the initialized state. To continue decoding, you must call **OH_AudioDecoder_Configure()** and then **OH_AudioDecoder_Start()**.
```c++
// Reset the decoder.
ret = OH_AudioDecoder_Reset(audioDec);
if (ret != AV_ERR_OK) {
// Exception handling.
}
// Reconfigure the decoder.
ret = OH_AudioDecoder_Configure(audioDec, format);
if (ret != AV_ERR_OK) {
// Exception handling.
}
```
```c++
// Reset the decoder.
ret = OH_AudioDecoder_Reset(audioDec);
if (ret != AV_ERR_OK) {
// Exception handling.
}
// Reconfigure the decoder.
ret = OH_AudioDecoder_Configure(audioDec, format);
if (ret != AV_ERR_OK) {
// Exception handling.
}
```
10. Call **OH_AudioDecoder_Stop()** to stop the decoder.
```c++
......@@ -293,18 +284,17 @@ The figure below shows the call relationship of audio decoding.
}
return ret;
```
11. Call **OH_AudioDecoder_Destroy()** to destroy the decoder instance and release resources.
**NOTE**: You only need to call this API once.
```c++
// Call OH_AudioDecoder_Destroy to destroy the decoder.
ret = OH_AudioDecoder_Destroy(audioDec);
if (ret != AV_ERR_OK) {
// Exception handling.
} else {
audioEnc = NULL; // The decoder cannot be destroyed repeatedly.
}
return ret;
```
\ No newline at end of file
**NOTE**: You only need to call this API once.
```c++
// Call OH_AudioDecoder_Destroy to destroy the decoder.
ret = OH_AudioDecoder_Destroy(audioDec);
if (ret != AV_ERR_OK) {
// Exception handling.
} else {
audioEnc = NULL; // The decoder cannot be destroyed repeatedly.
}
return ret;
```
......@@ -50,7 +50,7 @@ The figure below shows the call relationship of audio encoding.
```cpp
// Create an encoder by MIME type.
OH_AVCodec *audioEnc = OH_AudioEncoder_CreateByMime(OH_AVCODEC_MIMETYPE_AUDIO_AAC);
OH_AVCodec *audioEnc = OH_AudioEncoder_CreateByMime(OH_AVCODEC_MIMETYPE_AUDIO_AAC);
```
```cpp
......@@ -76,47 +76,46 @@ The figure below shows the call relationship of audio encoding.
Register the **OH_AVCodecAsyncCallback** struct that defines the following callback function pointers:
- **OnError**, a callback used to report a codec operation error
- **OnOutputFormatChanged**, a callback used to report a codec stream change, for example, audio channel change
- **OnInputBufferAvailable**, a callback used to report input data required, which means that the encoder is ready for receiving PCM data
- **OnOutputBufferAvailable**, a callback used to report output data generated, which means that encoding is complete
- **OH_AVCodecOnError**, a callback used to report a codec operation error
- **OH_AVCodecOnStreamChanged**, a callback used to report a codec stream change, for example, audio channel change
- **OH_AVCodecOnNeedInputData**, a callback used to report input data required, which means that the encoder is ready for receiving PCM data
- **OH_AVCodecOnNewOutputData**, a callback used to report output data generated, which means that encoding is complete
You need to process the callback functions to ensure that the encoder runs properly.
```cpp
// Set the OnError callback function.
// Implement the OH_AVCodecOnError callback function.
static void OnError(OH_AVCodec *codec, int32_t errorCode, void *userData)
{
(void)codec;
(void)errorCode;
(void)userData;
}
// Set the OnOutputFormatChanged callback function.
static void OnOutputFormatChanged(OH_AVCodec *codec, OH_AVFormat *format, void *userData)
// Implement the OH_AVCodecOnStreamChanged callback function.
static void OnStreamChanged(OH_AVCodec *codec, OH_AVFormat *format, void *userData)
{
(void)codec;
(void)format;
(void)userData;
}
// Set the OnInputBufferAvailable callback function, which is used to send the input PCM data to the InputBuffer queue.
static void OnInputBufferAvailable(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData)
// Implement the OH_AVCodecOnNeedInputData callback function.
static void OnNeedInputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData)
{
(void)codec;
// The input stream is sent to the InputBuffer queue.
AEncSignal *signal = static_cast<AEncSignal *>(userData);
cout << "OnInputBufferAvailable received, index:" << index << endl;
unique_lock<mutex> lock(signal->inMutex_);
signal->inQueue_.push(index);
signal->inBufferQueue_.push(data);
signal->inCond_.notify_all();
}
// Set the OnOutputBufferAvailable callback function, which is used to send the encoded stream to the OutputBuffer queue.
static void OnOutputBufferAvailable(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, OH_AVCodecBufferAttr *attr,
// Implement the OH_AVCodecOnNewOutputData callback function.
static void OnNeedOutputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, OH_AVCodecBufferAttr *attr,
void *userData)
{
(void)codec;
// The index of the output buffer is sent to the OutputQueue.
// The encoded data is sent to the OutputBuffer queue.
// The index of the output buffer is sent to OutputQueue_.
// The encoded data is sent to the outBuffer queue.
AEncSignal *signal = static_cast<AEncSignal *>(userData);
unique_lock<mutex> lock(signal->outMutex_);
signal->outQueue_.push(index);
......@@ -125,7 +124,7 @@ The figure below shows the call relationship of audio encoding.
signal->attrQueue_.push(*attr);
}
}
OH_AVCodecAsyncCallback cb = {&OnError, &OnOutputFormatChanged, &OnInputBufferAvailable, &OnOutputBufferAvailable};
OH_AVCodecAsyncCallback cb = {&OnError, &OnStreamChanged, &OnNeedInputData, &OnNeedOutputData};
// Set the asynchronous callbacks.
int32_t ret = OH_AudioEncoder_SetCallback(audioEnc, cb, userData);
```
......@@ -143,7 +142,7 @@ The figure below shows the call relationship of audio encoding.
};
int32_t ret;
// (Mandatory) Configure the audio sampling rate.
constexpr uint32_t DEFAULT_SMAPLERATE = 44100;
constexpr uint32_t DEFAULT_SMAPLERATE = 44100;
// (Mandatory) Configure the audio bit rate.
constexpr uint32_t DEFAULT_BITRATE = 32000;
// (Mandatory) Configure the number of audio channels.
......@@ -193,7 +192,7 @@ The figure below shows the call relationship of audio encoding.
```c++
inputFile_ = std::make_unique<std::ifstream>();
// Open the path of the binary file to be encoded.
inputFile_->open(inputFilePath.data(), std::ios::in |std::ios::binary);
inputFile_->open(inputFilePath.data(), std::ios::in |std::ios::binary);
// Configure the path of the output file.
outFile_ = std::make_unique<std::ofstream>();
outFile_->open(outputFilePath.data(), std::ios::out |std::ios::binary);
......
......@@ -15,21 +15,24 @@ Video software decoding and hardware decoding are different. When a decoder is c
Read [VideoDecoder](../reference/native-apis/_video_decoder.md) for the API reference.
The figure below shows the call relationship of video decoding.
![Call relationship of video decoding](figures/video-decode.png)
1. Create a decoder instance.
You can create a decoder by name or MIME type.
``` c++
// Create a decoder by name.
// To create a decoder by name, call OH_AVCapability_GetName to obtain the codec names available and then call OH_VideoDecoder_CreateByName. If your application has special requirements, for example, expecting a decoder that supports a certain resolution, you can call OH_AVCodec_GetCapability to query the capability first.
OH_AVCapability *capability = OH_AVCodec_GetCapability(OH_AVCODEC_MIMETYPE_VIDEO_AVC, false);
const char *name = OH_AVCapability_GetName(capability);
OH_AVCodec *videoDec = OH_VideoDecoder_CreateByName(name); // name:"OH.Media.Codec.Decoder.Video.AVC"
OH_AVCodec *videoDec = OH_VideoDecoder_CreateByName(name);
```
```c++
// Create a decoder by MIME type.
// Create an H.264 decoder for software/hardware decoding.
// Create an H.264 decoder for software/hardware decoding. The system creates the most appropriate decoder if multiple decoders are available.
OH_AVCodec *videoDec = OH_VideoDecoder_CreateByMime(OH_AVCODEC_MIMETYPE_VIDEO_AVC);
// Create a decoder by MIME type.
// Create an H.265 decoder for hardware decoding.
OH_AVCodec *videoDec = OH_VideoDecoder_CreateByMime(OH_AVCODEC_MIMETYPE_VIDEO_HEVC);
```
......@@ -54,30 +57,32 @@ Read [VideoDecoder](../reference/native-apis/_video_decoder.md) for the API refe
Register the **OH_AVCodecAsyncCallback** struct that defines the following callback function pointers:
- **OnError**, a callback used to report a codec operation error
- **OnOutputFormatChanged**, a callback used to report a codec stream change, for example, stream width or height change.
- **OnInputBufferAvailable**, a callback used to report input data required, which means that the decoder is ready for receiving data
- **OnOutputBufferAvailable**, a callback used to report output data generated, which means that decoding is complete (Note: The **data** parameter in the callback function is empty in surface output mode.)
- **OH_AVCodecOnError**, a callback used to report a codec operation error
- **OH_AVCodecOnStreamChanged**, a callback used to report a codec stream change, for example, stream width or height change.
- **OH_AVCodecOnNeedInputData**, a callback used to report input data required, which means that the decoder is ready for receiving data
- **OH_AVCodecOnNewOutputData**, a callback used to report output data generated, which means that decoding is complete (Note: The **data** parameter in the callback function is empty in surface output mode.)
You need to process the callback functions to ensure that the decoder runs properly.
``` c++
// Set the OnError callback function.
// Implement the OH_AVCodecOnError callback function.
static void OnError(OH_AVCodec *codec, int32_t errorCode, void *userData)
{
(void)codec;
(void)errorCode;
(void)userData;
}
// Set the OnOutputFormatChanged callback function.
static void OnOutputFormatChanged(OH_AVCodec *codec, OH_AVFormat *format, void *userData)
// Implement the OH_AVCodecOnStreamChanged callback function.
static void OnStreamChanged(OH_AVCodec *codec, OH_AVFormat *format, void *userData)
{
(void)codec;
(void)format;
(void)userData;
}
// Set the OnInputBufferAvailable callback function, which is used to obtain the input frame information.
static void OnInputBufferAvailable(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData)
// Implement the OH_AVCodecOnNeedInputData callback function.
static void OnNeedInputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData)
{
(void)codec;
VDecSignal *signal_ = static_cast<VDecSignal *>(userData);
......@@ -88,8 +93,9 @@ Read [VideoDecoder](../reference/native-apis/_video_decoder.md) for the API refe
signal_->inBufferQueue_.push(data);
signal_->inCond_.notify_all();
}
// Set the OnOutputBufferAvailable callback function, which is used to obtain the output frame information.
static void OnOutputBufferAvailable(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, OH_AVCodecBufferAttr *attr,
// Implement the OH_AVCodecOnNewOutputData callback function.
static void OnNeedOutputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, OH_AVCodecBufferAttr *attr,
void *userData)
{
(void)codec;
......@@ -102,7 +108,7 @@ Read [VideoDecoder](../reference/native-apis/_video_decoder.md) for the API refe
signal_->attrQueue_.push(*attr);
signal_->outCond_.notify_all();
}
OH_AVCodecAsyncCallback cb = {&OnError, &OnOutputFormatChanged, &OnInputBufferAvailable, &OnOutputBufferAvailable};
OH_AVCodecAsyncCallback cb = {&OnError, &OnStreamChanged, &OnNeedInputData, &OnNeedOutputData};
// Set the asynchronous callbacks.
int32_t ret = OH_VideoDecoder_SetCallback(videoDec, cb, signal_);
```
......@@ -146,7 +152,7 @@ Read [VideoDecoder](../reference/native-apis/_video_decoder.md) for the API refe
```
5. (Optional) Configure the surface parameters of the decoder. This step is required only when the surface is used.
``` c++
OH_AVFormat *format = OH_AVFormat_Create();
// Configure the display rotation angle.
......@@ -179,7 +185,7 @@ Read [VideoDecoder](../reference/native-apis/_video_decoder.md) for the API refe
``` c++
// Configure the buffer information.
OH_AVCodecBufferAttr info;
// Call av_packet_alloc to initialize and return a container packet.
// Call av_packet_alloc of FFmpeg to initialize and return a container packet.
AVPacket pkt = av_packet_alloc();
// Configure the input size, offset, and timestamp of the buffer.
info.size = pkt->size;
......@@ -208,9 +214,9 @@ Read [VideoDecoder](../reference/native-apis/_video_decoder.md) for the API refe
```
9. (Optional) Call **OH_VideoDecoder_Flush()** to refresh the decoder.
After **OH_VideoDecoder_Flush()** is called, the decoder remains in the running state, but the current queue is cleared and the buffer storing the decoded data is freed.
To continue decoding, you must call **OH_VideoDecoder_Start()** again.
``` c++
......@@ -225,7 +231,7 @@ Read [VideoDecoder](../reference/native-apis/_video_decoder.md) for the API refe
```
10. (Optional) Call **OH_VideoDecoder_Reset()** to reset the decoder.
After **OH_VideoDecoder_Reset()** is called, the decoder returns to the initialized state. To continue decoding, you must call **OH_VideoDecoder_Configure()** and then **OH_VideoDecoder_Start()**.
``` c++
......@@ -240,7 +246,7 @@ Read [VideoDecoder](../reference/native-apis/_video_decoder.md) for the API refe
```
11. Call **OH_VideoDecoder_Stop()** to stop the decoder.
``` c++
int32_t ret;
// Stop the decoder.
......
......@@ -29,14 +29,19 @@ For details about the development procedure, see [Buffer Input](#buffer-input) a
Read [VideoEncoder](../reference/native-apis/_video_encoder.md) for the API reference.
The figure below shows the call relationship of video encoding.
![Call relationship of video encoding](figures/video-encode.png)
### Buffer Input
The following walks you through how to implement the entire video encoding process in buffer input mode. It uses the YUV file input and H.264 encoding format as an example.
Currently, the **VideoEncoder** module supports only data transferring in asynchronous mode.
1. Create an encoder instance.
You can create an encoder by name or Multipurpose Internet Mail Extensions (MIME) type.
You can create an encoder by name or MIME type.
``` c++
// To create an encoder by MIME type, call OH_VideoEncoder_CreateByMime. The system creates the most appropriate encoder based on the MIME type.
......@@ -58,15 +63,15 @@ Currently, the **VideoEncoder** module supports only data transferring in asynch
Register the **OH_AVCodecAsyncCallback** struct that defines the following callback function pointers:
- **OnError**, a callback used to report a codec operation error
- **OnStreamChanged**, a callback used to report a codec stream change, for example, audio channel change
- **OnNeedInputData**, a callback used to report input data required, which means that the encoder is ready for receiving PCM data
- **OnNeedOutputData**, a callback used to report output data generated, which means that encoding is complete
- **OH_AVCodecOnError**, a callback used to report a codec operation error
- **OH_AVCodecOnStreamChanged**, a callback used to report a codec stream change, for example, audio channel change
- **OH_AVCodecOnNeedInputData**, a callback used to report input data required, which means that the encoder is ready for receiving PCM data
- **OH_AVCodecOnNewOutputData**, a callback used to report output data generated, which means that encoding is complete
You need to process the callback functions to ensure that the encoder runs properly.
``` c++
// Set the OnError callback function.
// Implement the OH_AVCodecOnError callback function.
static void OnError(OH_AVCodec *codec, int32_t errorCode, void *userData)
{
(void)codec;
......@@ -74,7 +79,7 @@ Currently, the **VideoEncoder** module supports only data transferring in asynch
(void)userData;
}
// Set the OnStreamChanged callback function.
// Implement the OH_AVCodecOnStreamChanged callback function.
static void OnStreamChanged(OH_AVCodec *codec, OH_AVFormat *format, void *userData)
{
(void)codec;
......@@ -82,7 +87,7 @@ Currently, the **VideoEncoder** module supports only data transferring in asynch
(void)userData;
}
// Set the OnNeedInputData callback function, which is used to send an input frame to the data queue.
// Implement the OH_AVCodecOnNeedInputData callback function.
static void OnNeedInputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *mem, void *userData)
{
(void)userData;
......@@ -92,8 +97,8 @@ Currently, the **VideoEncoder** module supports only data transferring in asynch
// 7. Write the stream to encode.
// 8. Notify the encoder of EOS.
}
// Set the OnNeedOutputData callback function, which is used to send an encoded frame to the output queue.
// Implement the OH_AVCodecOnNewOutputData callback function.
static void OnNeedOutputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *mem,
OH_AVCodecBufferAttr *attr, void *userData)
{
......@@ -259,7 +264,7 @@ Currently, the **VideoEncoder** module supports only data transferring in asynch
9. Call **OH_VideoEncoder_FreeOutputData()** to output the encoded frames.
In the code snippet below, the following parameters are used:
In the code snippet below, the following parameters are used:
- **index**: index of the data queue, which is passed in by the callback function **OnNeedOutputData**.
- **attr**: buffer storing the output data, which is passed in by the callback function **OnNeedOutputData**.
- **mem**: parameter passed in by the callback function **OnNeedOutputData**. You can call **OH_AVMemory_GetAddr** to obtain the pointer to the shared memory address.
......@@ -424,9 +429,9 @@ Currently, the **VideoEncoder** module supports only data transferring in asynch
Currently, the following options must be configured for all supported formats: video frame width, video frame height, and video pixel format.
In the code snippet below, the following data is used:
- **DEFAULT_WIDTH**: 320 pixels
- **DEFAULT_HEIGHT**: 240 pixels
- **DEFAULT_PIXELFORMAT**: **VideoPixelFormat::YUV420P** (the pixel format of the YUV file is YUV420P)
- **DEFAULT_WIDTH**: 320 pixels
- **DEFAULT_HEIGHT**: 240 pixels
- **DEFAULT_PIXELFORMAT**: **VideoPixelFormat::YUV420P** (the pixel format of the YUV file is YUV420P)
``` c++
// (Mandatory) Configure the video frame width.
......@@ -547,7 +552,7 @@ Currently, the **VideoEncoder** module supports only data transferring in asynch
10. Call **OH_VideoEncoder_FreeOutputData()** to output the encoded frames.
In the code snippet below, the following parameters are used:
In the code snippet below, the following parameters are used:
- **index**: index of the data queue, which is passed in by the callback function **OnNeedOutputData**.
- **attr**: buffer storing the output data, which is passed in by the callback function **OnNeedOutputData**.
- **mem**: parameter passed in by the callback function **OnNeedOutputData**. You can call **OH_AVMemory_GetAddr** to obtain the pointer to the shared memory address.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册