diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/avs/avs.c b/drivers/amlogic/media_modules/frame_provider/decoder/avs/avs.c index d7925496a0f8..810d5bcaf36a 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/avs/avs.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/avs/avs.c @@ -779,6 +779,9 @@ static void vavs_vf_put(struct vframe_s *vf, void *op_arg) int vavs_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { + if (!(stat & STAT_VDEC_RUN)) + return 0; + vstatus->frame_width = frame_width; vstatus->frame_height = frame_height; if (frame_dur != 0) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/avs2/vavs2.c b/drivers/amlogic/media_modules/frame_provider/decoder/avs2/vavs2.c index f7bb1c8d8268..612aafd27609 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/avs2/vavs2.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/avs2/vavs2.c @@ -5443,6 +5443,10 @@ int vavs2_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { struct AVS2Decoder_s *dec = (struct AVS2Decoder_s *)vdec->private; + + if (!dec || !(dec->stat & STAT_VDEC_RUN)) + return -1; + vstatus->frame_width = dec->frame_width; vstatus->frame_height = dec->frame_height; diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/h264/vh264.c b/drivers/amlogic/media_modules/frame_provider/decoder/h264/vh264.c index 16ba67bf7a59..274cfbb6851e 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/h264/vh264.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/h264/vh264.c @@ -2263,6 +2263,9 @@ exit: int vh264_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { + if (!(stat & STAT_VDEC_RUN)) + return -1; + vstatus->frame_width = frame_width; vstatus->frame_height = frame_height; if (frame_dur != 0) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c b/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c index b7fa966329bb..13d6cae87959 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c @@ -5237,6 +5237,10 @@ static void check_timer_func(unsigned long arg) static int dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { struct vdec_h264_hw_s *hw = (struct vdec_h264_hw_s *)vdec->private; + + if (!hw || !(hw->stat & STAT_VDEC_RUN)) + return -1; + vstatus->frame_width = hw->frame_width; vstatus->frame_height = hw->frame_height; if (hw->frame_dur != 0) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c b/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c index bc541094df53..c4595031ef4d 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c @@ -9078,6 +9078,9 @@ int vh265_dec_status(struct vdec_info *vstatus) #else struct hevc_state_s *hevc = gHevc; #endif + if (!hevc || !(hevc->stat & STAT_VDEC_RUN)) + return -1; + vstatus->frame_width = hevc->frame_width; vstatus->frame_height = hevc->frame_height; if (hevc->frame_dur != 0) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/mjpeg/vmjpeg.c b/drivers/amlogic/media_modules/frame_provider/decoder/mjpeg/vmjpeg.c index 57ed151a8c40..f3c7f68398a0 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/mjpeg/vmjpeg.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/mjpeg/vmjpeg.c @@ -418,6 +418,9 @@ static void vmjpeg_put_timer_func(unsigned long arg) int vmjpeg_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { + if (!(stat & STAT_VDEC_RUN)) + return -1; + vstatus->frame_width = frame_width; vstatus->frame_height = frame_height; if (0 != frame_dur) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/mjpeg/vmjpeg_multi.c b/drivers/amlogic/media_modules/frame_provider/decoder/mjpeg/vmjpeg_multi.c index 27f21bc17dc4..8b7f9fb5eecb 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/mjpeg/vmjpeg_multi.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/mjpeg/vmjpeg_multi.c @@ -384,6 +384,10 @@ static int vmjpeg_vf_states(struct vframe_states *states, void *op_arg) static int vmjpeg_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { struct vdec_mjpeg_hw_s *hw = (struct vdec_mjpeg_hw_s *)vdec->private; + + if (!hw || !(hw->stat & STAT_VDEC_RUN)) + return -1; + vstatus->frame_width = hw->frame_width; vstatus->frame_height = hw->frame_height; if (0 != hw->frame_dur) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/mpeg12/vmpeg12.c b/drivers/amlogic/media_modules/frame_provider/decoder/mpeg12/vmpeg12.c index fef5288ab4b8..ee2078c20fe4 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/mpeg12/vmpeg12.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/mpeg12/vmpeg12.c @@ -1362,6 +1362,9 @@ static void vmpeg_put_timer_func(unsigned long arg) int vmpeg12_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { + if (!(stat & STAT_VDEC_RUN)) + return -1; + vstatus->frame_width = frame_width; vstatus->frame_height = frame_height; if (frame_dur != 0) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/mpeg12/vmpeg12_multi.c b/drivers/amlogic/media_modules/frame_provider/decoder/mpeg12/vmpeg12_multi.c index b601f2b8721f..1b110046b321 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/mpeg12/vmpeg12_multi.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/mpeg12/vmpeg12_multi.c @@ -1084,8 +1084,10 @@ static int vmmpeg12_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { struct vdec_mpeg12_hw_s *hw = (struct vdec_mpeg12_hw_s *)vdec->private; - if (!hw) - return 0; + + if (!hw || !(hw->stat & STAT_VDEC_RUN)) + return -1; + vstatus->frame_width = hw->frame_width; vstatus->frame_height = hw->frame_height; if (hw->frame_dur != 0) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/mpeg4/vmpeg4.c b/drivers/amlogic/media_modules/frame_provider/decoder/mpeg4/vmpeg4.c index 501524b3e729..7f638085f416 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/mpeg4/vmpeg4.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/mpeg4/vmpeg4.c @@ -740,8 +740,9 @@ static void vmpeg_put_timer_func(unsigned long arg) int vmpeg4_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { - if (NULL == gvs) + if (!(stat & STAT_VDEC_RUN)) return -1; + vstatus->frame_width = vmpeg4_amstream_dec_info.width; vstatus->frame_height = vmpeg4_amstream_dec_info.height; if (0 != vmpeg4_amstream_dec_info.rate) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/mpeg4/vmpeg4_multi.c b/drivers/amlogic/media_modules/frame_provider/decoder/mpeg4/vmpeg4_multi.c index f2f231bfb2c0..4f62d601a284 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/mpeg4/vmpeg4_multi.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/mpeg4/vmpeg4_multi.c @@ -1039,8 +1039,10 @@ static int vmpeg_vf_states(struct vframe_states *states, void *op_arg) static int dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { struct vdec_mpeg4_hw_s *hw = (struct vdec_mpeg4_hw_s *)vdec->private; - if (NULL == hw) + + if (!hw || !(hw->stat & STAT_VDEC_RUN)) return -1; + vstatus->frame_width = hw->vmpeg4_amstream_dec_info.width; vstatus->frame_height = hw->vmpeg4_amstream_dec_info.height; if (0 != hw->vmpeg4_amstream_dec_info.rate) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/real/vreal.c b/drivers/amlogic/media_modules/frame_provider/decoder/real/vreal.c index fc3b20d2b7ed..b6135cd993de 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/real/vreal.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/real/vreal.c @@ -519,6 +519,9 @@ static void vreal_put_timer_func(unsigned long arg) int vreal_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { + if (!(stat & STAT_VDEC_RUN)) + return -1; + vstatus->frame_width = vreal_amstream_dec_info.width; vstatus->frame_height = vreal_amstream_dec_info.height; if (0 != vreal_amstream_dec_info.rate) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/vc1/vvc1.c b/drivers/amlogic/media_modules/frame_provider/decoder/vc1/vvc1.c index 658933878c96..687c78dd1972 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/vc1/vvc1.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/vc1/vvc1.c @@ -721,6 +721,9 @@ static int vvc1_event_cb(int type, void *data, void *private_data) int vvc1_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { + if (!(stat & STAT_VDEC_RUN)) + return -1; + vstatus->frame_width = vvc1_amstream_dec_info.width; vstatus->frame_height = vvc1_amstream_dec_info.height; if (vvc1_amstream_dec_info.rate != 0) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/vp9/vvp9.c b/drivers/amlogic/media_modules/frame_provider/decoder/vp9/vvp9.c index a5d770a5ccbf..835201d40038 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/vp9/vvp9.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/vp9/vvp9.c @@ -7742,6 +7742,10 @@ int vvp9_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus) { struct VP9Decoder_s *vp9 = (struct VP9Decoder_s *)vdec->private; + + if (!vp9 || !(vp9->stat & STAT_VDEC_RUN)) + return -1; + vstatus->frame_width = frame_width; vstatus->frame_height = frame_height; if (vp9->frame_dur != 0)