GstMemory *memory = NULL;
GstMapInfo map_info;
+ GstCaps *caps = NULL;
+ GstPad *pad = NULL;
+ GstStructure *structure = NULL;
mmf_return_val_if_fail(hcamcorder, FALSE);
mmf_return_val_if_fail(buffer, FALSE);
stream.format = sc->info_image->preview_format;
if (is_preview) {
- /* preview buffer */
- stream.width = sc->info_video->preview_width;
- stream.height = sc->info_video->preview_height;
+ /* preview buffer - get resolution from caps */
+ pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "src");
+ mmf_return_val_if_fail(pad, FALSE);
+
+ caps = gst_pad_get_allowed_caps(pad);
+ if (!caps) {
+ _mmcam_dbg_err("failed to get caps from pad %p", pad);
+ gst_object_unref(pad);
+ return FALSE;
+ }
+
+ structure = gst_caps_get_structure(caps, 0);
+ if (!structure) {
+ _mmcam_dbg_err("failed to get structure from caps %p", caps);
+ gst_caps_unref(caps);
+ gst_object_unref(pad);
+ return FALSE;
+ }
+
+ gst_structure_get_int(structure, "width", &stream.width);
+ gst_structure_get_int(structure, "height", &stream.height);
+
+ gst_caps_unref(caps);
+ caps = NULL;
+ gst_object_unref(pad);
+ pad = NULL;
} else {
/* video recording buffer */
stream.width = sc->info_video->video_width;