mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-19 20:46:22 +00:00
d3d11: Use gst_video_decoder_get_frame()
Now that the system_frame_number is saved on the pictures we can use gst_video_decoder_get_frame() helper instead of getting the full list and looping over it.
This commit is contained in:
parent
56c3b40c30
commit
020ee62c59
3 changed files with 6 additions and 70 deletions
|
@ -709,7 +709,6 @@ gst_d3d11_h264_dec_output_picture (GstH264Decoder * decoder,
|
||||||
GstH264Picture * picture)
|
GstH264Picture * picture)
|
||||||
{
|
{
|
||||||
GstD3D11H264Dec *self = GST_D3D11_H264_DEC (decoder);
|
GstD3D11H264Dec *self = GST_D3D11_H264_DEC (decoder);
|
||||||
GList *pending_frames, *iter;
|
|
||||||
GstVideoCodecFrame *frame = NULL;
|
GstVideoCodecFrame *frame = NULL;
|
||||||
GstBuffer *output_buffer = NULL;
|
GstBuffer *output_buffer = NULL;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
@ -726,28 +725,8 @@ gst_d3d11_h264_dec_output_picture (GstH264Decoder * decoder,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pending_frames = gst_video_decoder_get_frames (GST_VIDEO_DECODER (self));
|
frame = gst_video_decoder_get_frame (GST_VIDEO_DECODER (self),
|
||||||
for (iter = pending_frames; iter; iter = g_list_next (iter)) {
|
picture->system_frame_number);
|
||||||
GstVideoCodecFrame *tmp;
|
|
||||||
GstH264Picture *other_pic;
|
|
||||||
|
|
||||||
tmp = (GstVideoCodecFrame *) iter->data;
|
|
||||||
other_pic = gst_video_codec_frame_get_user_data (tmp);
|
|
||||||
if (!other_pic) {
|
|
||||||
/* FIXME: what should we do here? */
|
|
||||||
GST_WARNING_OBJECT (self,
|
|
||||||
"Codec frame %p does not have corresponding picture object", tmp);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (other_pic == picture) {
|
|
||||||
frame = gst_video_codec_frame_ref (tmp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free_full (pending_frames,
|
|
||||||
(GDestroyNotify) gst_video_codec_frame_unref);
|
|
||||||
|
|
||||||
/* if downstream is d3d11 element and forward playback case,
|
/* if downstream is d3d11 element and forward playback case,
|
||||||
* expose our decoder view without copy. In case of reverse playback, however,
|
* expose our decoder view without copy. In case of reverse playback, however,
|
||||||
|
|
|
@ -751,7 +751,6 @@ gst_d3d11_h265_dec_output_picture (GstH265Decoder * decoder,
|
||||||
GstH265Picture * picture)
|
GstH265Picture * picture)
|
||||||
{
|
{
|
||||||
GstD3D11H265Dec *self = GST_D3D11_H265_DEC (decoder);
|
GstD3D11H265Dec *self = GST_D3D11_H265_DEC (decoder);
|
||||||
GList *pending_frames, *iter;
|
|
||||||
GstVideoCodecFrame *frame = NULL;
|
GstVideoCodecFrame *frame = NULL;
|
||||||
GstBuffer *output_buffer = NULL;
|
GstBuffer *output_buffer = NULL;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
@ -768,29 +767,8 @@ gst_d3d11_h265_dec_output_picture (GstH265Decoder * decoder,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pending_frames = gst_video_decoder_get_frames (GST_VIDEO_DECODER (self));
|
frame = gst_video_decoder_get_frame (GST_VIDEO_DECODER (self),
|
||||||
|
picture->system_frame_number);
|
||||||
for (iter = pending_frames; iter; iter = g_list_next (iter)) {
|
|
||||||
GstVideoCodecFrame *tmp;
|
|
||||||
GstH265Picture *other_pic;
|
|
||||||
|
|
||||||
tmp = (GstVideoCodecFrame *) iter->data;
|
|
||||||
other_pic = gst_video_codec_frame_get_user_data (tmp);
|
|
||||||
if (!other_pic) {
|
|
||||||
/* FIXME: what should we do here? */
|
|
||||||
GST_WARNING_OBJECT (self,
|
|
||||||
"Codec frame %p does not have corresponding picture object", tmp);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (other_pic == picture) {
|
|
||||||
frame = gst_video_codec_frame_ref (tmp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free_full (pending_frames,
|
|
||||||
(GDestroyNotify) gst_video_codec_frame_unref);
|
|
||||||
|
|
||||||
/* if downstream is d3d11 element and forward playback case,
|
/* if downstream is d3d11 element and forward playback case,
|
||||||
* expose our decoder view without copy. In case of reverse playback, however,
|
* expose our decoder view without copy. In case of reverse playback, however,
|
||||||
|
|
|
@ -568,7 +568,6 @@ gst_d3d11_vp9_dec_output_picture (GstVp9Decoder * decoder,
|
||||||
GstVp9Picture * picture)
|
GstVp9Picture * picture)
|
||||||
{
|
{
|
||||||
GstD3D11Vp9Dec *self = GST_D3D11_VP9_DEC (decoder);
|
GstD3D11Vp9Dec *self = GST_D3D11_VP9_DEC (decoder);
|
||||||
GList *pending_frames, *iter;
|
|
||||||
GstVideoCodecFrame *frame = NULL;
|
GstVideoCodecFrame *frame = NULL;
|
||||||
GstBuffer *output_buffer = NULL;
|
GstBuffer *output_buffer = NULL;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
@ -584,28 +583,8 @@ gst_d3d11_vp9_dec_output_picture (GstVp9Decoder * decoder,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pending_frames = gst_video_decoder_get_frames (GST_VIDEO_DECODER (self));
|
frame = gst_video_decoder_get_frame (GST_VIDEO_DECODER (self),
|
||||||
for (iter = pending_frames; iter; iter = g_list_next (iter)) {
|
picture->system_frame_number);
|
||||||
GstVideoCodecFrame *tmp;
|
|
||||||
GstVp9Picture *other_pic;
|
|
||||||
|
|
||||||
tmp = (GstVideoCodecFrame *) iter->data;
|
|
||||||
other_pic = gst_video_codec_frame_get_user_data (tmp);
|
|
||||||
if (!other_pic) {
|
|
||||||
/* FIXME: what should we do here? */
|
|
||||||
GST_WARNING_OBJECT (self,
|
|
||||||
"Codec frame %p does not have corresponding picture object", tmp);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (other_pic == picture) {
|
|
||||||
frame = gst_video_codec_frame_ref (tmp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free_full (pending_frames,
|
|
||||||
(GDestroyNotify) gst_video_codec_frame_unref);
|
|
||||||
|
|
||||||
if (!picture->frame_hdr.show_frame) {
|
if (!picture->frame_hdr.show_frame) {
|
||||||
GST_LOG_OBJECT (self, "Decode only picture %p", picture);
|
GST_LOG_OBJECT (self, "Decode only picture %p", picture);
|
||||||
|
|
Loading…
Reference in a new issue