@@ -191,44 +191,46 @@ set_structure_to_caps(vector <cameraSrc_Main_Res_Range> main_res_range, GstCaps
191
191
GstStructure *structure = NULL ;
192
192
int feature_index = 0 ;
193
193
#if GST_VERSION_MINOR == 22 && GST_VERSION_MICRO == 6 || GST_VERSION_MINOR >= 23
194
- /* Set caps with dmabuffer */
195
- for (auto &res_range : main_res_range) {
196
- structure = create_structure (res_range.format );
197
- if (structure) {
198
- const gchar *fmt_str = gst_structure_get_string (structure, " format" );
199
- GstVideoFormat fmt = gst_video_format_from_string (fmt_str);
200
- GValue dma_drm_fmts = G_VALUE_INIT;
201
- g_value_init (&dma_drm_fmts, GST_TYPE_LIST);
202
- if (!CameraSrcUtils::_dma_fmt_to_dma_drm_fmts (display_drm, fmt,
203
- &dma_drm_fmts) ||
204
- gst_value_list_get_size (&dma_drm_fmts) <= 0 ) {
205
- gst_structure_free (structure);
194
+ if (display_drm) {
195
+ /* Set caps with dmabuffer */
196
+ for (auto &res_range : main_res_range) {
197
+ structure = create_structure (res_range.format );
198
+ if (structure) {
199
+ const gchar *fmt_str = gst_structure_get_string (structure, " format" );
200
+ GstVideoFormat fmt = gst_video_format_from_string (fmt_str);
201
+ GValue dma_drm_fmts = G_VALUE_INIT;
202
+ g_value_init (&dma_drm_fmts, GST_TYPE_LIST);
203
+ if (!CameraSrcUtils::_dma_fmt_to_dma_drm_fmts (display_drm, fmt,
204
+ &dma_drm_fmts) ||
205
+ gst_value_list_get_size (&dma_drm_fmts) <= 0 ) {
206
+ gst_structure_free (structure);
207
+ g_value_unset (&dma_drm_fmts);
208
+ continue ;
209
+ }
210
+ gst_structure_set (structure, " format" , G_TYPE_STRING, " DMA_DRM" , NULL );
211
+ gst_structure_set_value (structure, " drm-format" , &dma_drm_fmts);
206
212
g_value_unset (&dma_drm_fmts);
207
- continue ;
213
+ /* If has only one resolution */
214
+ if (res_range.range .max_w == res_range.range .min_w &&
215
+ res_range.range .max_h == res_range.range .min_h )
216
+ gst_structure_set (structure, " width" , G_TYPE_INT, res_range.range .max_w ,
217
+ " height" , G_TYPE_INT, res_range.range .max_h ,
218
+ " framerate" , GST_TYPE_FRACTION_RANGE, 0 , 1 , G_MAXINT,
219
+ 1 , " pixel-aspect-ratio" , GST_TYPE_FRACTION, 1 , 1 ,
220
+ NULL );
221
+ else
222
+ gst_structure_set (structure, " width" , GST_TYPE_INT_RANGE,
223
+ res_range.range .min_w , res_range.range .max_w ,
224
+ " height" , GST_TYPE_INT_RANGE, res_range.range .min_h ,
225
+ res_range.range .max_h , " framerate" ,
226
+ GST_TYPE_FRACTION_RANGE, 0 , 1 , G_MAXINT, 1 ,
227
+ " pixel-aspect-ratio" , GST_TYPE_FRACTION, 1 , 1 , NULL );
228
+ *caps = gst_caps_merge_structure (*caps, structure);
229
+ gst_caps_set_features (
230
+ *caps, feature_index,
231
+ gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_DMABUF, NULL ));
232
+ feature_index++;
208
233
}
209
- gst_structure_set (structure, " format" , G_TYPE_STRING, " DMA_DRM" , NULL );
210
- gst_structure_set_value (structure, " drm-format" , &dma_drm_fmts);
211
- g_value_unset (&dma_drm_fmts);
212
- /* If has only one resolution */
213
- if (res_range.range .max_w == res_range.range .min_w &&
214
- res_range.range .max_h == res_range.range .min_h )
215
- gst_structure_set (structure, " width" , G_TYPE_INT, res_range.range .max_w ,
216
- " height" , G_TYPE_INT, res_range.range .max_h ,
217
- " framerate" , GST_TYPE_FRACTION_RANGE, 0 , 1 , G_MAXINT,
218
- 1 , " pixel-aspect-ratio" , GST_TYPE_FRACTION, 1 , 1 ,
219
- NULL );
220
- else
221
- gst_structure_set (structure, " width" , GST_TYPE_INT_RANGE,
222
- res_range.range .min_w , res_range.range .max_w ,
223
- " height" , GST_TYPE_INT_RANGE, res_range.range .min_h ,
224
- res_range.range .max_h , " framerate" ,
225
- GST_TYPE_FRACTION_RANGE, 0 , 1 , G_MAXINT, 1 ,
226
- " pixel-aspect-ratio" , GST_TYPE_FRACTION, 1 , 1 , NULL );
227
- *caps = gst_caps_merge_structure (*caps, structure);
228
- gst_caps_set_features (
229
- *caps, feature_index,
230
- gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_DMABUF, NULL ));
231
- feature_index++;
232
234
}
233
235
}
234
236
#else
@@ -392,8 +394,7 @@ GstCaps *gst_camerasrc_get_all_caps ()
392
394
GstVaDisplay *display_drm = NULL ;
393
395
display_drm = gst_va_display_drm_new_from_path (" /dev/dri/renderD128" );
394
396
if (NULL == display_drm) {
395
- g_printerr (" Couldn't create a VA DRM display" );
396
- return NULL ;
397
+ g_warning (" Couldn't create a VA DRM display" );
397
398
}
398
399
#endif
399
400
int count = get_number_of_cameras ();
0 commit comments