mfvideosrc: Don't expose unsupported formats

Some UVC cameras support H.264 stream but we don't support it yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1452>
This commit is contained in:
Seungha Yang 2020-07-21 15:48:08 +09:00
parent 30a588f31e
commit c3ecea0aa4

View file

@ -26,6 +26,9 @@
#include "gstmfsourcereader.h"
#include <string.h>
#include <wrl.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace Microsoft::WRL;
@ -160,6 +163,7 @@ gst_mf_enum_media_type_from_source_reader (IMFSourceReader * source_reader,
gint i, j;
HRESULT hr;
GList *list = NULL;
std::vector<std::string> unhandled_caps;
g_return_val_if_fail (source_reader != NULL, FALSE);
g_return_val_if_fail (media_types != NULL, FALSE);
@ -173,6 +177,8 @@ gst_mf_enum_media_type_from_source_reader (IMFSourceReader * source_reader,
if (SUCCEEDED (hr)) {
GstMFStreamMediaType *mtype;
GstCaps *caps = NULL;
GstStructure *s;
std::string name;
caps = gst_mf_media_type_to_caps (media_type.Get ());
@ -180,6 +186,19 @@ gst_mf_enum_media_type_from_source_reader (IMFSourceReader * source_reader,
if (!caps)
continue;
s = gst_caps_get_structure (caps, 0);
name = gst_structure_get_name (s);
if (name != "video/x-raw" && name != "image/jpeg") {
auto it =
std::find(unhandled_caps.begin(), unhandled_caps.end(), name);
if (it == unhandled_caps.end()) {
GST_FIXME ("Skip not supported format %s", name.c_str());
unhandled_caps.push_back(name);
}
gst_caps_unref (caps);
continue;
}
mtype = g_new0 (GstMFStreamMediaType, 1);
mtype->media_type = media_type.Detach ();