From 0551ec2a504c0409564923696be40d8d25bf6128 Mon Sep 17 00:00:00 2001 From: li-jianchao1993 Date: Thu, 27 Jun 2024 15:16:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=20=E5=A2=9E=E5=8A=A0=E8=A7=A3=E7=A0=81?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E9=80=81=E6=98=BE=E6=97=B6=E9=97=B4=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=92=8C=E7=BC=96=E7=A0=81=E5=9D=87=E5=8C=80=E5=88=86?= =?UTF-8?q?=E5=B1=82=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-jianchao1993 --- multimedia/av_codec/native_avcodec_base.h | 3 ++ .../av_codec/native_avcodec_videodecoder.h | 32 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index fd602baa4a5..ed708d78856 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -841,6 +841,9 @@ typedef enum OH_TemporalGopReferenceMode { ADJACENT_REFERENCE = 0, /** Refer to latest long-term reference frame. */ JUMP_REFERENCE = 1, + /** Uniformly scaled reference structure, which has even distribution of video frames after drop the highest + * enhance layer. The temporal group of pictures must be power of 2. */ + UNIFORMLY_SCALED_REFERENCE = 2, } OH_TemporalGopReferenceMode; #ifdef __cplusplus diff --git a/multimedia/av_codec/native_avcodec_videodecoder.h b/multimedia/av_codec/native_avcodec_videodecoder.h index 12a664e4072..1b20c1af9a9 100644 --- a/multimedia/av_codec/native_avcodec_videodecoder.h +++ b/multimedia/av_codec/native_avcodec_videodecoder.h @@ -366,6 +366,38 @@ OH_AVErrCode OH_VideoDecoder_PushInputBuffer(OH_AVCodec *codec, uint32_t index); */ OH_AVErrCode OH_VideoDecoder_RenderOutputBuffer(OH_AVCodec *codec, uint32_t index); +/** + * @brief Return the processed output buffer with render timestamp to the decoder, and notify the decoder to finish + * rendering the decoded data contained in the buffer on the output surface. If the output surface is not configured + * before, calling this interface only returns the output buffer corresponding to the specified index to the decoder. + * The timestamp may have special meaning depending on the destination surface. + * Invoker can use the timestamp to render the buffer at a specific time (at the VSYNC at or after the buffer + * timestamp). For this to work, the timestamp needs to be reasonably close to the current SystemnanoTime. A few notes: + * 1. The buffer will not be returned to the codec until the timestamp has passed and the buffer is no longer used by + * the surface. + * 2. Buffers are processed sequentially, so you may block subsequent buffers to be displayed on the surface. + * This is important if you want to react to user action, e.g. stop the video or seek. + * 3. If multiple buffers are sent to the surface to be rendered at the same VSYNC, the last one will be shown, and the + * other ones will be dropped. + * 4. If the timestamp is not "reasonably close" to the current system time, the Surface will + * ignore the timestamp, and display the buffer at the earliest feasible time. In this mode it will not drop frames. + * @syscap SystemCapability.Multimedia.Media.VideoDecoder + * @param codec Pointer to an OH_AVCodec instance + * @param index The index value corresponding to the output buffer, should be given by {@link + * OH_AVCodecOnNewOutputBuffer} + * @param renderTimestampNs The timestamp is associated with the output buffer when it is sent to the surface. The unit + * is nanosecond + * @return Returns AV_ERR_OK if the execution is successful, + * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. + * {@link AV_ERR_NO_MEMORY}, the codec has already released. + * {@link AV_ERR_INVALID_VAL}, the parameter is invalid. + * {@link AV_ERR_UNKNOWN}, unknown error. + * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. + * @since 12 + */ +OH_AVErrCode OH_VideoDecoder_RenderOutputBufferAtTime(OH_AVCodec *codec, uint32_t index, int64_t renderTimestampNs); + /** * @brief Return the processed output Buffer to the decoder. * @syscap SystemCapability.Multimedia.Media.VideoDecoder -- Gitee From a78bc2d9a13d17be0505903451343c3b237fb66c Mon Sep 17 00:00:00 2001 From: li-jianchao1993 Date: Mon, 1 Jul 2024 21:36:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=20=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-jianchao1993 --- multimedia/av_codec/native_avcodec_videodecoder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multimedia/av_codec/native_avcodec_videodecoder.h b/multimedia/av_codec/native_avcodec_videodecoder.h index 1b20c1af9a9..d7bf69199f9 100644 --- a/multimedia/av_codec/native_avcodec_videodecoder.h +++ b/multimedia/av_codec/native_avcodec_videodecoder.h @@ -372,7 +372,7 @@ OH_AVErrCode OH_VideoDecoder_RenderOutputBuffer(OH_AVCodec *codec, uint32_t inde * before, calling this interface only returns the output buffer corresponding to the specified index to the decoder. * The timestamp may have special meaning depending on the destination surface. * Invoker can use the timestamp to render the buffer at a specific time (at the VSYNC at or after the buffer - * timestamp). For this to work, the timestamp needs to be reasonably close to the current SystemnanoTime. A few notes: + * timestamp). For this to work, the timestamp needs to be reasonably close to the current SystemNanoTime. A few notes: * 1. The buffer will not be returned to the codec until the timestamp has passed and the buffer is no longer used by * the surface. * 2. Buffers are processed sequentially, so you may block subsequent buffers to be displayed on the surface. -- Gitee