1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
Make v4lsink backward compatible
Upstream-Status: Pending
diff --git a/src/misc/v4l_sink/src/mfw_gst_v4lsink.c b/src/misc/v4l_sink/src/mfw_gst_v4lsink.c
index c9ec887..da2bac1 100644
--- a/src/misc/v4l_sink/src/mfw_gst_v4lsink.c
+++ b/src/misc/v4l_sink/src/mfw_gst_v4lsink.c
@@ -310,6 +310,9 @@ mfw_gst_v4l2sink_query_support_formats ()
ret = TRUE;
+ if(fmtdesc.index == 0)
+ ret = FALSE;
+
fail:
return ret;
@@ -2170,19 +2173,60 @@ mfw_gst_v4lsink_base_init (gpointer g_class)
GstCaps *capslist;
GstPadTemplate *sink_template = NULL;
- mfw_gst_v4l2sink_query_support_formats ();
- /* make a list of all available caps */
- capslist = gst_caps_new_empty ();
+ if(!mfw_gst_v4l2sink_query_support_formats ()) {
+ // failed query caps, use default setting
+ gint i;
+ guint32 formats[] = {
+ GST_MAKE_FOURCC ('I', '4', '2', '0'),
+ GST_MAKE_FOURCC ('Y', 'V', '1', '2'),
+ GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'),
+ GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V'),
+ GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
+ GST_MAKE_FOURCC ('N', 'V', '1', '2'),
+ GST_MAKE_FOURCC ('4', '2', '2', 'P'),
+ GST_MAKE_FOURCC ('Y', '4', '2', 'B')
- MfwV4lFmtMap * map = g_v4lfmt_maps;
+ };
- while (map->mime){
- if (map->enable){
- GstStructure * structure = gst_structure_from_string(map->mime, NULL);
- gst_caps_append_structure (capslist, structure);
- }
- map++;
- };
+ /* make a list of all available caps */
+ capslist = gst_caps_new_empty ();
+ for (i = 0; i < G_N_ELEMENTS (formats); i++) {
+ gst_caps_append_structure (capslist,
+ gst_structure_new ("video/x-raw-yuv",
+ "format",
+ GST_TYPE_FOURCC,
+ formats[i], "width",
+ GST_TYPE_INT_RANGE, 1,
+ G_MAXINT, "height",
+ GST_TYPE_INT_RANGE, 1,
+ G_MAXINT, "framerate",
+ GST_TYPE_FRACTION_RANGE,
+ 0, 1, G_MAXINT, 1,
+ NULL));
+ }
+ /* Add RGB support */
+ gst_caps_append_structure (capslist,
+ gst_structure_new ("video/x-raw-rgb",
+ "bpp", GST_TYPE_INT_RANGE,
+ 1, 32, "depth",
+ GST_TYPE_INT_RANGE, 1, 32,
+ NULL));
+
+ }
+ else {
+ /* make a list of all available caps */
+ capslist = gst_caps_new_empty ();
+
+ MfwV4lFmtMap * map = g_v4lfmt_maps;
+
+ while (map->mime){
+ if (map->enable){
+ GstStructure * structure = gst_structure_from_string(map->mime, NULL);
+ gst_caps_append_structure (capslist, structure);
+ }
+ map++;
+ };
+ }
sink_template = gst_pad_template_new ("sink",
GST_PAD_SINK, GST_PAD_ALWAYS, capslist);
|