unsigned int fourcc = 0;
const gchar *string_format;
video_decoded_data_info_s *info;
- gint width, height;
MMPixelFormatType format;
GstVideoInfo vinfo;
caps = gst_pad_get_current_caps(pad);
RET_VAL_IF(caps == NULL, NULL, "caps is NULL");
+ if (!gst_video_info_from_caps(&vinfo, caps)) {
+ gst_caps_unref(caps);
+ LOG_ERROR("failed to gst_video_info_from_caps()");
+ return NULL;
+ }
+
structure = gst_caps_get_structure(caps, 0);
- gst_structure_get_int(structure, "width", &width);
- gst_structure_get_int(structure, "height", &height);
string_format = gst_structure_get_string(structure, "format");
if (string_format)
fourcc = __convert_fourcc_string_to_value(string_format);
format = __get_pixel_format(fourcc);
- gst_video_info_from_caps(&vinfo, caps);
+
gst_caps_unref(caps);
- RET_VAL_IF(width == 0, NULL, "width is 0");
- RET_VAL_IF(height == 0, NULL, "height is 0");
+ RET_VAL_IF(vinfo.width == 0, NULL, "width is 0");
+ RET_VAL_IF(vinfo.height == 0, NULL, "height is 0");
RET_VAL_IF(format == MM_PIXEL_FORMAT_INVALID, NULL, "pixel format is invalid");
info = g_new0(video_decoded_data_info_s, 1);
- info->width = width;
- info->height = height;
+ info->width = vinfo.width;
+ info->height = vinfo.height;
info->format = format;
info->plane_num = GST_VIDEO_INFO_N_PLANES(&vinfo);