gst-decoder.c: look at the caps event instead of the allocation query
Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
Carlos Rafael Giani authored 7 years ago
Rob Clark committed 7 years ago
62 | 62 | pad_probe(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) |
63 | 63 | { |
64 | 64 | struct decoder *dec = user_data; |
65 | GstQuery *query = GST_PAD_PROBE_INFO_QUERY(info); | |
66 | gboolean need_pool; | |
65 | GstEvent *event = GST_PAD_PROBE_INFO_EVENT(info); | |
67 | 66 | GstCaps *caps; |
68 | 67 | |
69 | 68 | (void)pad; |
70 | 69 | |
71 | if (GST_QUERY_TYPE(query) != GST_QUERY_ALLOCATION) | |
70 | if (GST_EVENT_TYPE(event) != GST_EVENT_CAPS) | |
72 | 71 | return GST_PAD_PROBE_OK; |
73 | 72 | |
74 | gst_query_parse_allocation(query, &caps, &need_pool); | |
73 | gst_event_parse_caps(event, &caps); | |
75 | 74 | |
76 | 75 | if (!caps) { |
77 | GST_ERROR("allocation query without caps"); | |
76 | GST_ERROR("caps event without caps"); | |
78 | 77 | return GST_PAD_PROBE_OK; |
79 | 78 | } |
80 | 79 | |
81 | 80 | if (!gst_video_info_from_caps(&dec->info, caps)) { |
82 | GST_ERROR("allocation query with invalid caps"); | |
81 | GST_ERROR("caps event with invalid video caps"); | |
83 | 82 | return GST_PAD_PROBE_OK; |
84 | 83 | } |
85 | 84 | |
155 | 154 | g_object_set(G_OBJECT(dec->sink), "max-buffers", 2, NULL); |
156 | 155 | |
157 | 156 | gst_pad_add_probe(gst_element_get_static_pad(dec->sink, "sink"), |
158 | GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM, | |
157 | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, | |
159 | 158 | pad_probe, dec, NULL); |
160 | 159 | |
161 | 160 | /* hack to make sure we get dmabuf's from v4l2video0dec.. */ |