vaapidecode: keep only display_{width,height}

Instead of keeping the structure GstVideoInfo when we are using its width and
height, we only keep these two guints.

https://bugzilla.gnome.org/show_bug.cgi?id=764316
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-04-14 16:43:07 +02:00
parent 737fca4ddf
commit 49a59f00eb
2 changed files with 15 additions and 16 deletions

View file

@ -275,8 +275,8 @@ gst_vaapidecode_update_src_caps (GstVaapiDecode * decode)
break; break;
} }
width = GST_VIDEO_INFO_WIDTH (&decode->display_info); width = decode->display_width;
height = GST_VIDEO_INFO_HEIGHT (&decode->display_info); height = decode->display_height;
if (!width || !height) { if (!width || !height) {
width = ref_state->info.width; width = ref_state->info.width;
@ -390,27 +390,23 @@ is_display_resolution_changed (GstVaapiDecode * decode,
GstVideoDecoder *const vdec = GST_VIDEO_DECODER (decode); GstVideoDecoder *const vdec = GST_VIDEO_DECODER (decode);
GstVideoCodecState *state; GstVideoCodecState *state;
GstVideoInfo *vinfo; GstVideoInfo *vinfo;
GstVideoFormat format = GST_VIDEO_INFO_FORMAT (&decode->decoded_info); guint display_width, display_height;
guint display_width = GST_VIDEO_INFO_WIDTH (&decode->decoded_info);
guint display_height = GST_VIDEO_INFO_HEIGHT (&decode->decoded_info);
display_width = GST_VIDEO_INFO_WIDTH (&decode->decoded_info);
display_height = GST_VIDEO_INFO_HEIGHT (&decode->decoded_info);
if (crop_rect) { if (crop_rect) {
display_width = crop_rect->width; display_width = crop_rect->width;
display_height = crop_rect->height; display_height = crop_rect->height;
} }
state = gst_video_decoder_get_output_state (vdec); state = gst_video_decoder_get_output_state (vdec);
if (G_UNLIKELY (!state)) if (G_UNLIKELY (!state))
goto set_display_res; goto set_display_res;
vinfo = &state->info; vinfo = &state->info;
format = GST_VIDEO_INFO_FORMAT (vinfo);
if (GST_VIDEO_INFO_FORMAT (&decode->display_info) == GST_VIDEO_FORMAT_UNKNOWN)
decode->display_info = *vinfo;
if (!crop_rect) { if (!crop_rect) {
if (G_UNLIKELY (display_width != if (G_UNLIKELY (display_width != decode->display_width
GST_VIDEO_INFO_WIDTH (&decode->display_info) || display_height != decode->display_height))
|| display_height != GST_VIDEO_INFO_HEIGHT (&decode->display_info)))
goto set_display_res; goto set_display_res;
} }
@ -421,10 +417,10 @@ is_display_resolution_changed (GstVaapiDecode * decode,
} }
set_display_res: set_display_res:
gst_video_info_set_format (&decode->display_info, format, display_width,
display_height);
if (state) if (state)
gst_video_codec_state_unref (state); gst_video_codec_state_unref (state);
decode->display_width = display_width;
decode->display_height = display_height;
return TRUE; return TRUE;
} }
@ -932,8 +928,9 @@ gst_vaapidecode_open (GstVideoDecoder * vdec)
if (!gst_vaapi_plugin_base_open (GST_VAAPI_PLUGIN_BASE (decode))) if (!gst_vaapi_plugin_base_open (GST_VAAPI_PLUGIN_BASE (decode)))
return FALSE; return FALSE;
decode->display_width = 0;
decode->display_height = 0;
gst_video_info_init (&decode->decoded_info); gst_video_info_init (&decode->decoded_info);
gst_video_info_init (&decode->display_info);
/* Let GstVideoContext ask for a proper display to its neighbours */ /* Let GstVideoContext ask for a proper display to its neighbours */
/* Note: steal old display that may be allocated from get_caps() /* Note: steal old display that may be allocated from get_caps()

View file

@ -42,7 +42,6 @@ struct _GstVaapiDecode {
GstCaps *sinkpad_caps; GstCaps *sinkpad_caps;
GstCaps *srcpad_caps; GstCaps *srcpad_caps;
GstVideoInfo decoded_info; GstVideoInfo decoded_info;
GstVideoInfo display_info;
GstVaapiDecoder *decoder; GstVaapiDecoder *decoder;
GMutex surface_ready_mutex; GMutex surface_ready_mutex;
GCond surface_ready; GCond surface_ready;
@ -51,6 +50,9 @@ struct _GstVaapiDecode {
guint current_frame_size; guint current_frame_size;
guint has_texture_upload_meta : 1; guint has_texture_upload_meta : 1;
guint display_width;
guint display_height;
GstVideoCodecState *input_state; GstVideoCodecState *input_state;
}; };