mirror of
https://gitee.com/openharmony/multimedia_av_codec
synced 2024-10-07 14:13:29 +00:00
commit
f16ee74f06
@ -29,12 +29,8 @@ std::shared_ptr<AVCodec> CodecFactory::CreateByMime(const std::string &mime, boo
|
||||
std::shared_ptr<AVCodecImpl> impl = std::make_shared<AVCodecImpl>();
|
||||
CHECK_AND_RETURN_RET_LOG(impl != nullptr, nullptr, "failed to new AVCodecImpl");
|
||||
|
||||
int32_t ret;
|
||||
if (encoder) {
|
||||
ret = impl->Init(AVCODEC_TYPE_ENCODER, true, mime);
|
||||
} else {
|
||||
ret = impl->Init(AVCODEC_TYPE_DECODER, true, mime);
|
||||
}
|
||||
AVCodecType codeType = encoder ? AVCODEC_TYPE_ENCODER : AVCODEC_TYPE_DECODER;
|
||||
int32_t ret = impl->Init(codeType, true, mime);;
|
||||
CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, nullptr, "failed to init AVCodecImpl");
|
||||
|
||||
return impl;
|
||||
@ -158,7 +154,7 @@ int32_t AVCodecImpl::SetCallback(const std::shared_ptr<AVCodecCallback> &callbac
|
||||
return codecService_->SetCallback(callback);
|
||||
}
|
||||
|
||||
sptr<Surface> AVCodecVideoEncoderImpl::CreateInputSurface()
|
||||
sptr<Surface> AVCodecImpl::CreateInputSurface()
|
||||
{
|
||||
CHECK_AND_RETURN_RET_LOG(codecService_ != nullptr, nullptr, "service died");
|
||||
surface_ = codecService_->CreateInputSurface();
|
||||
@ -183,5 +179,6 @@ int32_t AVCodecImpl::DequeueOutputBuffer(size_t *index, int64_t timetUs)
|
||||
return codecService_->DequeueOutputBuffer(surface);
|
||||
}
|
||||
|
||||
|
||||
} // namespace AVCodec
|
||||
} // namespace OHOS
|
||||
|
@ -82,8 +82,8 @@ OH_AVErrCode OH_AVCodec_Destroy(OH_AVCodec *codec);
|
||||
OH_AVErrCode OH_AVCodec_SetCallback(OH_AVCodec *codec, OH_AVCodecCallback callback, void *userData);
|
||||
|
||||
/**
|
||||
* @brief To configure the codec, typically, you need to configure the description information of the decoded
|
||||
* video track, which can be extracted from the container. This interface must be called before Start is called.
|
||||
* @brief To configure the codec, typically, you would get the fotmat from an extractor for decoding.
|
||||
* This interface must be called before Start is called.
|
||||
* @syscap SystemCapability.Multimedia.AVCodec.Codec
|
||||
* @param codec Pointer to an OH_AVCodec instance
|
||||
* @param format A pointer to an OH_AVFormat to give the description of the video track to be decoded
|
||||
@ -168,6 +168,30 @@ OH_AVFormat *OH_AVCodec_GetOutputFormat(OH_AVCodec *codec);
|
||||
*/
|
||||
OH_AVErrCode OH_AVCodec_SetParameter(OH_AVCodec *codec, OH_AVFormat *format);
|
||||
|
||||
/**
|
||||
* @brief Get the index of the next ready input buffer.
|
||||
* @syscap SystemCapability.Multimedia.AVCodec.Codec
|
||||
* @param codec Pointer to an OH_AVCodec instance
|
||||
* @param timeoutUs timeoutUs
|
||||
* @return Returns non-negtive value of the buffer index,
|
||||
* otherwise returns negtive value for invalid buffer index
|
||||
* @since 10
|
||||
* @version 4.0
|
||||
*/
|
||||
int32_t OH_AVCodec_DequeueInputBuffer(OH_AVCodec *codec, int64_t timeoutUs);
|
||||
|
||||
/**
|
||||
* @brief Get an input buffer.
|
||||
* The buffer index must be odbtained from OH_AVCodec_DequeueInputBuffer, and not queued yet.
|
||||
* @syscap SystemCapability.Multimedia.AVCodec.Codec
|
||||
* @param codec Pointer to an OH_AVCodec instance
|
||||
* @param index The index value corresponding to the input Buffer
|
||||
* @return Returns a pointer to an BufferElement instance
|
||||
* @since 10
|
||||
* @version 4.0
|
||||
*/
|
||||
OH_AVBufferElement* OH_AVCodec_GetInputBuffer(OH_AVCodec *codec, size_t index);
|
||||
|
||||
/**
|
||||
* @brief Submit the input buffer filled with data to the codec. The {@link OH_AVCodecOnInputDataReady} callback
|
||||
* will report the available input buffer and the corresponding index value. Once the buffer with the specified index
|
||||
@ -187,18 +211,20 @@ OH_AVErrCode OH_AVCodec_SetParameter(OH_AVCodec *codec, OH_AVFormat *format);
|
||||
OH_AVErrCode OH_AVCodec_QueueInputBuffer(OH_AVCodec *codec, uint32_t index, OH_AVCodecBufferAttr attr);
|
||||
|
||||
/**
|
||||
* @brief Get an input buffer.
|
||||
* @brief Get the index of the next ready output buffer of processed data.
|
||||
* @syscap SystemCapability.Multimedia.AVCodec.Codec
|
||||
* @param codec Pointer to an OH_AVCodec instance
|
||||
* @param index The index value corresponding to the input Buffer
|
||||
* @return Returns a pointer to an BufferElement instance
|
||||
* @param timeoutUs timeoutUs
|
||||
* @return Returns non-negtive value of the buffer index,
|
||||
* otherwise returns negtive value for invalid buffer index
|
||||
* @since 10
|
||||
* @version 4.0
|
||||
*/
|
||||
OH_AVBufferElement* OH_AVCodec_GetInputBuffer(OH_AVCodec *codec, size_t index);
|
||||
int32_t OH_AVCodec_DequeueOutputBuffer(OH_AVCodec *codec, int64_t timeoutUs);
|
||||
|
||||
/**
|
||||
* @brief Get an output buffer.
|
||||
* The buffer index must be odbtained from OH_AVCodec_DequeueOutputBuffer.
|
||||
* @syscap SystemCapability.Multimedia.AVCodec.Codec
|
||||
* @param codec Pointer to an OH_AVCodec instance
|
||||
* @param index The index value corresponding to the output Buffer
|
||||
@ -208,30 +234,6 @@ OH_AVBufferElement* OH_AVCodec_GetInputBuffer(OH_AVCodec *codec, size_t index);
|
||||
*/
|
||||
OH_AVBufferElement* OH_AVCodec_GetOutputBuffer(OH_AVCodec *codec, size_t index);
|
||||
|
||||
/**
|
||||
* @brief Get the index of the next ready input buffer.
|
||||
* @syscap SystemCapability.Multimedia.AVCodec.Codec
|
||||
* @param codec Pointer to an OH_AVCodec instance
|
||||
* @param timeoutUs timeoutUs
|
||||
* @return Returns 0 or positive of the buffer index,
|
||||
* otherwise returns negtive value for invalid buffer index
|
||||
* @since 10
|
||||
* @version 4.0
|
||||
*/
|
||||
int32_t OH_AVCodec_DequeueInputBuffer(OH_AVCodec *codec, int64_t timeoutUs);
|
||||
|
||||
/**
|
||||
* @brief Get the index of the next ready output buffer of processed data.
|
||||
* @syscap SystemCapability.Multimedia.AVCodec.Codec
|
||||
* @param codec Pointer to an OH_AVCodec instance
|
||||
* @param timeoutUs timeoutUs
|
||||
* @return Returns 0 or positive of the buffer index,
|
||||
* otherwise returns negtive value for invalid buffer index
|
||||
* @since 10
|
||||
* @version 4.0
|
||||
*/
|
||||
int32_t OH_AVCodec_DequeueOutputBuffer(OH_AVCodec *codec, int64_t timeoutUs);
|
||||
|
||||
/**
|
||||
* @brief Return the processed output Buffer to the codec.
|
||||
* @syscap SystemCapability.Multimedia.AVCodec.Codec
|
||||
|
Loading…
Reference in New Issue
Block a user